refactored cards with non-static fields

This commit is contained in:
Evan Kranzler 2022-02-21 11:08:32 -05:00
parent 9b5f736c34
commit 091fd16af9
17 changed files with 54 additions and 54 deletions

View file

@ -35,7 +35,7 @@ public final class BallynockCohort extends CardImpl {
filter.add(AnotherPredicate.instance);
}
private String rule = "{this} gets +1/+1 as long as you control another white creature";
private static final String rule = "{this} gets +1/+1 as long as you control another white creature";
public BallynockCohort(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}");

View file

@ -24,7 +24,7 @@ import mage.players.Player;
*/
public final class BarbedWire extends CardImpl {
private final String rule = "At the beginning of each player's upkeep, "
private static final String rule = "At the beginning of each player's upkeep, "
+ "Barbed Wire deals 1 damage to that player.";
public BarbedWire(UUID ownerId, CardSetInfo setInfo) {

View file

@ -31,7 +31,7 @@ public final class BattlegateMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
private String rule = "Whenever you cast a spell that's both red and white, {this} has base power and toughness 4/2 and gains first strike until end of turn.";
private static final String rule = "Whenever you cast a spell that's both red and white, {this} has base power and toughness 4/2 and gains first strike until end of turn.";
public BattlegateMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R/W}");

View file

@ -35,7 +35,7 @@ public final class BriarberryCohort extends CardImpl {
filter.add(AnotherPredicate.instance);
}
private String rule = "{this} gets +1/+1 as long as you control another blue creature";
private static final String rule = "{this} gets +1/+1 as long as you control another blue creature";
public BriarberryCohort(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");

View file

@ -34,7 +34,7 @@ public final class EzuriClawOfProgress extends CardImpl {
filter2.add(AnotherPredicate.instance);
}
String rule = "Whenever a creature with power 2 or less enters the battlefield under your control, you get an experience counter.";
private static final String rule = "Whenever a creature with power 2 or less enters the battlefield under your control, you get an experience counter.";
public EzuriClawOfProgress(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");

View file

@ -27,7 +27,7 @@ public final class GodtrackerOfJund extends CardImpl {
filter.add(new PowerPredicate(ComparisonType.MORE_THAN, 4));
}
String rule = "Whenever a creature with power 5 or greater enters the battlefield under your control, you may put a +1/+1 counter on {this}.";
private static final String rule = "Whenever a creature with power 5 or greater enters the battlefield under your control, you may put a +1/+1 counter on {this}.";
public GodtrackerOfJund(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{G}");

View file

@ -33,8 +33,8 @@ public final class HagHedgeMage extends CardImpl {
filter2.add(SubType.FOREST.getPredicate());
}
private String rule = "When {this} enters the battlefield, if you control two or more Swamps, you may have target player discard a card.";
private String rule2 = "When {this} enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library.";
private static final String rule = "When {this} enters the battlefield, if you control two or more Swamps, you may have target player discard a card.";
private static final String rule2 = "When {this} enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library.";
public HagHedgeMage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B/G}");

View file

@ -1,30 +1,29 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ChooseOpponentEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LostOrderOfJarkeld extends CardImpl {
protected FilterCreaturePermanent filter = new FilterCreaturePermanent();
public LostOrderOfJarkeld(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
@ -39,8 +38,9 @@ public final class LostOrderOfJarkeld extends CardImpl {
// Lost Order of Jarkeld's power and toughness are each equal to 1 plus the number of creatures the chosen player controls.
this.addAbility(new SimpleStaticAbility(
Zone.ALL,
new SetPowerToughnessSourceEffect(
new AdditiveDynamicValue(new CreaturesControlledByChosenPlayer(), StaticValue.get(1)), Duration.EndOfGame)
new SetPowerToughnessSourceEffect(new AdditiveDynamicValue(
CreaturesControlledByChosenPlayer.instance, StaticValue.get(1)
), Duration.EndOfGame)
));
}
@ -54,7 +54,8 @@ public final class LostOrderOfJarkeld extends CardImpl {
}
}
class CreaturesControlledByChosenPlayer implements DynamicValue {
enum CreaturesControlledByChosenPlayer implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -70,7 +71,7 @@ class CreaturesControlledByChosenPlayer implements DynamicValue {
@Override
public CreaturesControlledByChosenPlayer copy() {
return new CreaturesControlledByChosenPlayer();
return this;
}
@Override

View file

@ -21,7 +21,7 @@ import java.util.UUID;
*/
public final class MurasaBehemoth extends CardImpl {
Condition condition = new CardsInControllerGraveyardCondition(1, StaticFilters.FILTER_CARD_LAND);
private static final Condition condition = new CardsInControllerGraveyardCondition(1, StaticFilters.FILTER_CARD_LAND);
public MurasaBehemoth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");

View file

@ -32,7 +32,7 @@ public final class NightskyMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.BLACK));
}
private String rule = "Whenever you cast a spell that's both white and black, {this} has base power and toughness 4/4 until end of turn and gains flying until end of turn.";
private static final String rule = "Whenever you cast a spell that's both white and black, {this} has base power and toughness 4/4 until end of turn and gains flying until end of turn.";
public NightskyMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W/B}");

View file

@ -34,8 +34,8 @@ public final class NoggleHedgeMage extends CardImpl {
filter2.add(SubType.MOUNTAIN.getPredicate());
}
private String rule = "When {this} enters the battlefield, if you control two or more Islands, you may tap two target permanents.";
private String rule2 = "When {this} enters the battlefield, if you control two or more Mountains, you may have {this} deal 2 damage to target player or planeswalker.";
private static final String rule = "When {this} enters the battlefield, if you control two or more Islands, you may tap two target permanents.";
private static final String rule2 = "When {this} enters the battlefield, if you control two or more Mountains, you may have {this} deal 2 damage to target player or planeswalker.";
public NoggleHedgeMage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U/R}");

View file

@ -32,7 +32,7 @@ public final class RiverfallMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.RED));
}
private String rule = "Whenever you cast a spell that's both blue and red, {this} has base power and toughness 3/3 until end of turn and can't be blocked this turn.";
private static final String rule = "Whenever you cast a spell that's both blue and red, {this} has base power and toughness 3/3 until end of turn and can't be blocked this turn.";
public RiverfallMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U/R}");

