From 32bd88a6c013d31edba6fbab14c4e5fc64ffa810 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 24 Dec 2019 21:05:08 -0500 Subject: [PATCH] Implemented Klothys, God of Destiny --- .../src/mage/cards/k/KlothysGodOfDestiny.java | 112 ++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 113 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java diff --git a/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java b/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java new file mode 100644 index 00000000000..9050b43e8f8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java @@ -0,0 +1,112 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.DevotionCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.LoseCreatureTypeSourceEffect; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KlothysGodOfDestiny extends CardImpl { + + private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.R, ColoredManaSymbol.G); + + public KlothysGodOfDestiny(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{R}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.GOD); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // Indestructible + this.addAbility(IndestructibleAbility.getInstance()); + + // As long as your devotion to red and green is less than seven, Klothys isn't a creature. + Effect effect = new LoseCreatureTypeSourceEffect(xValue, 7); + effect.setText("As long as your devotion to red and green is less than seven, {this} isn't a creature"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect).addHint(new ValueHint("Devotion to red and green", xValue))); + + // At the beginning of your precombat main phase, exile target card from a graveyard. If it was a land card, add {R} or {G}. Otherwise, you gain 2 life and Klothys deals 2 damage to each opponent. + Ability ability = new BeginningOfPreCombatMainTriggeredAbility( + new KlothysGodOfDestinyEffect(), TargetController.YOU, false + ); + ability.addTarget(new TargetCardInGraveyard()); + this.addAbility(ability); + } + + private KlothysGodOfDestiny(final KlothysGodOfDestiny card) { + super(card); + } + + @Override + public KlothysGodOfDestiny copy() { + return new KlothysGodOfDestiny(this); + } +} + +class KlothysGodOfDestinyEffect extends OneShotEffect { + + KlothysGodOfDestinyEffect() { + super(Outcome.Benefit); + staticText = "exile target card from a graveyard. If it was a land card, add {R} or {G}. " + + "Otherwise, you gain 2 life and {this} deals 2 damage to each opponent."; + } + + private KlothysGodOfDestinyEffect(final KlothysGodOfDestinyEffect effect) { + super(effect); + } + + @Override + public KlothysGodOfDestinyEffect copy() { + return new KlothysGodOfDestinyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Card card = game.getCard(source.getFirstTarget()); + if (player == null || card == null) { + return false; + } + if (card.isLand()) { + Mana mana = new Mana(); + if (player.chooseUse( + Outcome.PutManaInPool, "Choose a color of mana to add", + null, "Red", "Green", source, game + )) { + mana.increaseRed(); + } else { + mana.increaseGreen(); + } + player.getManaPool().addMana(mana, game, source); + } else { + player.gainLife(2, game, source); + game.getOpponents(player.getId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .forEach(opponent -> opponent.damage(2, source.getSourceId(), game)); + } + return player.moveCards(card, Zone.EXILED, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 2f530e2c7ae..1fde557d95a 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -44,6 +44,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Ironscale Hydra", 296, Rarity.RARE, mage.cards.i.IronscaleHydra.class)); cards.add(new SetCardInfo("Island", 251, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Klothys's Design", 176, Rarity.UNCOMMON, mage.cards.k.KlothyssDesign.class)); + cards.add(new SetCardInfo("Klothys, God of Destiny", 220, Rarity.MYTHIC, mage.cards.k.KlothysGodOfDestiny.class)); cards.add(new SetCardInfo("Leonin of the Lost Pride", 28, Rarity.COMMON, mage.cards.l.LeoninOfTheLostPride.class)); cards.add(new SetCardInfo("Memory Drain", 54, Rarity.COMMON, mage.cards.m.MemoryDrain.class)); cards.add(new SetCardInfo("Mire's Grasp", 106, Rarity.COMMON, mage.cards.m.MiresGrasp.class));