mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Eon Frolicker - fixed rollback error on play (#6780);
This commit is contained in:
parent
55f2893fc4
commit
ecaa5a5b42
6 changed files with 91 additions and 29 deletions
|
|
@ -0,0 +1,46 @@
|
|||
package org.mage.test.cards.single;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
|
||||
public class EonFrolickerTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_EonFrolicker_NormalPlay() {
|
||||
// https://github.com/magefree/mage/issues/6780
|
||||
|
||||
// {2}{U}{U}
|
||||
// When Eon Frolicker enters the battlefield, if you cast it, target opponent takes an extra turn after this one.
|
||||
// Until your next turn, you and planeswalkers you control gain protection from that player.
|
||||
// (You and planeswalkers you control can’t be targeted, dealt damage, or enchanted by anything controlled by that player.)
|
||||
addCard(Zone.HAND, playerA, "Eon Frolicker", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
//
|
||||
// Chandra’s Fury deals 4 damage to target player or planeswalker and 1 damage to each creature that player or that planeswalker’s controller controls.
|
||||
addCard(Zone.HAND, playerB, "Chandra's Fury", 1); // {4}{R}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Eon Frolicker");
|
||||
addTarget(playerA, playerB);
|
||||
|
||||
// AI can targets only Eon Frolicker (cause A protected from B)
|
||||
checkPlayableAbility("after", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cast Chandra's Fury", true);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Chandra's Fury");
|
||||
//addTarget(playerB, playerB);
|
||||
|
||||
//setStrictChooseMode(true); // AI must choose target for fury (itself)
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerB, "Chandra's Fury", 1);
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20 - 4);
|
||||
}
|
||||
}
|
||||
|
|
@ -2124,16 +2124,17 @@ public class TestPlayer implements Player {
|
|||
|| target.getOriginalTarget() instanceof TargetPermanentOrPlayer
|
||||
|| target.getOriginalTarget() instanceof TargetDefender) {
|
||||
for (String targetDefinition : targets) {
|
||||
if (targetDefinition.startsWith("targetPlayer=")) {
|
||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "=");
|
||||
String playerName = targetDefinition.substring(targetDefinition.indexOf("targetPlayer=") + 13);
|
||||
for (Player player : game.getPlayers().values()) {
|
||||
if (player.getName().equals(playerName)
|
||||
&& target.canTarget(computerPlayer.getId(), player.getId(), source, game)) {
|
||||
target.addTarget(player.getId(), source, game);
|
||||
targets.remove(targetDefinition);
|
||||
return true;
|
||||
}
|
||||
if (!targetDefinition.startsWith("targetPlayer=")) {
|
||||
continue;
|
||||
}
|
||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "=");
|
||||
String playerName = targetDefinition.substring(targetDefinition.indexOf("targetPlayer=") + 13);
|
||||
for (Player player : game.getPlayers().values()) {
|
||||
if (player.getName().equals(playerName)
|
||||
&& target.canTarget(computerPlayer.getId(), player.getId(), source, game)) {
|
||||
target.addTarget(player.getId(), source, game);
|
||||
targets.remove(targetDefinition);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2146,6 +2147,9 @@ public class TestPlayer implements Player {
|
|||
|| (target.getOriginalTarget() instanceof TargetCreatureOrPlayer)
|
||||
|| (target.getOriginalTarget() instanceof TargetDefender)) {
|
||||
for (String targetDefinition : targets) {
|
||||
if (targetDefinition.startsWith("targetPlayer=")) {
|
||||
continue;
|
||||
}
|
||||
checkTargetDefinitionMarksSupport(target, targetDefinition, "^[]");
|
||||
String[] targetList = targetDefinition.split("\\^");
|
||||
boolean targetFound = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue