Skip to content

Commit

Permalink
refactor: fixed dies events support in single cards (part 2);
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Nov 30, 2024
1 parent 0f8416c commit c334311
Show file tree
Hide file tree
Showing 29 changed files with 114 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/f/FalkenrathNoble.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public FalkenrathNobleTriggeredAbility() {
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), false);
this.addEffect(new GainLifeEffect(1));
this.addTarget(new TargetPlayer());
this.setLeavesTheBattlefieldTrigger(true);
setLeavesTheBattlefieldTrigger(true);
}

private FalkenrathNobleTriggeredAbility(final FalkenrathNobleTriggeredAbility ability) {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/g/GraveBetrayal.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl {

public GraveBetrayalTriggeredAbility() {
super(Zone.BATTLEFIELD, null);
this.setLeavesTheBattlefieldTrigger(true);
setLeavesTheBattlefieldTrigger(true);
}

private GraveBetrayalTriggeredAbility(final GraveBetrayalTriggeredAbility ability) {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/g/GravePact.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class GravePactTriggeredAbility extends TriggeredAbilityImpl {
public GravePactTriggeredAbility() {
super(Zone.BATTLEFIELD, new GravePactEffect());
setTriggerPhrase("Whenever a creature you control dies, ");
setLeavesTheBattlefieldTrigger(true);
this.setLeavesTheBattlefieldTrigger(true);
}

private GravePactTriggeredAbility(final GravePactTriggeredAbility ability) {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/k/KarmicJustice.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class KarmicJusticeTriggeredAbility extends TriggeredAbilityImpl {

KarmicJusticeTriggeredAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), true);
setLeavesTheBattlefieldTrigger(true);
this.setLeavesTheBattlefieldTrigger(true);
}

private KarmicJusticeTriggeredAbility(final KarmicJusticeTriggeredAbility ability) {
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/k/KayaTheInexorable.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class KayaTheInexorableTriggeredAbility extends TriggeredAbilityImpl {

public KayaTheInexorableTriggeredAbility() {
super(Zone.ALL, null, false);
setLeavesTheBattlefieldTrigger(true);
this.setLeavesTheBattlefieldTrigger(true);
}

private KayaTheInexorableTriggeredAbility(KayaTheInexorableTriggeredAbility ability) {
Expand Down
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/l/LuminousBroodmoth.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mage.cards.l;

import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
Expand Down Expand Up @@ -56,6 +57,7 @@ class LuminousBroodmothTriggeredAbility extends TriggeredAbilityImpl {

LuminousBroodmothTriggeredAbility() {
super(Zone.BATTLEFIELD, new LuminousBroodmothEffect(), false);
setLeavesTheBattlefieldTrigger(true);
}

private LuminousBroodmothTriggeredAbility(final LuminousBroodmothTriggeredAbility ability) {
Expand Down Expand Up @@ -97,6 +99,11 @@ public String getRule() {
return "Whenever a creature you control without flying dies, "
+ "return it to the battlefield under its owner's control with a flying counter on it.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class LuminousBroodmothEffect extends OneShotEffect {
Expand Down
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/m/MariTheKillingQuill.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mage.cards.m;

import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
Expand Down Expand Up @@ -165,6 +166,7 @@ class MariTheKillingQuillCreatureDiesAbility extends TriggeredAbilityImpl {

public MariTheKillingQuillCreatureDiesAbility() {
super(Zone.BATTLEFIELD, new MariTheKillingQuillExileCreatureEffect(), false);
setLeavesTheBattlefieldTrigger(true);
}

private MariTheKillingQuillCreatureDiesAbility(final MariTheKillingQuillCreatureDiesAbility ability) {
Expand Down Expand Up @@ -202,6 +204,11 @@ public boolean checkTrigger(GameEvent event, Game game) {
public String getRule() {
return "Whenever a creature an opponent controls dies, exile it with a hit counter on it.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class MariTheKillingQuillExileCreatureEffect extends OneShotEffect {
Expand Down
7 changes: 6 additions & 1 deletion Mage.Sets/src/mage/cards/m/MillicentRestlessRevenant.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class MillicentRestlessRevenantTriggeredAbility extends TriggeredAbilityImpl {

MillicentRestlessRevenantTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SpiritWhiteToken()));
setLeavesTheBattlefieldTrigger(true);
}

private MillicentRestlessRevenantTriggeredAbility(final MillicentRestlessRevenantTriggeredAbility ability) {
Expand Down Expand Up @@ -125,7 +126,11 @@ public boolean checkTrigger(GameEvent event, Game game) {

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
} else {
return super.isInUseableZone(game, source, event);
}
}

@Override
Expand Down
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/cards/p/PeltCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class PeltCollectorTriggeredAbility extends TriggeredAbilityImpl {

PeltCollectorTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
setLeavesTheBattlefieldTrigger(true);
}

private PeltCollectorTriggeredAbility(PeltCollectorTriggeredAbility ability) {
Expand Down
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/p/ProperBurial.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mage.cards.p;

import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
Expand Down Expand Up @@ -40,6 +41,7 @@ class ProperBurialTriggeredAbility extends TriggeredAbilityImpl {

public ProperBurialTriggeredAbility() {
super(Zone.BATTLEFIELD, null);
setLeavesTheBattlefieldTrigger(true);
}

private ProperBurialTriggeredAbility(final ProperBurialTriggeredAbility ability) {
Expand Down Expand Up @@ -76,4 +78,9 @@ public boolean checkTrigger(GameEvent event, Game game) {
public String getRule() {
return "Whenever a creature you control dies, you gain life equal to that creature's toughness.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/r/Remembrance.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

package mage.cards.r;

import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
Expand Down Expand Up @@ -52,6 +53,7 @@ class RemembranceTriggeredAbility extends TriggeredAbilityImpl {

RemembranceTriggeredAbility() {
super(Zone.BATTLEFIELD, null, true);
setLeavesTheBattlefieldTrigger(true);
}

private RemembranceTriggeredAbility(final RemembranceTriggeredAbility ability) {
Expand Down Expand Up @@ -92,4 +94,9 @@ public String getRule() {
"you may search your library for a card with the same name as that creature, " +
"reveal it, put it into your hand, then shuffle.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}
11 changes: 11 additions & 0 deletions Mage.Sets/src/mage/cards/r/RhukHexgoldNabber.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mage.cards.r;

import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
Expand Down Expand Up @@ -65,6 +66,7 @@ class RhukHexgoldNabberTriggeredAbility extends TriggeredAbilityImpl {

RhukHexgoldNabberTriggeredAbility() {
super(Zone.BATTLEFIELD, new RhukHexgoldNabberEffect(), true);
setLeavesTheBattlefieldTrigger(true);
}

private RhukHexgoldNabberTriggeredAbility(final RhukHexgoldNabberTriggeredAbility ability) {
Expand Down Expand Up @@ -110,6 +112,15 @@ public String getRule() {
return "Whenever an equipped creature you control other than {this} attacks or dies, " +
"you may attach all Equipment attached to that creature to {this}.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
} else {
return super.isInUseableZone(game, source, event);
}
}
}

class RhukHexgoldNabberEffect extends OneShotEffect {
Expand Down
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/r/RienneAngelOfRebirth.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mage.cards.r;

import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
Expand Down Expand Up @@ -70,6 +71,7 @@ class RienneAngelOfRebirthTriggeredAbility extends TriggeredAbilityImpl {

RienneAngelOfRebirthTriggeredAbility() {
super(Zone.BATTLEFIELD, new RienneAngelOfRebirthEffect(), false);
setLeavesTheBattlefieldTrigger(true);
}

private RienneAngelOfRebirthTriggeredAbility(final RienneAngelOfRebirthTriggeredAbility ability) {
Expand Down Expand Up @@ -109,6 +111,11 @@ public String getRule() {
return "Whenever another multicolored creature you control dies, " +
"return it to its owner's hand at the beginning of the next end step.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class RienneAngelOfRebirthEffect extends OneShotEffect {
Expand Down
8 changes: 8 additions & 0 deletions Mage.Sets/src/mage/cards/s/Sangromancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.FlyingAbility;
Expand Down Expand Up @@ -46,9 +47,11 @@ public Sangromancer copy() {
}

class SangromancerFirstTriggeredAbility extends TriggeredAbilityImpl {

SangromancerFirstTriggeredAbility() {
super(Zone.BATTLEFIELD, new GainLifeEffect(3), true);
setTriggerPhrase("Whenever a creature an opponent controls dies, ");
setLeavesTheBattlefieldTrigger(true);
}

private SangromancerFirstTriggeredAbility(final SangromancerFirstTriggeredAbility ability) {
Expand All @@ -75,6 +78,11 @@ public boolean checkTrigger(GameEvent event, Game game) {
}
return false;
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class SangromancerSecondTriggeredAbility extends TriggeredAbilityImpl {
Expand Down
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/cards/s/ShelobChildOfUngoliant.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public ShelobChildOfUngoliantTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
this.addWatcher(new ShelobChildOfUngoliantWatcher());
this.setTriggerPhrase("Whenever another creature dealt damage this turn by a Spider you controlled dies, ");
setLeavesTheBattlefieldTrigger(true);
}

private ShelobChildOfUngoliantTriggeredAbility(final ShelobChildOfUngoliantTriggeredAbility ability) {
Expand Down
8 changes: 8 additions & 0 deletions Mage.Sets/src/mage/cards/s/SlayersPlate.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package mage.cards.s;

import java.util.UUID;

import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
Expand Down Expand Up @@ -56,6 +58,7 @@ class SlayersPlateTriggeredAbility extends TriggeredAbilityImpl {

public SlayersPlateTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SpiritWhiteToken()));
setLeavesTheBattlefieldTrigger(true);
}

private SlayersPlateTriggeredAbility(final SlayersPlateTriggeredAbility ability) {
Expand Down Expand Up @@ -87,4 +90,9 @@ public boolean checkTrigger(GameEvent event, Game game) {
public String getRule() {
return "Whenever equipped creature dies, if it was a Human, create a 1/1 white Spirit creature token with flying.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/s/Sporogenesis.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mage.cards.s;

import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
Expand Down Expand Up @@ -68,6 +69,7 @@ class SporogenesisTriggeredAbility extends TriggeredAbilityImpl {

SporogenesisTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SaprolingToken(), new SporogenesisCount()), false);
setLeavesTheBattlefieldTrigger(true);
}

private SporogenesisTriggeredAbility(final SporogenesisTriggeredAbility ability) {
Expand Down Expand Up @@ -104,6 +106,11 @@ public boolean checkTrigger(GameEvent event, Game game) {
public String getRule() {
return "Whenever a creature with a fungus counter on it dies, create a 1/1 green Saproling creature token for each fungus counter on that creature.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class SporogenesisCount implements DynamicValue {
Expand Down
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl {

SyrKonradTheGrimTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamagePlayersEffect(1, TargetController.OPPONENT));
setLeavesTheBattlefieldTrigger(true);
}

private SyrKonradTheGrimTriggeredAbility(final SyrKonradTheGrimTriggeredAbility ability) {
Expand Down
7 changes: 7 additions & 0 deletions Mage.Sets/src/mage/cards/t/TheScorpionGod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
Expand Down Expand Up @@ -71,6 +72,7 @@ class TheScorpionGodTriggeredAbility extends TriggeredAbilityImpl {

public TheScorpionGodTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false);
setLeavesTheBattlefieldTrigger(true);
}

private TheScorpionGodTriggeredAbility(final TheScorpionGodTriggeredAbility ability) {
Expand Down Expand Up @@ -105,6 +107,11 @@ public boolean checkTrigger(GameEvent event, Game game) {
public String getRule() {
return "Whenever a creature with a -1/-1 counter on it dies, draw a card.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class TheScorpionGodEffect extends OneShotEffect {
Expand Down
6 changes: 6 additions & 0 deletions Mage.Sets/src/mage/cards/v/VerdantSuccession.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class VerdantSuccessionTriggeredAbility extends TriggeredAbilityImpl {

VerdantSuccessionTriggeredAbility() {
super(Zone.BATTLEFIELD, null, true);
setLeavesTheBattlefieldTrigger(true);
}

private VerdantSuccessionTriggeredAbility(final VerdantSuccessionTriggeredAbility ability) {
Expand Down Expand Up @@ -98,6 +99,11 @@ public boolean checkTrigger(GameEvent event, Game game) {
public String getRule() {
return "Whenever a green nontoken creature dies, that creature's controller may search their library for a card with the same name as that creature, put it onto the battlefield, then shuffle.";
}

@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
}
}

class VerdantSuccessionEffect extends OneShotEffect {
Expand Down
Loading

0 comments on commit c334311

Please sign in to comment.