Implemented Serra the Benevolent

This commit is contained in:
Evan Kranzler 2019-03-01 19:41:57 -05:00
parent 11f3dc79fc
commit 1724a13f44
4 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,59 @@
package mage.cards.s;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.command.emblems.SerraTheBenevolentEmblem;
import mage.game.permanent.token.AngelVigilanceToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SerraTheBenevolent extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("Creatures you control with flying");
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public SerraTheBenevolent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.SERRA);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4));
// +2: Creatures you control with flying get +1/+1 until end of turn.
this.addAbility(new LoyaltyAbility(new BoostControlledEffect(1, 1, Duration.EndOfTurn, filter), 2));
// -3: Create a 4/4 white Angel creature token with flying and vigilance.
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new AngelVigilanceToken()), -3));
// -6: You get an emblem with "If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new SerraTheBenevolentEmblem()), -6));
}
private SerraTheBenevolent(final SerraTheBenevolent card) {
super(card);
}
@Override
public SerraTheBenevolent copy() {
return new SerraTheBenevolent(this);
}
}

View file

@ -1,6 +1,7 @@
package mage.sets;
import mage.cards.ExpansionSet;
import mage.constants.Rarity;
import mage.constants.SetType;
/**
@ -26,6 +27,7 @@ public final class ModernHorizons extends ExpansionSet {
this.numBoosterRare = 1;
this.ratioBoosterMythic = 8;
cards.add(new SetCardInfo("Serra the Benevolent", 26, Rarity.MYTHIC, mage.cards.s.SerraTheBenevolent.class));
}
}

View file

@ -404,6 +404,7 @@ public enum SubType {
SAHEELI("Saheeli", SubTypeSet.PlaneswalkerType),
SAMUT("Samut", SubTypeSet.PlaneswalkerType),
SARKHAN("Sarkhan", SubTypeSet.PlaneswalkerType),
SERRA("Serra", SubTypeSet.PlaneswalkerType),
SIDIOUS("Sidious", SubTypeSet.PlaneswalkerType, true), // Star Wars
SORIN("Sorin", SubTypeSet.PlaneswalkerType),
TAMIYO("Tamiyo", SubTypeSet.PlaneswalkerType),

View file

@ -0,0 +1,73 @@
package mage.game.command.emblems;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
* @author TheElk801
*/
public final class SerraTheBenevolentEmblem extends Emblem {
// -6: You get an emblem with "If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead."
public SerraTheBenevolentEmblem() {
this.setName("Emblem Serra");
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new SerraTheBenevolentEmblemEffect()));
}
}
class SerraTheBenevolentEmblemEffect extends ReplacementEffectImpl {
SerraTheBenevolentEmblemEffect() {
super(Duration.Custom, Outcome.Benefit);
staticText = "If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead";
}
private SerraTheBenevolentEmblemEffect(final SerraTheBenevolentEmblemEffect effect) {
super(effect);
}
@Override
public SerraTheBenevolentEmblemEffect copy() {
return new SerraTheBenevolentEmblemEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (source.isControlledBy(event.getPlayerId())) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& (controller.getLife() - event.getAmount()) < 1
&& game.getBattlefield().count(
StaticFilters.FILTER_CONTROLLED_CREATURE,
source.getSourceId(), event.getPlayerId(), game) > 0
) {
event.setAmount(controller.getLife() - 1);
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return false;
}
}