mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[ZNR] fixed Moraug, Fury of Akoum bugs with combat (#7046)
This commit is contained in:
parent
c7ebb4851f
commit
20e7c7cda3
2 changed files with 42 additions and 2 deletions
|
@ -18,6 +18,7 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.watchers.Watcher;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -45,7 +46,7 @@ public final class MoraugFuryOfAkoum extends CardImpl {
|
|||
"<i>Landfall</i> — Whenever a land enters the battlefield under your control, " +
|
||||
"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."
|
||||
));
|
||||
), new MoraugFuryOfAkoumWatcher());
|
||||
}
|
||||
|
||||
private MoraugFuryOfAkoum(final MoraugFuryOfAkoum card) {
|
||||
|
@ -116,7 +117,18 @@ class MoraugFuryOfAkoumCombatEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
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.addDelayedTriggeredAbility(new MoraugFuryOfAkoumDelayedTriggeredAbility(combat.getId()), source);
|
||||
return true;
|
||||
|
@ -171,3 +183,22 @@ class MoraugFuryOfAkoumDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
|||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public class TurnMod implements Serializable {
|
|||
private PhaseStep skipStep;
|
||||
private TurnPhase afterPhase;
|
||||
private PhaseStep afterStep;
|
||||
private String note;
|
||||
|
||||
// Turn mod that should be applied after current turn mod.
|
||||
// Implemented only for control player turn mod!
|
||||
|
@ -181,4 +182,12 @@ public class TurnMod implements Serializable {
|
|||
public void setSubsequentTurnMod(TurnMod subsequentTurnMod) {
|
||||
this.subsequentTurnMod = subsequentTurnMod;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue