From 250f4259091c78266733ca7f6cf3c958030900ed Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 2 Sep 2021 20:39:10 -0400 Subject: [PATCH] [MID] Implemented Jadar, Ghoulcaller of Nephalia --- .../cards/j/JadarGhoulcallerOfNephalia.java | 58 +++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + .../abilities/keyword/DecayedAbility.java | 37 ++++++++++++ .../permanent/token/ZombieDecayedToken.java | 31 ++++++++++ 4 files changed, 127 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/j/JadarGhoulcallerOfNephalia.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/DecayedAbility.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/ZombieDecayedToken.java diff --git a/Mage.Sets/src/mage/cards/j/JadarGhoulcallerOfNephalia.java b/Mage.Sets/src/mage/cards/j/JadarGhoulcallerOfNephalia.java new file mode 100644 index 0000000000..bd5dfdb44c --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JadarGhoulcallerOfNephalia.java @@ -0,0 +1,58 @@ +package mage.cards.j; + +import mage.MageInt; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.DecayedAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.game.permanent.token.ZombieDecayedToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class JadarGhoulcallerOfNephalia extends CardImpl { + + private static final FilterPermanent filter + = new FilterControlledCreaturePermanent("if you control no creatures with decayed"); + + static { + filter.add(new AbilityPredicate(DecayedAbility.class)); + } + + private static final Condition condition + = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0); + + public JadarGhoulcallerOfNephalia(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // At the beginning of your end step, if you control no creatures with decayed, create a 2/2 black Zombie creature token with decayed. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieDecayedToken()), + TargetController.YOU, condition, false + )); + } + + private JadarGhoulcallerOfNephalia(final JadarGhoulcallerOfNephalia card) { + super(card); + } + + @Override + public JadarGhoulcallerOfNephalia copy() { + return new JadarGhoulcallerOfNephalia(this); + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 94add0a79b..5e2a16d2ee 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -39,6 +39,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Haunted Ridge", 263, Rarity.RARE, mage.cards.h.HauntedRidge.class)); cards.add(new SetCardInfo("Infernal Grasp", 107, Rarity.UNCOMMON, mage.cards.i.InfernalGrasp.class)); cards.add(new SetCardInfo("Island", 270, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); + cards.add(new SetCardInfo("Jadar, Ghoulcaller of Nephalia", 108, Rarity.RARE, mage.cards.j.JadarGhoulcallerOfNephalia.class)); cards.add(new SetCardInfo("Join the Dance", 229, Rarity.UNCOMMON, mage.cards.j.JoinTheDance.class)); cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Overgrown Farmland", 265, Rarity.RARE, mage.cards.o.OvergrownFarmland.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/DecayedAbility.java b/Mage/src/main/java/mage/abilities/keyword/DecayedAbility.java new file mode 100644 index 0000000000..8d7e03f1de --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/DecayedAbility.java @@ -0,0 +1,37 @@ +package mage.abilities.keyword; + +import mage.abilities.StaticAbility; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.abilities.effects.common.combat.CantBlockSourceEffect; +import mage.constants.Duration; +import mage.constants.Zone; + +/** + * @author TheElk801 + */ +public class DecayedAbility extends StaticAbility { + + public DecayedAbility() { + super(Zone.BATTLEFIELD, new CantBlockSourceEffect(Duration.WhileOnBattlefield)); + this.addSubAbility(new AttacksTriggeredAbility(new CreateDelayedTriggeredAbilityEffect( + new AtTheEndOfCombatDelayedTriggeredAbility(new SacrificeSourceEffect()) + ))); + } + + private DecayedAbility(final DecayedAbility ability) { + super(ability); + } + + @Override + public DecayedAbility copy() { + return new DecayedAbility(this); + } + + @Override + public String getRule() { + return "decayed"; + } +} diff --git a/Mage/src/main/java/mage/game/permanent/token/ZombieDecayedToken.java b/Mage/src/main/java/mage/game/permanent/token/ZombieDecayedToken.java new file mode 100644 index 0000000000..e64ab12141 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/ZombieDecayedToken.java @@ -0,0 +1,31 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.DecayedAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class ZombieDecayedToken extends TokenImpl { + + public ZombieDecayedToken() { + super("Zombie", "2/2 black Zombie creature token with decayed"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + subtype.add(SubType.ZOMBIE); + power = new MageInt(2); + toughness = new MageInt(2); + this.addAbility(new DecayedAbility()); + } + + public ZombieDecayedToken(final ZombieDecayedToken token) { + super(token); + } + + @Override + public ZombieDecayedToken copy() { + return new ZombieDecayedToken(this); + } +}