fix usable zone logic for abilities that function from other zones (#12446)

* remove superfluous constructor params

* fix Syrix, Carrier of the Flame

* standardize Zone = Battlefield

* rename class

* remove redundant class

* add docs

* adjustment
This commit is contained in:
xenohedron 2024-06-09 22:15:04 -04:00 committed by GitHub
parent 0d4acf26e5
commit a5488228b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 111 additions and 172 deletions

View file

@ -14,7 +14,7 @@ import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.SatyrCantBlockToken;
import java.util.UUID;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TokenPredicate;
@ -61,7 +61,7 @@ public final class AnaxHardenedInTheForge extends CardImpl {
}
}
class AnaxHardenedInTheForgeTriggeredAbility extends DiesThisOrAnotherCreatureTriggeredAbility {
class AnaxHardenedInTheForgeTriggeredAbility extends DiesThisOrAnotherTriggeredAbility {
AnaxHardenedInTheForgeTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) {
super(effect, optional, filter);

View file

@ -3,7 +3,7 @@ package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardsImpl;
@ -36,7 +36,7 @@ public final class ArchghoulOfThraben extends CardImpl {
// Whenever Archghoul of Thraben or another Zombie you control dies, look at the top card of your library.
// If it's a Zombie card, you may reveal it and put it into your hand.
// If you don't put the card into your hand, you may put it into your graveyard.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new ArchghoulOfThrabenEffect(), false, filter));
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new ArchghoulOfThrabenEffect(), false, filter));
}
private ArchghoulOfThraben(final ArchghoulOfThraben card) {

View file

@ -2,7 +2,7 @@ package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.SourceControllerCountersCount;
@ -46,7 +46,7 @@ public final class AzlaskTheSwellingScourge extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Azlask, the Swelling Scourge or another colorless creature you control dies, you get an experience counter.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new AddCountersPlayersEffect(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new AddCountersPlayersEffect(
CounterType.EXPERIENCE.createInstance(), TargetController.YOU
), false, filter));

View file

@ -4,7 +4,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
@ -57,7 +57,7 @@ public final class BasrisLieutenant extends CardImpl {
this.addAbility(ability);
// Whenever Basri's Lieutenant or another creature you control dies, if it had a +1/+1 counter on it, create a 2/2 white Knight creature token with vigilance.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new KnightToken()).setText("if it had a +1/+1 counter on it, create a 2/2 white Knight creature token with vigilance"),
false,
controlledCreatureWithP1P1CounterFilter

View file

@ -4,7 +4,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.CardImpl;
@ -28,7 +28,7 @@ public final class BloodArtist extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Blood Artist or another creature dies, target player loses 1 life and you gain 1 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeTargetEffect(1), false);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new LoseLifeTargetEffect(1), false);
ability.addEffect(new GainLifeEffect(1).concatBy("and"));
Target target = new TargetPlayer();
ability.addTarget(target);

View file

@ -3,7 +3,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.SacrificeOpponentsEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -36,7 +36,7 @@ public final class ButcherOfMalakir extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever Butcher of Malakir or another creature you control dies, each opponent sacrifices a creature.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new SacrificeOpponentsEffect(StaticFilters.FILTER_PERMANENT_CREATURE), false, filter));
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new SacrificeOpponentsEffect(StaticFilters.FILTER_PERMANENT_CREATURE), false, filter));
}
private ButcherOfMalakir(final ButcherOfMalakir card) {

View file

@ -1,7 +1,7 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.GainLifeEffect;
@ -32,7 +32,7 @@ public final class CacklingCulprit extends CardImpl {
this.nightCard = true;
// Whenever Cackling Culprit or another creature you control dies, you gain 1 life.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new GainLifeEffect(1), false, StaticFilters.FILTER_CONTROLLED_CREATURE
));

View file

@ -1,7 +1,7 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.BlitzAbility;
import mage.cards.CardImpl;
@ -37,7 +37,7 @@ public final class CaldaiaGuardian extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Caldaia Guardian or another creature you control with mana value 4 or greater dies, create two 1/1 green and white Citizen creature tokens.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new CitizenGreenWhiteToken(), 2), false, filter
));

View file

