[ZNR] fixed Moraug, Fury of Akoum bugs with combat (#7046)

This commit is contained in:
Evan Kranzler 2020-09-22 18:50:21 -04:00
parent c7ebb4851f
commit 20e7c7cda3
2 changed files with 42 additions and 2 deletions

View file

@ -18,6 +18,7 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.watchers.Watcher;
import mage.watchers.common.AttackedThisTurnWatcher; import mage.watchers.common.AttackedThisTurnWatcher;
import java.util.UUID; import java.util.UUID;
@ -45,7 +46,7 @@ public final class MoraugFuryOfAkoum extends CardImpl {
"<i>Landfall</i> &mdash; Whenever a land enters the battlefield under your control, " + "<i>Landfall</i> &mdash; Whenever a land enters the battlefield under your control, " +
"if it's your main phase, there's an additional combat phase after this phase. " + "if it's your main phase, there's an additional combat phase after this phase. " +
"At the beginning of that combat, untap all creatures you control." "At the beginning of that combat, untap all creatures you control."
)); ), new MoraugFuryOfAkoumWatcher());
} }
private MoraugFuryOfAkoum(final MoraugFuryOfAkoum card) { private MoraugFuryOfAkoum(final MoraugFuryOfAkoum card) {
@ -116,7 +117,18 @@ class MoraugFuryOfAkoumCombatEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT,TurnPhase.COMBAT, false); TurnPhase turnPhase = game.getPhase().getType();
for (TurnMod turnMod : game.getState().getTurnMods()) {
if ("moraug".equals(turnMod.getNote())
&& turnMod.getPlayerId().equals(source.getControllerId())
&& turnMod.getAfterPhase() == turnPhase) {
turnPhase = TurnPhase.COMBAT;
turnMod.setNote("moraugIgnore");
break;
}
}
TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, turnPhase, false);
combat.setNote("moraug");
game.getState().getTurnMods().add(combat); game.getState().getTurnMods().add(combat);
game.addDelayedTriggeredAbility(new MoraugFuryOfAkoumDelayedTriggeredAbility(combat.getId()), source); game.addDelayedTriggeredAbility(new MoraugFuryOfAkoumDelayedTriggeredAbility(combat.getId()), source);
return true; return true;
@ -171,3 +183,22 @@ class MoraugFuryOfAkoumDelayedTriggeredAbility extends DelayedTriggeredAbility {
return "At the beginning of that combat, untap all creatures you control"; return "At the beginning of that combat, untap all creatures you control";
} }
} }
class MoraugFuryOfAkoumWatcher extends Watcher {
MoraugFuryOfAkoumWatcher() {
super(WatcherScope.GAME);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.POSTCOMBAT_MAIN_PHASE_PRE) {
return;
}
for (TurnMod turnMod : game.getState().getTurnMods()) {
if ("moraug".equals(turnMod.getNote())) {
turnMod.setNote("moraugIgnore");
}
}
}
}

View file

@ -26,6 +26,7 @@ public class TurnMod implements Serializable {
private PhaseStep skipStep; private PhaseStep skipStep;
private TurnPhase afterPhase; private TurnPhase afterPhase;
private PhaseStep afterStep; private PhaseStep afterStep;
private String note;
// Turn mod that should be applied after current turn mod. // Turn mod that should be applied after current turn mod.
// Implemented only for control player turn mod! // Implemented only for control player turn mod!
@ -181,4 +182,12 @@ public class TurnMod implements Serializable {
public void setSubsequentTurnMod(TurnMod subsequentTurnMod) { public void setSubsequentTurnMod(TurnMod subsequentTurnMod) {
this.subsequentTurnMod = subsequentTurnMod; this.subsequentTurnMod = subsequentTurnMod;
} }
public void setNote(String note) {
this.note = note;
}
public String getNote() {
return note;
}
} }