[KHM] Implemented Ascendant Spirit

This commit is contained in:
Evan Kranzler 2021-01-16 12:28:01 -05:00
parent 4e66d4877c
commit bc464c5ed4
5 changed files with 354 additions and 180 deletions

View file

@ -0,0 +1,128 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.AddCardSubTypeSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AscendantSpirit extends CardImpl {
public AscendantSpirit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}");
this.addSuperType(SuperType.SNOW);
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {S}{S}: Ascendant Spirit becomes a Spirit Warrior with base power and toughness 2/3.
Ability ability = new SimpleActivatedAbility(new AddCardSubTypeSourceEffect(
Duration.Custom, SubType.SPIRIT, SubType.WARRIOR
).setText("{this} becomes a Spirit Warrior"), new ManaCostsImpl("{S}{S}"));
ability.addEffect(new SetPowerToughnessSourceEffect(
2, 3, Duration.Custom, SubLayer.SetPT_7b
).setText("with base power and toughness 2/3"));
this.addAbility(ability);
// {S}{S}{S}: If Ascendant Spirit is a Warrior, put a flying counter on it and it becomes a Spirit Warrior Angel with base power and toughness 4/4.
this.addAbility(new SimpleActivatedAbility(
new AscendantSpiritWarriorEffect(), new ManaCostsImpl("{S}{S}{S}")
));
// {S}{S}{S}{S}: If Ascendant Spirit is an Angel, put two +1/+1 counters on it and it gains "Whenever this creature deals damage to a player, draw a card."
this.addAbility(new SimpleActivatedAbility(
new AscendantSpiritAngelEffect(), new ManaCostsImpl("{S}{S}{S}{S}")
));
}
private AscendantSpirit(final AscendantSpirit card) {
super(card);
}
@Override
public AscendantSpirit copy() {
return new AscendantSpirit(this);
}
}
class AscendantSpiritWarriorEffect extends OneShotEffect {
AscendantSpiritWarriorEffect() {
super(Outcome.Benefit);
staticText = "if {this} is a Warrior, put a flying counter on it " +
"and it becomes a Spirit Warrior Angel with base power and toughness 4/4";
}
private AscendantSpiritWarriorEffect(final AscendantSpiritWarriorEffect effect) {
super(effect);
}
@Override
public AscendantSpiritWarriorEffect copy() {
return new AscendantSpiritWarriorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null || !permanent.hasSubtype(SubType.WARRIOR, game)) {
return false;
}
permanent.addCounters(CounterType.FLYING.createInstance(), source, game);
game.addEffect(new AddCardSubTypeSourceEffect(
Duration.Custom, SubType.SPIRIT, SubType.WARRIOR, SubType.ANGEL
), source);
game.addEffect(new SetPowerToughnessSourceEffect(
4, 4, Duration.Custom, SubLayer.SetPT_7b
), source);
return true;
}
}
class AscendantSpiritAngelEffect extends OneShotEffect {
AscendantSpiritAngelEffect() {
super(Outcome.Benefit);
staticText = "if {this} is an Angel, put two +1/+1 counters on it and it gains " +
"\"Whenever this creature deals damage to a player, draw a card.\"";
}
private AscendantSpiritAngelEffect(final AscendantSpiritAngelEffect effect) {
super(effect);
}
@Override
public AscendantSpiritAngelEffect copy() {
return new AscendantSpiritAngelEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null || !permanent.hasSubtype(SubType.ANGEL, game)) {
return false;
}
permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
game.addEffect(new GainAbilitySourceEffect(new DealsCombatDamageToAPlayerTriggeredAbility(
new DrawCardSourceControllerEffect(1), false
), Duration.Custom), source);
return true;
}
}

View file

