From 74bb1f895c0e46a44aa151938ae5fec19898193a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 30 Jun 2021 08:58:59 -0400 Subject: [PATCH] [AFR] Implemented Purple Worm --- Mage.Sets/src/mage/cards/p/PurpleWorm.java | 51 +++++++++++++++++++ .../sets/AdventuresInTheForgottenRealms.java | 1 + .../condition/common/MorbidCondition.java | 3 -- .../abilities/hint/common/MorbidHint.java | 28 ++++++++++ 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/p/PurpleWorm.java create mode 100644 Mage/src/main/java/mage/abilities/hint/common/MorbidHint.java diff --git a/Mage.Sets/src/mage/cards/p/PurpleWorm.java b/Mage.Sets/src/mage/cards/p/PurpleWorm.java new file mode 100644 index 0000000000..60005a96d1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PurpleWorm.java @@ -0,0 +1,51 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MorbidCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.abilities.hint.common.MorbidHint; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.watchers.common.MorbidWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PurpleWorm extends CardImpl { + + public PurpleWorm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}"); + + this.subtype.add(SubType.WORM); + this.power = new MageInt(8); + this.toughness = new MageInt(7); + + // This spell costs {2} less to cast if a creature died this turn. + Ability ability = new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionSourceEffect(1, MorbidCondition.instance) + ); + ability.setRuleAtTheTop(true); + this.addAbility(ability.addHint(MorbidHint.instance), new MorbidWatcher()); + + // Ward {2} + this.addAbility(new WardAbility(new ManaCostsImpl<>("{2}"))); + } + + private PurpleWorm(final PurpleWorm card) { + super(card); + } + + @Override + public PurpleWorm copy() { + return new PurpleWorm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 1208bc7304..b8871c75b3 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -60,6 +60,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Portable Hole", 33, Rarity.UNCOMMON, mage.cards.p.PortableHole.class)); cards.add(new SetCardInfo("Power Word Kill", 114, Rarity.UNCOMMON, mage.cards.p.PowerWordKill.class)); cards.add(new SetCardInfo("Prosperous Innkeeper", 200, Rarity.UNCOMMON, mage.cards.p.ProsperousInnkeeper.class)); + cards.add(new SetCardInfo("Purple Worm", 201, Rarity.UNCOMMON, mage.cards.p.PurpleWorm.class)); cards.add(new SetCardInfo("Ranger's Hawk", 37, Rarity.COMMON, mage.cards.r.RangersHawk.class)); cards.add(new SetCardInfo("Shortcut Seeker", 73, Rarity.COMMON, mage.cards.s.ShortcutSeeker.class)); cards.add(new SetCardInfo("Swamp", 270, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java b/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java index 45151ae60f..bc8cf09623 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/MorbidCondition.java @@ -1,4 +1,3 @@ - package mage.abilities.condition.common; import mage.abilities.Ability; @@ -10,7 +9,6 @@ import mage.watchers.common.MorbidWatcher; * @author nantuko */ public enum MorbidCondition implements Condition { - instance; @Override @@ -23,5 +21,4 @@ public enum MorbidCondition implements Condition { public String toString() { return "if a creature died this turn"; } - } diff --git a/Mage/src/main/java/mage/abilities/hint/common/MorbidHint.java b/Mage/src/main/java/mage/abilities/hint/common/MorbidHint.java new file mode 100644 index 0000000000..c498698273 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/hint/common/MorbidHint.java @@ -0,0 +1,28 @@ +package mage.abilities.hint.common; + +import mage.abilities.Ability; +import mage.abilities.condition.common.MorbidCondition; +import mage.abilities.hint.ConditionHint; +import mage.abilities.hint.Hint; +import mage.game.Game; + +/** + * @author TheElk801 + * TODO: add this to other morbid cards + */ +public enum MorbidHint implements Hint { + instance; + private static final ConditionHint hint = new ConditionHint( + MorbidCondition.instance, "A creature died this turn" + ); + + @Override + public String getText(Game game, Ability ability) { + return hint.getText(game, ability); + } + + @Override + public Hint copy() { + return instance; + } +}