Implement Liege of the Hollows from WTH (#5489) (#6727)

This commit is contained in:
arcox 2020-06-29 15:37:43 +00:00 committed by GitHub
parent 0bc7008130
commit a5d10d6a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -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));