Implemented Lena, Selfless Champion

This commit is contained in:
Evan Kranzler 2018-06-20 17:37:49 -04:00
parent af7c9b1796
commit 3ea2e5b099
2 changed files with 111 additions and 0 deletions

View file

@ -0,0 +1,110 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SoldierToken;
/**
*
* @author TheElk801
*/
public final class LenaSelflessChampion extends CardImpl {
private static final FilterControlledCreaturePermanent filter
= new FilterControlledCreaturePermanent("nontoken creature you control");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
public LenaSelflessChampion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.KNIGHT);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Lena, Selfless Champion enters the battlefield, create a 1/1 white Soldier creature token for each nontoken creature you control.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new CreateTokenEffect(
new SoldierToken(),
new PermanentsOnBattlefieldCount(filter)
).setText("create a 1/1 white Soldier creature token "
+ "for each nontoken creature you control")
));
// Sacrifice Lena: Creatures you control with power less than Lena's power gain indestructible until end of turn.
this.addAbility(new SimpleActivatedAbility(
new LenaSelflessChampionEffect(),
new SacrificeSourceCost()
));
}
public LenaSelflessChampion(final LenaSelflessChampion card) {
super(card);
}
@Override
public LenaSelflessChampion copy() {
return new LenaSelflessChampion(this);
}
}
class LenaSelflessChampionEffect extends OneShotEffect {
public LenaSelflessChampionEffect() {
super(Outcome.Benefit);
this.staticText = "Creatures you control with power less than "
+ "{this}'s power gain indestructible until end of turn";
}
public LenaSelflessChampionEffect(final LenaSelflessChampionEffect effect) {
super(effect);
}
@Override
public LenaSelflessChampionEffect copy() {
return new LenaSelflessChampionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, permanent.getPower().getValue()));
game.addEffect(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(),
Duration.EndOfTurn, filter
), source);
return true;
}
}

View file

@ -120,6 +120,7 @@ public final class CoreSet2019 extends ExpansionSet {
cards.add(new SetCardInfo("Knight's Pledge", 19, Rarity.COMMON, mage.cards.k.KnightsPledge.class));
cards.add(new SetCardInfo("Lathliss, Dragon Queen", 149, Rarity.RARE, mage.cards.l.LathlissDragonQueen.class));
cards.add(new SetCardInfo("Lava Axe", 150, Rarity.COMMON, mage.cards.l.LavaAxe.class));
cards.add(new SetCardInfo("Lena, Selfless Champion", 21, Rarity.RARE, mage.cards.l.LenaSelflessChampion.class));
cards.add(new SetCardInfo("Lich's Caress", 105, Rarity.COMMON, mage.cards.l.LichsCaress.class));
cards.add(new SetCardInfo("Lightning Mare", 151, Rarity.UNCOMMON, mage.cards.l.LightningMare.class));
cards.add(new SetCardInfo("Lightning Strike", 152, Rarity.COMMON, mage.cards.l.LightningStrike.class));