* Archelos, Lagoon Mystic - fixed broken ETB effect (#7283);

This commit is contained in:
Oleg Agafonov 2020-12-24 20:24:42 +04:00
parent 64e948e4b3
commit 6f34d514f9
3 changed files with 59 additions and 2 deletions

View file

@ -78,7 +78,18 @@ class ArchelosLagoonMysticEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return !source.getSourceId().equals(((EntersTheBattlefieldEvent) event).getTarget().getId());
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject == null) {
return false;
}
Permanent targetObject = ((EntersTheBattlefieldEvent) event).getTarget();
if (targetObject == null) {
return false;
}
return !sourceObject.getId().equals(targetObject.getId())
&& sourceObject.isTapped() == this.tapped;
}
@Override

View file

@ -0,0 +1,46 @@
package org.mage.test.cards.single.cmr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class ArchelosLagoonMysticTest extends CardTestPlayerBase {
@Test
public void test_Playable() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2 + 2); // add lands before Archelos, Lagoon Mystic to ignore ETB effects
// As long as Archelos, Lagoon Mystic is tapped, other permanents enter the battlefield tapped.
// As long as Archelos, Lagoon Mystic is untapped, other permanents enter the battlefield untapped.
addCard(Zone.BATTLEFIELD, playerA, "Archelos, Lagoon Mystic", 1);
//
addCard(Zone.HAND, playerA, "Grizzly Bears", 1); // {1}{G}
addCard(Zone.HAND, playerA, "Deranged Outcast", 1); // {1}{G}
// first - untapped
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentTapped("untapped", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Archelos, Lagoon Mystic", false, 1);
checkPermanentTapped("untapped", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", false, 1);
// prepare tapped mystic
attack(1, playerA, "Archelos, Lagoon Mystic", playerB);
checkPermanentTapped("tapped", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Archelos, Lagoon Mystic", true, 1);
// second - tapped
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Deranged Outcast");
waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN);
checkPermanentTapped("tapped", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Archelos, Lagoon Mystic", true, 1);
checkPermanentTapped("tapped", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Deranged Outcast", true, 1);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
}

View file

@ -1956,7 +1956,7 @@ public class TestPlayer implements Player {
int index = 0;
for (Map.Entry<String, String> entry : rEffects.entrySet()) {
if (entry.getValue().startsWith(choice)) {
choices.remove(choice);
choices.remove(0);
return index;
}
index++;