diff --git a/src/magic/model/action/CombatDamageAction.java b/src/magic/model/action/CombatDamageAction.java index d9c05e79d3..ee258771d5 100644 --- a/src/magic/model/action/CombatDamageAction.java +++ b/src/magic/model/action/CombatDamageAction.java @@ -21,6 +21,7 @@ public class CombatDamageAction extends MagicAction { private final MagicPlayer attackingPlayer; private final MagicPlayer defendingPlayer; private final boolean first; + private boolean dealtDamage = false; public CombatDamageAction(final MagicPlayer attackingPlayer, final MagicPlayer defendingPlayer, final boolean first) { this.attackingPlayer=attackingPlayer; @@ -113,10 +114,15 @@ public class CombatDamageAction extends MagicAction { for (final MagicDamage damage: combatDamage) { game.doAction(new DealDamageAction(damage)); } + dealtDamage = true; game.setStateCheckRequired(); } } + public boolean dealtDamage() { + return dealtDamage; + } + @Override public void doAction(final MagicGame game) { combatDamage(game,attackingPlayer,defendingPlayer); diff --git a/src/magic/model/phase/MagicCombatDamagePhase.java b/src/magic/model/phase/MagicCombatDamagePhase.java index 4ec9b45271..f69061fb70 100644 --- a/src/magic/model/phase/MagicCombatDamagePhase.java +++ b/src/magic/model/phase/MagicCombatDamagePhase.java @@ -2,19 +2,20 @@ package magic.model.phase; import magic.model.MagicGame; import magic.model.MagicPlayer; +import magic.model.MagicPermanent; +import magic.model.MagicAbility; import magic.model.action.CombatDamageAction; import magic.ui.MagicSound; public class MagicCombatDamagePhase extends MagicPhase { - private static final MagicPhase INSTANCE = new MagicCombatDamagePhase(); + public static final MagicPhase First = new MagicCombatDamagePhase(true); + public static final MagicPhase Second = new MagicCombatDamagePhase(false); + private final boolean isFirst; - private MagicCombatDamagePhase() { + private MagicCombatDamagePhase(final boolean first) { super(MagicPhaseType.CombatDamage); - } - - public static MagicPhase getInstance() { - return INSTANCE; + isFirst = first; } @Override @@ -28,13 +29,8 @@ public class MagicCombatDamagePhase extends MagicPhase { final int attackerPoisonBefore = attackingPlayer.getPoison(); final String attackerName = attackingPlayer.getName(); - //deal first strike damage - if (game.getStep() == MagicStep.Begin) { - game.doAction(new CombatDamageAction(attackingPlayer, defendingPlayer, true)); - } else { - //deal regular damage - game.doAction(new CombatDamageAction(attackingPlayer, defendingPlayer, false)); - } + final CombatDamageAction act = new CombatDamageAction(attackingPlayer, defendingPlayer, isFirst); + game.doAction(act); //combat message for defender final int defenderLifeAfter = defendingPlayer.getLife(); @@ -69,15 +65,13 @@ public class MagicCombatDamagePhase extends MagicPhase { } //End combat damage steps - if (game.getStep() == MagicStep.Begin) { + if (isFirst == false || act.dealtDamage()) { game.setStep(MagicStep.ActivePlayer); } else { + game.setStep(MagicStep.NextPhase); + } + if (isFirst == false) { game.playSound(MagicSound.COMBAT); } } - - @Override - protected void executeEndOfPhase(final MagicGame game) { - executeBeginStep(game); - } } diff --git a/src/magic/model/phase/MagicDefaultGameplay.java b/src/magic/model/phase/MagicDefaultGameplay.java index d54ea556bc..31ae948b33 100644 --- a/src/magic/model/phase/MagicDefaultGameplay.java +++ b/src/magic/model/phase/MagicDefaultGameplay.java @@ -35,9 +35,11 @@ public class MagicDefaultGameplay implements MagicGameplay { MagicDeclareBlockersPhase.getInstance() : MagicEndOfCombatPhase.getInstance(); case DeclareBlockers: - return MagicCombatDamagePhase.getInstance(); + return MagicCombatDamagePhase.First; case CombatDamage: - return MagicEndOfCombatPhase.getInstance(); + return game.getPhase() == MagicCombatDamagePhase.First ? + MagicCombatDamagePhase.Second : + MagicEndOfCombatPhase.getInstance(); case EndOfCombat: return MagicMainPhase.getSecondInstance(); case SecondMain: