mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
fixed Vraska, Golgari Queen's emblem not triggering
This commit is contained in:
parent
01dfede9e9
commit
b2beefc680
2 changed files with 25 additions and 24 deletions
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue