Implemented Kjeldoran Elite Guard (#8599)

This commit is contained in:
Alex Vasile 2022-01-26 18:06:05 -05:00 committed by GitHub
parent 5dcbb49ba6
commit 08ad3232f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 120 additions and 1 deletions

View file

@ -0,0 +1,117 @@
package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.condition.common.IsPhaseCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author Alex-Vasile
*/
public final class KjeldoranEliteGuard extends CardImpl {
public KjeldoranEliteGuard(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Target creature gets +2/+2 until end of turn.
// When that creature leaves the battlefield this turn, sacrifice Kjeldoran Elite Guard.
// Activate only during combat.
Ability ability = new ConditionalActivatedAbility(
Zone.BATTLEFIELD,
new KjeldoranEliteGuardEffect(),
new TapSourceCost(),
new IsPhaseCondition(TurnPhase.COMBAT, false));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
private KjeldoranEliteGuard(final KjeldoranEliteGuard card) { super(card); }
@Override
public Card copy() {
return new KjeldoranEliteGuard(this);
}
}
class KjeldoranEliteGuardEffect extends OneShotEffect {
KjeldoranEliteGuardEffect() {
super(Outcome.Neutral);
staticText = "Target creature gets +2/+2 until end of turn. "
+ "When that creature leaves the battlefield this turn, sacrifice Kjeldoran Elite Guard. "
+ "Activate only during combat.";
}
@Override
public boolean apply(Game game, Ability source) {
if (game.getPermanent(source.getFirstTarget()) == null) { return false; }
// Target creature gets +2/+2 until end of turn.
BoostTargetEffect buffEffect = new BoostTargetEffect(2, 2, Duration.EndOfTurn);
buffEffect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(buffEffect, source);
// When that creature leaves the battlefield this turn, sacrifice Kjeldoran Elite Guard.
game.addDelayedTriggeredAbility(
new KjeldoranEliteGuardDelayedTriggeredAbility(source.getFirstTarget()),
source);
return true;
}
private KjeldoranEliteGuardEffect(KjeldoranEliteGuardEffect effect) { super(effect); }
@Override
public KjeldoranEliteGuardEffect copy() { return new KjeldoranEliteGuardEffect(this); }
}
class KjeldoranEliteGuardDelayedTriggeredAbility extends DelayedTriggeredAbility {
private final UUID creatureId;
KjeldoranEliteGuardDelayedTriggeredAbility(UUID creatureId) {
super(new SacrificeSourceEffect(), Duration.EndOfTurn, true);
this.creatureId = creatureId;
}
KjeldoranEliteGuardDelayedTriggeredAbility(KjeldoranEliteGuardDelayedTriggeredAbility ability) {
super(ability);
this.creatureId = ability.creatureId;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) { return event.getTargetId().equals(creatureId); }
@Override
public KjeldoranEliteGuardDelayedTriggeredAbility copy() {
return new KjeldoranEliteGuardDelayedTriggeredAbility(this);
}
@Override
public String getRule() { return "that creature left the battlefield this turn"; }
}

View file

@ -50,7 +50,7 @@ public class ColdsnapThemeDecks extends ExpansionSet {
cards.add(new SetCardInfo("Island", 373, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 374, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Kjeldoran Dead", 137, Rarity.COMMON, mage.cards.k.KjeldoranDead.class));
//cards.add(new SetCardInfo("Kjeldoran Elite Guard", 34, Rarity.UNCOMMON, mage.cards.k.KjeldoranEliteGuard.class));
cards.add(new SetCardInfo("Kjeldoran Elite Guard", 34, Rarity.UNCOMMON, mage.cards.k.KjeldoranEliteGuard.class));
cards.add(new SetCardInfo("Kjeldoran Home Guard", 8, Rarity.UNCOMMON, mage.cards.k.KjeldoranHomeGuard.class));
cards.add(new SetCardInfo("Kjeldoran Pride", "9b", Rarity.COMMON, mage.cards.k.KjeldoranPride.class));
cards.add(new SetCardInfo("Lat-Nam's Legacy", "30b", Rarity.COMMON, mage.cards.l.LatNamsLegacy.class));

View file

@ -196,6 +196,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Karplusan Yeti", 197, Rarity.RARE, mage.cards.k.KarplusanYeti.class));
cards.add(new SetCardInfo("Kelsinko Ranger", 33, Rarity.COMMON, mage.cards.k.KelsinkoRanger.class));
cards.add(new SetCardInfo("Kjeldoran Dead", 137, Rarity.COMMON, mage.cards.k.KjeldoranDead.class));
cards.add(new SetCardInfo("Kjeldoran Elite Guard", 34, Rarity.UNCOMMON, mage.cards.k.KjeldoranEliteGuard.class));
cards.add(new SetCardInfo("Kjeldoran Frostbeast", 296, Rarity.UNCOMMON, mage.cards.k.KjeldoranFrostbeast.class));
cards.add(new SetCardInfo("Kjeldoran Knight", 36, Rarity.RARE, mage.cards.k.KjeldoranKnight.class));
cards.add(new SetCardInfo("Kjeldoran Phalanx", 37, Rarity.RARE, mage.cards.k.KjeldoranPhalanx.class));

View file

@ -141,6 +141,7 @@ public final class MastersEditionII extends ExpansionSet {
cards.add(new SetCardInfo("Karplusan Giant", 133, Rarity.UNCOMMON, mage.cards.k.KarplusanGiant.class));
cards.add(new SetCardInfo("Kaysa", 170, Rarity.RARE, mage.cards.k.Kaysa.class));
cards.add(new SetCardInfo("Kjeldoran Dead", 98, Rarity.COMMON, mage.cards.k.KjeldoranDead.class));
cards.add(new SetCardInfo("Kjeldoran Elite Guard", 21, Rarity.COMMON, mage.cards.k.KjeldoranEliteGuard.class));
cards.add(new SetCardInfo("Kjeldoran Home Guard", 22, Rarity.UNCOMMON, mage.cards.k.KjeldoranHomeGuard.class));
cards.add(new SetCardInfo("Kjeldoran Outpost", 233, Rarity.RARE, mage.cards.k.KjeldoranOutpost.class));
cards.add(new SetCardInfo("Kjeldoran Skycaptain", 23, Rarity.COMMON, mage.cards.k.KjeldoranSkycaptain.class));