Implemented Ajani, Strength of the Pride

This commit is contained in:
Evan Kranzler 2019-06-19 21:10:33 -04:00
parent 3835e28a18
commit 8ef3ebfc3c
3 changed files with 161 additions and 0 deletions

View file

@ -0,0 +1,123 @@
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ExileAllEffect;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.token.AjanisPridemateToken;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AjaniStrengthOfThePride extends CardImpl {
public AjaniStrengthOfThePride(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.AJANI);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5));
// +1: You gain life equal to the number of creatures you control plus the number of planeswalkers you control.
this.addAbility(new LoyaltyAbility(new GainLifeEffect(
AjaniStrengthOfThePrideValue.instance, "You gain life equal to " +
"the number of creatures you control plus the number of planeswalkers you control."
), 1));
// 2: Create a 2/2 white Cat Soldier creature token named Ajani's Pridemate with "Whenever you gain life, put a +1/+1 counter on Ajani's Pridemate."
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new AjanisPridemateToken()), -2));
// 0: If you have at least 15 life more than your starting life total, exile Ajani, Strength of the Pride and each artifact and creature your opponents control.
this.addAbility(new LoyaltyAbility(new AjaniStrengthOfThePrideEffect(), 0));
}
private AjaniStrengthOfThePride(final AjaniStrengthOfThePride card) {
super(card);
}
@Override
public AjaniStrengthOfThePride copy() {
return new AjaniStrengthOfThePride(this);
}
}
enum AjaniStrengthOfThePrideValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return game.getBattlefield().getAllActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURE,
sourceAbility.getControllerId(), game
).size() + game.getBattlefield().getAllActivePermanents(
StaticFilters.FILTER_PERMANENT_PLANESWALKER,
sourceAbility.getControllerId(), game
).size();
}
@Override
public DynamicValue copy() {
return instance;
}
@Override
public String getMessage() {
return "";
}
}
class AjaniStrengthOfThePrideEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE)
));
}
AjaniStrengthOfThePrideEffect() {
super(Outcome.Benefit);
staticText = "If you have at least 15 life more than your starting life total, " +
"exile {this} and each artifact and creature your opponents control.";
}
private AjaniStrengthOfThePrideEffect(final AjaniStrengthOfThePrideEffect effect) {
super(effect);
}
@Override
public AjaniStrengthOfThePrideEffect copy() {
return new AjaniStrengthOfThePrideEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getLife() < game.getLife() + 15) {
return false;
}
new ExileSourceEffect().apply(game, source);
return new ExileAllEffect(filter).apply(game, source);
}
}

View file

@ -27,6 +27,7 @@ public final class CoreSet2020 extends ExpansionSet {
this.ratioBoosterMythic = 8;
this.maxCardNumberInBooster = 280;
cards.add(new SetCardInfo("Ajani, Strength of the Pride", 2, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class));
cards.add(new SetCardInfo("Angel of Vitality", 4, Rarity.UNCOMMON, mage.cards.a.AngelOfVitality.class));
cards.add(new SetCardInfo("Atemsis, All-Seeing", 46, Rarity.RARE, mage.cards.a.AtemsisAllSeeing.class));
cards.add(new SetCardInfo("Barkhide Troll", 165, Rarity.UNCOMMON, mage.cards.b.BarkhideTroll.class));

View file

@ -0,0 +1,37 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.common.GainLifeControllerTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
/**
* @author LoneFox
*/
public final class AjanisPridemateToken extends TokenImpl {
public AjanisPridemateToken() {
super("Ajani's Pridemate", "2/2 white Cat Soldier creature token named Ajani's Pridemate with \"Whenever you gain life, put a +1/+1 counter on Ajani's Pridemate.\"");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add(SubType.CAT);
subtype.add(SubType.SOLDIER);
power = new MageInt(2);
toughness = new MageInt(2);
this.addAbility(new GainLifeControllerTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false
));
}
public AjanisPridemateToken(final AjanisPridemateToken token) {
super(token);
}
public AjanisPridemateToken copy() {
return new AjanisPridemateToken(this);
}
}