[STX] Implemented Retriever Phoenix

This commit is contained in:
Evan Kranzler 2021-04-07 19:24:41 -04:00
parent dd8e076ed8
commit bea736aa54
4 changed files with 115 additions and 4 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.r;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.LearnEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RetrieverPhoenix extends CardImpl {
public RetrieverPhoenix(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.PHOENIX);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Haste
this.addAbility(HasteAbility.getInstance());
// When Retriever Phoenix enters the battlefield, if you cast it, learn.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new LearnEffect()), CastFromEverywhereSourceCondition.instance,
"When {thi} enters the battlefield, if you cast it, " + LearnEffect.getDefaultText()
));
// As long as Retriever Phoenix is in your graveyard, if you would learn, you may instead return Retriever Phoenix to the battlefield.
this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, new RetrieverPhoenixEffect()));
}
private RetrieverPhoenix(final RetrieverPhoenix card) {
super(card);
}
@Override
public RetrieverPhoenix copy() {
return new RetrieverPhoenix(this);
}
}
class RetrieverPhoenixEffect extends ReplacementEffectImpl {
RetrieverPhoenixEffect() {
super(Duration.WhileInGraveyard, Outcome.PutCreatureInPlay);
staticText = "as long as {this} is in your graveyard, if you would learn, " +
"you may instead return {this} to the battlefield";
}
private RetrieverPhoenixEffect(final RetrieverPhoenixEffect effect) {
super(effect);
}
@Override
public RetrieverPhoenixEffect copy() {
return new RetrieverPhoenixEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
Player player = game.getPlayer(source.getControllerId());
return sourceObject instanceof Card
&& player != null
&& player.chooseUse(outcome, "Return " + sourceObject.getName() + " to the battlefield instead of learning?", source, game)
&& player.moveCards((Card) sourceObject, Zone.BATTLEFIELD, source, game);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LEARN;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.isControlledBy(event.getPlayerId());
}
}

View file

@ -198,6 +198,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Reject", 50, Rarity.COMMON, mage.cards.r.Reject.class));
cards.add(new SetCardInfo("Relic Sloth", 223, Rarity.COMMON, mage.cards.r.RelicSloth.class));
cards.add(new SetCardInfo("Resculpt", 51, Rarity.COMMON, mage.cards.r.Resculpt.class));
cards.add(new SetCardInfo("Retriever Phoenix", 113, Rarity.RARE, mage.cards.r.RetrieverPhoenix.class));
cards.add(new SetCardInfo("Returned Pastcaller", 224, Rarity.UNCOMMON, mage.cards.r.ReturnedPastcaller.class));
cards.add(new SetCardInfo("Rip Apart", 225, Rarity.UNCOMMON, mage.cards.r.RipApart.class));
cards.add(new SetCardInfo("Rise of Extus", 226, Rarity.COMMON, mage.cards.r.RiseOfExtus.class));

View file

@ -7,7 +7,7 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.game.events.GameEvent;
/**
* @author TheElk801
@ -20,10 +20,12 @@ public class LearnEffect extends OneShotEffect {
filter.add(SubType.LESSON.getPredicate());
}
private static final String defaultText = "learn. <i>(You may reveal a Lesson card you own from outside the game " +
"and put it into your hand, or discard a card to draw a card.)</i>";
public LearnEffect() {
super(Outcome.Neutral);
staticText = "learn. <i>(You may reveal a Lesson card you own from outside the game " +
"and put it into your hand, or discard a card to draw a card.)</i>";
staticText = defaultText;
}
private LearnEffect(final LearnEffect effect) {
@ -32,7 +34,12 @@ public class LearnEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (game.replaceEvent(GameEvent.getEvent(
GameEvent.EventType.LEARN, source.getSourceId(),
source, source.getControllerId()
))) {
return false;
}
return new WishEffect(filter, true).apply(game, source)
|| new DoIfCostPaid(
new DrawCardSourceControllerEffect(1), new DiscardCardCost()
@ -43,4 +50,8 @@ public class LearnEffect extends OneShotEffect {
public LearnEffect copy() {
return new LearnEffect(this);
}
public static String getDefaultText() {
return defaultText;
}
}

View file

@ -301,6 +301,7 @@ public class GameEvent implements Serializable {
DIDNT_PAY_CUMULATIVE_UPKEEP,
LIFE_PAID,
CASCADE_LAND,
LEARN,
//permanent events
ENTERS_THE_BATTLEFIELD_SELF, /* 616.1a If any of the replacement and/or prevention effects are self-replacement effects (see rule 614.15),
one of them must be chosen. If not, proceed to rule 616.1b. */