convert final transform card Zenos Yae Galvus

part of #14099
This commit is contained in:
jmlundeen 2025-12-06 09:14:06 -06:00
parent 0f5716d28e
commit b32ff6abe8
3 changed files with 113 additions and 160 deletions

View file

@ -1,137 +0,0 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.WinGameSourceControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetOpponent;
import mage.util.CardUtil;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ShinryuTranscendentRival extends CardImpl {
public ShinryuTranscendentRival(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(8);
this.toughness = new MageInt(8);
this.color.setBlack(true);
this.nightCard = true;
// Flying
this.addAbility(FlyingAbility.getInstance());
// As this creature transforms into Shinryu, choose an opponent.
this.addAbility(new SimpleStaticAbility(new ShinryuTranscendentRivalEffect()));
// Burning Chains -- When the chosen player loses the game, you win the game.
this.addAbility(new ShinryuTranscendentRivalTriggeredAbility());
}
private ShinryuTranscendentRival(final ShinryuTranscendentRival card) {
super(card);
}
@Override
public ShinryuTranscendentRival copy() {
return new ShinryuTranscendentRival(this);
}
}
class ShinryuTranscendentRivalEffect extends ReplacementEffectImpl {
ShinryuTranscendentRivalEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "as this creature transforms into {this}, choose an opponent";
}
private ShinryuTranscendentRivalEffect(final ShinryuTranscendentRivalEffect effect) {
super(effect);
}
@Override
public ShinryuTranscendentRivalEffect copy() {
return new ShinryuTranscendentRivalEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller == null || permanent == null) {
return false;
}
TargetPlayer target = new TargetOpponent(true);
controller.choose(outcome, target, source, game);
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent == null) {
return false;
}
game.informPlayers(permanent.getName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName());
game.getState().setValue(permanent.getId() + "_" + permanent.getZoneChangeCounter(game) + "_opponent", opponent.getId());
permanent.addInfo("chosen opponent", CardUtil.addToolTipMarkTags("Chosen Opponent " + opponent.getLogName()), game);
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TRANSFORMING;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.getSourceId().equals(event.getTargetId())
&& source.getSourcePermanentIfItStillExists(game) != null;
}
}
class ShinryuTranscendentRivalTriggeredAbility extends TriggeredAbilityImpl {
ShinryuTranscendentRivalTriggeredAbility() {
super(Zone.BATTLEFIELD, new WinGameSourceControllerEffect());
this.setTriggerPhrase("When the chosen player loses the game, ");
this.withFlavorWord("Burning Chains");
}
private ShinryuTranscendentRivalTriggeredAbility(final ShinryuTranscendentRivalTriggeredAbility ability) {
super(ability);
}
@Override
public ShinryuTranscendentRivalTriggeredAbility copy() {
return new ShinryuTranscendentRivalTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LOST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int zcc = game.getState().getZoneChangeCounter(this.getSourceId());
return Optional
.of(this.getSourceId() + "_" + zcc + "_opponent")
.map(game.getState()::getValue)
.map(event.getPlayerId()::equals)
.orElse(false);
}
}

View file