@ -2,7 +2,7 @@ package mage.cards.c;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.abilities.keyword.ReachAbility;
import mage.abilities.keyword.VigilanceAbility;
@ -57,7 +57,7 @@ public final class ColfenorTheLastYew extends CardImpl {
}
}
class ColfenorTheLastYewTriggeredAbility extends DiesThisOrAnotherCreatureTriggeredAbility {
class ColfenorTheLastYewTriggeredAbility extends DiesThisOrAnotherTriggeredAbility {
ColfenorTheLastYewTriggeredAbility() {
super(new ReturnFromGraveyardToHandTargetEffect(), false, StaticFilters.FILTER_CONTROLLED_CREATURE);
@ -68,7 +68,7 @@ class ColfenorTheLastYewTriggeredAbility extends DiesThisOrAnotherCreatureTrigge
}
@Override
public DiesThisOrAnotherCreatureTriggeredAbility copy() {
public DiesThisOrAnotherTriggeredAbility copy() {
return new ColfenorTheLastYewTriggeredAbility(this);
}

View file

@ -1,7 +1,7 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -29,7 +29,7 @@ public final class CordialVampire extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Cordial Vampire or another creature dies, put a +1/+1 counter on each vampire creature you control.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), false
));
}

View file

@ -1,9 +1,8 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.cards.CardImpl;
@ -34,7 +33,7 @@ public final class CruelCelebrant extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Cruel Celebrant or another creature or planeswalker you control dies, each opponent loses 1 life and you gain 1 life.
Ability ability = new DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter);
ability.addEffect(new GainLifeEffect(1).concatBy("and"));
this.addAbility(ability);

View file

@ -59,8 +59,8 @@ public final class DeathTyrant extends CardImpl {
class DeathTyrantTriggeredAbility extends TriggeredAbilityImpl {
public DeathTyrantTriggeredAbility() {
super(Zone.ALL, new CreateTokenEffect(new ZombieToken()));
DeathTyrantTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken()));
setTriggerPhrase("Whenever an attacking creature you control or a blocking creature an opponent controls dies, ");
}

View file

@ -17,12 +17,9 @@ import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
@ -67,7 +64,7 @@ public final class DeathsOasis extends CardImpl {
class DeathsOasisTriggeredAbility extends DiesCreatureTriggeredAbility {
DeathsOasisTriggeredAbility() {
super(Zone.BATTLEFIELD, null, false, StaticFilters.FILTER_CONTROLLED_CREATURE_NON_TOKEN, false);
super(null, false, StaticFilters.FILTER_CONTROLLED_CREATURE_NON_TOKEN, false);
}
private DeathsOasisTriggeredAbility(final DeathsOasisTriggeredAbility ability) {

View file

@ -2,7 +2,7 @@ package mage.cards.d;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -39,7 +39,7 @@ public final class DragonKamisEgg extends CardImpl {
this.nightCard = true;
// Whenever Dragon-Kami's Egg or a Dragon you control dies, you may cast a creature spell from among cards you own in exile with hatching counters on them without paying its mana cost.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new DragonKamisEggEffect(), false, filter
).setTriggerPhrase("Whenever {this} or a Dragon you control dies, "));
}

View file

@ -4,7 +4,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -32,7 +32,7 @@ public final class DrossScorpion extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Dross Scorpion or another artifact creature dies, you may untap target artifact.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new UntapTargetEffect(), true, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new UntapTargetEffect(), true, filter);
ability.addTarget(new TargetArtifactPermanent());
this.addAbility(ability);
}

View file

@ -1,7 +1,7 @@
package mage.cards.h;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -34,7 +34,7 @@ public final class HeadlessRider extends CardImpl {
this.toughness = new MageInt(1);
// Wheenver Headless Rider or another nontoken Zombie you control dies, create a 2/2 black Zombie creature token.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new ZombieToken()), false, filter
));
}

View file

@ -3,7 +3,7 @@ package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
@ -40,7 +40,7 @@ public final class KalastriaHighborn extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Kalastria Highborn or another Vampire you control dies, you may pay {B}. If you do, target player loses 2 life and you gain 2 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new DoIfCostPaid(new LoseGainEffect(), new ManaCostsImpl<>("{B}")), false, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new DoIfCostPaid(new LoseGainEffect(), new ManaCostsImpl<>("{B}")), false, filter);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}

View file

