From 7765d098f58570f06d86a51faf3080d613845b60 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 8 Apr 2023 19:13:31 -0400 Subject: [PATCH] [MOM] Implement Rankle and Torbran --- .../src/mage/cards/r/RankleAndTorbran.java | 120 ++++++++++++++++++ .../src/mage/sets/MarchOfTheMachine.java | 1 + 2 files changed, 121 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RankleAndTorbran.java diff --git a/Mage.Sets/src/mage/cards/r/RankleAndTorbran.java b/Mage.Sets/src/mage/cards/r/RankleAndTorbran.java new file mode 100644 index 0000000000..1c048cb4ef --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RankleAndTorbran.java @@ -0,0 +1,120 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.CreateTokenAllEffect; +import mage.abilities.effects.common.SacrificeAllEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RankleAndTorbran extends CardImpl { + + public RankleAndTorbran(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}{R}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.FAERIE); + this.subtype.add(SubType.DWARF); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // First strike + this.addAbility(FirstStrikeAbility.getInstance()); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Whenever Rankle and Torbran deals combat damage to a player or battle, choose any number -- + // * Each player creates a Treasure token. + Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility( + new CreateTokenAllEffect(new TreasureToken(), TargetController.EACH_PLAYER), false + ).setOrBattle(true); + ability.getModes().setMinModes(0); + ability.getModes().setMinModes(3); + + // * Each player sacrifices a creature. + ability.addMode(new Mode(new SacrificeAllEffect(1, StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT))); + + // * If a source would deal damage to a player or battle this turn, it deals that much damage plus 2 instead. + ability.addMode(new Mode(new RankleAndTorbranEffect())); + this.addAbility(ability); + } + + private RankleAndTorbran(final RankleAndTorbran card) { + super(card); + } + + @Override + public RankleAndTorbran copy() { + return new RankleAndTorbran(this); + } +} + +class RankleAndTorbranEffect extends ReplacementEffectImpl { + + RankleAndTorbranEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "if a source would deal damage to a player or battle this turn, it deals that much damage plus 2 instead"; + } + + private RankleAndTorbranEffect(final RankleAndTorbranEffect effect) { + super(effect); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT + || event.getType() == GameEvent.EventType.DAMAGE_PLAYER; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getAmount() < 1) { + return false; + } + Player player = game.getPlayer(event.getTargetId()); + if (player != null) { + return true; + } + Permanent permanent = game.getPermanent(event.getTargetId()); + return permanent != null && permanent.isBattle(game); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(CardUtil.overflowInc(event.getAmount(), 2)); + return false; + } + + @Override + public RankleAndTorbranEffect copy() { + return new RankleAndTorbranEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index 9fdf01a34b..c62b86033d 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -175,6 +175,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Ral's Reinforcements", 158, Rarity.COMMON, mage.cards.r.RalsReinforcements.class)); cards.add(new SetCardInfo("Ramosian Greatsword", 159, Rarity.UNCOMMON, mage.cards.r.RamosianGreatsword.class)); cards.add(new SetCardInfo("Rampaging Geoderm", 251, Rarity.UNCOMMON, mage.cards.r.RampagingGeoderm.class)); + cards.add(new SetCardInfo("Rankle and Torbran", 252, Rarity.RARE, mage.cards.r.RankleAndTorbran.class)); cards.add(new SetCardInfo("Ravenous Sailback", 202, Rarity.UNCOMMON, mage.cards.r.RavenousSailback.class)); cards.add(new SetCardInfo("Realmbreaker's Grasp", 33, Rarity.COMMON, mage.cards.r.RealmbreakersGrasp.class)); cards.add(new SetCardInfo("Redcap Heelslasher", 161, Rarity.COMMON, mage.cards.r.RedcapHeelslasher.class));