From 24a7bd4b379b238261f58f5b94ee70d4736d1a42 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 30 Jan 2019 17:11:24 -0500 Subject: [PATCH] Implemented Lava Storm --- Mage.Sets/src/mage/cards/l/LavaStorm.java | 79 +++++++++++++++++++++++ Mage.Sets/src/mage/sets/Weatherlight.java | 1 + 2 files changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LavaStorm.java diff --git a/Mage.Sets/src/mage/cards/l/LavaStorm.java b/Mage.Sets/src/mage/cards/l/LavaStorm.java new file mode 100644 index 0000000000..74d34536a4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LavaStorm.java @@ -0,0 +1,79 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.filter.predicate.permanent.BlockingPredicate; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LavaStorm extends CardImpl { + + public LavaStorm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); + + // Lava Storm deals 2 damage to each attacking creature or Lava Storm deals 2 damage to each blocking creature. + this.getSpellAbility().addEffect(new LavaStormEffect()); + } + + private LavaStorm(final LavaStorm card) { + super(card); + } + + @Override + public LavaStorm copy() { + return new LavaStorm(this); + } +} + +class LavaStormEffect extends OneShotEffect { + private static final FilterPermanent filter = new FilterCreaturePermanent(); + private static final FilterPermanent filter2 = new FilterCreaturePermanent(); + + static { + filter.add(AttackingPredicate.instance); + filter2.add(BlockingPredicate.instance); + } + + LavaStormEffect() { + super(Outcome.Benefit); + staticText = "{this} deals 2 damage to each attacking creature " + + "or {this} deals 2 damage to each blocking creature."; + } + + private LavaStormEffect(final LavaStormEffect effect) { + super(effect); + } + + @Override + public LavaStormEffect copy() { + return new LavaStormEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + if (player.chooseUse( + Outcome.Benefit, "Deal 2 damage to all attacking creatures or all blocking creatures?", + null, "Attackers", "Blockers", source, game) + ) { + return new DamageAllEffect(2, filter).apply(game, source); + } + return new DamageAllEffect(2, filter2).apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Weatherlight.java b/Mage.Sets/src/mage/sets/Weatherlight.java index 88f32d096d..988903d42e 100644 --- a/Mage.Sets/src/mage/sets/Weatherlight.java +++ b/Mage.Sets/src/mage/sets/Weatherlight.java @@ -107,6 +107,7 @@ public final class Weatherlight extends ExpansionSet { cards.add(new SetCardInfo("Inner Sanctum", 18, Rarity.RARE, mage.cards.i.InnerSanctum.class)); cards.add(new SetCardInfo("Jabari's Banner", 150, Rarity.UNCOMMON, mage.cards.j.JabarisBanner.class)); cards.add(new SetCardInfo("Lava Hounds", 109, Rarity.UNCOMMON, mage.cards.l.LavaHounds.class)); + cards.add(new SetCardInfo("Lava Storm", 110, Rarity.COMMON, mage.cards.l.LavaStorm.class)); cards.add(new SetCardInfo("Llanowar Behemoth", 132, Rarity.UNCOMMON, mage.cards.l.LlanowarBehemoth.class)); cards.add(new SetCardInfo("Llanowar Druid", 133, Rarity.COMMON, mage.cards.l.LlanowarDruid.class)); cards.add(new SetCardInfo("Llanowar Sentinel", 134, Rarity.COMMON, mage.cards.l.LlanowarSentinel.class));