diff --git a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java index c3d73cc95d..480ad18f98 100644 --- a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java @@ -251,7 +251,7 @@ public class MageActionCallback implements ActionCallback { } displayCard(card.getOriginal(), data); } else { - hideCard(); + //hideCard(); } } diff --git a/Mage/src/mage/abilities/TriggeredAbilities.java b/Mage/src/mage/abilities/TriggeredAbilities.java index 4f1098bf76..a009097c2d 100644 --- a/Mage/src/mage/abilities/TriggeredAbilities.java +++ b/Mage/src/mage/abilities/TriggeredAbilities.java @@ -42,12 +42,12 @@ import java.util.UUID; * * @author BetaSteward_at_googlemail.com */ -public class TriggeredAbilities extends HashMap { +public class TriggeredAbilities extends HashMap { public TriggeredAbilities() {} public TriggeredAbilities(final TriggeredAbilities abilities) { - for (Map.Entry entry: abilities.entrySet()) { + for (Map.Entry entry: abilities.entrySet()) { this.put(entry.getKey(), entry.getValue().copy()); } } @@ -96,8 +96,16 @@ public class TriggeredAbilities extends HashMap { return object; } - public void add(TriggeredAbility ability) { - this.put(ability.getId(), ability); + public void add(TriggeredAbility ability, MageObject attachedTo) { + this.put(getKey(ability, attachedTo), ability); + } + + private String getKey(TriggeredAbility ability, MageObject target) { + String key = ability.getId() + "_"; + if (target != null) { + key += target.getId(); + } + return key; } public TriggeredAbilities copy() { diff --git a/Mage/src/mage/game/GameState.java b/Mage/src/mage/game/GameState.java index 28d7bb979a..769f6c28aa 100644 --- a/Mage/src/mage/game/GameState.java +++ b/Mage/src/mage/game/GameState.java @@ -29,6 +29,7 @@ package mage.game; import mage.Constants.Zone; +import mage.MageObject; import mage.abilities.*; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffects; @@ -435,11 +436,11 @@ public class GameState implements Serializable, Copyable { watchers.add(watcher); } for (Ability ability: card.getAbilities()) { - addAbility(ability); + addAbility(ability, card); } } - public void addAbility(Ability ability) { + public void addAbility(Ability ability, MageObject attachedTo) { if (ability instanceof StaticAbility) { if (ability instanceof KickerAbility) { return; @@ -453,14 +454,14 @@ public class GameState implements Serializable, Copyable { } } else if (ability instanceof TriggeredAbility) { - this.triggers.add((TriggeredAbility)ability); + this.triggers.add((TriggeredAbility)ability, attachedTo); } } public void addEmblem(Emblem emblem) { getCommand().add(emblem); for (Ability ability: emblem.getAbilities()) { - addAbility(ability); + addAbility(ability, emblem); } } diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index e147036edc..22b2fed7d3 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -177,7 +177,7 @@ public abstract class PermanentImpl> extends CardImpl Ability copy = ability.copy(); copy.setControllerId(controllerId); copy.setSourceId(objectId); - game.getState().addAbility(copy); + game.getState().addAbility(copy, this); abilities.add(copy); } }