Test framework: fixed that ai play step command doesn't work correctly on declare attackers and blockers steps;

This commit is contained in:
Oleg Agafonov 2021-08-27 21:42:25 +04:00
parent 8a3f34df29
commit 91d577b0af
2 changed files with 51 additions and 4 deletions

View file

@ -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);
}
}

View file

@ -1683,8 +1683,8 @@ public class TestPlayer implements Player {
mustAttackByAction = true;
madeAttackByAction = true;
this.computerPlayer.selectAttackers(game, attackingPlayerId);
it.remove();
break;
// play step action will be removed on step end
continue;
}
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)) {
mustBlockByAction = true;
this.computerPlayer.selectBlockers(source, game, defendingPlayerId);
actions.remove(action);
break;
// play step action will be removed on step end
continue;
}
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("block:")) {