From 579e341944587478766b07ed4948ea7cca8eb291 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 4 Sep 2020 16:26:42 -0400 Subject: [PATCH] [ZNR] Implemented Coralhelm Chronicler --- .../src/mage/cards/c/CoralhelmChronicler.java | 65 +++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + .../predicate/mageobject/KickedPredicate.java | 35 ++++++++++ 3 files changed, 101 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CoralhelmChronicler.java create mode 100644 Mage/src/main/java/mage/filter/predicate/mageobject/KickedPredicate.java diff --git a/Mage.Sets/src/mage/cards/c/CoralhelmChronicler.java b/Mage.Sets/src/mage/cards/c/CoralhelmChronicler.java new file mode 100644 index 00000000000..f49a98f9241 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CoralhelmChronicler.java @@ -0,0 +1,65 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.abilities.keyword.KickerAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.mageobject.KickedPredicate; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CoralhelmChronicler extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a kicked spell"); + private static final FilterCard filter2 = new FilterCard("card with a kicker ability"); + + static { + filter.add(KickedPredicate.instance); + filter2.add(new AbilityPredicate(KickerAbility.class)); + } + + public CoralhelmChronicler(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); + + this.subtype.add(SubType.MERFOLK); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever you cast a kicked spell, draw a card, then discard a card. + this.addAbility(new SpellCastControllerTriggeredAbility( + new DrawDiscardControllerEffect(1, 1, false), filter, false + )); + + // When Coralhelm Chronicler enters the battlefield, look at the top five cards of your library. You may reveal a card with a kicker ability from among them and put it into your hand. Put the rest on the bottom of your library in a random order. + this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect( + StaticValue.get(5), false, StaticValue.get(1), filter2, Zone.LIBRARY, false, + true, false, Zone.HAND, true, false, false + ).setBackInRandomOrder(true).setText("look at the top five cards of your library. " + + "You may reveal a card with a kicker ability from among them and put it into your hand. " + + "Put the rest on the bottom of your library in a random order"))); + } + + private CoralhelmChronicler(final CoralhelmChronicler card) { + super(card); + } + + @Override + public CoralhelmChronicler copy() { + return new CoralhelmChronicler(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 4dceabfb4bb..bb982601f6d 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -90,6 +90,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Clearwater Pathway", 260, Rarity.RARE, mage.cards.c.ClearwaterPathway.class)); cards.add(new SetCardInfo("Cleric of Life's Bond", 222, Rarity.UNCOMMON, mage.cards.c.ClericOfLifesBond.class)); cards.add(new SetCardInfo("Cliffhaven Sell-Sword", 8, Rarity.COMMON, mage.cards.c.CliffhavenSellSword.class)); + cards.add(new SetCardInfo("Coralhelm Chronicler", 54, Rarity.RARE, mage.cards.c.CoralhelmChronicler.class)); cards.add(new SetCardInfo("Cragcrown Pathway", 261, Rarity.RARE, mage.cards.c.CragcrownPathway.class)); cards.add(new SetCardInfo("Dauntless Survivor", 184, Rarity.COMMON, mage.cards.d.DauntlessSurvivor.class)); cards.add(new SetCardInfo("Deadly Alliance", 96, Rarity.COMMON, mage.cards.d.DeadlyAlliance.class)); diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/KickedPredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/KickedPredicate.java new file mode 100644 index 00000000000..9c7d45f1f2f --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/KickedPredicate.java @@ -0,0 +1,35 @@ +package mage.filter.predicate.mageobject; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.keyword.KickerAbility; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.stack.Spell; + +/** + * @author TheElk801 + */ +public enum KickedPredicate implements Predicate { + instance; + + @Override + public boolean apply(MageObject input, Game game) { + Spell spell = game.getSpell(input.getId()); + if (spell == null) { + return false; + } + for (Ability ability : spell.getAbilities()) { + if (ability instanceof KickerAbility + && ((KickerAbility) ability).getKickedCounter(game, spell.getSpellAbility()) > 0) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return "Kicked"; + } +}