From 91244c09dc5782d44cbcabdf5c6b44c876bcf2a1 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 25 Jul 2018 12:58:19 -0400 Subject: [PATCH] Implemented Kestia, the Cultivator --- .../src/mage/cards/k/KestiaTheCultivator.java | 74 +++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2018.java | 1 + .../common/AttacksAllTriggeredAbility.java | 6 +- 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/k/KestiaTheCultivator.java diff --git a/Mage.Sets/src/mage/cards/k/KestiaTheCultivator.java b/Mage.Sets/src/mage/cards/k/KestiaTheCultivator.java new file mode 100644 index 0000000000..18f4dfcdc3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KestiaTheCultivator.java @@ -0,0 +1,74 @@ +package mage.cards.k; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.AttacksAllTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.abilities.keyword.BestowAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SetTargetPointer; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.EnchantedPredicate; + +/** + * + * @author TheElk801 + */ +public final class KestiaTheCultivator extends CardImpl { + + private static final FilterCreaturePermanent filter + = new FilterCreaturePermanent("an enchanted creature or enchantment creature you control"); + + static { + filter.add(Predicates.or( + new EnchantedPredicate(), + new CardTypePredicate(CardType.ENCHANTMENT) + )); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public KestiaTheCultivator(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{G}{W}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.NYMPH); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Bestow {3}{G}{W}{U} + this.addAbility(new BestowAbility(this, "{3}{G}{W}{U}")); + + // Enchanted creature gets +4/+4. + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, + new BoostEnchantedEffect(4, 4, Duration.WhileOnBattlefield) + )); + + // Whenever an enchanted creature or enchantment creature you control attacks, draw a card. + this.addAbility(new AttacksAllTriggeredAbility( + new DrawCardSourceControllerEffect(1), + false, filter, SetTargetPointer.NONE, false + )); + } + + public KestiaTheCultivator(final KestiaTheCultivator card) { + super(card); + } + + @Override + public KestiaTheCultivator copy() { + return new KestiaTheCultivator(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2018.java b/Mage.Sets/src/mage/sets/Commander2018.java index a1aaea2765..269aaef7be 100644 --- a/Mage.Sets/src/mage/sets/Commander2018.java +++ b/Mage.Sets/src/mage/sets/Commander2018.java @@ -42,6 +42,7 @@ public final class Commander2018 extends ExpansionSet { cards.add(new SetCardInfo("Forge of Heroes", 58, Rarity.COMMON, mage.cards.f.ForgeOfHeroes.class)); cards.add(new SetCardInfo("Fury Storm", 22, Rarity.RARE, mage.cards.f.FuryStorm.class)); cards.add(new SetCardInfo("Hydra Omnivore", 153, Rarity.MYTHIC, mage.cards.h.HydraOmnivore.class)); + cards.add(new SetCardInfo("Kestia, the Cultivator", 42, Rarity.MYTHIC, mage.cards.k.KestiaTheCultivator.class)); cards.add(new SetCardInfo("Loyal Apprentice", 23, Rarity.UNCOMMON, mage.cards.l.LoyalApprentice.class)); cards.add(new SetCardInfo("Loyal Drake", 10, Rarity.UNCOMMON, mage.cards.l.LoyalDrake.class)); cards.add(new SetCardInfo("Loyal Guardian", 31, Rarity.UNCOMMON, mage.cards.l.LoyalGuardian.class)); diff --git a/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java index 3b47bc1c16..c290a39cc2 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java @@ -1,4 +1,3 @@ - package mage.abilities.common; import java.util.UUID; @@ -102,7 +101,10 @@ public class AttacksAllTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Whenever a " + filter.getMessage() + " attacks" + (attacksYouOrYourPlaneswalker ? " you or a planeswalker you control" : "") + ", " + super.getRule(); + return "Whenever " + (filter.getMessage().startsWith("an") ? "" : "a ") + + filter.getMessage() + " attacks" + + (attacksYouOrYourPlaneswalker ? " you or a planeswalker you control" : "") + + ", " + super.getRule(); } }