Implemented Klothys, God of Destiny

This commit is contained in:
Evan Kranzler 2019-12-24 21:05:08 -05:00
parent bb83914698
commit 32bd88a6c0
2 changed files with 113 additions and 0 deletions

View file

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

View file

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