From f827924b8c3fd13251e3093c3b9b74852e4f66bf Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 21 Aug 2021 11:45:48 -0400 Subject: [PATCH] [AFC] Implemented Karazikar, the Eye Tyrant --- .../mage/cards/k/KarazikarTheEyeTyrant.java | 136 ++++++++++++++++++ .../mage/sets/ForgottenRealmsCommander.java | 1 + 2 files changed, 137 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KarazikarTheEyeTyrant.java diff --git a/Mage.Sets/src/mage/cards/k/KarazikarTheEyeTyrant.java b/Mage.Sets/src/mage/cards/k/KarazikarTheEyeTyrant.java new file mode 100644 index 0000000000..8b6af08619 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KarazikarTheEyeTyrant.java @@ -0,0 +1,136 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.*; +import mage.abilities.effects.common.combat.GoadTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KarazikarTheEyeTyrant extends CardImpl { + + public KarazikarTheEyeTyrant(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.BEHOLDER); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Whenever you attack a player, tap target creature that player controls and goad it. + this.addAbility(new KarazikarTheEyeTyrantFirstTriggeredAbility()); + + // Whenever an opponent attacks another one of your opponents, you and the attacking player each draw a card and lose 1 life. + this.addAbility(new KarazikarTheEyeTyrantSecondTriggeredAbility()); + } + + private KarazikarTheEyeTyrant(final KarazikarTheEyeTyrant card) { + super(card); + } + + @Override + public KarazikarTheEyeTyrant copy() { + return new KarazikarTheEyeTyrant(this); + } +} + +class KarazikarTheEyeTyrantFirstTriggeredAbility extends TriggeredAbilityImpl { + + KarazikarTheEyeTyrantFirstTriggeredAbility() { + super(Zone.BATTLEFIELD, new TapTargetEffect(), false); + this.addEffect(new GoadTargetEffect()); + } + + private KarazikarTheEyeTyrantFirstTriggeredAbility(final KarazikarTheEyeTyrantFirstTriggeredAbility ability) { + super(ability); + } + + @Override + public KarazikarTheEyeTyrantFirstTriggeredAbility copy() { + return new KarazikarTheEyeTyrantFirstTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DEFENDER_ATTACKED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!isControlledBy(event.getPlayerId())) { + return false; + } + Player player = game.getPlayer(event.getTargetId()); + if (player == null) { + return false; + } + FilterPermanent filter = new FilterCreaturePermanent("creature controlled by " + player.getName()); + filter.add(new ControllerIdPredicate(player.getId())); + this.getTargets().clear(); + this.addTarget(new TargetPermanent(filter)); + return true; + } + + @Override + public String getRule() { + return "Whenever you attack a player, tap target creature that player controls and goad it."; + } +} + +class KarazikarTheEyeTyrantSecondTriggeredAbility extends TriggeredAbilityImpl { + + KarazikarTheEyeTyrantSecondTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false); + this.addEffect(new LoseLifeSourceControllerEffect(1)); + this.addEffect(new DrawCardTargetEffect(1)); + this.addEffect(new LoseLifeTargetEffect(1)); + } + + private KarazikarTheEyeTyrantSecondTriggeredAbility(final KarazikarTheEyeTyrantSecondTriggeredAbility ability) { + super(ability); + } + + @Override + public KarazikarTheEyeTyrantSecondTriggeredAbility copy() { + return new KarazikarTheEyeTyrantSecondTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DEFENDER_ATTACKED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Set opponents = game.getOpponents(getControllerId()); + if (!opponents.contains(event.getPlayerId()) || !opponents.contains(event.getTargetId())) { + return false; + } + this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; + } + + @Override + public String getRule() { + return "Whenever an opponent attacks another one of your opponents, " + + "you and the attacking player each draw a card and lose 1 life."; + } +} diff --git a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java index 23ff352e9c..26c4051ffa 100644 --- a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java +++ b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java @@ -137,6 +137,7 @@ public final class ForgottenRealmsCommander extends ExpansionSet { cards.add(new SetCardInfo("Imprisoned in the Moon", 85, Rarity.RARE, mage.cards.i.ImprisonedInTheMoon.class)); cards.add(new SetCardInfo("Indomitable Might", 40, Rarity.RARE, mage.cards.i.IndomitableMight.class)); cards.add(new SetCardInfo("Izzet Chemister", 130, Rarity.RARE, mage.cards.i.IzzetChemister.class)); + cards.add(new SetCardInfo("Karazikar, the Eye Tyrant", 49, Rarity.MYTHIC, mage.cards.k.KarazikarTheEyeTyrant.class)); cards.add(new SetCardInfo("Karmic Guide", 68, Rarity.RARE, mage.cards.k.KarmicGuide.class)); cards.add(new SetCardInfo("Kenrith's Transformation", 162, Rarity.UNCOMMON, mage.cards.k.KenrithsTransformation.class)); cards.add(new SetCardInfo("Kindred Summons", 163, Rarity.RARE, mage.cards.k.KindredSummons.class));