From 2bcbb3095495a328ca3865ae74329d9b37e2a9ff Mon Sep 17 00:00:00 2001 From: jmlundeen Date: Sat, 6 Dec 2025 14:54:07 -0600 Subject: [PATCH] remove secondSideCardClazz --- Mage/src/main/java/mage/cards/CardImpl.java | 32 ++----------------- Mage/src/main/java/mage/game/GameImpl.java | 6 ---- .../mage/game/permanent/PermanentCard.java | 19 ++--------- 3 files changed, 4 insertions(+), 53 deletions(-) diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 966363ae338..fe7e0b658b0 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -41,7 +41,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card { protected UUID ownerId; protected Rarity rarity; - protected Class secondSideCardClazz; protected Class meldsWithClazz; protected Class meldsToClazz; protected MeldCard meldsToCard; @@ -121,19 +120,8 @@ public abstract class CardImpl extends MageObjectImpl implements Card { ownerId = card.ownerId; rarity = card.rarity; - // TODO: wtf, do not copy card sides cause it must be re-created each time (see details in getSecondCardFace) - // must be reworked to normal copy and workable transform without such magic - nightCard = card.nightCard; - secondSideCardClazz = card.secondSideCardClazz; - secondSideCard = null; // will be set on first getSecondCardFace call if card has one - // TODO: temporary until cards tdfc cards are converted - // can do normal copy after - if (card.secondSideCard instanceof DoubleFacedCardHalf) { - secondSideCard = card.secondSideCard.copy(); - } - if (card.secondSideCard instanceof MockableCard) { - // workaround to support gui's mock cards + if (card.secondSideCard != null) { secondSideCard = card.secondSideCard.copy(); } @@ -667,27 +655,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card { // If a spell or ability instructs a player to transform a permanent that // isn’t represented by a transforming token or a transforming double-faced // card, nothing happens. - return this.secondSideCardClazz != null || this.nightCard || this.secondSideCard != null; + return this.secondSideCard != null; } @Override public final Card getSecondCardFace() { - // init card side on first call - if (secondSideCardClazz == null && secondSideCard == null) { - return null; - } - - if (secondSideCard == null) { - secondSideCard = initSecondSideCard(secondSideCardClazz); - if (secondSideCard != null && secondSideCard.getSpellAbility() != null) { - // TODO: wtf, why it set cast mode here?! Transform tests fails without it - // must be reworked without that magic, also see CardImpl'constructor for copy code - secondSideCard.getSpellAbility().setSourceId(this.getId()); - secondSideCard.getSpellAbility().setSpellAbilityType(SpellAbilityType.BASE_ALTERNATE); - secondSideCard.getSpellAbility().setSpellAbilityCastMode(SpellAbilityCastMode.TRANSFORMED); - } - } - return secondSideCard; } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index ff45386549a..71b2a324e93 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -56,7 +56,6 @@ import mage.game.mulligan.Mulligan; import mage.game.permanent.Battlefield; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; -import mage.game.permanent.PermanentToken; import mage.game.stack.Spell; import mage.game.stack.SpellStack; import mage.game.stack.StackAbility; @@ -2117,11 +2116,6 @@ public abstract class GameImpl implements Game { BecomesFaceDownCreatureEffect.makeFaceDownObject(this, null, newBluePrint, faceDownType, null); } newBluePrint.assignNewId(); - // TODO: should be able to remove after tdfc rework - if (copyFromPermanent.isTransformed() && (copyFromPermanent instanceof PermanentToken || ((copyFromPermanent instanceof PermanentCard) && - !(((PermanentCard) copyFromPermanent).getCard() instanceof DoubleFacedCardHalf)))) { - TransformAbility.transformPermanent(newBluePrint, this, source); - } if (copyFromPermanent.isPrototyped()) { Abilities abilities = copyFromPermanent.getAbilities(); for (Ability ability : abilities) { diff --git a/Mage/src/main/java/mage/game/permanent/PermanentCard.java b/Mage/src/main/java/mage/game/permanent/PermanentCard.java index 9139caea669..476b9587882 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentCard.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentCard.java @@ -7,8 +7,6 @@ import mage.abilities.Ability; import mage.abilities.common.RoomAbility; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.keyword.NightboundAbility; -import mage.abilities.keyword.TransformAbility; import mage.cards.*; import mage.constants.SpellAbilityType; import mage.game.Game; @@ -103,16 +101,6 @@ public class PermanentCard extends PermanentImpl { if (card instanceof LevelerCard) { maxLevelCounters = ((LevelerCard) card).getMaxLevelCounters(); } - - // if transformed on ETB - // TODO: remove after tdfc rework - if (card.isTransformable() && !(card instanceof DoubleFacedCardHalf)) { - if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null - || NightboundAbility.checkCard(this, game)) { - game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), null); - TransformAbility.transformPermanent(this, game, null); - } - } } protected PermanentCard(final PermanentCard permanent) { @@ -163,7 +151,7 @@ public class PermanentCard extends PermanentImpl { } else if (card.getId() != this.getId()) { // if different id, abilities need to be added to game state for continuous/triggers for (Ability ability : card.getAbilities()) { - this.addAbility(ability, card.getId(), game, true); + this.addAbility(ability, card.getId(), game, true); } } else { // copy only own abilities; all dynamic added abilities must be added in the parent call @@ -202,9 +190,6 @@ public class PermanentCard extends PermanentImpl { this.setImageFileName(card.getImageFileName()); this.setImageNumber(card.getImageNumber()); - if (card.getSecondCardFace() != null && !(card instanceof DoubleFacedCardHalf)) { - this.secondSideCardClazz = card.getSecondCardFace().getClass(); - } if (card.getMeldsToCard() != null) { this.meldsToClazz = card.getMeldsToCard().getClass(); } @@ -249,7 +234,7 @@ public class PermanentCard extends PermanentImpl { @Override public boolean turnFaceUp(Ability source, Game game, UUID playerId) { - if (!this.getBasicMageObject().isPermanent()){ + if (!this.getBasicMageObject().isPermanent()) { // 701.34g. If a manifested permanent that's represented by an instant or sorcery card would turn face up, // its controller reveals it and leaves it face down. Abilities that trigger whenever a permanent // is turned face up won't trigger.