From 7e2724ed59ff770e5cf09f8ca7ea6ff37ad69524 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 8 Apr 2019 18:26:19 -0400 Subject: [PATCH] Implemented Kasmina, Enigmatic Mentor --- .../mage/cards/k/KasminaEnigmaticMentor.java | 101 ++++++++++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 1 + .../src/main/java/mage/constants/SubType.java | 1 + .../game/permanent/token/WizardToken.java | 25 +++++ 4 files changed, 128 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KasminaEnigmaticMentor.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/WizardToken.java diff --git a/Mage.Sets/src/mage/cards/k/KasminaEnigmaticMentor.java b/Mage.Sets/src/mage/cards/k/KasminaEnigmaticMentor.java new file mode 100644 index 0000000000..21db376b54 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KasminaEnigmaticMentor.java @@ -0,0 +1,101 @@ +package mage.cards.k; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.Mode; +import mage.abilities.SpellAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.WizardToken; +import mage.target.Target; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KasminaEnigmaticMentor extends CardImpl { + + public KasminaEnigmaticMentor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.KASMINA); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); + + // Spells your opponents cast that target a creature or planeswalker you control cost {2} more to cast. + this.addAbility(new SimpleStaticAbility(new KasminaEnigmaticMentorCostReductionEffect())); + + // -2: Create a 2/2 blue Wizard creature token. Draw a card, then discard a card. + Ability ability = new LoyaltyAbility(new CreateTokenEffect(new WizardToken()), -2); + ability.addEffect(new DrawDiscardControllerEffect( + 1, 1 + ).setText("Draw a card, then discard a card.")); + this.addAbility(ability); + } + + private KasminaEnigmaticMentor(final KasminaEnigmaticMentor card) { + super(card); + } + + @Override + public KasminaEnigmaticMentor copy() { + return new KasminaEnigmaticMentor(this); + } +} + +class KasminaEnigmaticMentorCostReductionEffect extends CostModificationEffectImpl { + + KasminaEnigmaticMentorCostReductionEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); + staticText = "Spells your opponents cast that target a creature or planeswalker you control cost {2} more to cast"; + } + + private KasminaEnigmaticMentorCostReductionEffect(KasminaEnigmaticMentorCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + CardUtil.adjustCost(spellAbility, -2); + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + if (abilityToModify.getAbilityType() != AbilityType.SPELL + || !game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { + return false; + } + for (UUID modeId : abilityToModify.getModes().getSelectedModes()) { + Mode mode = abilityToModify.getModes().get(modeId); + for (Target target : mode.getTargets()) { + for (UUID targetUUID : target.getTargets()) { + Permanent permanent = game.getPermanent(targetUUID); + if (permanent != null + && (permanent.isCreature() || permanent.isPlaneswalker()) + && permanent.isControlledBy(source.getControllerId())) { + return true; + } + } + } + } + return false; + } + + @Override + public KasminaEnigmaticMentorCostReductionEffect copy() { + return new KasminaEnigmaticMentorCostReductionEffect(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index 43184c5384..7f0f68d4c2 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -82,6 +82,7 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Jace, Wielder of Mysteries", 54, Rarity.RARE, mage.cards.j.JaceWielderOfMysteries.class)); cards.add(new SetCardInfo("Jiang Yanggu, Wildcrafter", 164, Rarity.UNCOMMON, mage.cards.j.JiangYangguWildcrafter.class)); cards.add(new SetCardInfo("Karn's Bastion", 248, Rarity.RARE, mage.cards.k.KarnsBastion.class)); + cards.add(new SetCardInfo("Kasmina, Enigmatic Mentor", 56, Rarity.UNCOMMON, mage.cards.k.KasminaEnigmaticMentor.class)); cards.add(new SetCardInfo("Kaya's Ghostform", 94, Rarity.COMMON, mage.cards.k.KayasGhostform.class)); cards.add(new SetCardInfo("Kaya, Bane of the Dead", 231, Rarity.UNCOMMON, mage.cards.k.KayaBaneOfTheDead.class)); cards.add(new SetCardInfo("Kiora's Dambreaker", 58, Rarity.COMMON, mage.cards.k.KiorasDambreaker.class)); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 7c29322629..522cc4bde9 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -392,6 +392,7 @@ public enum SubType { HUATLI("Huatli", SubTypeSet.PlaneswalkerType), JACE("Jace", SubTypeSet.PlaneswalkerType), KARN("Karn", SubTypeSet.PlaneswalkerType), + KASMINA("Kasmina", SubTypeSet.PlaneswalkerType), KAYA("Kaya", SubTypeSet.PlaneswalkerType), KIORA("Kiora", SubTypeSet.PlaneswalkerType), KOTH("Koth", SubTypeSet.PlaneswalkerType), diff --git a/Mage/src/main/java/mage/game/permanent/token/WizardToken.java b/Mage/src/main/java/mage/game/permanent/token/WizardToken.java new file mode 100644 index 0000000000..58e58fc47a --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/WizardToken.java @@ -0,0 +1,25 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +public final class WizardToken extends TokenImpl { + + public WizardToken() { + super("Wizard", "2/2 blue Human Wizard creature token"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.WIZARD); + color.setBlue(true); + power = new MageInt(2); + toughness = new MageInt(2); + } + + private WizardToken(final WizardToken token) { + super(token); + } + + public WizardToken copy() { + return new WizardToken(this); + } +}