Refactor ControlledCreaturesDealCombatDamagePlayerTriggeredAbility. (#5163)

It now triggers once for each player damaged.

Fixes https://github.com/magefree/mage/issues/5162
This commit is contained in:
Samuel Sandeen 2018-07-29 08:16:07 -04:00 committed by GitHub
parent 14520097a5
commit e5c1dfc4b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 160 additions and 64 deletions

View file

@ -0,0 +1,67 @@
package org.mage.test.cards.abilities.other;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import java.io.FileNotFoundException;
public class NaturesWillTest extends CardTestPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20);
playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC");
return game;
}
@Test
public void testAttackMultiplePlayers() {
addCard(Zone.HAND, playerA, "Nature's Will");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Suntail Hawk");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerC, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nature's Will");
attack(1, playerA, "Grizzly Bears", playerB);
attack(1, playerA, "Suntail Hawk", playerC);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertTappedCount("Forest", false, 4);
assertTappedCount("Mountain", true, 4);
assertTappedCount("Island", true, 4);
}
@Test
public void testAttackOnePlayer() {
addCard(Zone.HAND, playerA, "Nature's Will");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerC, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nature's Will");
attack(1, playerA, "Grizzly Bears", playerB);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertTappedCount("Forest", false, 4);
assertTappedCount("Mountain", true, 4);
assertTappedCount("Island", false, 4);
}
}

View file

@ -0,0 +1,59 @@
package org.mage.test.cards.abilities.other;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import java.io.FileNotFoundException;
public class StormTheVaultTest extends CardTestPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20);
playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC");
return game;
}
@Test
public void testAttackMultiplePlayers() {
addCard(Zone.BATTLEFIELD, playerA, "Storm the Vault");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Nessian Courser");
addCard(Zone.BATTLEFIELD, playerA, "Suntail Hawk");
addCard(Zone.BATTLEFIELD, playerA, "Lantern Kami");
attack(1, playerA, "Grizzly Bears", playerB);
attack(1, playerA, "Nessian Courser", playerB);
attack(1, playerA, "Suntail Hawk", playerC);
attack(1, playerA, "Lantern Kami", playerC);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Treasure", 2);
}
@Test
public void testAttackOnePlayer() {
addCard(Zone.BATTLEFIELD, playerA, "Storm the Vault");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Suntail Hawk");
attack(1, playerA, "Grizzly Bears", playerB);
attack(1, playerA, "Suntail Hawk", playerB);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Treasure", 1);
}
}