From b2beefc6807bc16d9fabc997862c04ee568e3387 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 20 Oct 2018 20:21:54 -0400 Subject: [PATCH] fixed Vraska, Golgari Queen's emblem not triggering --- ...alsDamageToAPlayerAllTriggeredAbility.java | 43 ++++++++++--------- .../emblems/VraskaGolgariQueenEmblem.java | 6 +-- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java index 0b0a41eaa6..4c662d195c 100644 --- a/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAllTriggeredAbility.java @@ -13,7 +13,6 @@ import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; /** - * * @author LevelX2 */ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImpl { @@ -28,7 +27,11 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp } public DealsDamageToAPlayerAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyCombat, boolean affectsDefendingPlayer) { - super(Zone.BATTLEFIELD, effect, optional); + this(Zone.BATTLEFIELD, effect, filter, optional, setTargetPointer, onlyCombat, affectsDefendingPlayer); + } + + public DealsDamageToAPlayerAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyCombat, boolean affectsDefendingPlayer) { + super(zone, effect, optional); this.setTargetPointer = setTargetPointer; this.filter = filter; this.onlyCombat = onlyCombat; @@ -57,27 +60,25 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp public boolean checkTrigger(GameEvent event, Game game) { if (!onlyCombat || ((DamagedPlayerEvent) event).isCombatDamage()) { Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent != null) { - if (filter.match(permanent, getSourceId(), getControllerId(), game)) { - for (Effect effect : this.getEffects()) { - effect.setValue("damage", event.getAmount()); - effect.setValue("sourceId", event.getSourceId()); - if (affectsDefendingPlayer) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - continue; - } - switch (setTargetPointer) { - case PLAYER: - effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); - break; - case PERMANENT: - effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); - break; - } - + if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + for (Effect effect : this.getEffects()) { + effect.setValue("damage", event.getAmount()); + effect.setValue("sourceId", event.getSourceId()); + if (affectsDefendingPlayer) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + continue; } - return true; + switch (setTargetPointer) { + case PLAYER: + effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); + break; + case PERMANENT: + effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); + break; + } + } + return true; } } return false; diff --git a/Mage/src/main/java/mage/game/command/emblems/VraskaGolgariQueenEmblem.java b/Mage/src/main/java/mage/game/command/emblems/VraskaGolgariQueenEmblem.java index f7c2fac333..018943ecab 100644 --- a/Mage/src/main/java/mage/game/command/emblems/VraskaGolgariQueenEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/VraskaGolgariQueenEmblem.java @@ -3,11 +3,11 @@ package mage.game.command.emblems; import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility; import mage.abilities.effects.common.LoseGameTargetPlayerEffect; import mage.constants.SetTargetPointer; +import mage.constants.Zone; import mage.filter.StaticFilters; import mage.game.command.Emblem; /** - * * @author TheElk801 */ public final class VraskaGolgariQueenEmblem extends Emblem { @@ -17,9 +17,9 @@ public final class VraskaGolgariQueenEmblem extends Emblem { this.setName("Emblem Vraska"); this.setExpansionSetCodeForImage("GRN"); this.getAbilities().add(new DealsDamageToAPlayerAllTriggeredAbility( - new LoseGameTargetPlayerEffect(), + Zone.COMMAND, new LoseGameTargetPlayerEffect(), StaticFilters.FILTER_CONTROLLED_A_CREATURE, - false, SetTargetPointer.PLAYER, true + false, SetTargetPointer.NONE, true, true )); } }