[ZNR] Implemented Leyline Tyrant

This commit is contained in:
Evan Kranzler 2020-09-12 15:01:41 -04:00
parent 0369a8dfb4
commit 9a83df8cd4
2 changed files with 130 additions and 0 deletions

View file

@ -0,0 +1,129 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LeylineTyrant extends CardImpl {
public LeylineTyrant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// You don't lose unspent red mana as steps and phases end.
this.addAbility(new SimpleStaticAbility(new LeylineTyrantManaEffect()));
// When Leyline Tyrant dies, you may pay any amount of {R}. When you do, it deals that much damage to any target.
this.addAbility(new DiesTriggeredAbility(new LeylineTyrantDamageEffect()));
}
private LeylineTyrant(final LeylineTyrant card) {
super(card);
}
@Override
public LeylineTyrant copy() {
return new LeylineTyrant(this);
}
}
class LeylineTyrantManaEffect extends ContinuousEffectImpl {
LeylineTyrantManaEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "You don't lose unspent red mana as steps and phases end";
}
private LeylineTyrantManaEffect(final LeylineTyrantManaEffect effect) {
super(effect);
}
@Override
public LeylineTyrantManaEffect copy() {
return new LeylineTyrantManaEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.getManaPool().addDoNotEmptyManaType(ManaType.RED);
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.RulesEffects;
}
}
class LeylineTyrantDamageEffect extends OneShotEffect {
LeylineTyrantDamageEffect() {
super(Outcome.Benefit);
staticText = "you may pay any amount of {R}. When you do, it deals that much damage to any target";
}
private LeylineTyrantDamageEffect(final LeylineTyrantDamageEffect effect) {
super(effect);
}
@Override
public LeylineTyrantDamageEffect copy() {
return new LeylineTyrantDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getManaPool().getRed() == 0) {
return false;
}
int costX = player.announceXMana(
0, player.getManaPool().getRed(),
"Announce the value for {X}", game, source
);
ManaCosts cost = new ManaCostsImpl<>("{" + costX + "}");
if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
new DamageTargetEffect(costX), false,
"{this} deals " + costX + " damage to any target"
);
ability.addTarget(new TargetAnyTarget());
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
}

View file

@ -228,6 +228,7 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Kor Celebrant", 22, Rarity.COMMON, mage.cards.k.KorCelebrant.class));
cards.add(new SetCardInfo("Lavaglide Pathway", 264, Rarity.RARE, mage.cards.l.LavaglidePathway.class));
cards.add(new SetCardInfo("Legion Angel", 23, Rarity.RARE, mage.cards.l.LegionAngel.class));
cards.add(new SetCardInfo("Leyline Tyrant", 147, Rarity.MYTHIC, mage.cards.l.LeylineTyrant.class));
cards.add(new SetCardInfo("Linvala, Shield of Sea Gate", 226, Rarity.RARE, mage.cards.l.LinvalaShieldOfSeaGate.class));
cards.add(new SetCardInfo("Living Tempest", 65, Rarity.COMMON, mage.cards.l.LivingTempest.class));
cards.add(new SetCardInfo("Lotus Cobra", 193, Rarity.RARE, mage.cards.l.LotusCobra.class));