From 11f8a0d3b19aef2c6841cfcc801282626d82dd1a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 19 Jan 2021 09:08:09 -0500 Subject: [PATCH] [KHM] Implemented Battle Mammoth --- Mage.Sets/src/mage/cards/b/BattleMammoth.java | 87 +++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 88 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BattleMammoth.java diff --git a/Mage.Sets/src/mage/cards/b/BattleMammoth.java b/Mage.Sets/src/mage/cards/b/BattleMammoth.java new file mode 100644 index 0000000000..e2e1297b70 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BattleMammoth.java @@ -0,0 +1,87 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.ForetellAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BattleMammoth extends CardImpl { + + public BattleMammoth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); + + this.subtype.add(SubType.ELEPHANT); + this.power = new MageInt(6); + this.toughness = new MageInt(5); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever a permanent you control becomes the target of a spell or ability an opponent controls, you may draw a card. + this.addAbility(new BattleMammothTriggeredAbility()); + + // Foretell {2}{G}{G} + this.addAbility(new ForetellAbility(this, "{2}{G}{G}")); + } + + private BattleMammoth(final BattleMammoth card) { + super(card); + } + + @Override + public BattleMammoth copy() { + return new BattleMammoth(this); + } +} + +class BattleMammothTriggeredAbility extends TriggeredAbilityImpl { + + BattleMammothTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true); + } + + private BattleMammothTriggeredAbility(final BattleMammothTriggeredAbility ability) { + super(ability); + } + + @Override + public BattleMammothTriggeredAbility copy() { + return new BattleMammothTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TARGETED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (permanent == null || !permanent.isControlledBy(this.getControllerId())) { + return false; + } + Player targetter = game.getPlayer(event.getPlayerId()); + Object object = game.getObject(event.getSourceId()); + return object != null && targetter != null && targetter.hasOpponent(this.getControllerId(), game); + } + + @Override + public String getRule() { + return "Whenever a permanent you control becomes the target of a spell or ability an opponent controls, you may draw a card."; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 60c5b60a88..5955b92e9b 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -89,6 +89,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Barkchannel Pathway", 251, Rarity.RARE, mage.cards.b.BarkchannelPathway.class)); cards.add(new SetCardInfo("Basalt Ravager", 122, Rarity.UNCOMMON, mage.cards.b.BasaltRavager.class)); cards.add(new SetCardInfo("Battershield Warrior", 2, Rarity.UNCOMMON, mage.cards.b.BattershieldWarrior.class)); + cards.add(new SetCardInfo("Battle Mammoth", 160, Rarity.MYTHIC, mage.cards.b.BattleMammoth.class)); cards.add(new SetCardInfo("Battle for Bretagard", 203, Rarity.RARE, mage.cards.b.BattleForBretagard.class)); cards.add(new SetCardInfo("Battle of Frost and Fire", 204, Rarity.RARE, mage.cards.b.BattleOfFrostAndFire.class)); cards.add(new SetCardInfo("Battlefield Raptor", 3, Rarity.COMMON, mage.cards.b.BattlefieldRaptor.class));