@ -30,7 +30,7 @@ public final class Lifeline extends CardImpl {
// Whenever a creature dies, if another creature is on the battlefield, return the first card to the battlefield under its owner's control at the beginning of the next end step.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new DiesCreatureTriggeredAbility(Zone.BATTLEFIELD, new LifelineEffect(), false, StaticFilters.FILTER_PERMANENT_CREATURE, true),
new DiesCreatureTriggeredAbility(new LifelineEffect(), false, StaticFilters.FILTER_PERMANENT_CREATURE, true),
new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_PERMANENT_CREATURE, false),
"Whenever a creature dies, if another creature is on the battlefield, return the first card to the battlefield under its owner's control at the beginning of the next end step.");
this.addAbility(ability);

View file

@ -1,7 +1,7 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.costs.CompositeCost;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.costs.mana.GenericManaCost;
@ -39,7 +39,7 @@ public final class MiaraThornOfTheGlade extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Miara, Thorn of the Glade or another Elf you control dies, you may pay {1} and 1 life. If you do, draw a card.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new DoIfCostPaid(
new DrawCardSourceControllerEffect(1),
new CompositeCost(

View file

@ -2,7 +2,7 @@ package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -39,7 +39,7 @@ public final class MidnightEntourage extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
// Whenever Midnight Entourage or another Aetherborn you control dies, you draw a card and you lose 1 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), false, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), false, filter);
Effect effect = new LoseLifeSourceControllerEffect(1);
ability.addEffect(effect.concatBy("and"));
this.addAbility(ability);

View file

@ -3,7 +3,7 @@ package mage.cards.n;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.effects.keyword.InvestigateEffect;
@ -46,7 +46,7 @@ public final class NickValentinePrivateEye extends CardImpl {
new CantBeBlockedByCreaturesSourceEffect(filterNonArtifact, Duration.WhileOnBattlefield)));
// Whenever Nick Valentine or another artifact creature you control dies, you may investigate.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new InvestigateEffect()
.setText("investigate. <i>(To investigate, create a Clue token. " +
"It's an artifact with \"{2}, Sacrifice this artifact: Draw a card.\")</i>"),

View file

@ -2,7 +2,7 @@ package mage.cards.o;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -28,7 +28,7 @@ public final class OdricsOutrider extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Odric's Outrider or another creature you control dies, put a +1/+1 counter on target creature you control.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(
Ability ability = new DiesThisOrAnotherTriggeredAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
false, StaticFilters.FILTER_CONTROLLED_CREATURE
);

View file

@ -4,7 +4,7 @@ package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DamageTargetEffect;
@ -42,7 +42,7 @@ public final class OmnathLocusOfRage extends CardImpl {
this.addAbility(new LandfallAbility(new CreateTokenEffect(new OmnathElementalToken()), false));
// Whenever Omnath, Locus of Rage or another Elemental you control dies, Omnath deals 3 damage to any target.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new DamageTargetEffect(3), false, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new DamageTargetEffect(3), false, filter);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}

View file

@ -2,7 +2,7 @@ package mage.cards.p;
import mage.MageInt;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.effects.common.GainLifeEffect;
@ -33,7 +33,7 @@ public final class PanickedBystander extends CardImpl {
this.secondSideCardClazz = mage.cards.c.CacklingCulprit.class;
// Whenever Panicked Bystander or another creature you control dies, you gain 1 life.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new GainLifeEffect(1), false, StaticFilters.FILTER_CONTROLLED_CREATURE
));

View file

@ -2,7 +2,7 @@ package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -47,7 +47,7 @@ public final class PashalikMons extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Pashalik Mons or another Goblin you control dies, Pashalik Mons deals 1 damage to any target.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(
Ability ability = new DiesThisOrAnotherTriggeredAbility(
new DamageTargetEffect(1), false, filter
);
ability.addTarget(new TargetAnyTarget());

View file

@ -2,7 +2,7 @@ package mage.cards.p;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -36,7 +36,7 @@ public final class PawnOfUlamog extends CardImpl {
// Whenever Pawn of Ulamog or another nontoken creature you control dies, you may create a 0/1 colorless
// Eldrazi Spawn creature token. It has "Sacrifice this creature: Add {C}."
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new EldraziSpawnToken()).withTextOptions(true), true, filter));
}

View file

