[KHM] Implemented Esika, God of the Tree (#7356)

This commit is contained in:
Daniel Bomar 2021-01-09 16:39:29 -06:00 committed by GitHub
parent a7b610d59d
commit b10d071c71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 120 additions and 0 deletions

View file

@ -0,0 +1,119 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.CompoundAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.mana.AnyColorManaAbility;
import mage.cards.*;
import mage.constants.*;
import mage.abilities.keyword.VigilanceAbility;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author weirddan455
*/
public final class EsikaGodOfTheTree extends ModalDoubleFacesCard {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("legendary creatures");
static {
filter.add(SuperType.LEGENDARY.getPredicate());
}
public EsikaGodOfTheTree(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo,
new CardType[]{CardType.CREATURE}, new SubType[]{SubType.GOD}, "{1}{G}{G}",
"The Prismatic Bridge", new CardType[]{CardType.ENCHANTMENT}, new SubType[]{}, "{W}{U}{B}{R}{G}"
);
// 1.
// Esika, God of the Tree
// Legendary Creature - God
this.getLeftHalfCard().addSuperType(SuperType.LEGENDARY);
this.getLeftHalfCard().setPT(new MageInt(1), new MageInt(4));
// Vigilance
this.getLeftHalfCard().addAbility(VigilanceAbility.getInstance());
// {T}: Add one mana of any color.
this.getLeftHalfCard().addAbility(new AnyColorManaAbility());
// Other legendary creatures you control have vigilance and "{T}: Add one mana of any color."
this.getLeftHalfCard().addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
new CompoundAbility(VigilanceAbility.getInstance(), new AnyColorManaAbility()),
Duration.WhileOnBattlefield, filter, true
)));
// 2.
// The Prismatic Bridge
// Legendary Enchantment
this.getRightHalfCard().addSuperType(SuperType.LEGENDARY);
// At the beginning of your upkeep, reveal cards from the top of your library until you reveal
// a creature or planeswalker card. Put that card onto the battlefield and the rest
// on the bottom of your library in a random order.
this.getRightHalfCard().addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, new PrismaticBridgeEffect(), TargetController.YOU, false, false
));
}
private EsikaGodOfTheTree(final EsikaGodOfTheTree card) {
super(card);
}
@Override
public EsikaGodOfTheTree copy() {
return new EsikaGodOfTheTree(this);
}
}
class PrismaticBridgeEffect extends OneShotEffect {
public PrismaticBridgeEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "reveal cards from the top of your library until you reveal "
+ "a creature or planeswalker card. Put that card onto the battlefield and the rest "
+ "on the bottom of your library in a random order";
}
private PrismaticBridgeEffect(final PrismaticBridgeEffect effect) {
super(effect);
}
@Override
public PrismaticBridgeEffect copy() {
return new PrismaticBridgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards toReveal = new CardsImpl();
Card toBattlefield = null;
for (Card card : controller.getLibrary().getCards(game)) {
toReveal.add(card);
if (card.isCreature() || card.isPlaneswalker()) {
toBattlefield = card;
break;
}
}
controller.revealCards(source, toReveal, game);
if (toBattlefield != null) {
toReveal.remove(toBattlefield);
controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
}
controller.putCardsOnBottomOfLibrary(toReveal, game, source, false);
return true;
}
}

View file

@ -63,6 +63,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Elderfang Ritualist", 385, Rarity.UNCOMMON, mage.cards.e.ElderfangRitualist.class));
cards.add(new SetCardInfo("Elven Ambush", 391, Rarity.UNCOMMON, mage.cards.e.ElvenAmbush.class));
cards.add(new SetCardInfo("Elvish Warmaster", 167, Rarity.RARE, mage.cards.e.ElvishWarmaster.class));
cards.add(new SetCardInfo("Esika, God of the Tree", 168, Rarity.MYTHIC, mage.cards.e.EsikaGodOfTheTree.class));
cards.add(new SetCardInfo("Fire Giant's Fury", 389, Rarity.UNCOMMON, mage.cards.f.FireGiantsFury.class));
cards.add(new SetCardInfo("Firja, Judge of Valor", 209, Rarity.UNCOMMON, mage.cards.f.FirjaJudgeOfValor.class));
cards.add(new SetCardInfo("Forging the Tyrite Sword", 211, Rarity.UNCOMMON, mage.cards.f.ForgingTheTyriteSword.class));