mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
[Mobile] Preferred Art Options
This commit is contained in:
@@ -54,6 +54,8 @@ public class StaticData {
|
||||
|
||||
private MulliganDefs.MulliganRule mulliganRule = MulliganDefs.getDefaultRule();
|
||||
|
||||
private String prefferedArt;
|
||||
|
||||
// Loaded lazily:
|
||||
private IStorage<SealedProduct.Template> boosters;
|
||||
private IStorage<SealedProduct.Template> specialBoosters;
|
||||
@@ -64,17 +66,18 @@ public class StaticData {
|
||||
|
||||
private static StaticData lastInstance = null;
|
||||
|
||||
public StaticData(CardStorageReader cardReader, CardStorageReader customCardReader, String editionFolder, String customEditionsFolder, String blockDataFolder, boolean enableUnknownCards, boolean loadNonLegalCards) {
|
||||
this(cardReader, null, customCardReader, editionFolder, customEditionsFolder, blockDataFolder, enableUnknownCards, loadNonLegalCards);
|
||||
public StaticData(CardStorageReader cardReader, CardStorageReader customCardReader, String editionFolder, String customEditionsFolder, String blockDataFolder, String prefferedArt, boolean enableUnknownCards, boolean loadNonLegalCards) {
|
||||
this(cardReader, null, customCardReader, editionFolder, customEditionsFolder, blockDataFolder, prefferedArt, enableUnknownCards, loadNonLegalCards);
|
||||
}
|
||||
|
||||
public StaticData(CardStorageReader cardReader, CardStorageReader tokenReader, CardStorageReader customCardReader, String editionFolder, String customEditionsFolder, String blockDataFolder, boolean enableUnknownCards, boolean loadNonLegalCards) {
|
||||
public StaticData(CardStorageReader cardReader, CardStorageReader tokenReader, CardStorageReader customCardReader, String editionFolder, String customEditionsFolder, String blockDataFolder, String prefferedArt, boolean enableUnknownCards, boolean loadNonLegalCards) {
|
||||
this.cardReader = cardReader;
|
||||
this.tokenReader = tokenReader;
|
||||
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
||||
this.blockDataFolder = blockDataFolder;
|
||||
this.customCardReader = customCardReader;
|
||||
this.customEditions = new CardEdition.Collection(new CardEdition.Reader(new File(customEditionsFolder)));
|
||||
this.prefferedArt = prefferedArt;
|
||||
lastInstance = this;
|
||||
|
||||
{
|
||||
@@ -275,6 +278,8 @@ public class StaticData {
|
||||
|
||||
public Predicate<PaperCard> getBrawlPredicate() { return brawlPredicate; }
|
||||
|
||||
public String getPrefferedArtOption() { return prefferedArt; }
|
||||
|
||||
public void setFilteredHandsEnabled(boolean filteredHandsEnabled){
|
||||
this.filteredHandsEnabled = filteredHandsEnabled;
|
||||
}
|
||||
@@ -333,6 +338,30 @@ public class StaticData {
|
||||
return card;
|
||||
}
|
||||
|
||||
public PaperCard getCardFromEarliestCoreExp(PaperCard card) {
|
||||
|
||||
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.EarliestCoreExp, card.getArtIndex());
|
||||
|
||||
if (null != c && c.hasImage()) {
|
||||
return c;
|
||||
}
|
||||
|
||||
c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.EarliestCoreExp, -1);
|
||||
|
||||
if (null != c && c.hasImage()) {
|
||||
return c;
|
||||
}
|
||||
|
||||
c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.Earliest, -1);
|
||||
|
||||
if (null != c) {
|
||||
return c;
|
||||
}
|
||||
|
||||
// I give up!
|
||||
return card;
|
||||
}
|
||||
|
||||
public boolean getFilteredHandsEnabled(){
|
||||
return filteredHandsEnabled;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import forge.StaticData;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -414,8 +415,9 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperCard getCardFromEdition(final String cardName, final Date printedBefore, final SetPreference fromSet, int artIndex) {
|
||||
public PaperCard getCardFromEdition(final String cardName, final Date printedBefore, final SetPreference fromSets, int artIndex) {
|
||||
final CardRequest cr = CardRequest.fromString(cardName);
|
||||
SetPreference fromSet = fromSets;
|
||||
List<PaperCard> cards = getAllCards(cr.cardName);
|
||||
if (printedBefore != null){
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, new Predicate<PaperCard>() {
|
||||
@@ -429,6 +431,10 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
return null;
|
||||
boolean cardsListReadOnly = true;
|
||||
|
||||
//overrides
|
||||
if (StaticData.instance().getPrefferedArtOption().equals("Earliest"))
|
||||
fromSet = SetPreference.EarliestCoreExp;
|
||||
|
||||
if (StringUtils.isNotBlank(cr.edition)) {
|
||||
cards = Lists.newArrayList(Iterables.filter(cards, new Predicate<PaperCard>() {
|
||||
@Override public boolean apply(PaperCard input) { return input.getEdition().equalsIgnoreCase(cr.edition); }
|
||||
|
||||
@@ -19,6 +19,7 @@ package forge.deck;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -259,7 +260,8 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
||||
}
|
||||
|
||||
private void convertByXitaxMethod() {
|
||||
//Date dateWithAllCards = StaticData.instance().getEditions().getEarliestDateWithAllCards(getAllCardsInASinglePool());
|
||||
Date dateWithAllCards = StaticData.instance().getEditions().getEarliestDateWithAllCards(getAllCardsInASinglePool());
|
||||
String artOption = StaticData.instance().getPrefferedArtOption();
|
||||
|
||||
for(Entry<DeckSection, CardPool> p : parts.entrySet()) {
|
||||
if( p.getKey() == DeckSection.Planes || p.getKey() == DeckSection.Schemes || p.getKey() == DeckSection.Avatar)
|
||||
@@ -271,7 +273,17 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
||||
PaperCard card = cp.getKey();
|
||||
int count = cp.getValue();
|
||||
|
||||
PaperCard replacementCard = StaticData.instance().getCardFromLatestorEarliest(card);
|
||||
PaperCard replacementCard;
|
||||
switch (artOption) {
|
||||
case "Latest":
|
||||
replacementCard = StaticData.instance().getCardFromLatestorEarliest(card);
|
||||
break;
|
||||
case "Earliest":
|
||||
replacementCard = StaticData.instance().getCardFromEarliestCoreExp(card);
|
||||
break;
|
||||
default:
|
||||
replacementCard = StaticData.instance().getCardByEditionDate(card, dateWithAllCards);
|
||||
}
|
||||
|
||||
if (replacementCard.getArtIndex() == card.getArtIndex()) {
|
||||
if (card.hasImage())
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CardDatabaseHelper {
|
||||
private static void initialize() {
|
||||
final CardStorageReader reader = new CardStorageReader(ForgeConstants.CARD_DATA_DIR, null, FModel.getPreferences().getPrefBoolean(FPref.LOAD_CARD_SCRIPTS_LAZILY));
|
||||
final CardStorageReader customReader = new CardStorageReader(ForgeConstants.USER_CUSTOM_CARDS_DIR, null, FModel.getPreferences().getPrefBoolean(FPref.LOAD_CARD_SCRIPTS_LAZILY));
|
||||
staticData = new StaticData(reader, customReader, ForgeConstants.EDITIONS_DIR, ForgeConstants.USER_CUSTOM_EDITIONS_DIR ,ForgeConstants.BLOCK_DATA_DIR, FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_UNKNOWN_CARDS), FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_NONLEGAL_CARDS));
|
||||
staticData = new StaticData(reader, customReader, ForgeConstants.EDITIONS_DIR, ForgeConstants.USER_CUSTOM_EDITIONS_DIR ,ForgeConstants.BLOCK_DATA_DIR, FModel.getPreferences().getPref(FPref.UI_PREFERRED_ART), FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_UNKNOWN_CARDS), FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_NONLEGAL_CARDS));
|
||||
}
|
||||
|
||||
private static boolean hasBeenInitialized() {
|
||||
|
||||
@@ -239,9 +239,7 @@ public class MatchController extends AbstractGuiGame {
|
||||
};
|
||||
try {
|
||||
phaseGameState.initFromGame(getGameView().getGame());
|
||||
} catch (Exception e) {
|
||||
System.out.println(phaseGameState);
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -396,6 +396,29 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
localizer.getMessage("cbImageFetcher"),
|
||||
localizer.getMessage("nlImageFetcher")),
|
||||
4);
|
||||
lstSettings.addItem(new CustomSelectSetting(FPref.UI_PREFERRED_ART,
|
||||
localizer.getMessage("lblPreferredArt"),
|
||||
localizer.getMessage("nlPreferredArt"),
|
||||
new String[]{"Latest", "Earliest", "Default"}) {
|
||||
@Override
|
||||
public void valueChanged(String newValue) {
|
||||
super.valueChanged(newValue);
|
||||
FOptionPane.showConfirmDialog (
|
||||
localizer.getMessage("lblRestartForgeDescription"),
|
||||
localizer.getMessage("lblRestartForge"),
|
||||
localizer.getMessage("lblRestart"),
|
||||
localizer.getMessage("lblLater"), new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean result) {
|
||||
if (result) {
|
||||
Forge.restart(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
4);
|
||||
lstSettings.addItem(new BooleanSetting(FPref.UI_OVERLAY_FOIL_EFFECT,
|
||||
localizer.getMessage("cbDisplayFoil"),
|
||||
localizer.getMessage("nlDisplayFoil")),
|
||||
|
||||
@@ -117,6 +117,8 @@ cbpCounterDisplayLocation=Markeranzeige Ort
|
||||
cbpGraveyardOrdering=Genaue Reihenfolge im Friedhof einhalten
|
||||
lblAltLifeDisplay=Alternatives Spieler-Layout (Landscape-Modus)
|
||||
nlAltLifeDisplay=Alternative Anzeige von Lebens-, Gift-, Energie- und Erfahrungspunkten.
|
||||
lblPreferredArt=Preferred Art
|
||||
nlPreferredArt=Sets the preferred art for cards.
|
||||
Troubleshooting=Fehlerbehebung
|
||||
GeneralConfiguration=Allgemeine Einstellungen
|
||||
lblPlayerName=Spielername
|
||||
|
||||
@@ -117,6 +117,8 @@ cbpCounterDisplayLocation=Counter Display Location
|
||||
cbpGraveyardOrdering=Allow Ordering Cards Put in Graveyard
|
||||
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
|
||||
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
|
||||
lblPreferredArt=Preferred Art
|
||||
nlPreferredArt=Sets the preferred art for cards (RESTART REQUIRED).
|
||||
Troubleshooting=Troubleshooting
|
||||
GeneralConfiguration=General Configuration
|
||||
lblPlayerName=Player Name
|
||||
|
||||
@@ -117,6 +117,8 @@ cbpCounterDisplayLocation=Ubicación del contador
|
||||
cbpGraveyardOrdering=Permitir ordenar cartas puestas en el cementerio
|
||||
lblAltLifeDisplay=Diseño alternativo de jugador (Modo apaisado)
|
||||
nlAltLifeDisplay=Permite un diseño alternativo para mostrar los contadores de vida, veneno, energía y experiencia.
|
||||
lblPreferredArt=Preferred Art
|
||||
nlPreferredArt=Sets the preferred art for cards.
|
||||
Troubleshooting=Solución de problemas
|
||||
GeneralConfiguration=Configuración general
|
||||
lblPlayerName=Nombre Jugador
|
||||
|
||||
@@ -117,6 +117,8 @@ cbpCounterDisplayLocation=Posizione display contatore
|
||||
cbpGraveyardOrdering=Consenti l''ordinazione di carte messe nel cimitero
|
||||
lblAltLifeDisplay=Alternate Player Layout (Landscape Mode)
|
||||
nlAltLifeDisplay=Enables alternate layout for displaying Player Life, Poison, Energy and Experience counters.
|
||||
lblPreferredArt=Preferred Art
|
||||
nlPreferredArt=Sets the preferred art for cards.
|
||||
Troubleshooting=Risoluzione dei problemi
|
||||
GeneralConfiguration=Configurazione generale
|
||||
lblPlayerName=Nome del giocatore
|
||||
|
||||
@@ -117,6 +117,8 @@ cbpCounterDisplayLocation=カウンター表示場所
|
||||
cbpGraveyardOrdering=墓地に置かれるカードの順番指定を許可する
|
||||
lblAltLifeDisplay=代替のプレイヤーレイアウト(ランドスケープモード時)
|
||||
nlAltLifeDisplay=代替のレイアウトでプレイヤーライフ、毒、エネルギーと経験カウンターを表示する
|
||||
lblPreferredArt=Preferred Art
|
||||
nlPreferredArt=Sets the preferred art for cards.
|
||||
Troubleshooting=トラブルシューティング
|
||||
GeneralConfiguration=一般設定
|
||||
lblPlayerName=プレイヤー名
|
||||
|
||||
@@ -117,6 +117,8 @@ cbpCounterDisplayLocation=计数器显示区域
|
||||
cbpGraveyardOrdering=允许指衍生物进入墓地
|
||||
lblAltLifeDisplay=备用牌手布局(横向模式)
|
||||
nlAltLifeDisplay=启用备用牌手布局以显示玩家的生命以及中毒,能量和经验指示物。
|
||||
lblPreferredArt=Preferred Art
|
||||
nlPreferredArt=Sets the preferred art for cards.
|
||||
Troubleshooting=故障排除
|
||||
GeneralConfiguration=常规配置
|
||||
lblPlayerName=玩家名称
|
||||
|
||||
@@ -81,6 +81,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_OVERLAY_CARD_ID ("true"),
|
||||
UI_OVERLAY_ABILITY_ICONS("true"),
|
||||
UI_ENABLE_ONLINE_IMAGE_FETCHER ("false"),
|
||||
UI_PREFERRED_ART ("Latest"),
|
||||
UI_DISABLE_CARD_IMAGES ("false"),
|
||||
UI_IMAGE_CACHE_MAXIMUM("400"),
|
||||
UI_OVERLAY_FOIL_EFFECT ("true"),
|
||||
|
||||
@@ -183,7 +183,7 @@ public final class FModel {
|
||||
} catch (Exception e) {
|
||||
customReader = null;
|
||||
}
|
||||
magicDb = new StaticData(reader, tokenReader, customReader, ForgeConstants.EDITIONS_DIR, ForgeConstants.USER_CUSTOM_EDITIONS_DIR,ForgeConstants.BLOCK_DATA_DIR, FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_UNKNOWN_CARDS), FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_NONLEGAL_CARDS));
|
||||
magicDb = new StaticData(reader, tokenReader, customReader, ForgeConstants.EDITIONS_DIR, ForgeConstants.USER_CUSTOM_EDITIONS_DIR,ForgeConstants.BLOCK_DATA_DIR, FModel.getPreferences().getPref(FPref.UI_PREFERRED_ART), FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_UNKNOWN_CARDS), FModel.getPreferences().getPrefBoolean(FPref.UI_LOAD_NONLEGAL_CARDS));
|
||||
CardTranslation.preloadTranslation(preferences.getPref(FPref.UI_LANGUAGE), ForgeConstants.LANG_DIR);
|
||||
|
||||
//create profile dirs if they don't already exist
|
||||
|
||||
Reference in New Issue
Block a user