[KHM] Implemented Dual Strike

This commit is contained in:
Evan Kranzler 2021-01-16 17:10:53 -05:00
parent 70d107d1aa
commit 6ecfd12df0
2 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.d;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.keyword.ForetellAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
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 DualStrike extends CardImpl {
public DualStrike(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}{R}");
// When you cast your next instant or sorcery spell with converted mana cost 4 or less this turn, copy that spell. You may choose new targets for the copy.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new DualStrikeAbility()));
// Foretell {R}
this.addAbility(new ForetellAbility(this, "{R}"));
}
private DualStrike(final DualStrike card) {
super(card);
}
@Override
public DualStrike copy() {
return new DualStrike(this);
}
}
class DualStrikeAbility extends DelayedTriggeredAbility {
DualStrikeAbility() {
super(new CopyTargetSpellEffect(true), Duration.EndOfTurn);
}
private DualStrikeAbility(final DualStrikeAbility ability) {
super(ability);
}
@Override
public DualStrikeAbility copy() {
return new DualStrikeAbility(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 (!this.isControlledBy(event.getPlayerId())) {
return false;
}
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell == null
|| !spell.isInstantOrSorcery()
|| spell.getConvertedManaCost() > 4) {
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 " +
"with converted mana cost 4 or less this turn, " +
"copy that spell. You may choose new targets for the copy.";
}
}

View file

@ -113,6 +113,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Doomskar Titan", 130, Rarity.UNCOMMON, mage.cards.d.DoomskarTitan.class));
cards.add(new SetCardInfo("Draugr's Helm", 88, Rarity.UNCOMMON, mage.cards.d.DraugrsHelm.class));
cards.add(new SetCardInfo("Dread Rider", 89, Rarity.COMMON, mage.cards.d.DreadRider.class));
cards.add(new SetCardInfo("Dual Strike", 132, Rarity.UNCOMMON, mage.cards.d.DualStrike.class));
cards.add(new SetCardInfo("Duskwielder", 91, Rarity.COMMON, mage.cards.d.Duskwielder.class));
cards.add(new SetCardInfo("Dwarven Reinforcements", 134, Rarity.COMMON, mage.cards.d.DwarvenReinforcements.class));
cards.add(new SetCardInfo("Egon, God of Death", 92, Rarity.RARE, mage.cards.e.EgonGodOfDeath.class));