fixed Vraska, Golgari Queen's emblem not triggering

This commit is contained in:
Evan Kranzler 2018-10-20 20:21:54 -04:00
parent 01dfede9e9
commit b2beefc680
2 changed files with 25 additions and 24 deletions

View file

@ -13,7 +13,6 @@ import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImpl { 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) { 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.setTargetPointer = setTargetPointer;
this.filter = filter; this.filter = filter;
this.onlyCombat = onlyCombat; this.onlyCombat = onlyCombat;
@ -57,27 +60,25 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (!onlyCombat || ((DamagedPlayerEvent) event).isCombatDamage()) { if (!onlyCombat || ((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) { if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
if (filter.match(permanent, getSourceId(), getControllerId(), game)) { for (Effect effect : this.getEffects()) {
for (Effect effect : this.getEffects()) { effect.setValue("damage", event.getAmount());
effect.setValue("damage", event.getAmount()); effect.setValue("sourceId", event.getSourceId());
effect.setValue("sourceId", event.getSourceId()); if (affectsDefendingPlayer) {
if (affectsDefendingPlayer) { effect.setTargetPointer(new FixedTarget(event.getTargetId()));
effect.setTargetPointer(new FixedTarget(event.getTargetId())); continue;
continue;
}
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; 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; return false;

View file

@ -3,11 +3,11 @@ package mage.game.command.emblems;
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility; import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
import mage.abilities.effects.common.LoseGameTargetPlayerEffect; import mage.abilities.effects.common.LoseGameTargetPlayerEffect;
import mage.constants.SetTargetPointer; import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.command.Emblem; import mage.game.command.Emblem;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class VraskaGolgariQueenEmblem extends Emblem { public final class VraskaGolgariQueenEmblem extends Emblem {
@ -17,9 +17,9 @@ public final class VraskaGolgariQueenEmblem extends Emblem {
this.setName("Emblem Vraska"); this.setName("Emblem Vraska");
this.setExpansionSetCodeForImage("GRN"); this.setExpansionSetCodeForImage("GRN");
this.getAbilities().add(new DealsDamageToAPlayerAllTriggeredAbility( this.getAbilities().add(new DealsDamageToAPlayerAllTriggeredAbility(
new LoseGameTargetPlayerEffect(), Zone.COMMAND, new LoseGameTargetPlayerEffect(),
StaticFilters.FILTER_CONTROLLED_A_CREATURE, StaticFilters.FILTER_CONTROLLED_A_CREATURE,
false, SetTargetPointer.PLAYER, true false, SetTargetPointer.NONE, true, true
)); ));
} }
} }