[KHM] Implemented Invasion of the Giants

This commit is contained in:
Evan Kranzler 2021-01-06 22:52:19 -05:00
parent aa6abe3045
commit 65ace87a83
5 changed files with 142 additions and 5 deletions

View file

@ -0,0 +1,131 @@
package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SagaAbility;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.costs.common.RevealTargetFromHandCost;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DoWhenCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetOpponentOrPlaneswalker;
import mage.util.CardUtil;
import mage.watchers.common.CastSpellLastTurnWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class InvasionOfTheGiants extends CardImpl {
private static final FilterCard filter = new FilterCard("a Giant card from your hand");
static {
filter.add(SubType.GIANT.getPredicate());
}
public InvasionOfTheGiants(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{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 Scry 2.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new ScryEffect(2));
// II Draw a card. Then you may reveal a Giant card from your hand. When you do, Invasion of the Giants deals 2 damage to target opponent or planeswalker.
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
new DamageTargetEffect(2), false,
"{this} deals 2 damage to target opponent or planeswalker"
);
ability.addTarget(new TargetOpponentOrPlaneswalker());
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_II,
new DrawCardSourceControllerEffect(1),
new DoWhenCostPaid(
ability,
new RevealTargetFromHandCost(new TargetCardInHand(filter)),
"Reveal a Giant card from your hand?"
).concatBy("Then")
);
// III The next Giant spell you cast this turns costs {2} less to cast.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new InvasionOfTheGiantsEffect());
this.addAbility(sagaAbility);
}
private InvasionOfTheGiants(final InvasionOfTheGiants card) {
super(card);
}
@Override
public InvasionOfTheGiants copy() {
return new InvasionOfTheGiants(this);
}
}
class InvasionOfTheGiantsEffect extends CostModificationEffectImpl {
private int spellsCast;
InvasionOfTheGiantsEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "the next Giant spell you cast this turns costs {2} less to cast";
}
private InvasionOfTheGiantsEffect(final InvasionOfTheGiantsEffect effect) {
super(effect);
this.spellsCast = effect.spellsCast;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null) {
spellsCast = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId());
}
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, 2);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher == null) {
return false;
}
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) > spellsCast) {
discard(); // only one use
return false;
}
if (!(abilityToModify instanceof SpellAbility)
|| !abilityToModify.isControlledBy(source.getControllerId())) {
return false;
}
Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game);
return spellCard != null && spellCard.hasSubtype(SubType.GIANT, game);
}
@Override
public InvasionOfTheGiantsEffect copy() {
return new InvasionOfTheGiantsEffect(this);
}
}

View file

@ -12,6 +12,7 @@ import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -105,8 +106,12 @@ class KazaRoilChaserEffect extends CostModificationEffectImpl {
discard(); // only one use
return false;
}
return abilityToModify instanceof SpellAbility
&& abilityToModify.isControlledBy(source.getControllerId());
if (!(abilityToModify instanceof SpellAbility)
|| !abilityToModify.isControlledBy(source.getControllerId())) {
return false;
}
Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game);
return spellCard != null && spellCard.isInstantOrSorcery();
}
@Override

View file

@ -44,6 +44,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Gladewalker Ritualist", 392, Rarity.UNCOMMON, mage.cards.g.GladewalkerRitualist.class));
cards.add(new SetCardInfo("Halvar, God of Battle", 15, Rarity.MYTHIC, mage.cards.h.HalvarGodOfBattle.class));
cards.add(new SetCardInfo("Hengegate Pathway", 260, Rarity.RARE, mage.cards.h.HengegatePathway.class));
cards.add(new SetCardInfo("Invasion of the Giants", 215, Rarity.UNCOMMON, mage.cards.i.InvasionOfTheGiants.class));
cards.add(new SetCardInfo("Kaya the Inexorable", 218, Rarity.MYTHIC, mage.cards.k.KayaTheInexorable.class));
cards.add(new SetCardInfo("Magda, Brazen Outlaw", 142, Rarity.RARE, mage.cards.m.MagdaBrazenOutlaw.class));
cards.add(new SetCardInfo("Pyre of Heroes", 241, Rarity.RARE, mage.cards.p.PyreOfHeroes.class));

View file

@ -12,7 +12,6 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.StackAbility;
import mage.game.stack.StackObject;
@ -40,8 +39,8 @@ public class SagaAbility extends SimpleStaticAbility {
this.maxChapter = ability.maxChapter;
}
public void addChapterEffect(Card card, SagaChapter chapter, Effect effect) {
addChapterEffect(card, chapter, chapter, effect);
public void addChapterEffect(Card card, SagaChapter chapter, Effect... effects) {
addChapterEffect(card, chapter, chapter, new Effects(effects));
}
public void addChapterEffect(Card card, SagaChapter fromChapter, SagaChapter toChapter, Effect effect) {

View file

@ -40024,6 +40024,7 @@ Sword of the Realms|Kaldheim|15|M|{1}{W}|Legendary Artifact - Equipment|||Equipp
Magda, Brazen Outlaw|Kaldheim|142|R|{1}{R}|Legendary Creature - Dwarf Berserker|2|1|Other Dwarves you control get +1/+0.$Whenever a Dwarf you control becomes tapped, create a Treasure token.$Sacrifice five Treasures: Search your library for an artifact or Dragon card, put that card onto the battlefield, then shuffle your library.|
Realmwalker|Kaldheim|188|R|{2}{G}|Creature - Shapeshifter|2|3|Changeling$As Realmwalker enters the battlefield, choose a creature type.$You may look at the top card of your library any time.$You may cast creature spells of the chosen type from the top of your library.|
Toski, Bearer of Secrets|Kaldheim|197|R|{3}{G}|Legendary Creature - Squirrel|1|1|This spell can't be countered.$Indestructible$Toski, Bearer of Secrets attacks each combat if able.$Whenever a creature you control deals combat damage to a player, draw a card.|
Invasion of the Giants|Kaldheim|215|U|{U}{R}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I — Scry 2.$II — Draw a card. Then you may reveal a Giant card from your hand. When you do, Invasion of the Giants deals 2 damage to target opponent or planeswalker.$III — The next Giant spell you cast this turns costs {2} less to cast.|
Kaya the Inexorable|Kaldheim|218|M|{3}{W}{B}|Legendary Planeswalker - Kaya|5|+1: Put a ghostform counter on up to one target nontoken creature. It gains "When this creature dies or is put into exile, return it to its owner's hand and create a 1/1 white Spirit creature token with flying."$3: Exile target nonland permanent.$7: You get an emblem with "At the beginning of your upkeep, you may cast a legendary spell from your hand, from your graveyard, or from among cards you own in exile without paying its mana cost."|
Sarulf, Realm Eater|Kaldheim|228|R|{1}{B}{G}|Legendary Creature - Wolf|3|3|Whenever a permanent an opponent controls is put into a graveyard from the battlefield, put a +1/+1 counter on Sarulf, Realm Eater.$At the beginning of your upkeep, if Sarulf has one or more +1/+1 counters on it, you may remove all of them. If you do, exile each other nonland permanent with converted mana cost less than or equal to the number of counters removed this way.|
Showdown of the Skalds|Kaldheim|229|R|{2}{R}{W}|Enchantment - Saga|||(As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)$I — Exile the top four cards of your library. Until the end of your next turn, you may play those cards.$II, III — Whenever you cast a spell this turn, put a +1/+1 counter on target creature you control.|