mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
GUI: fixed wrong card sides, data and errors for transform and double side cards;
This commit is contained in:
parent
3515647c7b
commit
3284cb5b24
10 changed files with 72 additions and 69 deletions
|
@ -6,6 +6,7 @@ import mage.abilities.icon.CardIconImpl;
|
||||||
import mage.abilities.icon.CardIconOrder;
|
import mage.abilities.icon.CardIconOrder;
|
||||||
import mage.abilities.icon.CardIconPosition;
|
import mage.abilities.icon.CardIconPosition;
|
||||||
import mage.abilities.icon.CardIconType;
|
import mage.abilities.icon.CardIconType;
|
||||||
|
import mage.abilities.keyword.TransformAbility;
|
||||||
import mage.cards.*;
|
import mage.cards.*;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.cards.repository.CardInfo;
|
import mage.cards.repository.CardInfo;
|
||||||
|
@ -109,7 +110,7 @@ public class TestCardRenderDialog extends MageDialog {
|
||||||
this.removeDialog();
|
this.removeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PermanentView createPermanentCard(Game game, UUID controllerId, String code, String cardNumber, int power, int toughness, int damage, boolean tapped, List<Ability> extraAbilities) {
|
private PermanentView createPermanentCard(Game game, UUID controllerId, String code, String cardNumber, int power, int toughness, int damage, boolean tapped, boolean transform, List<Ability> extraAbilities) {
|
||||||
CardInfo cardInfo = CardRepository.instance.findCard(code, cardNumber);
|
CardInfo cardInfo = CardRepository.instance.findCard(code, cardNumber);
|
||||||
ExpansionInfo setInfo = ExpansionRepository.instance.getSetByCode(code);
|
ExpansionInfo setInfo = ExpansionRepository.instance.getSetByCode(code);
|
||||||
CardSetInfo testSet = new CardSetInfo(cardInfo.getName(), setInfo.getCode(), cardNumber, cardInfo.getRarity(),
|
CardSetInfo testSet = new CardSetInfo(cardInfo.getName(), setInfo.getCode(), cardNumber, cardInfo.getRarity(),
|
||||||
|
@ -121,20 +122,21 @@ public class TestCardRenderDialog extends MageDialog {
|
||||||
game.loadCards(cardsList, controllerId);
|
game.loadCards(cardsList, controllerId);
|
||||||
|
|
||||||
Card permCard = CardUtil.getDefaultCardSideForBattlefield(newCard);
|
Card permCard = CardUtil.getDefaultCardSideForBattlefield(newCard);
|
||||||
|
|
||||||
if (extraAbilities != null) {
|
if (extraAbilities != null) {
|
||||||
extraAbilities.forEach(ability -> permCard.addAbility(ability));
|
extraAbilities.forEach(ability -> permCard.addAbility(ability));
|
||||||
}
|
}
|
||||||
|
|
||||||
PermanentCard perm = new PermanentCard(permCard, controllerId, game);
|
PermanentCard perm = new PermanentCard(permCard, controllerId, game);
|
||||||
|
if (transform) {
|
||||||
|
// need direct transform call to keep other side info (original)
|
||||||
|
TransformAbility.transformPermanent(perm, permCard.getSecondCardFace(), game, null);
|
||||||
|
}
|
||||||
|
|
||||||
if (damage > 0) perm.damage(damage, controllerId, null, game);
|
if (damage > 0) perm.damage(damage, controllerId, null, game);
|
||||||
if (power > 0) perm.getPower().setValue(power);
|
if (power > 0) perm.getPower().setValue(power);
|
||||||
if (toughness > 0) perm.getToughness().setValue(toughness);
|
if (toughness > 0) perm.getToughness().setValue(toughness);
|
||||||
perm.removeSummoningSickness();
|
perm.removeSummoningSickness();
|
||||||
perm.setTapped(tapped);
|
perm.setTapped(tapped);
|
||||||
if (perm.isTransformable()) {
|
|
||||||
perm.setTransformed(true);
|
|
||||||
}
|
|
||||||
PermanentView cardView = new PermanentView(perm, permCard, controllerId, game);
|
PermanentView cardView = new PermanentView(perm, permCard, controllerId, game);
|
||||||
|
|
||||||
return cardView;
|
return cardView;
|
||||||
|
@ -290,16 +292,16 @@ public class TestCardRenderDialog extends MageDialog {
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
/* //test emblems
|
/* //test emblems
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "78", 125, 89, 0, false, null)); // Noxious Groodion
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "78", 125, 89, 0, false, false, null)); // Noxious Groodion
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "14", 3, 5, 2, false, null)); // Knight of Sorrows
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "14", 3, 5, 2, false, false, null)); // Knight of Sorrows
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "DKA", "140", 5, 2, 2, false, null)); // Huntmaster of the Fells, transforms
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "DKA", "140", 5, 2, 2, false, false, null)); // Huntmaster of the Fells, transforms
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "221", 0, 0, 0, false, null)); // Bedeck // Bedazzle
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "221", 0, 0, 0, false, false, null)); // Bedeck // Bedazzle
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "XLN", "234", 0, 0, 0, false, null)); // Conqueror's Galleon
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "XLN", "234", 0, 0, 0, false, false, null)); // Conqueror's Galleon
|
||||||
cardViews.add(createEmblem(new AjaniAdversaryOfTyrantsEmblem())); // Emblem Ajani
|
cardViews.add(createEmblem(new AjaniAdversaryOfTyrantsEmblem())); // Emblem Ajani
|
||||||
cardViews.add(createPlane(new AkoumPlane())); // Plane - Akoum
|
cardViews.add(createPlane(new AkoumPlane())); // Plane - Akoum
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
/* //test split, transform and mdf in hands
|
//test split, transform and mdf in hands
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "SOI", "97")); // Accursed Witch
|
cardViews.add(createHandCard(game, playerYou.getId(), "SOI", "97")); // Accursed Witch
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "UMA", "225")); // Fire // Ice
|
cardViews.add(createHandCard(game, playerYou.getId(), "UMA", "225")); // Fire // Ice
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "ELD", "14")); // Giant Killer
|
cardViews.add(createHandCard(game, playerYou.getId(), "ELD", "14")); // Giant Killer
|
||||||
|
@ -309,11 +311,10 @@ public class TestCardRenderDialog extends MageDialog {
|
||||||
//* //test card icons
|
//* //test card icons
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "POR", "169")); // Grizzly Bears
|
cardViews.add(createHandCard(game, playerYou.getId(), "POR", "169")); // Grizzly Bears
|
||||||
cardViews.add(createHandCard(game, playerYou.getId(), "DKA", "140")); // Huntmaster of the Fells, transforms
|
cardViews.add(createHandCard(game, playerYou.getId(), "DKA", "140")); // Huntmaster of the Fells, transforms
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "DKA", "140", 3, 3, 1, false, additionalIcons)); // Huntmaster of the Fells, transforms
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "DKA", "140", 3, 3, 1, false, true, additionalIcons)); // Huntmaster of the Fells, transforms
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "MB1", "401", 1, 1, 0, false, additionalIcons)); // Hinterland Drake
|
cardViews.add(createPermanentCard(game, playerYou.getId(), "MB1", "401", 1, 1, 0, false, false, additionalIcons)); // Hinterland Drake
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "MB1", "1441", 1, 1, 0, true, additionalIcons)); // Kathari Remnant
|
//cardViews.add(createPermanentCard(game, playerYou.getId(), "MB1", "1441", 1, 1, 0, true, false, additionalIcons)); // Kathari Remnant
|
||||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "KHM", "50", 1, 1, 0, true, additionalIcons)); // Cosima, God of the Voyage
|
//cardViews.add(createPermanentCard(game, playerYou.getId(), "KHM", "50", 1, 1, 0, true, false, additionalIcons)); // Cosima, God of the Voyage
|
||||||
|
|
||||||
|
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
public double transformAngle = 1;
|
public double transformAngle = 1;
|
||||||
|
|
||||||
private boolean guiTransformed;
|
private boolean guiTransformed; // current main or other side in gui (use isTransformed() to find a real transform state)
|
||||||
private boolean animationInProgress = false;
|
private boolean animationInProgress = false;
|
||||||
|
|
||||||
private Container cardContainer;
|
private Container cardContainer;
|
||||||
|
@ -236,7 +236,7 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
public final void initialDraw() {
|
public final void initialDraw() {
|
||||||
// Kick off
|
// Kick off
|
||||||
if (getGameCard().isTransformed()) {
|
if (getGameCard().isTransformed() && !this.isTransformed()) {
|
||||||
// this calls updateImage
|
// this calls updateImage
|
||||||
toggleTransformed();
|
toggleTransformed();
|
||||||
} else {
|
} else {
|
||||||
|
@ -494,7 +494,11 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isTransformed() {
|
public final boolean isTransformed() {
|
||||||
return this.guiTransformed;
|
if (this.cardSideMain.isTransformed()) {
|
||||||
|
return !this.guiTransformed;
|
||||||
|
} else {
|
||||||
|
return this.guiTransformed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -572,17 +576,15 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update transform circle
|
// Update transform circle
|
||||||
if (card.canTransform()) {
|
if (card.canTransform() && dayNightButton != null) {
|
||||||
BufferedImage transformIcon;
|
BufferedImage transformIcon;
|
||||||
if (isTransformed() || card.isTransformed()) { // wtf
|
if (this.isTransformed()) {
|
||||||
transformIcon = ImageManagerImpl.instance.getNightImage();
|
transformIcon = ImageManagerImpl.instance.getNightImage();
|
||||||
} else {
|
} else {
|
||||||
transformIcon = ImageManagerImpl.instance.getDayImage();
|
transformIcon = ImageManagerImpl.instance.getDayImage();
|
||||||
}
|
}
|
||||||
if (dayNightButton != null) {
|
dayNightButton.setVisible(true); // show T button for any cards and permanents
|
||||||
dayNightButton.setVisible(true); // show T button for any cards and permanents
|
dayNightButton.setIcon(new ImageIcon(transformIcon));
|
||||||
dayNightButton.setIcon(new ImageIcon(transformIcon));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,7 +848,7 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
this.guiTransformed = !this.guiTransformed;
|
this.guiTransformed = !this.guiTransformed;
|
||||||
|
|
||||||
if (dayNightButton != null) { // if transformbable card is copied, button can be null
|
if (dayNightButton != null) { // if transformbable card is copied, button can be null
|
||||||
BufferedImage image = this.guiTransformed ? ImageManagerImpl.instance.getNightImage() : ImageManagerImpl.instance.getDayImage();
|
BufferedImage image = this.isTransformed() ? ImageManagerImpl.instance.getNightImage() : ImageManagerImpl.instance.getDayImage();
|
||||||
dayNightButton.setIcon(new ImageIcon(image));
|
dayNightButton.setIcon(new ImageIcon(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,7 +866,7 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
// alternative side -> main side
|
// alternative side -> main side
|
||||||
copySelections(this.cardSideOther, this.cardSideMain);
|
copySelections(this.cardSideOther, this.cardSideMain);
|
||||||
update(this.cardSideMain);
|
update(this.cardSideMain);
|
||||||
this.getGameCard().setAlternateName(this.cardSideOther.getName());
|
this.getGameCard().setAlternateName(this.cardSideOther.getName()); // wtf null protect
|
||||||
}
|
}
|
||||||
|
|
||||||
updateArtImage();
|
updateArtImage();
|
||||||
|
@ -939,14 +941,15 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
} else {
|
} else {
|
||||||
// from other side
|
// from other side
|
||||||
this.cardSideOther = gameCard;
|
this.cardSideOther = gameCard;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix other side: if it's a night side permanent then the main side info must be extracted
|
// fix other side: if it's a night side permanent then the main side info must be extracted
|
||||||
if (this.cardSideOther != null
|
if (this.cardSideOther == null || this.cardSideOther.getName().equals(this.cardSideMain.getName())) {
|
||||||
&& this.cardSideOther.getName().equals(this.cardSideMain.getName())
|
if (this.cardSideMain instanceof PermanentView) {
|
||||||
&& this.cardSideMain instanceof PermanentView) {
|
this.cardSideOther = ((PermanentView) this.cardSideMain).getOriginal();
|
||||||
this.cardSideOther = ((PermanentView) this.cardSideMain).getOriginal();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,8 +175,8 @@ public class CardView extends SimpleCardView {
|
||||||
this.subTypes = new SubTypes(cardView.subTypes);
|
this.subTypes = new SubTypes(cardView.subTypes);
|
||||||
this.superTypes = cardView.superTypes;
|
this.superTypes = cardView.superTypes;
|
||||||
|
|
||||||
this.color = cardView.color;
|
this.color = cardView.color.copy();
|
||||||
this.frameColor = cardView.frameColor;
|
this.frameColor = cardView.frameColor.copy();
|
||||||
this.frameStyle = cardView.frameStyle;
|
this.frameStyle = cardView.frameStyle;
|
||||||
this.manaCostLeftStr = cardView.manaCostLeftStr;
|
this.manaCostLeftStr = cardView.manaCostLeftStr;
|
||||||
this.manaCostRightStr = cardView.manaCostRightStr;
|
this.manaCostRightStr = cardView.manaCostRightStr;
|
||||||
|
@ -315,7 +315,7 @@ public class CardView extends SimpleCardView {
|
||||||
} else if (card instanceof Permanent) {
|
} else if (card instanceof Permanent) {
|
||||||
this.power = Integer.toString(card.getPower().getValue());
|
this.power = Integer.toString(card.getPower().getValue());
|
||||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||||
this.cardTypes = card.getCardType(game);
|
this.cardTypes = new ArrayList<>(card.getCardType(game));
|
||||||
this.faceDown = card.isFaceDown(game);
|
this.faceDown = card.isFaceDown(game);
|
||||||
} else {
|
} else {
|
||||||
// this.hideInfo = true;
|
// this.hideInfo = true;
|
||||||
|
@ -390,9 +390,9 @@ public class CardView extends SimpleCardView {
|
||||||
this.displayName = card.getName();
|
this.displayName = card.getName();
|
||||||
this.displayFullName = fullCardName;
|
this.displayFullName = fullCardName;
|
||||||
if (game == null) {
|
if (game == null) {
|
||||||
this.rules = card.getRules();
|
this.rules = new ArrayList<>(card.getRules());
|
||||||
} else {
|
} else {
|
||||||
this.rules = card.getRules(game);
|
this.rules = new ArrayList<>(card.getRules(game));
|
||||||
}
|
}
|
||||||
this.manaValue = card.getManaValue();
|
this.manaValue = card.getManaValue();
|
||||||
|
|
||||||
|
@ -469,10 +469,10 @@ public class CardView extends SimpleCardView {
|
||||||
|
|
||||||
this.power = Integer.toString(card.getPower().getValue());
|
this.power = Integer.toString(card.getPower().getValue());
|
||||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||||
this.cardTypes = card.getCardType(game);
|
this.cardTypes = new ArrayList<>(card.getCardType(game));
|
||||||
this.subTypes = card.getSubtype(game);
|
this.subTypes = new SubTypes(card.getSubtype(game));
|
||||||
this.superTypes = card.getSuperType();
|
this.superTypes = card.getSuperType();
|
||||||
this.color = card.getColor(game);
|
this.color = card.getColor(game).copy();
|
||||||
this.flipCard = card.isFlipCard();
|
this.flipCard = card.isFlipCard();
|
||||||
this.faceDown = !showFaceUp;
|
this.faceDown = !showFaceUp;
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ public class CardView extends SimpleCardView {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// set code and card number for token copies to get the image
|
// set code and card number for token copies to get the image
|
||||||
this.rules = card.getRules(game);
|
this.rules = new ArrayList<>(card.getRules(game));
|
||||||
this.type = ((PermanentToken) card).getToken().getTokenType();
|
this.type = ((PermanentToken) card).getToken().getTokenType();
|
||||||
} else {
|
} else {
|
||||||
this.rarity = card.getRarity();
|
this.rarity = card.getRarity();
|
||||||
|
@ -567,7 +567,7 @@ public class CardView extends SimpleCardView {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frame color
|
// Frame color
|
||||||
this.frameColor = card.getFrameColor(game);
|
this.frameColor = card.getFrameColor(game).copy();
|
||||||
|
|
||||||
// Frame style
|
// Frame style
|
||||||
this.frameStyle = card.getFrameStyle();
|
this.frameStyle = card.getFrameStyle();
|
||||||
|
@ -593,10 +593,10 @@ public class CardView extends SimpleCardView {
|
||||||
this.toughness = object.getToughness().toString();
|
this.toughness = object.getToughness().toString();
|
||||||
this.loyalty = "";
|
this.loyalty = "";
|
||||||
}
|
}
|
||||||
this.cardTypes = object.getCardType(game);
|
this.cardTypes = new ArrayList<>(object.getCardType(game));
|
||||||
this.subTypes = object.getSubtype(game);
|
this.subTypes = new SubTypes(object.getSubtype(game));
|
||||||
this.superTypes = object.getSuperType();
|
this.superTypes = object.getSuperType();
|
||||||
this.color = object.getColor(game);
|
this.color = object.getColor(game).copy();
|
||||||
this.manaCostLeftStr = String.join("", object.getManaCostSymbols());
|
this.manaCostLeftStr = String.join("", object.getManaCostSymbols());
|
||||||
this.manaCostRightStr = "";
|
this.manaCostRightStr = "";
|
||||||
this.manaValue = object.getManaCost().manaValue();
|
this.manaValue = object.getManaCost().manaValue();
|
||||||
|
@ -605,18 +605,18 @@ public class CardView extends SimpleCardView {
|
||||||
PermanentToken permanentToken = (PermanentToken) object;
|
PermanentToken permanentToken = (PermanentToken) object;
|
||||||
this.rarity = Rarity.COMMON;
|
this.rarity = Rarity.COMMON;
|
||||||
this.expansionSetCode = permanentToken.getExpansionSetCode();
|
this.expansionSetCode = permanentToken.getExpansionSetCode();
|
||||||
this.rules = permanentToken.getRules();
|
this.rules = new ArrayList<>(permanentToken.getRules());
|
||||||
this.type = permanentToken.getToken().getTokenType();
|
this.type = permanentToken.getToken().getTokenType();
|
||||||
} else if (object instanceof Emblem) {
|
} else if (object instanceof Emblem) {
|
||||||
this.mageObjectType = MageObjectType.EMBLEM;
|
this.mageObjectType = MageObjectType.EMBLEM;
|
||||||
Emblem emblem = (Emblem) object;
|
Emblem emblem = (Emblem) object;
|
||||||
this.rarity = Rarity.SPECIAL;
|
this.rarity = Rarity.SPECIAL;
|
||||||
this.rules = emblem.getAbilities().getRules(emblem.getName());
|
this.rules = new ArrayList<>(emblem.getAbilities().getRules(emblem.getName()));
|
||||||
} else if (object instanceof Dungeon) {
|
} else if (object instanceof Dungeon) {
|
||||||
this.mageObjectType = MageObjectType.DUNGEON;
|
this.mageObjectType = MageObjectType.DUNGEON;
|
||||||
Dungeon dungeon = (Dungeon) object;
|
Dungeon dungeon = (Dungeon) object;
|
||||||
this.rarity = Rarity.SPECIAL;
|
this.rarity = Rarity.SPECIAL;
|
||||||
this.rules = dungeon.getRules();
|
this.rules = new ArrayList<>(dungeon.getRules());
|
||||||
} else if (object instanceof Plane) {
|
} else if (object instanceof Plane) {
|
||||||
this.mageObjectType = MageObjectType.PLANE;
|
this.mageObjectType = MageObjectType.PLANE;
|
||||||
Plane plane = (Plane) object;
|
Plane plane = (Plane) object;
|
||||||
|
@ -624,14 +624,14 @@ public class CardView extends SimpleCardView {
|
||||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||||
// Display in landscape/rotated/on its side
|
// Display in landscape/rotated/on its side
|
||||||
this.rotate = true;
|
this.rotate = true;
|
||||||
this.rules = plane.getAbilities().getRules(plane.getName());
|
this.rules = new ArrayList<>(plane.getAbilities().getRules(plane.getName()));
|
||||||
} else if (object instanceof Designation) {
|
} else if (object instanceof Designation) {
|
||||||
this.mageObjectType = MageObjectType.DESIGNATION;
|
this.mageObjectType = MageObjectType.DESIGNATION;
|
||||||
Designation designation = (Designation) object;
|
Designation designation = (Designation) object;
|
||||||
this.rarity = Rarity.SPECIAL;
|
this.rarity = Rarity.SPECIAL;
|
||||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||||
// Display in landscape/rotated/on its side
|
// Display in landscape/rotated/on its side
|
||||||
this.rules = designation.getAbilities().getRules(designation.getName());
|
this.rules = new ArrayList<>(designation.getAbilities().getRules(designation.getName()));
|
||||||
}
|
}
|
||||||
if (this.rarity == null && object instanceof StackAbility) {
|
if (this.rarity == null && object instanceof StackAbility) {
|
||||||
StackAbility stackAbility = (StackAbility) object;
|
StackAbility stackAbility = (StackAbility) object;
|
||||||
|
@ -643,7 +643,7 @@ public class CardView extends SimpleCardView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Frame color
|
// Frame color
|
||||||
this.frameColor = object.getFrameColor(game);
|
this.frameColor = object.getFrameColor(game).copy();
|
||||||
// Frame style
|
// Frame style
|
||||||
this.frameStyle = object.getFrameStyle();
|
this.frameStyle = object.getFrameStyle();
|
||||||
// Starting loyalty. Must be extracted from an ability
|
// Starting loyalty. Must be extracted from an ability
|
||||||
|
@ -662,7 +662,7 @@ public class CardView extends SimpleCardView {
|
||||||
this.name = emblem.getName();
|
this.name = emblem.getName();
|
||||||
this.displayName = name;
|
this.displayName = name;
|
||||||
this.displayFullName = name;
|
this.displayFullName = name;
|
||||||
this.rules = emblem.getRules();
|
this.rules = new ArrayList<>(emblem.getRules());
|
||||||
// emblem images are always with common (black) symbol
|
// emblem images are always with common (black) symbol
|
||||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||||
this.expansionSetCode = emblem.getExpansionSetCode();
|
this.expansionSetCode = emblem.getExpansionSetCode();
|
||||||
|
@ -677,7 +677,7 @@ public class CardView extends SimpleCardView {
|
||||||
this.name = dungeon.getName();
|
this.name = dungeon.getName();
|
||||||
this.displayName = name;
|
this.displayName = name;
|
||||||
this.displayFullName = name;
|
this.displayFullName = name;
|
||||||
this.rules = dungeon.getRules();
|
this.rules = new ArrayList<>(dungeon.getRules());
|
||||||
// emblem images are always with common (black) symbol
|
// emblem images are always with common (black) symbol
|
||||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||||
this.expansionSetCode = dungeon.getExpansionSetCode();
|
this.expansionSetCode = dungeon.getExpansionSetCode();
|
||||||
|
@ -692,7 +692,7 @@ public class CardView extends SimpleCardView {
|
||||||
this.name = plane.getName();
|
this.name = plane.getName();
|
||||||
this.displayName = name;
|
this.displayName = name;
|
||||||
this.displayFullName = name;
|
this.displayFullName = name;
|
||||||
this.rules = plane.getRules();
|
this.rules = new ArrayList<>(plane.getRules());
|
||||||
// Display the plane in landscape (similar to Fused cards)
|
// Display the plane in landscape (similar to Fused cards)
|
||||||
this.rotate = true;
|
this.rotate = true;
|
||||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||||
|
@ -776,16 +776,16 @@ public class CardView extends SimpleCardView {
|
||||||
this.name = token.getName();
|
this.name = token.getName();
|
||||||
this.displayName = token.getName();
|
this.displayName = token.getName();
|
||||||
this.displayFullName = token.getName();
|
this.displayFullName = token.getName();
|
||||||
this.rules = token.getAbilities().getRules(this.name);
|
this.rules = new ArrayList<>(token.getAbilities().getRules(this.name));
|
||||||
this.power = token.getPower().toString();
|
this.power = token.getPower().toString();
|
||||||
this.toughness = token.getToughness().toString();
|
this.toughness = token.getToughness().toString();
|
||||||
this.loyalty = "";
|
this.loyalty = "";
|
||||||
this.startingLoyalty = "";
|
this.startingLoyalty = "";
|
||||||
this.cardTypes = token.getCardType(game);
|
this.cardTypes = new ArrayList<>(token.getCardType(game));
|
||||||
this.subTypes = token.getSubtype(game);
|
this.subTypes = new SubTypes(token.getSubtype(game));
|
||||||
this.superTypes = token.getSuperType();
|
this.superTypes = token.getSuperType();
|
||||||
this.color = token.getColor(game);
|
this.color = token.getColor(game).copy();
|
||||||
this.frameColor = token.getFrameColor(game);
|
this.frameColor = token.getFrameColor(game).copy();
|
||||||
this.frameStyle = token.getFrameStyle();
|
this.frameStyle = token.getFrameStyle();
|
||||||
this.manaCostLeftStr = String.join("", token.getManaCostSymbols());
|
this.manaCostLeftStr = String.join("", token.getManaCostSymbols());
|
||||||
this.manaCostRightStr = "";
|
this.manaCostRightStr = "";
|
||||||
|
@ -839,7 +839,7 @@ public class CardView extends SimpleCardView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void overrideRules(List<String> rules) {
|
public void overrideRules(List<String> rules) {
|
||||||
this.rules = rules;
|
this.rules = new ArrayList<>(rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsAbility(boolean isAbility) {
|
public void setIsAbility(boolean isAbility) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class PermanentView extends CardView {
|
||||||
private final boolean summoningSickness;
|
private final boolean summoningSickness;
|
||||||
private final int damage;
|
private final int damage;
|
||||||
private List<UUID> attachments;
|
private List<UUID> attachments;
|
||||||
private final CardView original;
|
private final CardView original; // original card before transforms and modifications
|
||||||
private final boolean copy;
|
private final boolean copy;
|
||||||
private final String nameOwner; // only filled if != controller
|
private final String nameOwner; // only filled if != controller
|
||||||
private final boolean controlled;
|
private final boolean controlled;
|
||||||
|
@ -52,14 +52,14 @@ public class PermanentView extends CardView {
|
||||||
}
|
}
|
||||||
this.attachedTo = permanent.getAttachedTo();
|
this.attachedTo = permanent.getAttachedTo();
|
||||||
if (isToken()) {
|
if (isToken()) {
|
||||||
original = new CardView(((PermanentToken) permanent).getToken(), game);
|
original = new CardView(((PermanentToken) permanent).getToken().copy(), (Game) null);
|
||||||
original.expansionSetCode = permanent.getExpansionSetCode();
|
original.expansionSetCode = permanent.getExpansionSetCode();
|
||||||
tokenSetCode = original.getTokenSetCode();
|
tokenSetCode = original.getTokenSetCode();
|
||||||
tokenDescriptor = original.getTokenDescriptor();
|
tokenDescriptor = original.getTokenDescriptor();
|
||||||
} else {
|
} else {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
// original may not be face down
|
// original may not be face down
|
||||||
original = new CardView(card, game);
|
original = new CardView(card.copy(), (Game) null);
|
||||||
} else {
|
} else {
|
||||||
original = null;
|
original = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class VolrathsShapeshifterEffect extends ContinuousEffectImpl {
|
||||||
permanent.getToughness().setValue(card.getToughness().getValue());
|
permanent.getToughness().setValue(card.getToughness().getValue());
|
||||||
permanent.getColor(game).setColor(card.getColor(game));
|
permanent.getColor(game).setColor(card.getColor(game));
|
||||||
permanent.getManaCost().clear();
|
permanent.getManaCost().clear();
|
||||||
permanent.getManaCost().add(card.getManaCost());
|
permanent.getManaCost().add(card.getManaCost().copy());
|
||||||
permanent.removeAllCardTypes(game);
|
permanent.removeAllCardTypes(game);
|
||||||
permanent.setName(card.getName());
|
permanent.setName(card.getName());
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class CopyEffect extends ContinuousEffectImpl {
|
||||||
permanent.setName(copyFromObject.getName());
|
permanent.setName(copyFromObject.getName());
|
||||||
permanent.getColor(game).setColor(copyFromObject.getColor(game));
|
permanent.getColor(game).setColor(copyFromObject.getColor(game));
|
||||||
permanent.getManaCost().clear();
|
permanent.getManaCost().clear();
|
||||||
permanent.getManaCost().add(copyFromObject.getManaCost());
|
permanent.getManaCost().add(copyFromObject.getManaCost().copy());
|
||||||
permanent.removeAllCardTypes(game);
|
permanent.removeAllCardTypes(game);
|
||||||
for (CardType type : copyFromObject.getCardType(game)) {
|
for (CardType type : copyFromObject.getCardType(game)) {
|
||||||
permanent.addCardType(game, type);
|
permanent.addCardType(game, type);
|
||||||
|
|
|
@ -42,10 +42,11 @@ public class TransformAbility extends SimpleStaticAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
permanent.setTransformed(true);
|
||||||
permanent.setName(sourceCard.getName());
|
permanent.setName(sourceCard.getName());
|
||||||
permanent.getColor(game).setColor(sourceCard.getColor(game));
|
permanent.getColor(game).setColor(sourceCard.getColor(game));
|
||||||
permanent.getManaCost().clear();
|
permanent.getManaCost().clear();
|
||||||
permanent.getManaCost().add(sourceCard.getManaCost());
|
permanent.getManaCost().add(sourceCard.getManaCost().copy());
|
||||||
permanent.removeAllCardTypes(game);
|
permanent.removeAllCardTypes(game);
|
||||||
for (CardType type : sourceCard.getCardType(game)) {
|
for (CardType type : sourceCard.getCardType(game)) {
|
||||||
permanent.addCardType(game, type);
|
permanent.addCardType(game, type);
|
||||||
|
|
|
@ -38,8 +38,7 @@ public class ModalDoubleFacesCardHalfImpl extends CardImpl implements ModalDoubl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImageName() {
|
public String getImageName() {
|
||||||
// TODO: own name?
|
return name;
|
||||||
return parentCard.getImageName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,7 +74,6 @@ public class PermanentCard extends PermanentImpl {
|
||||||
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId()) != null
|
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId()) != null
|
||||||
|| NightboundAbility.checkCard(this, game)) {
|
|| NightboundAbility.checkCard(this, game)) {
|
||||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId(), null);
|
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + getId(), null);
|
||||||
setTransformed(true);
|
|
||||||
TransformAbility.transformPermanent(this, getSecondCardFace(), game, null);
|
TransformAbility.transformPermanent(this, getSecondCardFace(), game, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class CopyTokenFunction implements Function<Token, Card> {
|
||||||
target.setName(sourceObj.getName());
|
target.setName(sourceObj.getName());
|
||||||
target.getColor().setColor(sourceObj.getColor());
|
target.getColor().setColor(sourceObj.getColor());
|
||||||
target.getManaCost().clear();
|
target.getManaCost().clear();
|
||||||
target.getManaCost().add(sourceObj.getManaCost());
|
target.getManaCost().add(sourceObj.getManaCost().copy());
|
||||||
target.removeAllCardTypes();
|
target.removeAllCardTypes();
|
||||||
for (CardType type : sourceObj.getCardType()) {
|
for (CardType type : sourceObj.getCardType()) {
|
||||||
target.addCardType(type);
|
target.addCardType(type);
|
||||||
|
|
Loading…
Reference in a new issue