mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* AI: fixed wrong targeting for gain control abilities (#6340);
This commit is contained in:
parent
3cd5682db7
commit
14ddb6eb28
7 changed files with 99 additions and 24 deletions
|
|
@ -0,0 +1,75 @@
|
|||
package org.mage.test.AI.basic;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBaseWithAIHelps;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class GainControlAITest extends CardTestPlayerBaseWithAIHelps {
|
||||
|
||||
@Test
|
||||
public void test_GainControl_Manual() {
|
||||
// You control enchanted land.
|
||||
addCard(Zone.HAND, playerA, "Annex", 1); // {2}{U}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
|
||||
// take control
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Annex", "Swamp");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Island", 4);
|
||||
assertPermanentCount(playerA, "Swamp", 1);
|
||||
assertPermanentCount(playerB, "Swamp", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_GainControl_AI_Single() {
|
||||
// You control enchanted land.
|
||||
addCard(Zone.HAND, playerA, "Annex", 1); // {2}{U}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
|
||||
// take control by AI
|
||||
aiPlayPriority(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Island", 4);
|
||||
assertPermanentCount(playerA, "Swamp", 1);
|
||||
assertPermanentCount(playerB, "Swamp", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_GainControl_AI_MostValuable() {
|
||||
// You control enchanted land.
|
||||
addCard(Zone.HAND, playerA, "Annex", 1); // {2}{U}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Badlands", 1);
|
||||
|
||||
// take control by AI (selects most valueable enemy card)
|
||||
aiPlayPriority(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Island", 4);
|
||||
assertPermanentCount(playerA, "Swamp", 0);
|
||||
assertPermanentCount(playerA, "Badlands", 1);
|
||||
assertPermanentCount(playerB, "Swamp", 1);
|
||||
assertPermanentCount(playerB, "Badlands", 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +55,6 @@ public class TargetControllerChangeTest extends CardTestPlayerBase {
|
|||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, "Evangelize", 1);
|
||||
assertPermanentCount(playerA, "Balduvian Bears", 1); // AI give smallest permanent to A as bad effect for B
|
||||
assertPermanentCount(playerA, "Balduvian Bears", 1); // AI give smallest permanent to A as bad effect for target (target control change)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue