[FIN] Implement Retrieve the Esper

This commit is contained in:
theelk801 2025-05-14 21:28:10 -04:00
parent 83886b8f65
commit 181a3306a6
3 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.condition.common.CastFromGraveyardSourceCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.token.RobotBlueToken;
import mage.game.permanent.token.Token;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RetrieveTheEsper extends CardImpl {
public RetrieveTheEsper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}");
// Create a 3/3 blue Robot Warrior artifact creature token. Then if this spell was cast from a graveyard, put two +1/+1 counters on that token.
this.getSpellAbility().addEffect(new RetrieveTheEsperEffect());
// Flashback {5}{U}
this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{5}{U}")));
}
private RetrieveTheEsper(final RetrieveTheEsper card) {
super(card);
}
@Override
public RetrieveTheEsper copy() {
return new RetrieveTheEsper(this);
}
}
class RetrieveTheEsperEffect extends OneShotEffect {
RetrieveTheEsperEffect() {
super(Outcome.Benefit);
staticText = "create a 3/3 blue Robot Warrior artifact creature token. " +
"Then if this spell was cast from a graveyard, put two +1/+1 counters on that token";
}
private RetrieveTheEsperEffect(final RetrieveTheEsperEffect effect) {
super(effect);
}
@Override
public RetrieveTheEsperEffect copy() {
return new RetrieveTheEsperEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Token token = new RobotBlueToken();
token.putOntoBattlefield(1, game, source);
if (!CastFromGraveyardSourceCondition.instance.apply(game, source)) {
return true;
}
for (UUID tokenId : token.getLastAddedTokenIds()) {
Optional.ofNullable(tokenId)
.map(game::getPermanent)
.ifPresent(permanent -> permanent.addCounters(
CounterType.P1P1.createInstance(2), source, game
));
}
return true;
}
}

View file

@ -173,6 +173,7 @@ public final class FinalFantasy extends ExpansionSet {
cards.add(new SetCardInfo("Ragnarok, Divine Deliverance", "446b", Rarity.UNCOMMON, mage.cards.r.RagnarokDivineDeliverance.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ragnarok, Divine Deliverance", "526b", Rarity.UNCOMMON, mage.cards.r.RagnarokDivineDeliverance.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ragnarok, Divine Deliverance", "99b", Rarity.UNCOMMON, mage.cards.r.RagnarokDivineDeliverance.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Retrieve the Esper", 68, Rarity.COMMON, mage.cards.r.RetrieveTheEsper.class));
cards.add(new SetCardInfo("Rinoa Heartilly", 237, Rarity.UNCOMMON, mage.cards.r.RinoaHeartilly.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Rinoa Heartilly", 502, Rarity.UNCOMMON, mage.cards.r.RinoaHeartilly.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Rosa, Resolute White Mage", 431, Rarity.RARE, mage.cards.r.RosaResoluteWhiteMage.class, NON_FULL_USE_VARIOUS));

View file

@ -0,0 +1,29 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author TheElk801
*/
public final class RobotBlueToken extends TokenImpl {
public RobotBlueToken() {
super("Robot Token", "3/3 blue Robot Warrior artifact creature token");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add(SubType.ROBOT);
power = new MageInt(3);
toughness = new MageInt(3);
}
private RobotBlueToken(final RobotBlueToken token) {
super(token);
}
public RobotBlueToken copy() {
return new RobotBlueToken(this);
}
}