[CMR] Implemented Krark, the Thumbless

This commit is contained in:
Evan Kranzler 2020-10-29 21:10:12 -04:00
parent 7bc4d6159a
commit f76910b827
3 changed files with 89 additions and 3 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.PartnerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KrarkTheThumbless extends CardImpl {
public KrarkTheThumbless(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever you cast an instant or sorcery spell, flip a coin. If you lose the flip, return that spell to its owner's hand. If you win the flip, copy that spell, and you may choose new targets for the copy.
this.addAbility(new SpellCastControllerTriggeredAbility(
new KrarkTheThumblessEffect(),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY,
false, true
));
// Partner
this.addAbility(PartnerAbility.getInstance());
}
private KrarkTheThumbless(final KrarkTheThumbless card) {
super(card);
}
@Override
public KrarkTheThumbless copy() {
return new KrarkTheThumbless(this);
}
}
class KrarkTheThumblessEffect extends OneShotEffect {
KrarkTheThumblessEffect() {
super(Outcome.Benefit);
staticText = "flip a coin. If you lose the flip, return that spell to its owner's hand. " +
"If you win the flip, copy that spell, and you may choose new targets for the copy";
}
private KrarkTheThumblessEffect(final KrarkTheThumblessEffect effect) {
super(effect);
}
@Override
public KrarkTheThumblessEffect copy() {
return new KrarkTheThumblessEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Spell spell = game.getSpellOrLKIStack(getTargetPointer().getFirst(game, source));
if (player == null || spell == null) {
return false;
}
if (player.flipCoin(source, game, true)) {
spell.createCopyOnStack(game, source, player.getId(), true);
return true;
}
if (spell.isCopy()) {
game.getStack().remove(spell, game);
return true;
}
return game.getSpell(spell.getId()) == null && player.moveCards(spell, Zone.HAND, source, game);
}
}

View file

@ -67,6 +67,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Kitesail Corsair", 76, Rarity.COMMON, mage.cards.k.KitesailCorsair.class));
cards.add(new SetCardInfo("Kitesail Skirmisher", 77, Rarity.COMMON, mage.cards.k.KitesailSkirmisher.class));
cards.add(new SetCardInfo("Kor Cartographer", 377, Rarity.COMMON, mage.cards.k.KorCartographer.class));
cards.add(new SetCardInfo("Krark, the Thumbless", 189, Rarity.RARE, mage.cards.k.KrarkTheThumbless.class));
cards.add(new SetCardInfo("Kydele, Chosen of Kruphix", 524, Rarity.MYTHIC, mage.cards.k.KydeleChosenOfKruphix.class));
cards.add(new SetCardInfo("Ludevic, Necro-Alchemist", 525, Rarity.MYTHIC, mage.cards.l.LudevicNecroAlchemist.class));
cards.add(new SetCardInfo("Maelstrom Colossus", 322, Rarity.COMMON, mage.cards.m.MaelstromColossus.class));

View file

@ -1,4 +1,3 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
@ -11,7 +10,6 @@ import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author North
*/
public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
@ -67,7 +65,7 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
if (rememberSource) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId(), game));
}
return true;
}