@ -1,27 +1,31 @@
package mage.cards.z;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.ChooseCreatureEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.effects.common.WinGameSourceControllerEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.TransformingDoubleFacedCard;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetOpponent;
import mage.util.CardUtil;
import java.util.Optional;
@ -30,7 +34,7 @@ import java.util.UUID;
/**
* @author TheElk801
*/
public final class ZenosYaeGalvus extends CardImpl {
public final class ZenosYaeGalvus extends TransformingDoubleFacedCard {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
private static final FilterPermanent filter2 = new FilterPermanent();
@ -41,15 +45,14 @@ public final class ZenosYaeGalvus extends CardImpl {
}
public ZenosYaeGalvus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
super(ownerId, setInfo,
new SuperType[]{SuperType.LEGENDARY}, new CardType[]{CardType.CREATURE}, new SubType[]{SubType.HUMAN, SubType.NOBLE, SubType.WARRIOR}, "{3}{B}{B}",
"Shinryu, Transcendent Rival",
new SuperType[]{SuperType.LEGENDARY}, new CardType[]{CardType.CREATURE}, new SubType[]{SubType.DRAGON}, "B"
);
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.NOBLE);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
this.secondSideCardClazz = mage.cards.s.ShinryuTranscendentRival.class;
// Zenos yae Galvus
this.getLeftHalfCard().setPT(4, 4);
// My First Friend -- When Zenos yae Galvus enters, choose a creature an opponent controls. Until end of turn, creatures other than Zenos yae Galvus and the chosen creature get -2/-2.
Ability ability = new EntersBattlefieldTriggeredAbility(
@ -58,13 +61,24 @@ public final class ZenosYaeGalvus extends CardImpl {
ability.addEffect(new BoostAllEffect(
-2, -2, Duration.EndOfTurn, filter, true
).setText("until end of turn, creatures other than {this} and the chosen creature get -2/-2"));
this.addAbility(ability.withFlavorWord("My First Friend"));
this.getLeftHalfCard().addAbility(ability.withFlavorWord("My First Friend"));
// When the chosen creature leaves the battlefield, transform Zenos yae Galvus.
this.addAbility(new TransformAbility());
this.addAbility(new LeavesBattlefieldAllTriggeredAbility(
this.getLeftHalfCard().addAbility(new LeavesBattlefieldAllTriggeredAbility(
new TransformSourceEffect(), filter2
).setTriggerPhrase("When the chosen creature leaves the battlefield, "));
// Shinryu, Transcendent Rival
this.getRightHalfCard().setPT(8, 8);
// Flying
this.getRightHalfCard().addAbility(FlyingAbility.getInstance());
// As this creature transforms into Shinryu, choose an opponent.
this.getRightHalfCard().addAbility(new SimpleStaticAbility(new ShinryuTranscendentRivalEffect()));
// Burning Chains -- When the chosen player loses the game, you win the game.
this.getRightHalfCard().addAbility(new ShinryuTranscendentRivalTriggeredAbility());
}
private ZenosYaeGalvus(final ZenosYaeGalvus card) {
@ -101,3 +115,83 @@ enum ZenosYaeGalvusPredicate implements ObjectSourcePlayerPredicate<Permanent> {
.orElse(false);
}
}
class ShinryuTranscendentRivalEffect extends ReplacementEffectImpl {
ShinryuTranscendentRivalEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "as this creature transforms into {this}, choose an opponent";
}
private ShinryuTranscendentRivalEffect(final ShinryuTranscendentRivalEffect effect) {
super(effect);
}
@Override
public ShinryuTranscendentRivalEffect copy() {
return new ShinryuTranscendentRivalEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (controller == null || permanent == null) {
return false;
}
TargetPlayer target = new TargetOpponent(true);
controller.choose(Outcome.Benefit, target, source, game);
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent == null) {
return false;
}
game.informPlayers(permanent.getName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName());
game.getState().setValue(permanent.getId() + "_" + permanent.getZoneChangeCounter(game) + "_opponent", opponent.getId());
permanent.addInfo("chosen opponent", CardUtil.addToolTipMarkTags("Chosen Opponent " + opponent.getLogName()), game);
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TRANSFORMING;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.getSourceId().equals(event.getTargetId())
&& source.getSourcePermanentIfItStillExists(game) != null;
}
}
class ShinryuTranscendentRivalTriggeredAbility extends TriggeredAbilityImpl {
ShinryuTranscendentRivalTriggeredAbility() {
super(Zone.BATTLEFIELD, new WinGameSourceControllerEffect());
this.setTriggerPhrase("When the chosen player loses the game, ");
this.withFlavorWord("Burning Chains");
}
private ShinryuTranscendentRivalTriggeredAbility(final ShinryuTranscendentRivalTriggeredAbility ability) {
super(ability);
}
@Override
public ShinryuTranscendentRivalTriggeredAbility copy() {
return new ShinryuTranscendentRivalTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LOST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int zcc = game.getState().getZoneChangeCounter(this.getSourceId());
return Optional
.of(this.getSourceId() + "_" + zcc + "_opponent")
.map(game.getState()::getValue)
.map(event.getPlayerId()::equals)
.orElse(false);
}
}

View file

@ -421,10 +421,6 @@ public final class FinalFantasy extends ExpansionSet {
cards.add(new SetCardInfo("Shantotto, Tactician Magician", 507, Rarity.UNCOMMON, mage.cards.s.ShantottoTacticianMagician.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Sharlayan, Nation of Scholars", 288, Rarity.COMMON, mage.cards.s.SharlayanNationOfScholars.class));
cards.add(new SetCardInfo("Shinra Reinforcements", 118, Rarity.COMMON, mage.cards.s.ShinraReinforcements.class));
cards.add(new SetCardInfo("Shinryu, Transcendent Rival", 127, Rarity.RARE, mage.cards.s.ShinryuTranscendentRival.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Shinryu, Transcendent Rival", 384, Rarity.RARE, mage.cards.s.ShinryuTranscendentRival.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Shinryu, Transcendent Rival", 455, Rarity.RARE, mage.cards.s.ShinryuTranscendentRival.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Shinryu, Transcendent Rival", 529, Rarity.RARE, mage.cards.s.ShinryuTranscendentRival.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Sidequest: Card Collection", 73, Rarity.UNCOMMON, mage.cards.s.SidequestCardCollection.class));
cards.add(new SetCardInfo("Sidequest: Catch a Fish", 31, Rarity.UNCOMMON, mage.cards.s.SidequestCatchAFish.class));
cards.add(new SetCardInfo("Sidequest: Hunt the Mark", 119, Rarity.UNCOMMON, mage.cards.s.SidequestHuntTheMark.class, NON_FULL_USE_VARIOUS));