From 3f7f4a0f82a3bce2abfe320e868af982d33495a5 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Thu, 14 Jan 2021 15:33:45 -0600 Subject: [PATCH] [KHM] Implemented Battle of Frost and Fire (#7392) --- .../mage/cards/b/BattleOfFrostAndFire.java | 103 ++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 104 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BattleOfFrostAndFire.java diff --git a/Mage.Sets/src/mage/cards/b/BattleOfFrostAndFire.java b/Mage.Sets/src/mage/cards/b/BattleOfFrostAndFire.java new file mode 100644 index 0000000000..f561c96dcd --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BattleOfFrostAndFire.java @@ -0,0 +1,103 @@ +package mage.cards.b; + +import java.util.UUID; + +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.constants.Duration; +import mage.constants.SagaChapter; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; + +/** + * + * @author weirddan455 + */ +public final class BattleOfFrostAndFire extends CardImpl { + + private static final FilterPermanent filter + = new FilterPermanent("non-Giant creature and each planeswalker"); + + static { + filter.add(Predicates.or( + Predicates.and(CardType.CREATURE.getPredicate(), Predicates.not(SubType.GIANT.getPredicate())), + CardType.PLANESWALKER.getPredicate() + )); + } + + public BattleOfFrostAndFire(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{R}"); + + this.subtype.add(SubType.SAGA); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.) + SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_III); + + // I — Battle of Frost and Fire deals 4 damage to each non-Giant creature and each planeswalker. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new DamageAllEffect(4, filter)); + + // II — Scry 3. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new ScryEffect(3)); + + // III — Whenever you cast a spell with converted mana cost 5 or greater this turn, draw two cards, then discard a card. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new CreateDelayedTriggeredAbilityEffect( + new BattleOfFrostAndFireTriggeredAbility(), false, false + )); + this.addAbility(sagaAbility); + } + + private BattleOfFrostAndFire(final BattleOfFrostAndFire card) { + super(card); + } + + @Override + public BattleOfFrostAndFire copy() { + return new BattleOfFrostAndFire(this); + } +} + +class BattleOfFrostAndFireTriggeredAbility extends DelayedTriggeredAbility { + + public BattleOfFrostAndFireTriggeredAbility() { + super(new DrawDiscardControllerEffect(2, 1), Duration.EndOfTurn, false); + } + + private BattleOfFrostAndFireTriggeredAbility(BattleOfFrostAndFireTriggeredAbility ability) { + super(ability); + } + + @Override + public BattleOfFrostAndFireTriggeredAbility copy() { + return new BattleOfFrostAndFireTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SPELL_CAST; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getPlayerId().equals(this.getControllerId())) { + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getConvertedManaCost() >= 5; + } + return false; + } + + @Override + public String getRule() { + return "Whenever you cast a spell with converted mana cost 5 or greater this turn, " + super.getRule(); + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index cc2956c1da..fdfbc6453c 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -65,6 +65,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Axgard Cavalry", 121, Rarity.COMMON, mage.cards.a.AxgardCavalry.class)); cards.add(new SetCardInfo("Barkchannel Pathway", 251, Rarity.RARE, mage.cards.b.BarkchannelPathway.class)); cards.add(new SetCardInfo("Basalt Ravager", 122, Rarity.UNCOMMON, mage.cards.b.BasaltRavager.class)); + cards.add(new SetCardInfo("Battle of Frost and Fire", 204, Rarity.RARE, mage.cards.b.BattleOfFrostAndFire.class)); cards.add(new SetCardInfo("Bearded Axe", 388, Rarity.UNCOMMON, mage.cards.b.BeardedAxe.class)); cards.add(new SetCardInfo("Behold the Multiverse", 46, Rarity.COMMON, mage.cards.b.BeholdTheMultiverse.class)); cards.add(new SetCardInfo("Binding the Old Gods", 206, Rarity.UNCOMMON, mage.cards.b.BindingTheOldGods.class));