View file

@ -32,7 +32,7 @@ public final class ShorecrasherMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
private String rule = "Whenever you cast a spell that's both green and blue, {this} has base power and toughness 5/3 until end of turn and gains trample until end of turn.";
private static final String rule = "Whenever you cast a spell that's both green and blue, {this} has base power and toughness 5/3 until end of turn and gains trample until end of turn.";
public ShorecrasherMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G/U}");

View file

@ -5,14 +5,16 @@ import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
@ -27,19 +29,14 @@ import java.util.UUID;
*/
public final class ShrewdHatchling extends CardImpl {
private static final FilterSpell filter = new FilterSpell("blue spell");
private static final FilterSpell filter2 = new FilterSpell("red spell");
private static final FilterSpell filter = new FilterSpell("a blue spell");
private static final FilterSpell filter2 = new FilterSpell("a red spell");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filter.add(new ColorPredicate(ObjectColor.BLUE));
filter2.add(TargetController.YOU.getControllerPredicate());
filter2.add(new ColorPredicate(ObjectColor.RED));
}
private String rule = "Whenever you cast a blue spell, remove a -1/-1 counter from Shrewd Hatchling.";
private String rule2 = "Whenever you cast a red spell, remove a -1/-1 counter from Shrewd Hatchling.";
public ShrewdHatchling(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U/R}");
this.subtype.add(SubType.ELEMENTAL);
@ -48,18 +45,24 @@ public final class ShrewdHatchling extends CardImpl {
this.toughness = new MageInt(6);
// Shrewd Hatchling enters the battlefield with four -1/-1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(4))));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(
CounterType.M1M1.createInstance(4)
), "with four -1/-1 counters on it"));
// {UR}: Target creature can't block Shrewd Hatchling this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShrewdHatchlingEffect(), new ManaCostsImpl("{U/R}"));
Ability ability = new SimpleActivatedAbility(new ShrewdHatchlingEffect(), new ManaCostsImpl<>("{U/R}"));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// Whenever you cast a blue spell, remove a -1/-1 counter from Shrewd Hatchling.
this.addAbility(new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter, false, rule));
this.addAbility(new SpellCastControllerTriggeredAbility(
new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter, false
));
// Whenever you cast a red spell, remove a -1/-1 counter from Shrewd Hatchling.
this.addAbility(new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter2, false, rule2));
this.addAbility(new SpellCastControllerTriggeredAbility(
new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter2, false
));
}

