mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
AI: fixed that computer can cheat with target selection and choose 1 creature instead multiple required (example: sacrifice, close #13219)
This commit is contained in:
parent
1f1d1088a1
commit
39872e2625
2 changed files with 99 additions and 1 deletions
|
|
@ -204,7 +204,9 @@ public class ComputerPlayer extends PlayerImpl {
|
|||
for (Permanent permanent : targets) {
|
||||
if (origTarget.canTarget(abilityControllerId, permanent.getId(), source, game, false) && !target.getTargets().contains(permanent.getId())) {
|
||||
target.add(permanent.getId(), game);
|
||||
return true;
|
||||
if (target.isChosen(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
package org.mage.test.cards.single.rix;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBaseWithAIHelps;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class VonasHungerTest extends CardTestPlayerBaseWithAIHelps {
|
||||
|
||||
@Test
|
||||
public void test_NoAscend_Normal() {
|
||||
// Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.)
|
||||
// Each opponent sacrifices a creature.
|
||||
// If you have the city's blessing, instead each opponent sacrifices half the creatures they control rounded up.
|
||||
addCard(Zone.HAND, playerA, "Vona's Hunger"); // {2}{B}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 5);
|
||||
|
||||
// opponent must sacrifice 1
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vona's Hunger");
|
||||
setChoice(playerB, "Grizzly Bears"); // to sacrifice
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, 5 - 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_NoAscend_AI() {
|
||||
// Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.)
|
||||
// Each opponent sacrifices a creature.
|
||||
// If you have the city's blessing, instead each opponent sacrifices half the creatures they control rounded up.
|
||||
addCard(Zone.HAND, playerA, "Vona's Hunger"); // {2}{B}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 5);
|
||||
|
||||
// AI must sacrifice 1
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vona's Hunger");
|
||||
aiPlayStep(1, PhaseStep.PRECOMBAT_MAIN, playerB);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, 5 - 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Ascend_Normal() {
|
||||
// Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.)
|
||||
// Each opponent sacrifices a creature.
|
||||
// If you have the city's blessing, instead each opponent sacrifices half the creatures they control rounded up.
|
||||
addCard(Zone.HAND, playerA, "Vona's Hunger"); // {2}{B}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 5);
|
||||
|
||||
// opponent must sacrifice 3
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vona's Hunger");
|
||||
setChoice(playerB, "Grizzly Bears^Grizzly Bears^Grizzly Bears"); // to sacrifice
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, 5 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Ascend_AI() {
|
||||
// Ascend (If you control ten or more permanents, you get the city's blessing for the rest of the game.)
|
||||
// Each opponent sacrifices a creature.
|
||||
// If you have the city's blessing, instead each opponent sacrifices half the creatures they control rounded up.
|
||||
addCard(Zone.HAND, playerA, "Vona's Hunger"); // {2}{B}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10);
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 5);
|
||||
|
||||
// AI must sacrifice 3
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vona's Hunger");
|
||||
aiPlayStep(1, PhaseStep.PRECOMBAT_MAIN, playerB);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, 5 - 3);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue