Revert "Move AttacksUnblocked triggers to after fast effects" as it fires the trigger before blockers are declared

This reverts commit 4076301597.
master
melvinzhang 2016-06-17 08:28:16 +08:00
parent ec71eb4f5a
commit 77bc02b2f9
2 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.choice.MagicCombatCreature;
import magic.model.choice.MagicDeclareBlockersResult;
import magic.model.trigger.MagicTriggerType;
public class DeclareBlockersAction extends MagicAction {
@ -24,6 +25,16 @@ public class DeclareBlockersAction extends MagicAction {
for (int index=1;index<creatures.length;index++) {
game.doAction(new DeclareBlockerAction(attacker,creatures[index].permanent));
}
if (attacker.isBlocked()) {
game.executeTrigger(MagicTriggerType.WhenBecomesBlocked,attacker);
}
}
}
for (final MagicPermanent permanent : player.getOpponent().getPermanents()) {
if (permanent.isAttacking() && !permanent.isBlocked()) {
game.executeTrigger(MagicTriggerType.WhenAttacksUnblocked,permanent);
}
}
}

View File

@ -2,7 +2,6 @@ package magic.model.phase;
import magic.model.MagicGame;
import magic.model.event.MagicDeclareBlockersEvent;
import magic.model.trigger.MagicTriggerType;
public class MagicDeclareBlockersPhase extends MagicPhase {
@ -20,9 +19,5 @@ public class MagicDeclareBlockersPhase extends MagicPhase {
public void executeBeginStep(final MagicGame game) {
game.addEvent(new MagicDeclareBlockersEvent(game.getDefendingPlayer()));
game.setStep(MagicStep.ActivePlayer);
//Activate attacking and unblocked triggers after all actions during DeclareBlockers and Fast Effects
game.getAttackingPlayer().getPermanents().stream().filter
(permanent -> permanent.isAttacking() && !permanent.isBlocked()).forEach
(permanent -> game.executeTrigger(MagicTriggerType.WhenAttacksUnblocked, permanent));
}
}