From 8d04ec9b10781c549018b680c7ed87c881c43e02 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 24 May 2022 19:54:51 -0400 Subject: [PATCH] [CLB] Implemented Thunderwave --- Mage.Sets/src/mage/cards/t/Thunderwave.java | 85 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 86 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/Thunderwave.java diff --git a/Mage.Sets/src/mage/cards/t/Thunderwave.java b/Mage.Sets/src/mage/cards/t/Thunderwave.java new file mode 100644 index 0000000000..d3f210b11b --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/Thunderwave.java @@ -0,0 +1,85 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.RollDieWithResultTableEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Thunderwave extends CardImpl { + + public Thunderwave(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}{R}"); + + // Roll a d20. + RollDieWithResultTableEffect effect = new RollDieWithResultTableEffect(20); + + // 1-9 | Thunderwave deals 3 damage to each creature. + effect.addTableEntry(1, 9, new DamageAllEffect(3, StaticFilters.FILTER_PERMANENT_CREATURE)); + + // 10-19 | You may choose a creature. Thunderwave deals 3 damage to each creature not chosen this way. + effect.addTableEntry(10, 19, new ThunderwaveEffect()); + + // 20 | Thunderwave deals 6 damage to each creature your opponents control. + effect.addTableEntry(20, 20, new DamageAllEffect(6, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)); + } + + private Thunderwave(final Thunderwave card) { + super(card); + } + + @Override + public Thunderwave copy() { + return new Thunderwave(this); + } +} + +class ThunderwaveEffect extends OneShotEffect { + + ThunderwaveEffect() { + super(Outcome.Benefit); + staticText = "you may choose a creature. {this} deals 3 damage to each creature not chosen this way"; + } + + private ThunderwaveEffect(final ThunderwaveEffect effect) { + super(effect); + } + + @Override + public ThunderwaveEffect copy() { + return new ThunderwaveEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetPermanent target = new TargetControlledCreaturePermanent(0, 1); + target.setNotTarget(true); + player.choose(outcome, target, source, game); + for (Permanent permanent : game.getBattlefield().getActivePermanents( + StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game + )) { + if (!permanent.getId().equals(target.getFirstTarget())) { + permanent.damage(6, source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 3769420a54..336c23e94f 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -142,6 +142,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Tasha, the Witch Queen", 294, Rarity.MYTHIC, mage.cards.t.TashaTheWitchQueen.class)); cards.add(new SetCardInfo("The Council of Four", 271, Rarity.RARE, mage.cards.t.TheCouncilOfFour.class)); cards.add(new SetCardInfo("Thrakkus the Butcher", 295, Rarity.UNCOMMON, mage.cards.t.ThrakkusTheButcher.class)); + cards.add(new SetCardInfo("Thunderwave", 201, Rarity.UNCOMMON, mage.cards.t.Thunderwave.class)); cards.add(new SetCardInfo("Treasure Keeper", 341, Rarity.UNCOMMON, mage.cards.t.TreasureKeeper.class)); cards.add(new SetCardInfo("Tymora's Invoker", 101, Rarity.COMMON, mage.cards.t.TymorasInvoker.class)); cards.add(new SetCardInfo("Viconia, Drow Apostate", 156, Rarity.UNCOMMON, mage.cards.v.ViconiaDrowApostate.class));