@ -1,71 +1,56 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.common.continuous.AddCardSubTypeSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration; import mage.game.Game;
import mage.constants.SubType; import mage.game.permanent.Permanent;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import java.util.UUID;
import mage.game.permanent.token.TokenImpl;
/** /**
* * @author TheElk801
* @author LevelX2
*/ */
public final class FigureOfDestiny extends CardImpl { public final class FigureOfDestiny extends CardImpl {
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent();
private static final FilterCreaturePermanent filter3 = new FilterCreaturePermanent();
static {
filter2.add(SubType.SPIRIT.getPredicate());
filter3.add(SubType.WARRIOR.getPredicate());
}
public FigureOfDestiny(UUID ownerId, CardSetInfo setInfo) { public FigureOfDestiny(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R/W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R/W}");
this.subtype.add(SubType.KITHKIN); this.subtype.add(SubType.KITHKIN);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {RW}: Figure of Destiny becomes a Kithkin Spirit with base power and toughness 2/2. // {RW}: Figure of Destiny becomes a Kithkin Spirit with base power and toughness 2/2.
this.addAbility(new SimpleActivatedAbility( Ability ability = new SimpleActivatedAbility(new AddCardSubTypeSourceEffect(
Zone.BATTLEFIELD, Duration.Custom, SubType.KITHKIN, SubType.SPIRIT
new BecomesCreatureSourceEffect(new FigureOfDestiny.FigureOfDestinyToken1(), "", Duration.Custom), ).setText("{this} becomes a Kithkin Spirit"), new ManaCostsImpl("{R/W}"));
new ManaCostsImpl("{R/W}"))); ability.addEffect(new SetPowerToughnessSourceEffect(
2, 2, Duration.Custom, SubLayer.SetPT_7b
).setText("with base power and toughness 2/2"));
this.addAbility(ability);
// {RW}{RW}{RW}: If Figure of Destiny is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4. // {RW}{RW}{RW}: If Figure of Destiny is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD, new FigureOfDestinySpiritEffect(), new ManaCostsImpl("{R/W}{R/W}{R/W}")
new ConditionalContinuousEffect( ));
new BecomesCreatureSourceEffect(new FigureOfDestiny.FigureOfDestinyToken2(), "", Duration.Custom),
new LockedInCondition(new SourceMatchesFilterCondition(filter2)),
"If {this} is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4"),
new ManaCostsImpl("{R/W}{R/W}{R/W}")
));
// {RW}{RW}{RW}{RW}{RW}{RW}: If Figure of Destiny is a Warrior, it becomes a Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike. // {RW}{RW}{RW}{RW}{RW}{RW}: If Figure of Destiny is a Warrior, it becomes a Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD, new FigureOfDestinyWarriorEffect(), new ManaCostsImpl("{R/W}{R/W}{R/W}{R/W}{R/W}{R/W}")
new ConditionalContinuousEffect( ));
new BecomesCreatureSourceEffect(new FigureOfDestiny.FigureOfDestinyToken3(), "", Duration.Custom),
new LockedInCondition(new SourceMatchesFilterCondition(filter3)),
"If {this} is a Warrior, it becomes a Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike"),
new ManaCostsImpl("{R/W}{R/W}{R/W}{R/W}{R/W}{R/W}")
));
} }
public FigureOfDestiny(final FigureOfDestiny card) { private FigureOfDestiny(final FigureOfDestiny card) {
super(card); super(card);
} }
@ -73,78 +58,75 @@ public final class FigureOfDestiny extends CardImpl {
public FigureOfDestiny copy() { public FigureOfDestiny copy() {
return new FigureOfDestiny(this); return new FigureOfDestiny(this);
} }
}
private class FigureOfDestinyToken1 extends TokenImpl { class FigureOfDestinySpiritEffect extends OneShotEffect {
public FigureOfDestinyToken1() { FigureOfDestinySpiritEffect() {
super("Figure of Destiny", "Kithkin Spirit with base power and toughness 2/2"); super(Outcome.Benefit);
this.cardType.add(CardType.CREATURE); staticText = "if {this} is a Spirit, it becomes a Kithkin Spirit Warrior with base power and toughness 4/4";
this.subtype.add(SubType.KITHKIN);
this.subtype.add(SubType.SPIRIT);
this.color.setRed(true);
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
}
public FigureOfDestinyToken1(final FigureOfDestinyToken1 token) {
super(token);
}
public FigureOfDestinyToken1 copy() {
return new FigureOfDestinyToken1(this);
}
} }
private class FigureOfDestinyToken2 extends TokenImpl { private FigureOfDestinySpiritEffect(final FigureOfDestinySpiritEffect effect) {
super(effect);
public FigureOfDestinyToken2() {
super("Figure of Destiny", "Kithkin Spirit Warrior with base power and toughness 4/4");
this.cardType.add(CardType.CREATURE);
this.subtype.add(SubType.KITHKIN);
this.subtype.add(SubType.SPIRIT);
this.subtype.add(SubType.WARRIOR);
this.color.setRed(true);
this.color.setWhite(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
}
public FigureOfDestinyToken2(final FigureOfDestinyToken2 token) {
super(token);
}
public FigureOfDestinyToken2 copy() {
return new FigureOfDestinyToken2(this);
}
} }
private class FigureOfDestinyToken3 extends TokenImpl { @Override
public FigureOfDestinySpiritEffect copy() {
return new FigureOfDestinySpiritEffect(this);
}
public FigureOfDestinyToken3() { @Override
super("Figure of Destiny", "Kithkin Spirit Warrior Avatar with base power and toughness 8/8, flying, and first strike"); public boolean apply(Game game, Ability source) {
this.cardType.add(CardType.CREATURE); Permanent permanent = source.getSourcePermanentIfItStillExists(game);
this.subtype.add(SubType.KITHKIN); if (permanent == null || !permanent.hasSubtype(SubType.SPIRIT, game)) {
this.subtype.add(SubType.SPIRIT); return false;
this.subtype.add(SubType.WARRIOR);
this.subtype.add(SubType.AVATAR);
this.color.setRed(true);
this.color.setWhite(true);
this.power = new MageInt(8);
this.toughness = new MageInt(8);
this.addAbility(FlyingAbility.getInstance());
this.addAbility(FirstStrikeAbility.getInstance());
}
public FigureOfDestinyToken3(final FigureOfDestinyToken3 token) {
super(token);
}
public FigureOfDestinyToken3 copy() {
return new FigureOfDestinyToken3(this);
} }
game.addEffect(new AddCardSubTypeSourceEffect(
Duration.Custom, SubType.KITHKIN, SubType.SPIRIT, SubType.WARRIOR
), source);
game.addEffect(new SetPowerToughnessSourceEffect(
4, 4, Duration.Custom, SubLayer.SetPT_7b
), source);
return true;
}
}
class FigureOfDestinyWarriorEffect extends OneShotEffect {
FigureOfDestinyWarriorEffect() {
super(Outcome.Benefit);
staticText = "if {this} is a Warrior, it becomes a Kithkin Spirit Warrior Avatar " +
"with base power and toughness 8/8, flying, and first strike";
}
private FigureOfDestinyWarriorEffect(final FigureOfDestinyWarriorEffect effect) {
super(effect);
}
@Override
public FigureOfDestinyWarriorEffect copy() {
return new FigureOfDestinyWarriorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null || !permanent.hasSubtype(SubType.WARRIOR, game)) {
return false;
}
game.addEffect(new AddCardSubTypeSourceEffect(
Duration.Custom, SubType.KITHKIN, SubType.SPIRIT, SubType.WARRIOR, SubType.AVATAR
), source);
game.addEffect(new SetPowerToughnessSourceEffect(
8, 8, Duration.Custom, SubLayer.SetPT_7b
), source);
game.addEffect(new GainAbilitySourceEffect(
FlyingAbility.getInstance(), Duration.Custom
), source);
game.addEffect(new GainAbilitySourceEffect(
FirstStrikeAbility.getInstance(), Duration.Custom
), source);
return true;
} }
} }

