mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* UI: fixed that tokens in M15 render mode did not use a variety of images (all same named tokens uses same image);
This commit is contained in:
parent
fe3c2cc386
commit
2b21298377
4 changed files with 21 additions and 10 deletions
|
@ -562,8 +562,8 @@ public class MageBook extends JComponent {
|
||||||
Constructor<?> cons = c.getConstructor();
|
Constructor<?> cons = c.getConstructor();
|
||||||
Object newToken = cons.newInstance();
|
Object newToken = cons.newInstance();
|
||||||
if (newToken instanceof Token) {
|
if (newToken instanceof Token) {
|
||||||
((Token) newToken).setExpansionSetCodeForImage(set);
|
|
||||||
((Token) newToken).setOriginalExpansionSetCode(set);
|
((Token) newToken).setOriginalExpansionSetCode(set);
|
||||||
|
((Token) newToken).setExpansionSetCodeForImage(set);
|
||||||
((Token) newToken).setTokenType(token.getType());
|
((Token) newToken).setTokenType(token.getType());
|
||||||
tokens.add((Token) newToken);
|
tokens.add((Token) newToken);
|
||||||
}
|
}
|
||||||
|
@ -634,6 +634,10 @@ public class MageBook extends JComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emblems.size() == 0) {
|
||||||
|
return emblems;
|
||||||
|
}
|
||||||
|
|
||||||
int totalTokens = getTotalNumTokens(set);
|
int totalTokens = getTotalNumTokens(set);
|
||||||
int start = 0;
|
int start = 0;
|
||||||
if (!(page * conf.CARDS_PER_PAGE <= totalTokens && (page + 1) * conf.CARDS_PER_PAGE >= totalTokens)) {
|
if (!(page * conf.CARDS_PER_PAGE <= totalTokens && (page + 1) * conf.CARDS_PER_PAGE >= totalTokens)) {
|
||||||
|
@ -917,8 +921,8 @@ public class MageBook extends JComponent {
|
||||||
|
|
||||||
private int currentPage = 0;
|
private int currentPage = 0;
|
||||||
private String currentSet = "RTR";
|
private String currentSet = "RTR";
|
||||||
private int currentCardsInSet = 0;
|
private final int currentCardsInSet = 0;
|
||||||
private int currentCardsNotInSet = 0;
|
private final int currentCardsNotInSet = 0;
|
||||||
|
|
||||||
private static CardDimensions cardDimensions = new CardDimensions(1.2d);
|
private static CardDimensions cardDimensions = new CardDimensions(1.2d);
|
||||||
private static final Logger log = Logger.getLogger(MageBook.class);
|
private static final Logger log = Logger.getLogger(MageBook.class);
|
||||||
|
|
|
@ -154,6 +154,7 @@ public class CardPanelRenderImpl extends CardPanel {
|
||||||
sb.append(this.view.getToughness());
|
sb.append(this.view.getToughness());
|
||||||
sb.append(this.view.getLoyalty());
|
sb.append(this.view.getLoyalty());
|
||||||
sb.append(this.view.getColor().toString());
|
sb.append(this.view.getColor().toString());
|
||||||
|
sb.append(this.view.getType());
|
||||||
sb.append(this.view.getExpansionSetCode());
|
sb.append(this.view.getExpansionSetCode());
|
||||||
for (CardType type : this.view.getCardTypes()) {
|
for (CardType type : this.view.getCardTypes()) {
|
||||||
sb.append((char) type.ordinal());
|
sb.append((char) type.ordinal());
|
||||||
|
@ -227,7 +228,7 @@ public class CardPanelRenderImpl extends CardPanel {
|
||||||
private BufferedImage faceArtImage;
|
private BufferedImage faceArtImage;
|
||||||
|
|
||||||
// Factory to generate card appropriate views
|
// Factory to generate card appropriate views
|
||||||
private CardRendererFactory cardRendererFactory = new CardRendererFactory();
|
private final CardRendererFactory cardRendererFactory = new CardRendererFactory();
|
||||||
|
|
||||||
// The rendered card image, with or without the art image loaded yet
|
// The rendered card image, with or without the art image loaded yet
|
||||||
// = null while invalid
|
// = null while invalid
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class ImageCache {
|
||||||
private static final SoftValuesLoadingCache<String, BufferedImage> FACE_IMAGE_CACHE;
|
private static final SoftValuesLoadingCache<String, BufferedImage> FACE_IMAGE_CACHE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common pattern for keys. Format: "<cardname>#<setname>#<collectorID>"
|
* Common pattern for keys. See ImageCache.getKey for structure info
|
||||||
*/
|
*/
|
||||||
private static final Pattern KEY_PATTERN = Pattern.compile("(.*)#(.*)#(.*)#(.*)#(.*)#(.*)");
|
private static final Pattern KEY_PATTERN = Pattern.compile("(.*)#(.*)#(.*)#(.*)#(.*)#(.*)");
|
||||||
|
|
||||||
|
@ -428,11 +428,14 @@ public final class ImageCache {
|
||||||
* Returns the map key for a card, without any suffixes for the image size.
|
* Returns the map key for a card, without any suffixes for the image size.
|
||||||
*/
|
*/
|
||||||
private static String getKey(CardView card, String name, String suffix) {
|
private static String getKey(CardView card, String name, String suffix) {
|
||||||
return name + '#' + card.getExpansionSetCode() + '#' + card.getType() + '#' + card.getCardNumber() + '#'
|
return name
|
||||||
+ (card.getTokenSetCode() == null ? "" : card.getTokenSetCode())
|
+ '#' + card.getExpansionSetCode()
|
||||||
|
+ '#' + card.getType()
|
||||||
|
+ '#' + card.getCardNumber()
|
||||||
|
+ '#' + (card.getTokenSetCode() == null ? "" : card.getTokenSetCode())
|
||||||
+ suffix
|
+ suffix
|
||||||
+ (card.getUsesVariousArt() ? "#usesVariousArt" : "")
|
+ (card.getUsesVariousArt() ? "#usesVariousArt" : "")
|
||||||
+ (card.getTokenDescriptor() != null ? '#' + card.getTokenDescriptor() : "#");
|
+ '#' + (card.getTokenDescriptor() != null ? card.getTokenDescriptor() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -370,7 +370,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
copyAbility.setSourceId(objectId);
|
copyAbility.setSourceId(objectId);
|
||||||
// triggered abilities must be added to the state().triggers
|
// triggered abilities must be added to the state().triggers
|
||||||
// still as long as the prev. permanent is known to the LKI (e.g. Showstopper) so gained dies triggered ability will trigger
|
// still as long as the prev. permanent is known to the LKI (e.g. Showstopper) so gained dies triggered ability will trigger
|
||||||
|
if (game != null) {
|
||||||
|
// game is null in cards viewer window (MageBook)
|
||||||
game.getState().addAbility(copyAbility, sourceId, this);
|
game.getState().addAbility(copyAbility, sourceId, this);
|
||||||
|
}
|
||||||
abilities.add(copyAbility);
|
abilities.add(copyAbility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,7 +403,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeAbilities(List<Ability> abilitiesToRemove, UUID sourceId, Game game){
|
public void removeAbilities(List<Ability> abilitiesToRemove, UUID sourceId, Game game) {
|
||||||
if (abilitiesToRemove == null) {
|
if (abilitiesToRemove == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue