diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 24cf16e6bef..c6f0b119ccc 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -3657,9 +3657,16 @@ public class Card extends GameEntity implements Comparable { public final void addChangedCardTraits(Collection spells, Collection removedAbilities, Collection trigger, Collection replacements, Collection statics, boolean removeAll, boolean removeNonMana, boolean removeIntrinsic, long timestamp) { - changedCardTraits.put(timestamp, new CardTraitChanges( - spells, removedAbilities, trigger, replacements, statics, removeAll, removeNonMana, removeIntrinsic - )); + // in case two static abilities has the same timestamp + if (changedCardTraits.containsKey(timestamp)) { + changedCardTraits.get(timestamp).merge( + spells, removedAbilities, trigger, replacements, statics, removeAll, removeNonMana, removeIntrinsic + ); + } else { + changedCardTraits.put(timestamp, new CardTraitChanges( + spells, removedAbilities, trigger, replacements, statics, removeAll, removeNonMana, removeIntrinsic + )); + } // update view updateAbilityTextForView(); } diff --git a/forge-game/src/main/java/forge/game/card/CardTraitChanges.java b/forge-game/src/main/java/forge/game/card/CardTraitChanges.java index cb656beaaff..48074e86f17 100644 --- a/forge-game/src/main/java/forge/game/card/CardTraitChanges.java +++ b/forge-game/src/main/java/forge/game/card/CardTraitChanges.java @@ -19,13 +19,19 @@ public class CardTraitChanges implements Cloneable { private List removedAbilities = Lists.newArrayList(); - private boolean removeAll; - private boolean removeNonMana; - private boolean removeIntrinsic; + private boolean removeAll = false; + private boolean removeNonMana = false; + private boolean removeIntrinsic = false; public CardTraitChanges(Collection spells, Collection removedAbilities, Collection trigger, Collection res, Collection st, boolean removeAll, boolean removeNonMana, boolean removeIntrinsic) { + merge(spells, removedAbilities, trigger, res, st, removeAll, removeNonMana, removeIntrinsic); + } + + public void merge(Collection spells, Collection removedAbilities, + Collection trigger, Collection res, Collection st, + boolean removeAll, boolean removeNonMana, boolean removeIntrinsic) { if (spells != null) { this.abilities.addAll(spells); } @@ -41,10 +47,10 @@ public class CardTraitChanges implements Cloneable { if (st != null) { this.staticAbilities.addAll(st); } - - this.removeAll = removeAll; - this.removeNonMana = removeNonMana; - this.removeIntrinsic = removeIntrinsic; + + this.removeAll |= removeAll; + this.removeNonMana |= removeNonMana; + this.removeIntrinsic |= removeIntrinsic; } /**