[CLB] Implemented Lozhan, Dragons' Legacy

This commit is contained in:
Evan Kranzler 2022-05-25 09:32:00 -04:00
parent d45cb1b705
commit 9c50b2331c
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,100 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreaturePlayerOrPlaneswalker;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CommanderPredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.target.common.TargetAnyTarget;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LozhanDragonsLegacy extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an Adventure spell or Dragon spell");
private static final FilterCreaturePlayerOrPlaneswalker filter2
= new FilterCreaturePlayerOrPlaneswalker("any target that isn't a commander");
static {
filter.add(Predicates.or(
SubType.ADVENTURE.getPredicate(),
SubType.DRAGON.getPredicate()
));
filter2.getPermanentFilter().add(Predicates.not(CommanderPredicate.instance));
}
public LozhanDragonsLegacy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.DRAGON);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(4);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast an Adventure spell or Dragon spell, Lozhan, Dragons' Legacy deals damage equal to that spell's mana value to any target that isn't a commander.
Ability ability = new SpellCastControllerTriggeredAbility(
new DamageTargetEffect(LozhanDragonsLegacyValue.instance), filter, false
);
ability.addTarget(new TargetAnyTarget(filter2));
this.addAbility(ability);
}
private LozhanDragonsLegacy(final LozhanDragonsLegacy card) {
super(card);
}
@Override
public LozhanDragonsLegacy copy() {
return new LozhanDragonsLegacy(this);
}
}
enum LozhanDragonsLegacyValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return Optional.of(effect.getValue("spellCast"))
.map(Spell.class::cast)
.filter(Objects::nonNull)
.map(Spell::getManaValue)
.orElse(0);
}
@Override
public LozhanDragonsLegacyValue copy() {
return this;
}
@Override
public String getMessage() {
return "that spells' mana value";
}
@Override
public String toString() {
return "1";
}
}

View file

@ -109,6 +109,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Legion Loyalty", 31, Rarity.MYTHIC, mage.cards.l.LegionLoyalty.class));
cards.add(new SetCardInfo("Lightning Bolt", 187, Rarity.COMMON, mage.cards.l.LightningBolt.class));
cards.add(new SetCardInfo("Livaan, Cultist of Tiamat", 188, Rarity.UNCOMMON, mage.cards.l.LivaanCultistOfTiamat.class));
cards.add(new SetCardInfo("Lozhan, Dragons' Legacy", 281, Rarity.UNCOMMON, mage.cards.l.LozhanDragonsLegacy.class));
cards.add(new SetCardInfo("Lulu, Loyal Hollyphant", 32, Rarity.UNCOMMON, mage.cards.l.LuluLoyalHollyphant.class));
cards.add(new SetCardInfo("Luxury Suite", 355, Rarity.RARE, mage.cards.l.LuxurySuite.class));
cards.add(new SetCardInfo("Mahadi, Emporium Master", 282, Rarity.UNCOMMON, mage.cards.m.MahadiEmporiumMaster.class));