View file

@ -1,76 +1,67 @@
package mage.cards.w; package mage.cards.w;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition; import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.AddCardSubTypeSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.FilterPermanent;
import mage.game.permanent.token.TokenImpl; import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
* * @author TheElk801
* @author LevelX2
*/ */
public final class WardenOfTheFirstTree extends CardImpl { public final class WardenOfTheFirstTree extends CardImpl {
private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent(); private static final FilterPermanent filter = new FilterPermanent(SubType.SPIRIT, "");
private static final FilterCreaturePermanent FILTER2 = new FilterCreaturePermanent(); private static final Condition condition = new SourceMatchesFilterCondition(filter);
static {
FILTER.add(SubType.WARRIOR.getPredicate());
FILTER2.add(SubType.SPIRIT.getPredicate());
}
public WardenOfTheFirstTree(UUID ownerId, CardSetInfo setInfo) { public WardenOfTheFirstTree(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {1}{W/B}: Warden of the First Tree becomes a Human Warrior with base power and toughness 3/3. // {1}{W/B}: Warden of the First Tree becomes a Human Warrior with base power and toughness 3/3.
this.addAbility(new SimpleActivatedAbility( Ability ability = new SimpleActivatedAbility(new AddCardSubTypeSourceEffect(
Zone.BATTLEFIELD, Duration.Custom, SubType.HUMAN, SubType.WARRIOR
new BecomesCreatureSourceEffect(new WardenOfTheFirstTree1(), "", Duration.Custom), ).setText("{this} becomes a Human Warrior"), new ManaCostsImpl("{1}{W/B}"));
new ManaCostsImpl("{1}{W/B}"))); ability.addEffect(new SetPowerToughnessSourceEffect(
3, 3, Duration.Custom, SubLayer.SetPT_7b
).setText("with base power and toughness 3/3"));
this.addAbility(ability);
// {2}{W/B}{W/B}: If Warden of the First Tree is a Warrior, it becomes a Human Spirit Warrior with trample and lifelink. // {2}{W/B}{W/B}: If Warden of the First Tree is a Warrior, it becomes a Human Spirit Warrior with trample and lifelink.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD, new WardenOfTheFirstTreeEffect(), new ManaCostsImpl("{2}{W/B}{W/B}")
new ConditionalContinuousEffect(
new BecomesCreatureSourceEffect(new WardenOfTheFirstTree2(), "", Duration.Custom),
new LockedInCondition(new SourceMatchesFilterCondition(FILTER)),
"If {this} is a Warrior, it becomes a Human Spirit Warrior with trample and lifelink"),
new ManaCostsImpl("{2}{W/B}{W/B}")
)); ));
// {3}{W/B}{W/B}{W/B}: If Warden of the First Tree is a Spirit, put five +1/+1 counters on it. // {3}{W/B}{W/B}{W/B}: If Warden of the First Tree is a Spirit, put five +1/+1 counters on it.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new ConditionalOneShotEffect( new ConditionalOneShotEffect(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(5)), new AddCountersSourceEffect(CounterType.P1P1.createInstance(5)),
new SourceMatchesFilterCondition(FILTER2), condition, "If {this} is a Spirit, put five +1/+1 counters on it"
"If {this} is a Spirit, put five +1/+1 counters on it"), ), new ManaCostsImpl("{3}{W/B}{W/B}{W/B}")
new ManaCostsImpl("{3}{W/B}{W/B}{W/B}")
)); ));
} }
public WardenOfTheFirstTree(final WardenOfTheFirstTree card) { private WardenOfTheFirstTree(final WardenOfTheFirstTree card) {
super(card); super(card);
} }
@ -80,46 +71,37 @@ public final class WardenOfTheFirstTree extends CardImpl {
} }
} }
class WardenOfTheFirstTree1 extends TokenImpl { class WardenOfTheFirstTreeEffect extends OneShotEffect {
public WardenOfTheFirstTree1() { WardenOfTheFirstTreeEffect() {
super("Warden of the First Tree", "Human Warrior with base power and toughness 3/3"); super(Outcome.Benefit);
this.cardType.add(CardType.CREATURE); staticText = "if {this} is a Warrior, it becomes a Human Spirit Warrior with trample and lifelink";
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
}
public WardenOfTheFirstTree1(final WardenOfTheFirstTree1 token) {
super(token);
} }
public WardenOfTheFirstTree1 copy() { private WardenOfTheFirstTreeEffect(final WardenOfTheFirstTreeEffect effect) {
return new WardenOfTheFirstTree1(this); super(effect);
} }
}
@Override
class WardenOfTheFirstTree2 extends TokenImpl { public WardenOfTheFirstTreeEffect copy() {
return new WardenOfTheFirstTreeEffect(this);
public WardenOfTheFirstTree2() { }
super("Warden of the First Tree", "Human Spirit Warrior with trample and lifelink");
this.cardType.add(CardType.CREATURE); @Override
this.subtype.add(SubType.HUMAN); public boolean apply(Game game, Ability source) {
this.subtype.add(SubType.SPIRIT); Permanent permanent = source.getSourcePermanentIfItStillExists(game);
this.subtype.add(SubType.WARRIOR); if (permanent == null || !permanent.hasSubtype(SubType.WARRIOR, game)) {
return false;
this.power = new MageInt(3); }
this.toughness = new MageInt(3); game.addEffect(new AddCardSubTypeSourceEffect(
Duration.Custom, SubType.HUMAN, SubType.SPIRIT, SubType.WARRIOR
this.addAbility(TrampleAbility.getInstance()); ), source);
this.addAbility(LifelinkAbility.getInstance()); game.addEffect(new GainAbilitySourceEffect(
} TrampleAbility.getInstance(), Duration.Custom
public WardenOfTheFirstTree2(final WardenOfTheFirstTree2 token) { ), source);
super(token); game.addEffect(new GainAbilitySourceEffect(
} LifelinkAbility.getInstance(), Duration.Custom
), source);
public WardenOfTheFirstTree2 copy() { return true;
return new WardenOfTheFirstTree2(this);
} }
} }