View file

@ -1,13 +1,11 @@
package mage.cards.s;
import java.util.LinkedList;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.combat.MustBeBlockedByTargetSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -24,14 +22,16 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;
import java.util.LinkedList;
import java.util.UUID;
/**
* @author jeffwadsworth
*/
public final class SistersOfStoneDeath extends CardImpl {
private UUID exileId = UUID.randomUUID();
public SistersOfStoneDeath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{G}{G}");
this.addSuperType(SuperType.LEGENDARY);
@ -46,7 +46,7 @@ public final class SistersOfStoneDeath extends CardImpl {
this.addAbility(ability);
// {B}{G}: Exile target creature blocking or blocked by Sisters of Stone Death.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect(exileId, this.getIdName()), new ManaCostsImpl("{B}{G}"));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileTargetForSourceEffect(), new ManaCostsImpl("{B}{G}"));
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature blocking or blocked by Sisters of Stone Death");
filter.add(Predicates.or(new BlockedByIdPredicate(this.getId()),
new BlockingAttackerIdPredicate(this.getId())));
@ -54,7 +54,7 @@ public final class SistersOfStoneDeath extends CardImpl {
this.addAbility(ability2);
// {2}{B}: Put a creature card exiled with Sisters of Stone Death onto the battlefield under your control.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SistersOfStoneDeathEffect(exileId), new ManaCostsImpl("{2}{B}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SistersOfStoneDeathEffect(), new ManaCostsImpl("{2}{B}")));
}
@ -70,17 +70,13 @@ public final class SistersOfStoneDeath extends CardImpl {
class SistersOfStoneDeathEffect extends OneShotEffect {
private final UUID exileId;
public SistersOfStoneDeathEffect(UUID exileId) {
public SistersOfStoneDeathEffect() {
super(Outcome.PutCreatureInPlay);
this.exileId = exileId;
staticText = "Put a creature card exiled with {this} onto the battlefield under your control";
}
public SistersOfStoneDeathEffect(final SistersOfStoneDeathEffect effect) {
super(effect);
this.exileId = effect.exileId;
}
@Override
@ -89,7 +85,7 @@ class SistersOfStoneDeathEffect extends OneShotEffect {
TargetCard target = new TargetCard(Zone.EXILED, StaticFilters.FILTER_CARD_CREATURE);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ExileZone exile = game.getExile().getExileZone(exileId);
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
if (exile != null) {
LinkedList<UUID> cards = new LinkedList<>(exile);
for (UUID cardId : cards) {

View file

@ -38,7 +38,7 @@ public final class SoulReap extends CardImpl {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.GREEN)));
}
private String rule = "Its controller loses 3 life if you've cast another black spell this turn";
private static final String rule = "Its controller loses 3 life if you've cast another black spell this turn";
public SoulReap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}");

View file

@ -32,7 +32,7 @@ public final class WoodlurkerMimic extends CardImpl {
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
private String rule = "Whenever you cast a spell that's both black and green, {this} has base power and toughness 4/5 until end of turn and gains wither until end of turn.";
private static final String rule = "Whenever you cast a spell that's both black and green, {this} has base power and toughness 4/5 until end of turn and gains wither until end of turn.";
public WoodlurkerMimic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B/G}");