mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Remove triggers in setup game state
This commit is contained in:
@@ -758,30 +758,10 @@ public abstract class GameState {
|
||||
}
|
||||
game.fireEvent(new GameEventAttackersDeclared(attackingPlayer, attackersMap));
|
||||
|
||||
if (!combat.getAttackers().isEmpty()) {
|
||||
List<GameEntity> attackedTarget = new ArrayList<>();
|
||||
for (GameEntity ge : combat.getDefenders()) {
|
||||
if (!combat.getAttackersOf(ge).isEmpty()) {
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Attackers, combat.getAttackersOf(ge));
|
||||
runParams.put(AbilityKey.AttackingPlayer, combat.getAttackingPlayer());
|
||||
runParams.put(AbilityKey.AttackedTarget, ge);
|
||||
attackedTarget.add(ge);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.AttackersDeclaredOneTarget, runParams, false);
|
||||
}
|
||||
}
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Attackers, combat.getAttackers());
|
||||
runParams.put(AbilityKey.AttackingPlayer, combat.getAttackingPlayer());
|
||||
runParams.put(AbilityKey.AttackedTarget, attackedTarget);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.AttackersDeclared, runParams, false);
|
||||
}
|
||||
|
||||
for (final Card c : combat.getAttackers()) {
|
||||
CombatUtil.checkDeclaredAttacker(game, c, combat);
|
||||
CombatUtil.checkDeclaredAttacker(game, c, combat, false);
|
||||
}
|
||||
|
||||
game.getTriggerHandler().resetActiveTriggers();
|
||||
game.updateCombatForView();
|
||||
game.fireEvent(new GameEventCombatChanged());
|
||||
|
||||
|
||||
@@ -352,17 +352,19 @@ public class CombatUtil {
|
||||
* @param c
|
||||
* a {@link forge.game.card.Card} object.
|
||||
*/
|
||||
public static void checkDeclaredAttacker(final Game game, final Card c, final Combat combat) {
|
||||
public static void checkDeclaredAttacker(final Game game, final Card c, final Combat combat, boolean triggers) {
|
||||
// Run triggers
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Attacker, c);
|
||||
final List<Card> otherAttackers = combat.getAttackers();
|
||||
otherAttackers.remove(c);
|
||||
runParams.put(AbilityKey.OtherAttackers, otherAttackers);
|
||||
runParams.put(AbilityKey.Attacked, combat.getDefenderByAttacker(c));
|
||||
runParams.put(AbilityKey.DefendingPlayer, combat.getDefenderPlayerByAttacker(c));
|
||||
runParams.put(AbilityKey.Defenders, combat.getDefenders());
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Attacks, runParams, false);
|
||||
if (triggers) {
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Attacker, c);
|
||||
final List<Card> otherAttackers = combat.getAttackers();
|
||||
otherAttackers.remove(c);
|
||||
runParams.put(AbilityKey.OtherAttackers, otherAttackers);
|
||||
runParams.put(AbilityKey.Attacked, combat.getDefenderByAttacker(c));
|
||||
runParams.put(AbilityKey.DefendingPlayer, combat.getDefenderPlayerByAttacker(c));
|
||||
runParams.put(AbilityKey.Defenders, combat.getDefenders());
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Attacks, runParams, false);
|
||||
}
|
||||
|
||||
c.getDamageHistory().setCreatureAttackedThisCombat(true);
|
||||
c.getDamageHistory().clearNotAttackedSinceLastUpkeepOf();
|
||||
|
||||
@@ -632,7 +632,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
}
|
||||
|
||||
for (final Card c : combat.getAttackers()) {
|
||||
CombatUtil.checkDeclaredAttacker(game, c, combat);
|
||||
CombatUtil.checkDeclaredAttacker(game, c, combat, true);
|
||||
}
|
||||
|
||||
game.getTriggerHandler().resetActiveTriggers();
|
||||
|
||||
Reference in New Issue
Block a user