View file

@ -71,6 +71,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Arctic Treeline", 249, Rarity.COMMON, mage.cards.a.ArcticTreeline.class)); cards.add(new SetCardInfo("Arctic Treeline", 249, Rarity.COMMON, mage.cards.a.ArcticTreeline.class));
cards.add(new SetCardInfo("Armed and Armored", 379, Rarity.UNCOMMON, mage.cards.a.ArmedAndArmored.class)); cards.add(new SetCardInfo("Armed and Armored", 379, Rarity.UNCOMMON, mage.cards.a.ArmedAndArmored.class));
cards.add(new SetCardInfo("Arni Slays the Troll", 201, Rarity.UNCOMMON, mage.cards.a.ArniSlaysTheTroll.class)); cards.add(new SetCardInfo("Arni Slays the Troll", 201, Rarity.UNCOMMON, mage.cards.a.ArniSlaysTheTroll.class));
cards.add(new SetCardInfo("Ascendant Spirit", 43, Rarity.RARE, mage.cards.a.AscendantSpirit.class));
cards.add(new SetCardInfo("Augury Raven", 44, Rarity.COMMON, mage.cards.a.AuguryRaven.class)); cards.add(new SetCardInfo("Augury Raven", 44, Rarity.COMMON, mage.cards.a.AuguryRaven.class));
cards.add(new SetCardInfo("Avalanche Caller", 45, Rarity.UNCOMMON, mage.cards.a.AvalancheCaller.class)); cards.add(new SetCardInfo("Avalanche Caller", 45, Rarity.UNCOMMON, mage.cards.a.AvalancheCaller.class));
cards.add(new SetCardInfo("Axgard Armory", 250, Rarity.UNCOMMON, mage.cards.a.AxgardArmory.class)); cards.add(new SetCardInfo("Axgard Armory", 250, Rarity.UNCOMMON, mage.cards.a.AxgardArmory.class));

