Fix some display problems:

- Update GUI after clone effects.
- Fix foil display on face-down cards.
- Update icons on card panels more aggressively.
This commit is contained in:
elcnesh
2014-09-16 14:17:03 +00:00
parent 2e48a21f0e
commit 12e331e2bd
12 changed files with 135 additions and 118 deletions

View File

@@ -46,6 +46,7 @@ import forge.util.gui.SGuiDialog;
import forge.util.gui.SOptionPane;
import forge.view.CardView;
import forge.view.PlayerView;
import forge.view.SpellAbilityView;
public final class DevModeUtil {
@@ -437,7 +438,14 @@ public final class DevModeUtil {
return; // when would it happen?
}
final SpellAbility sa = choices.size() == 1 ? choices.get(0) : SGuiChoose.oneOrNone(controller.getGui(), "Choose", choices);
final SpellAbility sa;
if (choices.size() == 1) {
sa = choices.iterator().next();
} else {
final SpellAbilityView saView = SGuiChoose.oneOrNone(controller.getGui(), "Choose", controller.getSpellAbilityViews(choices));
sa = controller.getSpellAbility(saView);
}
if (sa == null) {
return; // happens if cancelled
}

View File

@@ -34,7 +34,6 @@ public class CardView extends GameEntityView {
private final boolean isUiDisplayable;
private PlayerView owner, controller;
private ZoneType zone;
private int foilIndex;
private boolean isCloned, isFaceDown, isFlipCard, isFlipped, isSplitCard, isTransformed;
private String setCode;
private CardRarity rarity;
@@ -71,7 +70,6 @@ public class CardView extends GameEntityView {
this.owner = null;
this.controller = null;
this.zone = null;
this.foilIndex = 0;
this.isCloned = false;
this.isFaceDown = false;
this.isFlipped = false;
@@ -186,24 +184,6 @@ public class CardView extends GameEntityView {
this.hasAltState = hasAltState;
}
/**
* @return the foilIndex
*/
public int getFoilIndex() {
return foilIndex;
}
/**
* @param foilIndex the foilIndex to set
*/
public void setFoilIndex(final int foilIndex) {
this.foilIndex = foilIndex;
}
public void setRandomFoil() {
this.setFoilIndex(CardEdition.getRandomFoil(getSetCode()));
}
/**
* @return the isCloned
*/
@@ -760,6 +740,7 @@ public class CardView extends GameEntityView {
private Map<String, String> changedColorWords,
changedTypes;
private boolean hasDeathtouch, hasInfect, hasStorm, hasTrample;
private int foilIndex;
public CardStateView() {
this.reset();
@@ -781,6 +762,7 @@ public class CardView extends GameEntityView {
this.hasInfect = false;
this.hasStorm = false;
this.hasTrample = false;
this.foilIndex = 0;
}
@Override
@@ -1006,6 +988,24 @@ public class CardView extends GameEntityView {
this.hasTrample = hasTrample;
}
/**
* @return the foilIndex
*/
public int getFoilIndex() {
return foilIndex;
}
/**
* @param foilIndex the foilIndex to set
*/
public void setFoilIndex(final int foilIndex) {
this.foilIndex = foilIndex;
}
public void setRandomFoil() {
this.setFoilIndex(CardEdition.getRandomFoil(getSetCode()));
}
public boolean isBasicLand() {
return this.isLand() && Iterables.any(type, Predicates.in(CardType.getBasicTypes()));
}

View File

@@ -32,7 +32,6 @@ public final class ViewUtil {
view.setZone(c.getZone() == null ? null : c.getZone().getZoneType());
view.setHasAltState(hasAltState);
view.setFaceDown(c.isFaceDown());
view.setFoilIndex(c.getFoil());
view.setCloned(c.isCloned());
view.setFlipCard(c.isFlipCard());
view.setFlipped(c.getCurState().equals(CardCharacteristicName.Flipped));
@@ -85,6 +84,7 @@ public final class ViewUtil {
origView.setHasInfect(c.hasKeyword("Infect"));
origView.setHasStorm(c.hasKeyword("Storm"));
origView.setHasTrample(c.hasKeyword("Trample"));
origView.setFoilIndex(c.getCharacteristics().getFoil());
final CardStateView altView = view.getAlternate();
CardCharacteristicName altState = null;
@@ -116,8 +116,9 @@ public final class ViewUtil {
view.setManaCost(chars.getManaCost());
view.setPower(chars.getBaseAttack());
view.setToughness(chars.getBaseDefense());
view.setLoyalty(0); // FIXME why is loyalty not a property of CardCharacteristic?
view.setLoyalty(0); // Q why is loyalty not a property of CardCharacteristic? A: because no alt states have a base loyalty (only candidate is Garruk Relentless).
view.setText(chars.getOracleText());
view.setFoilIndex(chars.getFoil());
}
public static CardView getCardForUi(final IPaperCard pc) {