[MID] Implemented Galvanic Iteration

This commit is contained in:
Evan Kranzler 2021-09-05 15:12:40 -04:00
parent 34a7dbe86c
commit fd32d3ea47
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.g;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TimingRule;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GalvanicIteration extends CardImpl {
public GalvanicIteration(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{R}");
// When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new GalvanicIterationAbility()));
// Flashback {1}{U}{R}
this.addAbility(new FlashbackAbility(new ManaCostsImpl<>("{1}{U}{R}"), TimingRule.INSTANT));
}
private GalvanicIteration(final GalvanicIteration card) {
super(card);
}
@Override
public GalvanicIteration copy() {
return new GalvanicIteration(this);
}
}
class GalvanicIterationAbility extends DelayedTriggeredAbility {
GalvanicIterationAbility() {
super(new CopyTargetSpellEffect(true), Duration.EndOfTurn);
}
private GalvanicIterationAbility(final GalvanicIterationAbility ability) {
super(ability);
}
@Override
public GalvanicIterationAbility copy() {
return new GalvanicIterationAbility(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 (!isControlledBy(event.getPlayerId())) {
return false;
}
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell == null || !spell.isInstantOrSorcery(game)) {
return false;
}
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
return true;
}
@Override
public String getRule() {
return "When you cast your next instant or sorcery spell this turn, "
+ "copy that spell. You may choose new targets for the copy.";
}
}

View file

@ -48,6 +48,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Festival Crasher", 140, Rarity.COMMON, mage.cards.f.FestivalCrasher.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Foul Play", 101, Rarity.UNCOMMON, mage.cards.f.FoulPlay.class));
cards.add(new SetCardInfo("Galvanic Iteration", 224, Rarity.RARE, mage.cards.g.GalvanicIteration.class));
cards.add(new SetCardInfo("Graveyard Glutton", 104, Rarity.RARE, mage.cards.g.GraveyardGlutton.class));
cards.add(new SetCardInfo("Graveyard Trespasser", 104, Rarity.RARE, mage.cards.g.GraveyardTrespasser.class));
cards.add(new SetCardInfo("Haunted Ridge", 263, Rarity.RARE, mage.cards.h.HauntedRidge.class));