[KHM] Implemented Battle of Frost and Fire (#7392)

This commit is contained in:
Daniel Bomar 2021-01-14 15:33:45 -06:00 committed by GitHub
parent a668b99264
commit 3f7f4a0f82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 0 deletions

View file

@ -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();
}
}

View file

@ -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));