diff --git a/Mage/src/mage/abilities/keyword/ProwlAbility.java b/Mage/src/mage/abilities/keyword/ProwlAbility.java index 4ca59aa9f3..7630fa3f8f 100644 --- a/Mage/src/mage/abilities/keyword/ProwlAbility.java +++ b/Mage/src/mage/abilities/keyword/ProwlAbility.java @@ -117,12 +117,10 @@ public class ProwlAbility extends StaticAbility implements Alterna throw new IllegalArgumentException("Params can't be null"); } boolean canProwl = false; - if (prowlWatcher.getDamagingSubtypes(ability.getControllerId()) != null) { - for (String subtype : prowlWatcher.getDamagingSubtypes(ability.getControllerId())) { - if (card.getSubtype().contains(subtype)) { - canProwl = true; - break; - } + for (String subtype: card.getSubtype()) { + if (prowlWatcher.hasSubtypeMadeCombatDamage(ability.getControllerId(), subtype)) { + canProwl = true; + break; } } if (canProwl) { diff --git a/Mage/src/mage/watchers/common/ProwlWatcher.java b/Mage/src/mage/watchers/common/ProwlWatcher.java index 0f8fa533e2..063c8bed82 100644 --- a/Mage/src/mage/watchers/common/ProwlWatcher.java +++ b/Mage/src/mage/watchers/common/ProwlWatcher.java @@ -28,11 +28,13 @@ package mage.watchers.common; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.UUID; +import mage.abilities.keyword.ChangelingAbility; import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; @@ -50,6 +52,7 @@ import mage.watchers.WatcherImpl; public class ProwlWatcher extends WatcherImpl { private Map> damagingSubtypes = new HashMap>(); + private Set allSubtypes = new HashSet(); public ProwlWatcher() { super("Prowl", WatcherScope.GAME); @@ -73,13 +76,17 @@ public class ProwlWatcher extends WatcherImpl { DamagedPlayerEvent dEvent = (DamagedPlayerEvent) event; if (dEvent.isCombatDamage()) { Permanent creature = game.getPermanent(dEvent.getSourceId()); - if (creature != null) { - Set subtypes = damagingSubtypes.get(creature.getControllerId()); - if (subtypes == null) { - subtypes = new LinkedHashSet(); + if (creature != null && !allSubtypes.contains(creature.getControllerId())) { + if (creature.getAbilities().containsKey(ChangelingAbility.getInstance().getId())) { + allSubtypes.add(creature.getControllerId()); + } else { + Set subtypes = damagingSubtypes.get(creature.getControllerId()); + if (subtypes == null) { + subtypes = new LinkedHashSet(); + } + subtypes.addAll(creature.getSubtype()); + damagingSubtypes.put(creature.getControllerId(), subtypes); } - subtypes.addAll(creature.getSubtype()); - damagingSubtypes.put(creature.getControllerId(), subtypes); } } } @@ -89,9 +96,18 @@ public class ProwlWatcher extends WatcherImpl { public void reset() { super.reset(); damagingSubtypes.clear(); + allSubtypes.clear(); } - public Set getDamagingSubtypes(UUID playerId) { - return damagingSubtypes.get(playerId); + public boolean hasSubtypeMadeCombatDamage(UUID playerId, String subtype) { + if (allSubtypes.contains(playerId)) { + return true; + } + Set subtypes = damagingSubtypes.get(playerId); + if (subtypes != null) { + return subtypes.contains(subtype); + } + return false; } + }