From 0897ab2d1eb32bd5a8b1342920ee671eedfa563a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 4 Jun 2022 13:29:36 -0400 Subject: [PATCH] [CLB] Implemented Delayed Blast Fireball --- .../mage/cards/d/DelayedBlastFireball.java | 82 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 83 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DelayedBlastFireball.java diff --git a/Mage.Sets/src/mage/cards/d/DelayedBlastFireball.java b/Mage.Sets/src/mage/cards/d/DelayedBlastFireball.java new file mode 100644 index 00000000000..27869758212 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DelayedBlastFireball.java @@ -0,0 +1,82 @@ +package mage.cards.d; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.keyword.ForetellAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.stack.Spell; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DelayedBlastFireball extends CardImpl { + + public DelayedBlastFireball(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}{R}"); + + // Delayed Blast Fireball deals 2 damage to each opponent and each creature they control. If this spell was cast from exile, it deals 5 damage to each opponent and each creature they control instead. + this.getSpellAbility().addEffect(new DamagePlayersEffect( + Outcome.Damage, DelayedBlastFireballValue.instance, TargetController.OPPONENT + )); + this.getSpellAbility().addEffect(new DamageAllEffect( + DelayedBlastFireballValue.instance, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE + ).setText("and each creature they control. If this spell was cast from exile, " + + "it deals 5 damage to each opponent and each creature they control instead")); + + // Foretell {4}{R}{R} + this.addAbility(new ForetellAbility(this, "{4}{R}{R}")); + } + + private DelayedBlastFireball(final DelayedBlastFireball card) { + super(card); + } + + @Override + public DelayedBlastFireball copy() { + return new DelayedBlastFireball(this); + } +} + +enum DelayedBlastFireballValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return Optional + .of(sourceAbility.getSourceObjectIfItStillExists(game)) + .filter(Spell.class::isInstance) + .map(Spell.class::cast) + .map(Spell::getFromZone) + .filter(Zone.EXILED::match) + .map(x -> 5) + .orElse(2); + } + + @Override + public DelayedBlastFireballValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } + + @Override + public String toString() { + return "2"; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index dba293ecfc4..80d94b29ef9 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -160,6 +160,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Dawnbringer Cleric", 15, Rarity.COMMON, mage.cards.d.DawnbringerCleric.class)); cards.add(new SetCardInfo("Deadly Dispute", 124, Rarity.COMMON, mage.cards.d.DeadlyDispute.class)); cards.add(new SetCardInfo("Decanter of Endless Water", 309, Rarity.COMMON, mage.cards.d.DecanterOfEndlessWater.class)); + cards.add(new SetCardInfo("Delayed Blast Fireball", 676, Rarity.RARE, mage.cards.d.DelayedBlastFireball.class)); cards.add(new SetCardInfo("Demon Bolt", 787, Rarity.COMMON, mage.cards.d.DemonBolt.class)); cards.add(new SetCardInfo("Descent into Avernus", 169, Rarity.RARE, mage.cards.d.DescentIntoAvernus.class)); cards.add(new SetCardInfo("Desolate Lighthouse", 890, Rarity.RARE, mage.cards.d.DesolateLighthouse.class));