[TLA] Implement Ozai, the Phoenix King

This commit is contained in:
Grath 2025-11-07 22:22:33 -05:00
parent a17635564a
commit 90815541f9
3 changed files with 144 additions and 0 deletions

View file

@ -0,0 +1,123 @@
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.*;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.ManaPool;
import mage.players.Player;
/**
*
* @author anonymous
*/
public final class OzaiThePhoenixKing extends CardImpl {
public OzaiThePhoenixKing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}{R}{R}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.NOBLE);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Firebending 4
this.addAbility(new FirebendingAbility(4));
// Haste
this.addAbility(HasteAbility.getInstance());
// If you would lose unspent mana, that mana becomes red instead.
this.addAbility(new SimpleStaticAbility(new OzaiThePhoenixKingManaEffect()));
// Ozai has flying and indestructible as long as you have six or more unspent mana.
this.addAbility(new SimpleStaticAbility(new OzaiThePhoenixKingBoostEffect()));
}
private OzaiThePhoenixKing(final OzaiThePhoenixKing card) {
super(card);
}
@Override
public OzaiThePhoenixKing copy() {
return new OzaiThePhoenixKing(this);
}
}
class OzaiThePhoenixKingManaEffect extends ContinuousEffectImpl {
OzaiThePhoenixKingManaEffect() {
super(Duration.WhileOnBattlefield, Layer.RulesEffects, SubLayer.NA, Outcome.Benefit);
staticText = "if you would lose unspent mana, that mana becomes red instead";
}
private OzaiThePhoenixKingManaEffect(final OzaiThePhoenixKingManaEffect effect) {
super(effect);
}
@Override
public OzaiThePhoenixKingManaEffect copy() {
return new OzaiThePhoenixKingManaEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.getManaPool().setManaBecomesRed(true);
}
return true;
}
}
class OzaiThePhoenixKingBoostEffect extends ContinuousEffectImpl {
OzaiThePhoenixKingBoostEffect() {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "{this} has flying and indestructible as long as you have six or more unspent mana";
}
private OzaiThePhoenixKingBoostEffect(final OzaiThePhoenixKingBoostEffect effect) {
super(effect);
}
@Override
public OzaiThePhoenixKingBoostEffect copy() {
return new OzaiThePhoenixKingBoostEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent creature = game.getPermanent(source.getSourceId());
if (controller == null || creature == null) {
return false;
}
ManaPool pool = controller.getManaPool();
int blackMana = pool.getBlack();
int whiteMana = pool.getWhite();
int blueMana = pool.getBlue();
int greenMana = pool.getGreen();
int redMana = pool.getRed();
int colorlessMana = pool.getColorless();
int manaPoolTotal = blackMana + whiteMana + blueMana + greenMana + redMana + colorlessMana;
if (manaPoolTotal >= 6) {
creature.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
creature.addAbility(IndestructibleAbility.getInstance(), source.getSourceId(), game);
return true;
}
return false;
}
}

View file

@ -188,6 +188,9 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
cards.add(new SetCardInfo("Ostrich-Horse", 188, Rarity.COMMON, mage.cards.o.OstrichHorse.class));
cards.add(new SetCardInfo("Otter-Penguin", 67, Rarity.COMMON, mage.cards.o.OtterPenguin.class));
cards.add(new SetCardInfo("Ozai's Cruelty", 113, Rarity.UNCOMMON, mage.cards.o.OzaisCruelty.class));
cards.add(new SetCardInfo("Ozai, the Phoenix King", 235, Rarity.MYTHIC, mage.cards.o.OzaiThePhoenixKing.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ozai, the Phoenix King", 311, Rarity.MYTHIC, mage.cards.o.OzaiThePhoenixKing.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ozai, the Phoenix King", 335, Rarity.MYTHIC, mage.cards.o.OzaiThePhoenixKing.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Path to Redemption", 31, Rarity.COMMON, mage.cards.p.PathToRedemption.class));
cards.add(new SetCardInfo("Pillar Launch", 189, Rarity.COMMON, mage.cards.p.PillarLaunch.class));
cards.add(new SetCardInfo("Plains", 282, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));

View file

@ -42,6 +42,7 @@ public class ManaPool implements Serializable {
// empty mana pool effects
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>(); // keep some colors
private boolean manaBecomesBlack = false; // replace all pool by black
private boolean manaBecomesRed = false; // replace all pool by red
private boolean manaBecomesColorless = false; // replace all pool by colorless
private static final class ConditionalManaInfo {
@ -76,6 +77,7 @@ public class ManaPool implements Serializable {
}
this.doNotEmptyManaTypes.addAll(pool.doNotEmptyManaTypes);
this.manaBecomesBlack = pool.manaBecomesBlack;
this.manaBecomesRed = pool.manaBecomesRed;
this.manaBecomesColorless = pool.manaBecomesColorless;
}
@ -236,6 +238,7 @@ public class ManaPool implements Serializable {
public void clearEmptyManaPoolRules() {
doNotEmptyManaTypes.clear();
this.manaBecomesBlack = false;
this.manaBecomesRed = false;
this.manaBecomesColorless = false;
}
@ -247,6 +250,10 @@ public class ManaPool implements Serializable {
this.manaBecomesBlack = manaBecomesBlack;
}
public void setManaBecomesRed(boolean manaBecomesRed) {
this.manaBecomesRed = manaBecomesRed;
}
public void setManaBecomesColorless(boolean manaBecomesColorless) {
this.manaBecomesColorless = manaBecomesColorless;
}
@ -267,6 +274,9 @@ public class ManaPool implements Serializable {
if (manaBecomesBlack) {
continue;
}
if (manaBecomesRed) {
continue;
}
if (manaBecomesColorless) {
continue;
}
@ -315,12 +325,20 @@ public class ManaPool implements Serializable {
return 0;
}
}
// TODO: This should be reimplemented as replacement effects instead, so you can choose which applies.
if (manaBecomesBlack) {
int amount = toEmpty.get(manaType);
toEmpty.clear(manaType);
toEmpty.add(ManaType.BLACK, amount);
return 0;
}
if (manaBecomesRed) {
int amount = toEmpty.get(manaType);
toEmpty.clear(manaType);
toEmpty.add(ManaType.RED, amount);
return 0;
}
if (manaBecomesColorless) {
int amount = toEmpty.get(manaType);
toEmpty.clear(manaType);