mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Test framework: fixed that ai play step command doesn't work correctly on declare attackers and blockers steps;
This commit is contained in:
parent
8a3f34df29
commit
91d577b0af
2 changed files with 51 additions and 4 deletions
|
@ -0,0 +1,47 @@
|
||||||
|
package org.mage.test.cards.single.stx;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBaseWithAIHelps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public class DaemogothTitanTest extends CardTestPlayerBaseWithAIHelps {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_Attack_Manual() {
|
||||||
|
// Whenever Daemogoth Titan attacks or blocks, sacrifice a creature.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Daemogoth Titan"); // 11/10
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
|
||||||
|
|
||||||
|
attack(1, playerA, "Daemogoth Titan");
|
||||||
|
addTarget(playerA, "Grizzly Bears");
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertLife(playerB, 20 - 11);
|
||||||
|
assertGraveyardCount(playerA, "Grizzly Bears", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_Attack_AI() {
|
||||||
|
// Whenever Daemogoth Titan attacks or blocks, sacrifice a creature.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Daemogoth Titan"); // 11/10
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
|
||||||
|
|
||||||
|
aiPlayStep(1, PhaseStep.DECLARE_ATTACKERS, playerA);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertLife(playerB, 20 - 11);
|
||||||
|
assertGraveyardCount(playerA, "Grizzly Bears", 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1683,8 +1683,8 @@ public class TestPlayer implements Player {
|
||||||
mustAttackByAction = true;
|
mustAttackByAction = true;
|
||||||
madeAttackByAction = true;
|
madeAttackByAction = true;
|
||||||
this.computerPlayer.selectAttackers(game, attackingPlayerId);
|
this.computerPlayer.selectAttackers(game, attackingPlayerId);
|
||||||
it.remove();
|
// play step action will be removed on step end
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) {
|
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) {
|
||||||
|
@ -1774,8 +1774,8 @@ public class TestPlayer implements Player {
|
||||||
if (action.getTurnNum() == game.getTurnNum() && action.getAction().equals(AI_PREFIX + AI_COMMAND_PLAY_STEP)) {
|
if (action.getTurnNum() == game.getTurnNum() && action.getAction().equals(AI_PREFIX + AI_COMMAND_PLAY_STEP)) {
|
||||||
mustBlockByAction = true;
|
mustBlockByAction = true;
|
||||||
this.computerPlayer.selectBlockers(source, game, defendingPlayerId);
|
this.computerPlayer.selectBlockers(source, game, defendingPlayerId);
|
||||||
actions.remove(action);
|
// play step action will be removed on step end
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("block:")) {
|
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("block:")) {
|
||||||
|
|
Loading…
Reference in a new issue