From 93c0156c90e920786c56455304fa0edf818ab3aa Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 12 Sep 2019 16:43:13 -0400 Subject: [PATCH] Implemented Elite Headhunter --- .../src/mage/cards/e/EliteHeadhunter.java | 77 +++++++++++++++++++ .../src/mage/cards/k/KumenasSpeaker.java | 36 +++++---- Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + 3 files changed, 101 insertions(+), 13 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/e/EliteHeadhunter.java diff --git a/Mage.Sets/src/mage/cards/e/EliteHeadhunter.java b/Mage.Sets/src/mage/cards/e/EliteHeadhunter.java new file mode 100644 index 0000000000..b5e86c7537 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EliteHeadhunter.java @@ -0,0 +1,77 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetCreatureOrPlaneswalker; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EliteHeadhunter extends CardImpl { + + private static final FilterControlledPermanent filter + = new FilterControlledPermanent("another creature or an artifact"); + + static { + filter.add(EliteHeadhunterPredicate.instance); + } + + public EliteHeadhunter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B/R}{B/R}{B/R}{B/R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Menace + this.addAbility(new MenaceAbility()); + + // {B/R}{B/R}{B/R}, Sacrifice another creature or an artifact: Elite Headhunter deals 2 damage to target creature or planeswalker. + Ability ability = new SimpleActivatedAbility( + new DamageTargetEffect(2), new ManaCostsImpl("{B/R}{B/R}{B/R}") + ); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addTarget(new TargetCreatureOrPlaneswalker()); + this.addAbility(ability); + } + + private EliteHeadhunter(final EliteHeadhunter card) { + super(card); + } + + @Override + public EliteHeadhunter copy() { + return new EliteHeadhunter(this); + } +} + +enum EliteHeadhunterPredicate implements ObjectSourcePlayerPredicate> { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + MageObject obj = input.getObject(); + if (obj.getId().equals(input.getSourceId())) { + return obj.isArtifact(); + } + return obj.isCreature() || obj.isArtifact(); + } +} diff --git a/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java b/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java index 58cc2dd777..9626941ed4 100644 --- a/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java +++ b/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java @@ -1,22 +1,21 @@ - package mage.cards.k; -import java.util.UUID; import mage.MageInt; +import mage.MageObject; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.continuous.BoostSourceWhileControlsEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; + +import java.util.UUID; /** - * * @author TheElk801 */ public final class KumenasSpeaker extends CardImpl { @@ -24,10 +23,7 @@ public final class KumenasSpeaker extends CardImpl { private static final FilterPermanent filter = new FilterPermanent("another Merfolk or an Island"); static { - filter.add(AnotherPredicate.instance); - filter.add(Predicates.or( - new SubtypePredicate(SubType.ISLAND), - new SubtypePredicate(SubType.MERFOLK))); + filter.add(KumenasSpeakerPredicate.instance); } public KumenasSpeaker(UUID ownerId, CardSetInfo setInfo) { @@ -39,10 +35,10 @@ public final class KumenasSpeaker extends CardImpl { this.toughness = new MageInt(1); // Kumena's Omenspeaker gets +1/+1 as long as you control another Merfolk or Island. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceWhileControlsEffect(filter, 1, 1))); + this.addAbility(new SimpleStaticAbility(new BoostSourceWhileControlsEffect(filter, 1, 1))); } - public KumenasSpeaker(final KumenasSpeaker card) { + private KumenasSpeaker(final KumenasSpeaker card) { super(card); } @@ -51,3 +47,17 @@ public final class KumenasSpeaker extends CardImpl { return new KumenasSpeaker(this); } } + +enum KumenasSpeakerPredicate implements ObjectSourcePlayerPredicate> { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + MageObject obj = input.getObject(); + if (obj.getId().equals(input.getSourceId())) { + return obj.hasSubtype(SubType.ISLAND, game); + } + return obj.hasSubtype(SubType.ISLAND, game) + || obj.hasSubtype(SubType.MERFOLK, game); + } +} diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 9a14e94e4b..795839494c 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -55,6 +55,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Crystal Slipper", 119, Rarity.COMMON, mage.cards.c.CrystalSlipper.class)); cards.add(new SetCardInfo("Curious Pair", 150, Rarity.COMMON, mage.cards.c.CuriousPair.class)); cards.add(new SetCardInfo("Doom Foretold", 187, Rarity.RARE, mage.cards.d.DoomForetold.class)); + cards.add(new SetCardInfo("Elite Headhunter", 209, Rarity.UNCOMMON, mage.cards.e.EliteHeadhunter.class)); cards.add(new SetCardInfo("Embercleave", 120, Rarity.MYTHIC, mage.cards.e.Embercleave.class)); cards.add(new SetCardInfo("Embereth Paladin", 121, Rarity.COMMON, mage.cards.e.EmberethPaladin.class)); cards.add(new SetCardInfo("Embereth Shieldbreaker", 122, Rarity.UNCOMMON, mage.cards.e.EmberethShieldbreaker.class));