View file

@ -0,0 +1,81 @@
package mage.abilities.effects.common.continuous;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* @author TheElk801
*/
public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
private final List<SubType> addedSubTypes = new ArrayList<>();
public AddCardSubTypeSourceEffect(Duration duration, SubType... addedSubType) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
for (SubType cardType : addedSubType) {
this.addedSubTypes.add(cardType);
}
}
private AddCardSubTypeSourceEffect(final AddCardSubTypeSourceEffect effect) {
super(effect);
this.addedSubTypes.addAll(effect.addedSubTypes);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
for (SubType cardType : addedSubTypes) {
permanent.addSubType(game, cardType);
}
return true;
} else if (this.getDuration() == Duration.Custom) {
this.discard();
}
return false;
}
@Override
public AddCardSubTypeSourceEffect copy() {
return new AddCardSubTypeSourceEffect(this);
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
sb.append("{this} becomes ");
boolean article = false;
for (SubType subType : addedSubTypes) {
if (!article) {
if (subType.toString().startsWith("A") || subType.toString().startsWith("E")) {
sb.append("an ");
} else {
sb.append("a ");
}
article = true;
}
sb.append(subType.toString().toLowerCase(Locale.ENGLISH)).append(" ");
}
sb.append(" in addition to its other types ").append(this.getDuration().toString());
return sb.toString();
}
}