GUI: fixed wrong card sides, data and errors for transform and double side cards;

This commit is contained in:
Oleg Agafonov 2021-11-09 10:16:39 +04:00
parent 3515647c7b
commit 3284cb5b24
10 changed files with 72 additions and 69 deletions

View file

@ -175,8 +175,8 @@ public class CardView extends SimpleCardView {
this.subTypes = new SubTypes(cardView.subTypes);
this.superTypes = cardView.superTypes;
this.color = cardView.color;
this.frameColor = cardView.frameColor;
this.color = cardView.color.copy();
this.frameColor = cardView.frameColor.copy();
this.frameStyle = cardView.frameStyle;
this.manaCostLeftStr = cardView.manaCostLeftStr;
this.manaCostRightStr = cardView.manaCostRightStr;
@ -315,7 +315,7 @@ public class CardView extends SimpleCardView {
} else if (card instanceof Permanent) {
this.power = Integer.toString(card.getPower().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);
} else {
// this.hideInfo = true;
@ -390,9 +390,9 @@ public class CardView extends SimpleCardView {
this.displayName = card.getName();
this.displayFullName = fullCardName;
if (game == null) {
this.rules = card.getRules();
this.rules = new ArrayList<>(card.getRules());
} else {
this.rules = card.getRules(game);
this.rules = new ArrayList<>(card.getRules(game));
}
this.manaValue = card.getManaValue();
@ -469,10 +469,10 @@ public class CardView extends SimpleCardView {
this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue());
this.cardTypes = card.getCardType(game);
this.subTypes = card.getSubtype(game);
this.cardTypes = new ArrayList<>(card.getCardType(game));
this.subTypes = new SubTypes(card.getSubtype(game));
this.superTypes = card.getSuperType();
this.color = card.getColor(game);
this.color = card.getColor(game).copy();
this.flipCard = card.isFlipCard();
this.faceDown = !showFaceUp;
@ -492,7 +492,7 @@ public class CardView extends SimpleCardView {
}
//
// 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();
} else {
this.rarity = card.getRarity();
@ -567,7 +567,7 @@ public class CardView extends SimpleCardView {
}
// Frame color
this.frameColor = card.getFrameColor(game);
this.frameColor = card.getFrameColor(game).copy();
// Frame style
this.frameStyle = card.getFrameStyle();
@ -593,10 +593,10 @@ public class CardView extends SimpleCardView {
this.toughness = object.getToughness().toString();
this.loyalty = "";
}
this.cardTypes = object.getCardType(game);
this.subTypes = object.getSubtype(game);
this.cardTypes = new ArrayList<>(object.getCardType(game));
this.subTypes = new SubTypes(object.getSubtype(game));
this.superTypes = object.getSuperType();
this.color = object.getColor(game);
this.color = object.getColor(game).copy();
this.manaCostLeftStr = String.join("", object.getManaCostSymbols());
this.manaCostRightStr = "";
this.manaValue = object.getManaCost().manaValue();
@ -605,18 +605,18 @@ public class CardView extends SimpleCardView {
PermanentToken permanentToken = (PermanentToken) object;
this.rarity = Rarity.COMMON;
this.expansionSetCode = permanentToken.getExpansionSetCode();
this.rules = permanentToken.getRules();
this.rules = new ArrayList<>(permanentToken.getRules());
this.type = permanentToken.getToken().getTokenType();
} else if (object instanceof Emblem) {
this.mageObjectType = MageObjectType.EMBLEM;
Emblem emblem = (Emblem) object;
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) {
this.mageObjectType = MageObjectType.DUNGEON;
Dungeon dungeon = (Dungeon) object;
this.rarity = Rarity.SPECIAL;
this.rules = dungeon.getRules();
this.rules = new ArrayList<>(dungeon.getRules());
} else if (object instanceof Plane) {
this.mageObjectType = MageObjectType.PLANE;
Plane plane = (Plane) object;
@ -624,14 +624,14 @@ public class CardView extends SimpleCardView {
this.frameStyle = FrameStyle.M15_NORMAL;
// Display in landscape/rotated/on its side
this.rotate = true;
this.rules = plane.getAbilities().getRules(plane.getName());
this.rules = new ArrayList<>(plane.getAbilities().getRules(plane.getName()));
} else if (object instanceof Designation) {
this.mageObjectType = MageObjectType.DESIGNATION;
Designation designation = (Designation) object;
this.rarity = Rarity.SPECIAL;
this.frameStyle = FrameStyle.M15_NORMAL;
// 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) {
StackAbility stackAbility = (StackAbility) object;
@ -643,7 +643,7 @@ public class CardView extends SimpleCardView {
}
}
// Frame color
this.frameColor = object.getFrameColor(game);
this.frameColor = object.getFrameColor(game).copy();
// Frame style
this.frameStyle = object.getFrameStyle();
// Starting loyalty. Must be extracted from an ability
@ -662,7 +662,7 @@ public class CardView extends SimpleCardView {
this.name = emblem.getName();
this.displayName = name;
this.displayFullName = name;
this.rules = emblem.getRules();
this.rules = new ArrayList<>(emblem.getRules());
// emblem images are always with common (black) symbol
this.frameStyle = FrameStyle.M15_NORMAL;
this.expansionSetCode = emblem.getExpansionSetCode();
@ -677,7 +677,7 @@ public class CardView extends SimpleCardView {
this.name = dungeon.getName();
this.displayName = name;
this.displayFullName = name;
this.rules = dungeon.getRules();
this.rules = new ArrayList<>(dungeon.getRules());
// emblem images are always with common (black) symbol
this.frameStyle = FrameStyle.M15_NORMAL;
this.expansionSetCode = dungeon.getExpansionSetCode();
@ -692,7 +692,7 @@ public class CardView extends SimpleCardView {
this.name = plane.getName();
this.displayName = name;
this.displayFullName = name;
this.rules = plane.getRules();
this.rules = new ArrayList<>(plane.getRules());
// Display the plane in landscape (similar to Fused cards)
this.rotate = true;
this.frameStyle = FrameStyle.M15_NORMAL;
@ -776,16 +776,16 @@ public class CardView extends SimpleCardView {
this.name = token.getName();
this.displayName = 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.toughness = token.getToughness().toString();
this.loyalty = "";
this.startingLoyalty = "";
this.cardTypes = token.getCardType(game);
this.subTypes = token.getSubtype(game);
this.cardTypes = new ArrayList<>(token.getCardType(game));
this.subTypes = new SubTypes(token.getSubtype(game));
this.superTypes = token.getSuperType();
this.color = token.getColor(game);
this.frameColor = token.getFrameColor(game);
this.color = token.getColor(game).copy();
this.frameColor = token.getFrameColor(game).copy();
this.frameStyle = token.getFrameStyle();
this.manaCostLeftStr = String.join("", token.getManaCostSymbols());
this.manaCostRightStr = "";
@ -839,7 +839,7 @@ public class CardView extends SimpleCardView {
}
public void overrideRules(List<String> rules) {
this.rules = rules;
this.rules = new ArrayList<>(rules);
}
public void setIsAbility(boolean isAbility) {