From a00f3db62a8632f4d40675b52f1451f579181b66 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 23 Jan 2021 19:43:36 -0500 Subject: [PATCH] [KHM] Implemented Quakebringer --- Mage.Sets/src/mage/cards/q/Quakebringer.java | 94 ++++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/q/Quakebringer.java diff --git a/Mage.Sets/src/mage/cards/q/Quakebringer.java b/Mage.Sets/src/mage/cards/q/Quakebringer.java new file mode 100644 index 0000000000..820fcea170 --- /dev/null +++ b/Mage.Sets/src/mage/cards/q/Quakebringer.java @@ -0,0 +1,94 @@ +package mage.cards.q; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.continuous.CantGainLifeAllEffect; +import mage.abilities.keyword.ForetellAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Quakebringer extends CardImpl { + + public Quakebringer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); + + this.subtype.add(SubType.GIANT); + this.subtype.add(SubType.BERSERKER); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // Your opponents can't gain life. + this.addAbility(new SimpleStaticAbility(new CantGainLifeAllEffect( + Duration.WhileOnBattlefield, TargetController.OPPONENT + ))); + + // At the beginning of your upkeep, Quakebringer deals 2 damage to each opponent. This ability triggers only if Quakebringer is on the battlefield or if Quakebringer is in your graveyard and you control a Giant. + this.addAbility(new QuakebringerTriggeredAbility()); + + // Foretell {2}{R}{R} + this.addAbility(new ForetellAbility(this, "{2}{R}{R}")); + } + + private Quakebringer(final Quakebringer card) { + super(card); + } + + @Override + public Quakebringer copy() { + return new Quakebringer(this); + } +} + +class QuakebringerTriggeredAbility extends TriggeredAbilityImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.GIANT); + + QuakebringerTriggeredAbility() { + super(Zone.ALL, new DamagePlayersEffect(2, TargetController.OPPONENT)); + } + + private QuakebringerTriggeredAbility(final QuakebringerTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + switch (game.getState().getZone(getSourceId())) { + case BATTLEFIELD: + return game.isActivePlayer(getControllerId()); + case GRAVEYARD: + return game.isActivePlayer(game.getOwnerId(getSourceId())) + && game.getBattlefield().count(filter, getSourceId(), getControllerId(), game) > 0; + } + return false; + } + + @Override + public QuakebringerTriggeredAbility copy() { + return new QuakebringerTriggeredAbility(this); + } + + @Override + public String getRule() { + return "At the beginning of your upkeep, {this} deals 2 damage to each opponent. " + + "This ability triggers only if {this} is on the battlefield " + + "or if {this} is in your graveyard and you control a Giant."; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index ba08e5fc12..6c5e066196 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -210,6 +210,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Priest of the Haunted Edge", 104, Rarity.COMMON, mage.cards.p.PriestOfTheHauntedEdge.class)); cards.add(new SetCardInfo("Provoke the Trolls", 144, Rarity.UNCOMMON, mage.cards.p.ProvokeTheTrolls.class)); cards.add(new SetCardInfo("Pyre of Heroes", 241, Rarity.RARE, mage.cards.p.PyreOfHeroes.class)); + cards.add(new SetCardInfo("Quakebringer", 145, Rarity.MYTHIC, mage.cards.q.Quakebringer.class)); cards.add(new SetCardInfo("Raiders' Karve", 242, Rarity.COMMON, mage.cards.r.RaidersKarve.class)); cards.add(new SetCardInfo("Raise the Draugr", 105, Rarity.COMMON, mage.cards.r.RaiseTheDraugr.class)); cards.add(new SetCardInfo("Rally the Ranks", 20, Rarity.RARE, mage.cards.r.RallyTheRanks.class));