From a5d10d6a5df2d59f6b7b95bdde4e27bc3eb24bf6 Mon Sep 17 00:00:00 2001 From: arcox <10953229+arcox@users.noreply.github.com> Date: Mon, 29 Jun 2020 15:37:43 +0000 Subject: [PATCH] Implement Liege of the Hollows from WTH (#5489) (#6727) --- .../src/mage/cards/l/LiegeOfTheHollows.java | 88 +++++++++++++++++++ Mage.Sets/src/mage/sets/Weatherlight.java | 3 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java diff --git a/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java b/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java new file mode 100644 index 0000000000..0d95599b09 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LiegeOfTheHollows.java @@ -0,0 +1,88 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.token.SquirrelToken; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; +import mage.util.ManaUtil; + +import java.util.UUID; + +/** + * @author arcox + */ +public final class LiegeOfTheHollows extends CardImpl { + + public LiegeOfTheHollows(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.subtype.add(SubType.SPIRIT); + + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // When Liege of the Hollows dies, each player may pay any amount of mana. + // Then each player creates a number of 1/1 green Squirrel creature tokens equal to the amount of mana they paid this way. + this.addAbility(new DiesTriggeredAbility(new LiegeOfTheHollowsEffect())); + } + + public LiegeOfTheHollows(final LiegeOfTheHollows card) { + super(card); + } + + @Override + public LiegeOfTheHollows copy() { + return new LiegeOfTheHollows(this); + } +} + +class LiegeOfTheHollowsEffect extends OneShotEffect { + + public LiegeOfTheHollowsEffect() { + super(Outcome.Detriment); + this.staticText = "each player may pay any amount of mana. Then each player creates a number " + + "of 1/1 green Squirrel creature tokens equal to the amount of mana they paid this way"; + } + + public LiegeOfTheHollowsEffect(final LiegeOfTheHollowsEffect effect) { + super(effect); + } + + @Override + public LiegeOfTheHollowsEffect copy() { + return new LiegeOfTheHollowsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + int numSquirrels = ManaUtil.playerPaysXGenericMana(false, "Liege of the Hollows", player, source, game); + if (numSquirrels > 0) { + Effect effect = new CreateTokenTargetEffect(new SquirrelToken(), numSquirrels); + effect.setTargetPointer(new FixedTarget(playerId)); + effect.apply(game, source); + } + } + } + + // prevent undo + controller.resetStoredBookmark(game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Weatherlight.java b/Mage.Sets/src/mage/sets/Weatherlight.java index 5f906dddc8..5112b953c6 100644 --- a/Mage.Sets/src/mage/sets/Weatherlight.java +++ b/Mage.Sets/src/mage/sets/Weatherlight.java @@ -66,7 +66,7 @@ public final class Weatherlight extends ExpansionSet { cards.add(new SetCardInfo("Cinder Giant", 93, Rarity.UNCOMMON, mage.cards.c.CinderGiant.class)); cards.add(new SetCardInfo("Cinder Wall", 94, Rarity.COMMON, mage.cards.c.CinderWall.class)); cards.add(new SetCardInfo("Cloud Djinn", 36, Rarity.UNCOMMON, mage.cards.c.CloudDjinn.class)); - cards.add(new SetCardInfo("Coils of the Medusa", 65, Rarity.COMMON, mage.cards.c.CoilsOfTheMedusa.class)); + cards.add(new SetCardInfo("Coils of the Medusa", 65, Rarity.COMMON, mage.cards.c.CoilsOfTheMedusa.class)); cards.add(new SetCardInfo("Cone of Flame", 95, Rarity.UNCOMMON, mage.cards.c.ConeOfFlame.class)); cards.add(new SetCardInfo("Debt of Loyalty", 11, Rarity.RARE, mage.cards.d.DebtOfLoyalty.class)); cards.add(new SetCardInfo("Dense Foliage", 124, Rarity.RARE, mage.cards.d.DenseFoliage.class)); @@ -114,6 +114,7 @@ public final class Weatherlight extends ExpansionSet { cards.add(new SetCardInfo("Kithkin Armor", 19, Rarity.COMMON, mage.cards.k.KithkinArmor.class)); cards.add(new SetCardInfo("Lava Hounds", 109, Rarity.UNCOMMON, mage.cards.l.LavaHounds.class)); cards.add(new SetCardInfo("Lava Storm", 110, Rarity.COMMON, mage.cards.l.LavaStorm.class)); + cards.add(new SetCardInfo("Liege of the Hollows", 131, Rarity.RARE, mage.cards.l.LiegeOfTheHollows.class)); cards.add(new SetCardInfo("Llanowar Behemoth", 132, Rarity.UNCOMMON, mage.cards.l.LlanowarBehemoth.class)); cards.add(new SetCardInfo("Llanowar Druid", 133, Rarity.COMMON, mage.cards.l.LlanowarDruid.class)); cards.add(new SetCardInfo("Llanowar Sentinel", 134, Rarity.COMMON, mage.cards.l.LlanowarSentinel.class));