@ -2,7 +2,7 @@ package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.ReachAbility;
@ -50,7 +50,7 @@ public final class PolukranosEngineOfRuin extends CardImpl {
this.addAbility(LifelinkAbility.getInstance());
// Whenever Polukranos, Engine of Ruin or another nontoken Hydra you control dies, create a 3/3 green and white Phyrexian Hydra creature token with reach and a 3/3 green and white Phyrexian Hydra creature token with lifelink.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(
Ability ability = new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new PhyrexianHydraWithReachToken()), false, filter
);
ability.addEffect(new CreateTokenEffect(new PhyrexianHydraWithLifelinkToken())

View file

@ -3,7 +3,7 @@ package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -28,7 +28,7 @@ public final class RotlungReanimator extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Rotlung Reanimator or another Cleric dies, create a 2/2 black Zombie creature token.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new CreateTokenEffect(new ZombieToken()), false, filter));
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new CreateTokenEffect(new ZombieToken()), false, filter));
}
private RotlungReanimator(final RotlungReanimator card) {

View file

@ -2,7 +2,7 @@ package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
@ -41,7 +41,7 @@ public final class RundveltHordemaster extends CardImpl {
)));
// Whenever Rundvelt Hordemaster or another Goblin you control dies, exile the top card of your library. If it's a Goblin creature card, you may cast that card until the end of your next turn.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new RundveltHordemasterEffect(), false, filter2
));
}

View file

@ -2,7 +2,7 @@ package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -44,7 +44,7 @@ public final class ScionOfOpulence extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Scion of Opulence or another nontoken Vampire you control dies, create a Treasure token.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new TreasureToken()), false, filter
));

View file

@ -4,7 +4,7 @@ package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.MillCardsTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -27,7 +27,7 @@ public final class SelhoffOccultist extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Selhoff Occultist or another creature dies, target player puts the top card of their library into their graveyard.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new MillCardsTargetEffect(1), false);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new MillCardsTargetEffect(1), false);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}

View file

@ -4,7 +4,7 @@ package mage.cards.s;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
@ -43,7 +43,7 @@ public final class SkirkDrillSergeant extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Skirk Drill Sergeant or another Goblin dies, you may pay {2}{R}. If you do, reveal the top card of your library. If it's a Goblin permanent card, put it onto the battlefield. Otherwise, put it into your graveyard.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new DoIfCostPaid(new SkirkDrillSergeantEffect(), new ManaCostsImpl<>("{2}{R}")), false, filter));
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new DoIfCostPaid(new SkirkDrillSergeantEffect(), new ManaCostsImpl<>("{2}{R}")), false, filter));
}

View file

@ -1,7 +1,7 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
@ -44,7 +44,7 @@ public final class SlurrkAllIngesting extends CardImpl {
));
// Whenever Slurrk or another creature you control dies, if it had a +1/+1 counter on it, put a +1/+1 counter on each creature you control that has a +1/+1 counter on it.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new AddCountersAllEffect(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new AddCountersAllEffect(
CounterType.P1P1.createInstance(), filter
).setText("if it had a +1/+1 counter on it, put a +1/+1 counter " +
"on each creature you control that has a +1/+1 counter on it"), false, filter));

View file

@ -64,7 +64,7 @@ public class SyrixCarrierOfTheFlame extends CardImpl {
this.addAbility(new DiesCreatureTriggeredAbility(
Zone.GRAVEYARD,
new SyrixCarrierOfTheFlameCastEffect(),
true,
false, // already accounted for in effect
anotherPhoenixFilter,
false)
);

View file

@ -2,7 +2,7 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
@ -45,7 +45,7 @@ public final class TotentanzSwarmPiper extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Totentanz, Swarm Piper or another nontoken creature you control dies, create a 1/1 black Rat creature token with "This creature can't block."
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new RatCantBlockToken()), false,
StaticFilters.FILTER_CONTROLLED_CREATURE_NON_TOKEN
));

View file

@ -2,7 +2,7 @@ package mage.cards.u;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.cards.CardImpl;
@ -35,7 +35,7 @@ public final class UndeadAugur extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Undead Augur or another Zombie you control dies, you draw a card and you lose 1 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(
Ability ability = new DiesThisOrAnotherTriggeredAbility(
new DrawCardSourceControllerEffect(1).setText("you draw a card"), false, filter
);
ability.addEffect(new LoseLifeSourceControllerEffect(1).concatBy("and"));

View file

@ -3,7 +3,7 @@ package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -30,7 +30,7 @@ public final class VengefulDead extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Vengeful Dead or another Zombie dies, each opponent loses 1 life.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter));
this.addAbility(new DiesThisOrAnotherTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter));
}
private VengefulDead(final VengefulDead card) {

View file

@ -2,7 +2,7 @@ package mage.cards.v;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.TransformSourceEffect;
@ -51,7 +51,7 @@ public final class VoldarenBloodcaster extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever Voldaren Bloodcaster or another nontoken creature you control dies, create a Blood token.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new BloodToken()), false, filter
));

View file

@ -1,7 +1,7 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.keyword.AmassEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -34,7 +34,7 @@ public final class WarbeastOfGorgoroth extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Warbeast of Gorgoroth or another creature you control with power 4 or greater dies, amass Orcs 2.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new AmassEffect(2, SubType.ORC), false, filter
));
}

View file

@ -1,7 +1,7 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -33,7 +33,7 @@ public final class WarteyeWitch extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Warteye Witch or another creature you control dies, scry 1.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new ScryEffect(1, false), false, filter
));
}

View file

@ -2,7 +2,7 @@ package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.CardImpl;
@ -38,7 +38,7 @@ public final class WaywardDisciple extends CardImpl {
this.nightCard = true;
// Whenever Wayward Disciple or another creature you control dies, target opponent loses 1 life and you gain 1 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeTargetEffect(1), false, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new LoseLifeTargetEffect(1), false, filter);
ability.addEffect(new GainLifeEffect(1).concatBy("and"));
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

View file

@ -1,7 +1,7 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.NightboundAbility;
import mage.cards.CardImpl;
@ -38,7 +38,7 @@ public final class WeddingCrasher extends CardImpl {
this.nightCard = true;
// Whenever Wedding Crasher or another Wolf or Werewolf you control dies, draw a card.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
this.addAbility(new DiesThisOrAnotherTriggeredAbility(
new DrawCardSourceControllerEffect(1), false, filter
));

View file

@ -4,7 +4,7 @@ package mage.cards.x;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
@ -38,7 +38,7 @@ public final class XathridNecromancer extends CardImpl {
// Whenever Xathrid Necromancer or another Human creature you control dies, create a tapped 2/2 black Zombie creature token.
Effect effect = new CreateTokenEffect(new ZombieToken(), 1, true, false);
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(effect, false, filter);
Ability ability = new DiesThisOrAnotherTriggeredAbility(effect, false, filter);
this.addAbility(ability);
}

View file

@ -4,7 +4,7 @@ package mage.cards.z;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.common.DiesThisOrAnotherTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
@ -28,7 +28,7 @@ public final class ZulaportCutthroat extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Zulaport Cutthroat or another creature you control dies, each opponent loses 1 life and you gain 1 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new LoseLifeOpponentsEffect(1), false, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED);
Ability ability = new DiesThisOrAnotherTriggeredAbility(new LoseLifeOpponentsEffect(1), false, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED);
Effect effect = new GainLifeEffect(1);
effect.setText("and you gain 1 life");
ability.addEffect(effect);

View file

@ -2,7 +2,6 @@ package org.mage.test.cards.single.ncc;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -74,13 +73,12 @@ public class SyrixCarrierOfTheFlameTest extends CardTestPlayerBase {
}
@Ignore("Usable zone issue, see #10550")
@Test
public void testCast() {
addCard(Zone.GRAVEYARD, playerA, syrix);
addCard(Zone.BATTLEFIELD, playerA, phoenix);
addCard(Zone.HAND, playerA, shock);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 6);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shock, phoenix);
// phoenix dies, syrix ability triggers
@ -95,7 +93,7 @@ public class SyrixCarrierOfTheFlameTest extends CardTestPlayerBase {
assertPowerToughness(playerA, syrix, 3, 3);
assertGraveyardCount(playerA, phoenix, 1);
assertGraveyardCount(playerA, shock, 1);
assertTappedCount("Badlands", true, 6);
assertTappedCount("Badlands", true, 5);
}

View file

@ -430,6 +430,12 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
return this;
}
/**
* For triggered abilities that function from the battlefield that must trigger when the source permanent dies
* and/or for any other events that happen simultaneously to the source permanent dying.
* (Similar logic must be used for any leaves-the-battlefield, but this method assumes to graveyard only.)
* NOTE: If your ability functions from another zone (not battlefield) then must use standard logic, not this.
*/
public static boolean isInUseableZoneDiesTrigger(TriggeredAbility source, GameEvent event, Game game) {
// Get the source permanent of the ability
MageObject sourceObject = null;

View file

@ -82,6 +82,10 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
if (this.zone == Zone.BATTLEFIELD) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
} else {
return super.isInUseableZone(game, source, event);
}
}
}

View file

@ -1,66 +0,0 @@
package mage.abilities.common;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
/**
* @author noxx
*/
public class DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility extends TriggeredAbilityImpl {
protected FilterCreatureOrPlaneswalkerPermanent filter;
public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, new FilterCreatureOrPlaneswalkerPermanent());
}
public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(Effect effect, boolean optional, FilterCreatureOrPlaneswalkerPermanent filter) {
super(Zone.ALL, effect, optional); // Needs "ALL" if the source itself should trigger or multiple (incl. source go to grave)
this.filter = filter;
setTriggerPhrase("Whenever {this} or another " + filter.getMessage() + " dies, ");
}
public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}
@Override
public DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility copy() {
return new DiesThisOrAnotherCreatureOrPlaneswalkerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) {
if (zEvent.getTarget() != null) {
if (zEvent.getTarget().getId().equals(this.getSourceId())) {
return true;
} else {
if (filter.match(zEvent.getTarget(), getControllerId(), this, game)) {
return true;
}
}
}
}
return false;
}
@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

View file

@ -13,17 +13,17 @@ import mage.game.events.ZoneChangeEvent;
/**
* @author noxx
*/
public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityImpl {
public class DiesThisOrAnotherTriggeredAbility extends TriggeredAbilityImpl {
protected FilterPermanent filter;
private boolean applyFilterOnSource = false;
public DiesThisOrAnotherCreatureTriggeredAbility(Effect effect, boolean optional) {
public DiesThisOrAnotherTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, StaticFilters.FILTER_PERMANENT_CREATURE);
}
public DiesThisOrAnotherCreatureTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter) {
super(Zone.ALL, effect, optional); // Needs "ALL" if the source itself should trigger or multiple (incl. source go to grave)
public DiesThisOrAnotherTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter) {
super(Zone.BATTLEFIELD, effect, optional);
this.filter = filter;
String filterMessage = filter.getMessage();
if (filterMessage.startsWith("a ")) {
@ -32,20 +32,20 @@ public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityI
setTriggerPhrase("Whenever {this} or another " + filterMessage + " dies, ");
}
protected DiesThisOrAnotherCreatureTriggeredAbility(final DiesThisOrAnotherCreatureTriggeredAbility ability) {
protected DiesThisOrAnotherTriggeredAbility(final DiesThisOrAnotherTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.applyFilterOnSource = ability.applyFilterOnSource;
}
public DiesThisOrAnotherCreatureTriggeredAbility setApplyFilterOnSource(boolean applyFilterOnSource) {
public DiesThisOrAnotherTriggeredAbility setApplyFilterOnSource(boolean applyFilterOnSource) {
this.applyFilterOnSource = applyFilterOnSource;
return this;
}
@Override
public DiesThisOrAnotherCreatureTriggeredAbility copy() {
return new DiesThisOrAnotherCreatureTriggeredAbility(this);
public DiesThisOrAnotherTriggeredAbility copy() {
return new DiesThisOrAnotherTriggeredAbility(this);
}
@Override
@ -59,6 +59,7 @@ public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityI
if (zEvent.isDiesEvent()) {
if (zEvent.getTarget() != null) {
if (!applyFilterOnSource && zEvent.getTarget().getId().equals(this.getSourceId())) {
// TODO: remove this workaround for Basri's Lieutenant
return true;
} else {
if (filter.match(zEvent.getTarget(), getControllerId(), this, game)) {

View file

@ -17,8 +17,8 @@ import mage.target.targetpointer.FixedTarget;
public class PutIntoGraveFromBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
private final FilterPermanent filter;
private boolean setTargetPointer;
private boolean onlyToControllerGraveyard;
private final boolean setTargetPointer;
private final boolean onlyToControllerGraveyard;
public PutIntoGraveFromBattlefieldAllTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter, boolean setTargetPointer) {
this(effect, optional, filter, setTargetPointer, false);

View file

@ -21,7 +21,7 @@ public class PutIntoGraveFromBattlefieldSourceTriggeredAbility extends Triggered
}
public PutIntoGraveFromBattlefieldSourceTriggeredAbility(Effect effect, boolean optional, boolean onlyToControllerGraveyard) {
super(Zone.ALL, effect, optional);
super(Zone.BATTLEFIELD, effect, optional);
setLeavesTheBattlefieldTrigger(true);
this.onlyToControllerGraveyard = onlyToControllerGraveyard;
setTriggerPhrase("When {this} is put into " + (onlyToControllerGraveyard ? "your" : "a") + " graveyard from the battlefield, ");