* AI: fixed that computer was able to choose non valid targets/cards (from all graveyards, hands, etc);

This commit is contained in:
Oleg Agafonov 2019-12-16 02:58:10 +04:00
parent 0885a01849
commit 419cbf3c28
2 changed files with 131 additions and 53 deletions

View file

@ -0,0 +1,58 @@
package org.mage.test.AI.basic;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class ChooseTargetTest extends CardTestPlayerBase {
@Test
public void test_chooseTargetCard_Manual() {
// At the beginning of your end step, choose a creature card in an opponent's graveyard, then that player chooses a creature card in your graveyard.
// You may return those cards to the battlefield under their owners' control.
addCard(Zone.BATTLEFIELD, playerA, "Dawnbreak Reclaimer", 1);
//
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion", 1);
addCard(Zone.GRAVEYARD, playerB, "Silvercoat Lion", 1);
setChoice(playerA, "Silvercoat Lion");
setChoice(playerB, "Silvercoat Lion");
setChoice(playerA, "Yes");
setStrictChooseMode(true);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 1);
}
@Test
public void test_chooseTargetCard_AI() {
// At the beginning of your end step, choose a creature card in an opponent's graveyard, then that player chooses a creature card in your graveyard.
// You may return those cards to the battlefield under their owners' control.
addCard(Zone.BATTLEFIELD, playerA, "Dawnbreak Reclaimer", 1);
//
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion", 1);
addCard(Zone.GRAVEYARD, playerB, "Silvercoat Lion", 1);
// AI must choose itself (strict mode must be disabled)
//setChoice(playerA, "Silvercoat Lion");
//setChoice(playerB, "Silvercoat Lion");
//setChoice(playerA, "Yes");
//setStrictChooseMode(true);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 1);
}
}