mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
refactor: removed outdated or un-used code (part of #11873)
This commit is contained in:
parent
2aea44da2c
commit
734e2fae0f
5 changed files with 8 additions and 127 deletions
|
|
@ -11,8 +11,7 @@ import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||||
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
|
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: outdated, delete and use xmage tokens instead ?!
|
* Additional images from a third party sources
|
||||||
* Used when we need to point to direct links to download resources from.
|
|
||||||
*
|
*
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
|
@ -20,6 +19,9 @@ public class DirectLinksForDownload implements Iterable<DownloadJob> {
|
||||||
|
|
||||||
private static final Map<String, String> directLinks = new LinkedHashMap<>();
|
private static final Map<String, String> directLinks = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
// face down cards uses tokens source for a cardback image
|
||||||
|
// that's cardback used for miss images
|
||||||
|
// TODO: replace miss image cardback to some generic card (must be diff from face down image)
|
||||||
public static final String cardbackFilename = "cardback.jpg";
|
public static final String cardbackFilename = "cardback.jpg";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ public final class ImageCache {
|
||||||
|
|
||||||
CardDownloadData info = new CardDownloadData(name, setCode, collectorId, usesVariousArt, imageNumber);
|
CardDownloadData info = new CardDownloadData(name, setCode, collectorId, usesVariousArt, imageNumber);
|
||||||
|
|
||||||
boolean cardback = false;
|
|
||||||
String path;
|
String path;
|
||||||
if (collectorId.isEmpty() || "0".equals(collectorId)) {
|
if (collectorId.isEmpty() || "0".equals(collectorId)) {
|
||||||
// TOKEN
|
// TOKEN
|
||||||
|
|
@ -89,7 +88,6 @@ public final class ImageCache {
|
||||||
// try unknown token image
|
// try unknown token image
|
||||||
if (tokenFile == null || !tokenFile.exists()) {
|
if (tokenFile == null || !tokenFile.exists()) {
|
||||||
// TODO: replace empty token by other default card, not cardback
|
// TODO: replace empty token by other default card, not cardback
|
||||||
cardback = true;
|
|
||||||
path = CardImageUtils.buildImagePathToDefault(DirectLinksForDownload.cardbackFilename);
|
path = CardImageUtils.buildImagePathToDefault(DirectLinksForDownload.cardbackFilename);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -102,19 +100,9 @@ public final class ImageCache {
|
||||||
return new ImageCacheData(path, null);
|
return new ImageCacheData(path, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cardback) {
|
BufferedImage image = loadImage(file);
|
||||||
// TODO: is there any different in images styles? Cardback must be from scryfall, not wizards
|
image = getRoundCorner(image);
|
||||||
// need cardback image
|
return new ImageCacheData(path, image);
|
||||||
BufferedImage image = loadImage(file);
|
|
||||||
image = getRoundCorner(image);
|
|
||||||
return new ImageCacheData(path, image);
|
|
||||||
} else {
|
|
||||||
// need normal card image
|
|
||||||
BufferedImage image = loadImage(file);
|
|
||||||
image = getWizardsCard(image);
|
|
||||||
image = getRoundCorner(image);
|
|
||||||
return new ImageCacheData(path, image);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unknown card image's key format: " + key);
|
throw new IllegalArgumentException("Unknown card image's key format: " + key);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
package mage.view;
|
|
||||||
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.game.command.CommandObject;
|
|
||||||
import mage.game.permanent.token.Token;
|
|
||||||
import mage.util.Copyable;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: delete, no needs?!
|
|
||||||
*
|
|
||||||
* GUI: card drawing info
|
|
||||||
* Can be different from real card name, set code, etc - see morph, copy, etc)
|
|
||||||
*
|
|
||||||
* @author JayDi85
|
|
||||||
*/
|
|
||||||
public class CardImageView implements Serializable, Copyable<CardImageView> {
|
|
||||||
|
|
||||||
private boolean isTokenRepository; // card or token database
|
|
||||||
private String cardName; // card or token
|
|
||||||
private String setCode; // card or token
|
|
||||||
private String cardNumber; // card only, token has "0"
|
|
||||||
private Integer imageNumber; // token only
|
|
||||||
private boolean isUseVariousArt; // card only
|
|
||||||
|
|
||||||
public CardImageView() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardImageView(final CardImageView cardImageView) {
|
|
||||||
this.isTokenRepository = cardImageView.isTokenRepository;
|
|
||||||
this.cardName = cardImageView.cardName;
|
|
||||||
this.setCode = cardImageView.setCode;
|
|
||||||
this.cardNumber = cardImageView.cardNumber;
|
|
||||||
this.imageNumber = cardImageView.imageNumber;
|
|
||||||
this.isUseVariousArt = cardImageView.isUseVariousArt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardImageView fromCard(Card card) {
|
|
||||||
this.isTokenRepository = false;
|
|
||||||
this.cardName = card.getName();
|
|
||||||
this.setCode = card.getExpansionSetCode();
|
|
||||||
this.cardNumber = card.getCardNumber();
|
|
||||||
this.imageNumber = card.getImageNumber();
|
|
||||||
this.isUseVariousArt = card.getUsesVariousArt();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardImageView fromToken(Token token) {
|
|
||||||
this.isTokenRepository = true;
|
|
||||||
this.cardName = token.getName();
|
|
||||||
this.setCode = token.getExpansionSetCode();
|
|
||||||
this.cardNumber = token.getCardNumber();
|
|
||||||
this.imageNumber = token.getImageNumber();
|
|
||||||
this.isUseVariousArt = false;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardImageView fromCommandObject(CommandObject commandObject) {
|
|
||||||
this.isTokenRepository = true;
|
|
||||||
this.cardName = commandObject.getName();
|
|
||||||
this.setCode = commandObject.getExpansionSetCode();
|
|
||||||
this.cardNumber = commandObject.getCardNumber();
|
|
||||||
this.imageNumber = commandObject.getImageNumber();
|
|
||||||
this.isUseVariousArt = false;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CardImageView copy() {
|
|
||||||
return new CardImageView(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTokenRepository() {
|
|
||||||
return isTokenRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardName() {
|
|
||||||
return cardName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSetCode() {
|
|
||||||
return setCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardNumber() {
|
|
||||||
return cardNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getImageNumber() {
|
|
||||||
return imageNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUseVariousArt() {
|
|
||||||
return isUseVariousArt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -95,18 +95,6 @@ public class PermanentView extends CardView {
|
||||||
}
|
}
|
||||||
this.nameController = nameController;
|
this.nameController = nameController;
|
||||||
|
|
||||||
// add additional info for face down permanents
|
|
||||||
if (permanent.isFaceDown(game)) {
|
|
||||||
//if (permanent.isManifested()) {
|
|
||||||
// this.rules.add("A manifested creature card can be turned face up any time for it's mana cost."
|
|
||||||
// + " A face-down card can also be turned face up for its morph cost.");
|
|
||||||
//} else if (permanent.isMorphed()) {
|
|
||||||
// this.rules.add("If the controller has priority, they may turn this permanent face up."
|
|
||||||
// + " This is a special action; it doesn't use the stack. To do this they pay the morph costs,"
|
|
||||||
// + " then turns this permanent face up.");
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
// determines if shown in it's own column
|
// determines if shown in it's own column
|
||||||
boolean attachedToPermanent = false;
|
boolean attachedToPermanent = false;
|
||||||
boolean attachedControllerDiffers = false;
|
boolean attachedControllerDiffers = false;
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ public class PermanentCard extends PermanentImpl {
|
||||||
this.abilities.setSourceId(objectId);
|
this.abilities.setSourceId(objectId);
|
||||||
this.cardType.clear();
|
this.cardType.clear();
|
||||||
this.cardType.addAll(card.getCardType());
|
this.cardType.addAll(card.getCardType());
|
||||||
this.color = card.getColor(null).copy(); // TODO: need research - why it null
|
this.color = card.getColor(game).copy();
|
||||||
this.frameColor = card.getFrameColor(game).copy();
|
this.frameColor = card.getFrameColor(game).copy();
|
||||||
this.frameStyle = card.getFrameStyle();
|
this.frameStyle = card.getFrameStyle();
|
||||||
this.manaCost = card.getManaCost().copy();
|
this.manaCost = card.getManaCost().copy();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue