mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
* fixed dies events support in single cards (use cases like sacrifice cost);
This commit is contained in:
parent
66b338c6fc
commit
0f8416cfb1
17 changed files with 84 additions and 32 deletions
|
|
@ -33,7 +33,7 @@ public final class Chronozoa extends CardImpl {
|
|||
// Vanishing 3 (This permanent enters the battlefield with three time counters on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)
|
||||
this.addAbility(new VanishingAbility(3));
|
||||
|
||||
// When Chronozoa is put into a graveyard from play, if it had no time counters on it, create two tokens that are copies of it.
|
||||
// When Chronozoa dies, if it had no time counters on it, create two tokens that are copies of it.
|
||||
Effect effect = new CreateTokenCopySourceEffect(2);
|
||||
effect.setText("create two tokens that are copies of it");
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new DiesSourceTriggeredAbility(effect, false),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.AbilityImpl;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
|
|
@ -51,6 +53,7 @@ class FalkenrathNobleTriggeredAbility extends TriggeredAbilityImpl {
|
|||
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), false);
|
||||
this.addEffect(new GainLifeEffect(1));
|
||||
this.addTarget(new TargetPlayer());
|
||||
this.setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private FalkenrathNobleTriggeredAbility(final FalkenrathNobleTriggeredAbility ability) {
|
||||
|
|
@ -87,4 +90,9 @@ class FalkenrathNobleTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public String getRule() {
|
||||
return "Whenever {this} or another creature dies, target player loses 1 life and you gain 1 life.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -53,6 +55,7 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public GraveBetrayalTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, null);
|
||||
this.setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private GraveBetrayalTriggeredAbility(final GraveBetrayalTriggeredAbility ability) {
|
||||
|
|
@ -92,6 +95,11 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public String getRule() {
|
||||
return "Whenever a creature you don't control dies, return it to the battlefield under your control with an additional +1/+1 counter on it at the beginning of the next end step. That creature is a black Zombie in addition to its other colors and types.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
||||
class GraveBetrayalEffect extends OneShotEffect {
|
||||
|
|
@ -125,7 +133,6 @@ class GraveBetrayalEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class GraveBetrayalReplacementEffect extends ReplacementEffectImpl {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -29,7 +30,6 @@ public final class GravePact extends CardImpl {
|
|||
public GravePact(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}{B}");
|
||||
|
||||
|
||||
// Whenever a creature you control dies, each other player sacrifices a creature.
|
||||
this.addAbility(new GravePactTriggeredAbility());
|
||||
}
|
||||
|
|
@ -49,6 +49,7 @@ class GravePactTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public GravePactTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GravePactEffect());
|
||||
setTriggerPhrase("Whenever a creature you control dies, ");
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private GravePactTriggeredAbility(final GravePactTriggeredAbility ability) {
|
||||
|
|
@ -74,6 +75,11 @@ class GravePactTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
||||
class GravePactEffect extends OneShotEffect {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class KarmicJusticeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
KarmicJusticeTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), true);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private KarmicJusticeTriggeredAbility(final KarmicJusticeTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ class KayaTheInexorableTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public KayaTheInexorableTriggeredAbility() {
|
||||
super(Zone.ALL, null, false);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private KayaTheInexorableTriggeredAbility(KayaTheInexorableTriggeredAbility ability) {
|
||||
|
|
@ -107,22 +108,6 @@ class KayaTheInexorableTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
Permanent sourcePermanent = null;
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent = game.getPermanent(getSourceId());
|
||||
} else {
|
||||
if (game.checkShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
|
||||
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
}
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
return hasSourceObjectAbility(game, sourcePermanent, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KayaTheInexorableTriggeredAbility copy() {
|
||||
return new KayaTheInexorableTriggeredAbility(this);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.cards.m;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -67,6 +68,7 @@ class MarchesaTheBlackRoseTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public MarchesaTheBlackRoseTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new MarchesaTheBlackRoseEffect());
|
||||
setTriggerPhrase("Whenever a creature you control with a +1/+1 counter on it dies, ");
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private MarchesaTheBlackRoseTriggeredAbility(final MarchesaTheBlackRoseTriggeredAbility ability) {
|
||||
|
|
@ -100,6 +102,11 @@ class MarchesaTheBlackRoseTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
||||
class MarchesaTheBlackRoseEffect extends OneShotEffect {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package mage.cards.m;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -52,6 +53,7 @@ class MassacreWurmTriggeredAbility extends TriggeredAbilityImpl {
|
|||
MassacreWurmTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(2));
|
||||
setTriggerPhrase("Whenever a creature an opponent controls dies, ");
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private MassacreWurmTriggeredAbility(final MassacreWurmTriggeredAbility ability) {
|
||||
|
|
@ -81,4 +83,9 @@ class MassacreWurmTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ package mage.cards.m;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -60,6 +62,7 @@ class MimicVatTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
MimicVatTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new MimicVatEffect(), true);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private MimicVatTriggeredAbility(final MimicVatTriggeredAbility ability) {
|
||||
|
|
@ -105,6 +108,11 @@ class MimicVatTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public String getRule() {
|
||||
return AbilityWord.IMPRINT.formatWord() + "Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with {this} to its owner's graveyard.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
||||
class MimicVatEffect extends OneShotEffect {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class MycoidShepherdTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public MycoidShepherdTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainLifeEffect(5), true);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private MycoidShepherdTriggeredAbility(final MycoidShepherdTriggeredAbility ability) {
|
||||
|
|
@ -91,4 +92,9 @@ class MycoidShepherdTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public MycoidShepherdTriggeredAbility copy() {
|
||||
return new MycoidShepherdTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package mage.cards.n;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
|
||||
|
|
@ -55,6 +56,7 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public NecroskitterTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ReturnToBattlefieldUnderYourControlTargetEffect(), true);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private NecroskitterTriggeredAbility(final NecroskitterTriggeredAbility ability) {
|
||||
|
|
@ -92,4 +94,9 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public String getRule() {
|
||||
return "Whenever a creature an opponent controls with a -1/-1 counter on it dies, you may return that card to the battlefield under your control.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
|
|
@ -51,6 +52,7 @@ class OrahSkyclaveHierophantTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
OrahSkyclaveHierophantTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect());
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private OrahSkyclaveHierophantTriggeredAbility(final OrahSkyclaveHierophantTriggeredAbility ability) {
|
||||
|
|
@ -94,4 +96,9 @@ class OrahSkyclaveHierophantTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return "Whenever {this} or another Cleric you control dies, return target Cleric card " +
|
||||
"with lesser mana value from your graveyard to the battlefield.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class PatronOfTheVeinCreatureDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public PatronOfTheVeinCreatureDiesTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new PatronOfTheVeinExileCreatureEffect(), false);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private PatronOfTheVeinCreatureDiesTriggeredAbility(final PatronOfTheVeinCreatureDiesTriggeredAbility ability) {
|
||||
|
|
@ -107,6 +108,11 @@ class PatronOfTheVeinCreatureDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public String getRule() {
|
||||
return "Whenever a creature an opponent controls dies, exile it and put a +1/+1 counter on each Vampire you control.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
||||
class PatronOfTheVeinExileCreatureEffect extends OneShotEffect {
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@ public final class PhantasmalImage extends CardImpl {
|
|||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
// You may have Phantasmal Image enter the battlefield as a copy of any creature
|
||||
// on the battlefield, except it's an Illusion in addition to its other types and
|
||||
// it has "When this creature becomes the target of a spell or ability, sacrifice it."
|
||||
// You may have Phantasmal Image enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it has "When this creature becomes the target of a spell or ability, sacrifice it."
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, phantasmalImageApplier);
|
||||
effect.setText(effectText);
|
||||
this.addAbility(new EntersBattlefieldAbility(effect, true));
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class ReyhanLastOfTheAbzanTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public ReyhanLastOfTheAbzanTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, null, true);
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private ReyhanLastOfTheAbzanTriggeredAbility(final ReyhanLastOfTheAbzanTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -185,6 +186,11 @@ class ShelobChildOfUngoliantTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
}
|
||||
|
||||
class ShelobChildOfUngoliantEffect extends OneShotEffect {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ class VindictiveVampireTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public VindictiveVampireTriggeredAbility(Zone zone, Effect effect) {
|
||||
super(zone, effect, false);
|
||||
setTriggerPhrase("Whenever another creature you control dies, ");
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private VindictiveVampireTriggeredAbility(final VindictiveVampireTriggeredAbility ability) {
|
||||
|
|
@ -70,16 +71,7 @@ class VindictiveVampireTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
Permanent sourcePermanent;
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent = game.getPermanent(getSourceId());
|
||||
} else {
|
||||
sourcePermanent = (Permanent) game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
}
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
return hasSourceObjectAbility(game, sourcePermanent, event);
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue