- GuiChoose (desktop Forge): show the right card face in the card detail panel when choosing a card name.

This commit is contained in:
Agetian
2018-06-29 08:08:03 +03:00
parent d890ee248c
commit eafc717dd8

View File

@@ -13,6 +13,7 @@ import javax.swing.WindowConstants;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import forge.card.CardStateName;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Function; import com.google.common.base.Function;
@@ -165,7 +166,24 @@ public class GuiChoose {
if (paper == null) { if (paper == null) {
paper = FModel.getMagicDb().getVariantCards().getUniqueByName(face.getName()); paper = FModel.getMagicDb().getVariantCards().getUniqueByName(face.getName());
} }
if (paper != null && !paper.getName().equals(face.getName())) {
Card c = Card.getCardForUi(paper);
boolean foundState = false;
for (CardStateName cs : c.getStates()) {
if (c.getState(cs).getName().equals(face.getName())) {
foundState = true;
c.setState(cs, true);
matchUI.setCard(c.getView());
}
}
if (!foundState) {
matchUI.setCard(paper); matchUI.setCard(paper);
}
} else {
matchUI.setCard(paper);
}
return; return;
} }