diff --git a/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java b/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java new file mode 100644 index 00000000000..e56829c19b6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java @@ -0,0 +1,93 @@ +package mage.cards.b; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.constants.SubType; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.counters.Counters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author TheElk801 + */ +public final class BogardanPhoenix extends CardImpl { + + public BogardanPhoenix(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}{R}"); + + this.subtype.add(SubType.PHOENIX); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Bogardan Phoenix dies, exile it if it had a death counter on it. Otherwise, return it to the battlefield under your control and put a death counter on it. + this.addAbility(new DiesTriggeredAbility(new BogardanPhoenixEffect(), false)); + } + + public BogardanPhoenix(final BogardanPhoenix card) { + super(card); + } + + @Override + public BogardanPhoenix copy() { + return new BogardanPhoenix(this); + } +} + +class BogardanPhoenixEffect extends OneShotEffect { + + public BogardanPhoenixEffect() { + super(Outcome.Benefit); + this.staticText = "exile it if it had a death counter on it. " + + "Otherwise, return it to the battlefield under your control " + + "and put a death counter on it."; + } + + public BogardanPhoenixEffect(final BogardanPhoenixEffect effect) { + super(effect); + } + + @Override + public BogardanPhoenixEffect copy() { + return new BogardanPhoenixEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + Player controller = game.getPlayer(source.getControllerId()); + if (permanent == null + || controller == null + || permanent.getZoneChangeCounter(game) + 1 + != source.getSourceObjectZoneChangeCounter()) { + return false; + } + Card card = game.getCard(permanent.getId()); + if (card == null || card.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter()) { + return false; + } + if (permanent.getCounters(game).containsKey(CounterType.DEATH)) { + return controller.moveCards(card, Zone.EXILED, source, game); + } else { + Counters countersToAdd = new Counters(); + countersToAdd.addCounter(CounterType.DEATH.createInstance()); + game.setEnterWithCounters(source.getSourceId(), countersToAdd); + return controller.moveCards(card, Zone.BATTLEFIELD, source, game); + } + } +} diff --git a/Mage.Sets/src/mage/sets/Visions.java b/Mage.Sets/src/mage/sets/Visions.java index d2bfc1318e1..d06d7129f73 100644 --- a/Mage.Sets/src/mage/sets/Visions.java +++ b/Mage.Sets/src/mage/sets/Visions.java @@ -34,6 +34,7 @@ public final class Visions extends ExpansionSet { cards.add(new SetCardInfo("Army Ants", 126, Rarity.UNCOMMON, mage.cards.a.ArmyAnts.class)); cards.add(new SetCardInfo("Betrayal", 26, Rarity.COMMON, mage.cards.b.Betrayal.class)); cards.add(new SetCardInfo("Blanket of Night", 52, Rarity.UNCOMMON, mage.cards.b.BlanketOfNight.class)); + cards.add(new SetCardInfo("Bogardan Phoenix", 76, Rarity.RARE, mage.cards.b.BogardanPhoenix.class)); cards.add(new SetCardInfo("Brass-Talon Chimera", 142, Rarity.UNCOMMON, mage.cards.b.BrassTalonChimera.class)); cards.add(new SetCardInfo("Breathstealer's Crypt", 127, Rarity.RARE, mage.cards.b.BreathstealersCrypt.class)); cards.add(new SetCardInfo("Breezekeeper", 27, Rarity.COMMON, mage.cards.b.Breezekeeper.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index b859ad613bf..d671afc263a 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -25,6 +25,7 @@ public enum CounterType { CRYSTAL("crystal"), CUBE("cube"), CURRENCY("currency"), + DEATH("death"), DELAY("delay"), DEPLETION("depletion"), DESPAIR("despair"),