From 7ef0f234df99990732891b4537056cb228c9a263 Mon Sep 17 00:00:00 2001 From: myk Date: Fri, 8 Mar 2013 02:41:44 +0000 Subject: [PATCH] step one in separating user from program data - define user/program/cache directories in NewConstants - use directories where applicable - merge lang and properties into constants - create separate image lists for sealed products - update howto document - allow alternate file extensions for images - a whole bunch of code cleanup --- .gitattributes | 21 +- .../editor.preferences} | 0 .../editor.xml} | 0 res/defaults/forge.preferences | 66 + .../home_default.xml => defaults/home.xml} | 0 .../match_default.xml => defaults/match.xml} | 0 res/draft/common.txt | 106 -- res/draft/draft.properties | 3 - res/draft/rare.txt | 68 - res/draft/uncommon.txt | 60 - res/howto.txt | 122 ++ res/lang/howTo/en.properties | 68 - res/preferences/.project | 11 - res/preferences/main.properties | 71 - res/product-images.txt | 106 -- res/quest/fatpack-images.txt | 52 + res/quest/precon-images.txt | 152 +++ res/quest/quest.properties | 19 - res/quest/tournamentpack-images.txt | 22 + src/main/java/forge/Card.java | 4 +- src/main/java/forge/CardUtil.java | 72 +- src/main/java/forge/Constant.java | 6 - src/main/java/forge/ImageCache.java | 38 +- src/main/java/forge/ImageLoader.java | 88 +- src/main/java/forge/Singletons.java | 50 +- src/main/java/forge/StaticEffects.java | 2 +- .../java/forge/card/CardRulesPredicates.java | 1 + src/main/java/forge/card/CardRulesReader.java | 9 +- .../java/forge/card/FormatCollection.java | 1 + .../forge/card/ability/AbilityFactory.java | 2 - src/main/java/forge/card/ability/ApiType.java | 94 +- .../java/forge/card/ability/ai/AddTurnAi.java | 4 +- .../java/forge/card/ability/ai/AttachAi.java | 2 +- .../java/forge/card/ability/ai/BondAi.java | 2 +- .../forge/card/ability/ai/ChangeZoneAi.java | 6 +- .../java/forge/card/ability/ai/CharmAi.java | 4 +- .../forge/card/ability/ai/ControlGainAi.java | 1 - .../card/ability/ai/CopyPermanentAi.java | 2 +- .../forge/card/ability/ai/CountersAi.java | 1 - .../java/forge/card/ability/ai/DrawAi.java | 2 - .../java/forge/card/ability/ai/EncodeAi.java | 2 +- .../forge/card/ability/ai/LifeGainAi.java | 2 +- .../java/forge/card/ability/ai/ProtectAi.java | 1 + .../java/forge/card/ability/ai/PumpAi.java | 3 +- .../java/forge/card/ability/ai/PumpAllAi.java | 2 +- .../forge/card/ability/ai/RegenerateAi.java | 1 - .../forge/card/ability/ai/RepeatEachAi.java | 2 +- .../forge/card/ability/ai/SacrificeAi.java | 1 + .../forge/card/ability/ai/StoreSVarAi.java | 2 +- .../java/forge/card/ability/ai/TapAiBase.java | 2 +- .../java/forge/card/ability/ai/TapAllAi.java | 2 +- .../java/forge/card/ability/ai/UntapAi.java | 2 +- .../ability/effects/AnimateEffectBase.java | 2 +- .../card/ability/effects/AttachEffect.java | 1 + .../ability/effects/ChangeZoneEffect.java | 1 + .../card/ability/effects/CharmEffect.java | 1 + .../ability/effects/ChooseCardEffect.java | 2 +- .../ability/effects/ChooseCardNameEffect.java | 2 +- .../ability/effects/ChooseGenericEffect.java | 1 + .../ability/effects/ChooseSourceEffect.java | 4 +- .../card/ability/effects/CounterEffect.java | 1 + .../card/ability/effects/PlayEffect.java | 2 +- .../card/ability/effects/PumpEffect.java | 1 + .../card/ability/effects/RepeatEffect.java | 1 + .../ability/effects/RevealEffectBase.java | 2 - .../card/ability/effects/TokenEffect.java | 2 +- .../card/ability/effects/TwoPilesEffect.java | 1 + .../card/ability/effects/UntapEffect.java | 3 +- .../forge/card/cardfactory/CardFactory.java | 7 +- .../cardfactory/CardFactoryArtifacts.java | 1 - .../cardfactory/CardFactoryCreatures.java | 2 +- .../card/cardfactory/CardFactoryLands.java | 1 - .../cardfactory/CardFactorySorceries.java | 2 +- .../card/cardfactory/CardFactoryUtil.java | 4 +- .../card/cardfactory/CardStorageReader.java | 4 +- src/main/java/forge/card/cost/Cost.java | 2 +- .../java/forge/card/cost/CostDiscard.java | 3 +- src/main/java/forge/card/cost/CostExile.java | 1 - src/main/java/forge/card/cost/CostMill.java | 1 - .../forge/card/cost/CostPartWithList.java | 1 - .../java/forge/card/cost/CostPutCounter.java | 1 - .../forge/card/cost/CostRemoveCounter.java | 1 - src/main/java/forge/card/cost/CostReturn.java | 1 - src/main/java/forge/card/cost/CostReveal.java | 3 +- .../java/forge/card/cost/CostSacrifice.java | 1 - .../java/forge/card/cost/CostTapType.java | 1 - .../java/forge/card/cost/CostUntapType.java | 1 - .../forge/card/mana/ManaCostBeingPaid.java | 1 + .../java/forge/card/mana/ManaCostShard.java | 2 +- .../card/spellability/AbilityActivated.java | 1 - .../java/forge/card/spellability/Spell.java | 3 +- .../spellability/SpellAbilityCondition.java | 1 - .../spellability/SpellAbilityRestriction.java | 1 - .../SpellAbilityStackInstance.java | 1 - .../card/spellability/SpellPermanent.java | 1 - .../card/spellability/TargetSelection.java | 4 +- .../StaticAbilityContinuous.java | 3 +- src/main/java/forge/card/trigger/Trigger.java | 1 - .../card/trigger/TriggerAttackerBlocked.java | 1 - .../trigger/TriggerAttackerUnblocked.java | 1 - .../trigger/TriggerAttackersDeclared.java | 2 - .../forge/card/trigger/TriggerAttacks.java | 1 - .../card/trigger/TriggerBecomesTarget.java | 1 - .../forge/card/trigger/TriggerBlocks.java | 1 - .../forge/card/trigger/TriggerClashed.java | 1 - .../forge/card/trigger/TriggerHandler.java | 3 +- .../forge/card/trigger/TriggerLandPlayed.java | 1 - .../card/trigger/TriggerSpellAbilityCast.java | 3 +- src/main/java/forge/control/FControl.java | 4 +- .../java/forge/control/input/InputAttack.java | 1 - .../java/forge/control/input/InputBlock.java | 1 - .../control/input/InputPayManaSimple.java | 2 +- .../forge/control/input/InputPayManaX.java | 2 +- .../control/input/InputPayReturnCost.java | 1 - .../forge/control/input/InputPaySacCost.java | 1 - src/main/java/forge/deck/CardCollections.java | 17 +- src/main/java/forge/deck/CardPool.java | 1 - src/main/java/forge/deck/Deck.java | 1 - src/main/java/forge/deck/DeckgenUtil.java | 1 + .../deck/generate/Generate2ColorDeck.java | 7 +- .../deck/generate/Generate3ColorDeck.java | 7 +- .../deck/generate/Generate5ColorDeck.java | 6 +- .../generate/GenerateColoredDeckBase.java | 20 +- .../forge/deck/generate/GenerateDeckUtil.java | 4 +- .../java/forge/deck/io/OldDeckParser.java | 4 +- src/main/java/forge/error/BugReporter.java | 4 +- src/main/java/forge/game/GameAction.java | 2 + src/main/java/forge/game/GameActionPlay.java | 2 +- src/main/java/forge/game/GameActionUtil.java | 4 +- src/main/java/forge/game/GameNew.java | 2 +- src/main/java/forge/game/MatchController.java | 9 +- src/main/java/forge/game/PlanarDice.java | 1 + .../forge/game/ai/AiAttackController.java | 1 - src/main/java/forge/game/ai/AiController.java | 3 +- src/main/java/forge/game/ai/ComputerUtil.java | 3 +- .../java/forge/game/ai/ComputerUtilBlock.java | 1 - .../java/forge/game/ai/ComputerUtilMana.java | 2 +- .../java/forge/game/limited/BoosterDraft.java | 32 +- .../game/limited/CardPoolLimitation.java | 9 - .../java/forge/game/limited/CardRatings.java | 306 ----- .../java/forge/game/limited/GauntletMini.java | 6 +- .../java/forge/game/limited/LimitedDeck.java | 6 +- .../forge/game/limited/ReadDraftRankings.java | 9 +- .../java/forge/game/limited/SealedDeck.java | 4 +- src/main/java/forge/game/phase/Combat.java | 1 - .../java/forge/game/phase/CombatUtil.java | 1 - src/main/java/forge/game/phase/EndOfTurn.java | 1 - src/main/java/forge/game/phase/Untap.java | 5 +- src/main/java/forge/game/phase/Upkeep.java | 2 +- src/main/java/forge/game/player/AIPlayer.java | 2 +- .../java/forge/game/player/HumanPlayer.java | 3 +- src/main/java/forge/game/player/Player.java | 3 +- .../game/player/PlayerControllerHuman.java | 2 +- .../java/forge/game/player/PlayerUtil.java | 1 - src/main/java/forge/game/zone/MagicStack.java | 3 +- src/main/java/forge/game/zone/PlayerZone.java | 1 - .../game/zone/PlayerZoneBattlefield.java | 1 - src/main/java/forge/game/zone/Zone.java | 1 - src/main/java/forge/game/zone/ZoneType.java | 18 - src/main/java/forge/gui/ForgeAction.java | 85 +- src/main/java/forge/gui/GuiDisplayUtil.java | 80 +- src/main/java/forge/gui/GuiImportPicture.java | 7 +- .../java/forge/gui/deckeditor/DeckImport.java | 4 +- .../java/forge/gui/deckeditor/SEditorIO.java | 29 +- .../deckeditor/controllers/CCurrentDeck.java | 8 +- .../controllers/CEditorConstructed.java | 1 + .../deckeditor/controllers/CStatistics.java | 5 +- .../deckeditor/tables/ManaCostRenderer.java | 2 +- .../gui/deckeditor/tables/SColumnUtil.java | 2 +- .../gui/download/GuiDownloadPicturesLQ.java | 39 +- .../forge/gui/download/GuiDownloadPrices.java | 23 +- .../gui/download/GuiDownloadQuestImages.java | 47 +- .../download/GuiDownloadSetPicturesLQ.java | 96 +- .../forge/gui/download/GuiDownloader.java | 53 +- .../java/forge/gui/framework/DragCell.java | 3 +- .../java/forge/gui/framework/SLayoutIO.java | 39 +- .../gui/home/quest/CSubmenuQuestData.java | 5 +- .../java/forge/gui/home/quest/PnlEvent.java | 4 +- .../forge/gui/home/quest/QuestFileLister.java | 7 +- .../home/sanctioned/VSubmenuConstructed.java | 1 + .../home/settings/VSubmenuDownloaders.java | 6 +- .../home/settings/VSubmenuPreferences.java | 4 +- src/main/java/forge/gui/match/CMatchUI.java | 3 +- .../java/forge/gui/match/ControlWinLose.java | 2 +- .../java/forge/gui/match/QuestWinLose.java | 35 +- .../java/forge/gui/match/VAssignDamage.java | 1 + .../java/forge/gui/match/ViewWinLose.java | 8 +- .../gui/match/nonsingleton/CCommand.java | 1 - .../forge/gui/match/nonsingleton/CField.java | 24 +- .../java/forge/gui/match/views/VPlayers.java | 1 - .../java/forge/gui/match/views/VStack.java | 16 +- .../forge/gui/toolbox/CardFaceSymbols.java | 3 +- .../forge/gui/toolbox/SaveOpenDialog.java | 3 +- src/main/java/forge/item/BoosterPack.java | 2 +- src/main/java/forge/item/CardDb.java | 1 - src/main/java/forge/item/FatPack.java | 2 +- src/main/java/forge/item/IPaperCard.java | 1 + src/main/java/forge/item/PreconDeck.java | 3 +- src/main/java/forge/item/TournamentPack.java | 8 +- src/main/java/forge/model/FModel.java | 40 +- .../java/forge/properties/FileLocation.java | 28 + .../forge/properties/ForgePreferences.java | 46 +- .../properties/ForgeProfileProperties.java | 100 ++ .../java/forge/properties/ForgeProps.java | 187 --- .../java/forge/properties/NewConstants.java | 1207 ++--------------- src/main/java/forge/quest/BoosterUtils.java | 3 +- .../java/forge/quest/QuestController.java | 18 +- .../forge/quest/QuestRewardCardChooser.java | 10 +- src/main/java/forge/quest/QuestUtil.java | 9 +- .../java/forge/quest/QuestUtilUnlockSets.java | 2 + src/main/java/forge/quest/QuestWorld.java | 1 - .../forge/quest/bazaar/QuestItemType.java | 1 + .../quest/bazaar/QuestPetController.java | 4 +- .../forge/quest/bazaar/QuestPetStats.java | 3 +- .../forge/quest/data/GameFormatQuest.java | 2 +- .../forge/quest/data/QuestPreferences.java | 7 +- src/main/java/forge/quest/io/QuestDataIO.java | 5 +- .../java/forge/quest/io/ReadPriceList.java | 8 +- .../java/forge/sound/EventVisualizer.java | 5 +- src/main/java/forge/util/CopyFiles.java | 4 +- src/main/java/forge/util/FileUtil.java | 51 +- src/main/java/forge/util/HttpUtil.java | 56 +- src/main/java/forge/util/ThreadUtil.java | 1 + src/main/java/forge/util/TreeProperties.java | 531 -------- .../forge/util/storage/StorageReaderFile.java | 1 - .../util/storage/StorageReaderFolder.java | 1 - src/main/java/forge/view/FView.java | 1 - src/main/java/forge/view/Main.java | 39 +- src/main/java/forge/view/arcane/PlayArea.java | 1 + .../java/forge/ReadDraftRankingsTest.java | 9 +- src/test/java/forge/item/DeckHintsTest.java | 3 +- src/test/java/forge/model/FModelTest.java | 3 +- 232 files changed, 1300 insertions(+), 3741 deletions(-) rename res/{preferences/editor.default.preferences => defaults/editor.preferences} (100%) rename res/{layouts/editor_default.xml => defaults/editor.xml} (100%) create mode 100644 res/defaults/forge.preferences rename res/{layouts/home_default.xml => defaults/home.xml} (100%) rename res/{layouts/match_default.xml => defaults/match.xml} (100%) delete mode 100644 res/draft/common.txt delete mode 100644 res/draft/draft.properties delete mode 100644 res/draft/rare.txt delete mode 100644 res/draft/uncommon.txt create mode 100644 res/howto.txt delete mode 100644 res/lang/howTo/en.properties delete mode 100644 res/preferences/.project delete mode 100644 res/preferences/main.properties delete mode 100644 res/product-images.txt create mode 100644 res/quest/fatpack-images.txt create mode 100644 res/quest/precon-images.txt delete mode 100644 res/quest/quest.properties create mode 100644 res/quest/tournamentpack-images.txt delete mode 100644 src/main/java/forge/game/limited/CardRatings.java create mode 100644 src/main/java/forge/properties/FileLocation.java create mode 100644 src/main/java/forge/properties/ForgeProfileProperties.java delete mode 100644 src/main/java/forge/properties/ForgeProps.java delete mode 100644 src/main/java/forge/util/TreeProperties.java diff --git a/.gitattributes b/.gitattributes index cf342a07787..5194c947597 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12402,25 +12402,22 @@ res/decks/cube/RtRPromoIzzet.dck -text res/decks/cube/RtRPromoRakdos.dck -text res/decks/cube/RtRPromoSelesnya.dck -text res/decks/cube/SkieraCube.dck -text -res/draft/common.txt svneol=native#text/plain +res/defaults/editor.preferences svneol=native#text/xml +res/defaults/editor.xml svneol=native#text/xml +res/defaults/home.xml svneol=native#text/xml +res/defaults/match.xml svneol=native#text/xml res/draft/cube_juzamjedi.draft -text res/draft/cube_skiera.draft -text -res/draft/draft.properties svneol=native#text/plain res/draft/rankings.txt -text -res/draft/rare.txt svneol=native#text/plain -res/draft/uncommon.txt svneol=native#text/plain res/gamedata/NonStackingKWList.txt svneol=native#text/plain res/gamedata/TypeLists.txt svneol=native#text/plain res/gauntlet/LOCKED_DotP[!!-~]Preconstructed.dat -text res/gauntlet/LOCKED_Swimming[!!-~]With[!!-~]Sharks.dat -text +res/howto.txt svneol=native#text/plain res/lang/de.properties svneol=native#text/plain res/lang/en.properties svneol=native#text/plain res/lang/howTo/de.properties svneol=native#text/plain -res/lang/howTo/en.properties svneol=native#text/plain res/lang/lang.properties svneol=native#text/plain -res/layouts/editor_default.xml svneol=native#text/xml -res/layouts/home_default.xml svneol=native#text/xml -res/layouts/match_default.xml svneol=native#text/xml res/licenses/java-yield-license.txt svneol=native#text/plain res/licenses/log4j-license.txt svneol=native#text/plain res/licenses/multiline-label-license.txt svneol=native#text/plain @@ -12741,10 +12738,6 @@ res/pics_product/tournamentpacks/SHM.jpg -text res/pics_product/tournamentpacks/TMP.jpg -text res/pics_product/tournamentpacks/TSP.jpg -text res/pics_product/tournamentpacks/USG.jpg -text -res/preferences/.project -text -res/preferences/editor.default.preferences svneol=native#text/xml -res/preferences/main.properties -text -res/product-images.txt -text res/quest/all-prices.txt svneol=native#text/plain res/quest/bazaar/ape_pet_l1.txt -text res/quest/bazaar/ape_pet_l2.txt -text @@ -13315,7 +13308,6 @@ res/quest/price.txt svneol=native#text/plain res/quest/quest-opponent-icons.txt -text res/quest/quest-pet-shop-icons.txt -text res/quest/quest-pet-token-images.txt -text -res/quest/quest.properties svneol=native#text/plain res/quest/themes/-1[!!-~]-1[!!-~]Counters[!!-~]BG.thm -text res/quest/themes/Anti[!!-~]Black[!!-~]WB.thm -text res/quest/themes/Anti[!!-~]Black[!!-~]WG.thm -text @@ -14175,7 +14167,6 @@ src/main/java/forge/game/limited/BoosterDraftAI.java svneol=native#text/plain src/main/java/forge/game/limited/CCnt.java svneol=native#text/plain src/main/java/forge/game/limited/CardPoolLimitation.java -text src/main/java/forge/game/limited/CardRankingComparator.java -text -src/main/java/forge/game/limited/CardRatings.java -text src/main/java/forge/game/limited/CustomLimited.java svneol=native#text/plain src/main/java/forge/game/limited/DeckColors.java svneol=native#text/plain src/main/java/forge/game/limited/DraftRankCache.java -text @@ -14445,7 +14436,6 @@ src/main/java/forge/model/package-info.java svneol=native#text/plain src/main/java/forge/net/package-info.java -text src/main/java/forge/package-info.java svneol=native#text/plain src/main/java/forge/properties/ForgePreferences.java svneol=native#text/plain -src/main/java/forge/properties/ForgeProps.java svneol=native#text/plain src/main/java/forge/properties/NewConstants.java svneol=native#text/plain src/main/java/forge/properties/Preferences.java svneol=native#text/plain src/main/java/forge/properties/SavePreferencesListener.java svneol=native#text/plain @@ -14521,7 +14511,6 @@ src/main/java/forge/util/PredicateString.java -text src/main/java/forge/util/ReflectionUtil.java -text src/main/java/forge/util/TextUtil.java -text src/main/java/forge/util/ThreadUtil.java svneol=native#text/plain -src/main/java/forge/util/TreeProperties.java svneol=native#text/plain src/main/java/forge/util/XmlUtil.java -text src/main/java/forge/util/package-info.java -text src/main/java/forge/util/storage/IStorage.java -text diff --git a/res/preferences/editor.default.preferences b/res/defaults/editor.preferences similarity index 100% rename from res/preferences/editor.default.preferences rename to res/defaults/editor.preferences diff --git a/res/layouts/editor_default.xml b/res/defaults/editor.xml similarity index 100% rename from res/layouts/editor_default.xml rename to res/defaults/editor.xml diff --git a/res/defaults/forge.preferences b/res/defaults/forge.preferences new file mode 100644 index 00000000000..816af584120 --- /dev/null +++ b/res/defaults/forge.preferences @@ -0,0 +1,66 @@ +UI_USE_OLD=false +UI_RANDOM_FOIL=false +UI_SMOOTH_LAND=false +UI_AVATARS=0,1 +UI_CARD_OVERLAY=true +UI_UPLOAD_DRAFT=false +UI_SCALE_LARGER=true +UI_MAX_STACK=3 +UI_STACK_OFFSET=tiny +UI_CARD_SIZE=small +UI_BUGZ_NAME= +UI_BUGZ_PWD= +UI_ANTE=false +UI_MANABURN=false +UI_SKIN=default +UI_PREFERRED_AVATARS_ONLY=false +UI_TARGETING_OVERLAY=2 +UI_ENABLE_SOUNDS=true +UI_RANDOM_CARD_ART=false +SUBMENU_CURRENTMENU=HOME_CONSTRUCTED +SUBMENU_SANCTIONED=false +SUBMENU_GAUNTLET=false +SUBMENU_VARIANT=false +SUBMENU_QUEST=false +SUBMENU_SETTINGS=false +SUBMENU_UTILITIES=false +ENFORCE_DECK_LEGALITY=true +DEV_MODE_ENABLED=false +DEV_MILLING_LOSS=true +DEV_UNLIMITED_LAND=false +DECKGEN_SINGLETONS=false +DECKGEN_ARTIFACTS=false +DECKGEN_NOSMALL=false +PHASE_AI_UPKEEP=true +PHASE_AI_DRAW=true +PHASE_AI_MAIN1=true +PHASE_AI_BEGINCOMBAT=true +PHASE_AI_DECLAREATTACKERS=true +PHASE_AI_DECLAREBLOCKERS=true +PHASE_AI_FIRSTSTRIKE=true +PHASE_AI_COMBATDAMAGE=true +PHASE_AI_ENDCOMBAT=true +PHASE_AI_MAIN2=true +PHASE_AI_EOT=true +PHASE_AI_CLEANUP=true +PHASE_HUMAN_UPKEEP=true +PHASE_HUMAN_DRAW=true +PHASE_HUMAN_MAIN1=true +PHASE_HUMAN_BEGINCOMBAT=true +PHASE_HUMAN_DECLAREATTACKERS=true +PHASE_HUMAN_DECLAREBLOCKERS=true +PHASE_HUMAN_FIRSTSTRIKE=true +PHASE_HUMAN_COMBATDAMAGE=true +PHASE_HUMAN_ENDCOMBAT=true +PHASE_HUMAN_MAIN2=true +PHASE_HUMAN_EOT=true +PHASE_HUMAN_CLEANUP=true +SHORTCUT_SHOWSTACK=83 +SHORTCUT_SHOWCOMBAT=67 +SHORTCUT_SHOWCONSOLE=76 +SHORTCUT_SHOWPLAYERS=80 +SHORTCUT_SHOWDEV=68 +SHORTCUT_CONCEDE=17 +SHORTCUT_ENDTURN=69 +SHORTCUT_ALPHASTRIKE=65 +SHORTCUT_SHOWTARGETING=84 diff --git a/res/layouts/home_default.xml b/res/defaults/home.xml similarity index 100% rename from res/layouts/home_default.xml rename to res/defaults/home.xml diff --git a/res/layouts/match_default.xml b/res/defaults/match.xml similarity index 100% rename from res/layouts/match_default.xml rename to res/defaults/match.xml diff --git a/res/draft/common.txt b/res/draft/common.txt deleted file mode 100644 index acef2735370..00000000000 --- a/res/draft/common.txt +++ /dev/null @@ -1,106 +0,0 @@ -Akrasan Squire -Alpha Myr -Anarchist -Aven Squire -Azorius Chancery -Battering Sliver -Blade of the Sixth Pride -Blastoderm -Blightning -Bonesplitter Sliver -Brainstorm -Brilliant Halo -Capsize -Carnophage -Cavern Harpy -Child of Night -Cloud of Faeries -Coiled Tinviper -Colossal Might -Corrupt -Dark Ritual -Darksteel Ingot -Dauthi Marauder -Dauthi Slayer -Deep Analysis -Deft Duelist -Diabolic Edict -Dimir Aqueduct -Disenchant -Divination -Drift of Phantasms -Duress -Elephant Ambush -Elvish Fury -Exclude -Faceless Butcher -False Defeat -Firebolt -Fledgling Djinn -Foul Imp -Frostling -Gemhide Sliver -Giant Spider -Gruul Turf -Guardians of Akrasa -Hymn to Tourach -Imperious Perfect -Impulse -Kindle -Kird Ape -Kitesail -Kodama's Reach -Kor Skyfisher -Lightning Blast -Lightning Bolt -Lignify -Llanowar Elves -Mana Leak -Metallic Sliver -Moaning Spirit -Molten Rain -Mudbutton Torchrunner -Mulldrifter -Multani's Acolyte -Muscle Sliver -Naturalize -Nightguard Patrol -Oblivion Ring -Order of the Ebon Hand -Pacifism -Pestermite -Phyrexian Rager -Plated Geopede -Plated Sliver -Pouncing Jaguar -Qasali Pridemage -Rakdos Carnarium -Rancor -Repulse -Rishadan Airship -River Boa -Selesnya Sanctuary -Serum Visions -Shock -Sign in Blood -Sinew Sliver -Snapping Drake -Sprout Swarm -Steppe Lynx -Stone Rain -Sunlance -Synchronous Sliver -Talruum Minotaur -Tarfire -Tendrils of Corruption -Trinket Mage -Vampire Lacerator -Veteran Armorer -Veteran Armorsmith -Veteran Swordsmith -Viashino Fangtail -Vulshok Morningstar -Vulshok Sorcerer -Wild Nacatl -Winged Sliver -Yavimaya Wurm diff --git a/res/draft/draft.properties b/res/draft/draft.properties deleted file mode 100644 index 6344efeaa1d..00000000000 --- a/res/draft/draft.properties +++ /dev/null @@ -1,3 +0,0 @@ -common--file=common.txt -uncommon--file=uncommon.txt -rare--file=rare.txt diff --git a/res/draft/rare.txt b/res/draft/rare.txt deleted file mode 100644 index b0dfa02bb6c..00000000000 --- a/res/draft/rare.txt +++ /dev/null @@ -1,68 +0,0 @@ -Absorb -Armageddon -Badlands -Baneslayer Angel -Beacon of Destruction -Birds of Paradise -Bitterblossom -Bloodghast -Bribery -Captain of the Watch -Chameleon Colossus -Chandra Nalaar -Char -Day of Judgment -Dragon Roost -Elspeth, Knight-Errant -Gaea's Anthem -Garruk Wildspeaker -Goblin Guide -Goblin Piledriver -Honor of the Pure -Iona, Shield of Emeria -Jace, the Mind Sculptor -Jeska, Warrior Adept -Juzam Djinn -Keiga, the Tide Star -Knight of the White Orchid -Kokusho, the Evening Star -Liliana Vess -Loxodon Hierarch -Meloku the Clouded Mirror -Morphling -Mycoloth -Nantuko Shade -Nevinyrral's Disk -Noble Hierarch -Ob Nixilis, the Fallen -Paladin en-Vec -Phyrexian Arena -Rakka Mar -Rampaging Baloths -Rolling Earthquake -Rorix Bladewing -Sarkhan Vol -Savannah -Scion of Oona -Serendib Efreet -Shadowmage Infiltrator -Siege-Gang Commander -Solemn Simulacrum -Sower of Temptation -Sphinx of Jwar Isle -Squall Line -Survival of the Fittest -Taiga -Tarmogoyf -Thoughtseize -Time Warp -Troll Ascetic -Tundra -Umezawa's Jitte -Underground Sea -Vampiric Tutor -Vendilion Clique -Visara the Dreadful -Wall of Reverence -Wort, Boggart Auntie -Wrath of God diff --git a/res/draft/uncommon.txt b/res/draft/uncommon.txt deleted file mode 100644 index cf12eb1fc1a..00000000000 --- a/res/draft/uncommon.txt +++ /dev/null @@ -1,60 +0,0 @@ -Air Elemental -Animate Dead -Behemoth Sledge -Bituminous Blast -Blade Sliver -Blaze -Blood Knight -Briarhorn -Calciderm -Centaur Glade -Chainer's Edict -Cloud Djinn -Control Magic -Council of Advisors -Counterspell -Demonic Tutor -Dimir Guildmage -Elite Vanguard -Enlightened Tutor -Eternal Witness -Flame Javelin -Flametongue Kavu -Force of Will -Ghitu Encampment -Harmonize -Honden of Cleansing Fire -Honden of Infinite Rage -Honden of Life's Web -Honden of Night's Reach -Honden of Seeing Winds -Infest -Isochron Scepter -Ivory Tower -Jackal Pup -Keening Banshee -Knight of Meadowgrain -Knight of Stromgald -Magma Jet -Might Sliver -Path to Exile -Pillage -Regrowth -Sejiri Merfolk -Shriekmaw -Skullclamp -Smother -Sol Ring -Soltari Monk -Soltari Priest -Spectral Procession -Spell Snare -Swords to Plowshares -Thieving Magpie -Treetop Village -Twinblade Slasher -Vampire Nighthawk -Viridian Shaman -Volcanic Fallout -Wall of Blossoms -Wall of Denial diff --git a/res/howto.txt b/res/howto.txt new file mode 100644 index 00000000000..d317ff3e843 --- /dev/null +++ b/res/howto.txt @@ -0,0 +1,122 @@ +How to Play + + + +Introduction + +1. This game is similar to many other trading card games. You start out with 20 life and your goal is to reduce your opponents life to zero by attacking with your creatures. The game will end when your life or the computer's life is reduced to zero. You play "matches" against the computer as a set of "best two out of three" games. + +2. You use land to pay for spells. You can play one land a turn. + +3. Each land produces a different magical energy. This magical energy is shortened to one letter on cards. + + Forests make G + Swamps make B + Plains make W + Islands make U + Mountains make R + +4. Each non-land card has a name and a cost. The cost looks like this "2GG" A cost like that would require two Forest lands and two other lands. The number 2 can be paid for by any land. A cost like "R", would require a Mountain land. + +5. Creature cards stay in play and can attack on the turn AFTER they are played. A creature's attack and defense is shown like 2/4 meaning that the creature has an attack power of 2 and a defense of 4. If this creature receives 4 damage it is put into the graveyard. + +6. When you attack with your creatures the computer has a chance to block with his creatures. When you attack you "tap" your creatures by turning them sideways. Your creatures will untap during your next turn. When you block, only untapped creatures can block. Usually a creature cannot attack and block during the same turn. + +7. Sorcery and Instant cards have an effect on the game. After you play any card it goes on the stack to the left, click OK and the stack will clear. Sorcery cards can only be played during your turn and when the stack is empty. Instant cards can be played at any time and are more versatile. + +8. If a card has a target, you get to choose that target. If the target is a player, click on that player's picture (next to their life points). + +9. When you mulligan, the cards in your hand are shuffled into you deck and you are given 1 less card. + + +Legendary Cards + +Legendary cards are powerful cards that can be either creatures, enchantments, lands, artifacts, or planeswalkers. These cards can only exist once in the battlefield, and if another copy of the legendary card is played, all copies of the card are destroyed and sent to the graveyard. + + +Planeswalkers + +There are relatively few planeswalkers available in the game and they have specific rules for their special abilities. + +You can only use one ability a turn. A planeswalker can be attacked, but you can also block with your creatures. For each 1 damage a planeswalker receives, you remove 1 counter. When a planeswalker doesn't have any counters, it goes to the graveyard. + + +Hybrid Mana and Multicolored Cards + +1. Hybrid Mana Cards are unique in their casting cost as seen in the card. Instead of seeing a single color per mana symbol, these cards have 2 colors per mana symbol indicating that the player has the choice of playing either of the two. There are also cases where numbers and colors are combined together in one mana symbol, which indicates that either colorless or colored mana can be paid for each symbol. Hybrid cards are treated as two colors and as such can be said to be multicolored. + +2. Multicolored Cards are slightly different than hybrid mana cards, as they require two or more different colors of mana, which may or not be in a single mana symbol. An example would be a card like Lightning Helix which requires one red and one white mana to be played. + + +Game Types + +1. In Constructed Deck mode you can use any of the cards to make your deck. To make a constructed deck, select the "Deck Editor" button on the main screen. + +2. In Sealed Deck mode you are given 75 cards and you have to make your deck from just those cards. + +3. In Booster Draft mode you select 1 card at a time and then make your deck from just those cards. You can then play against the other 7 computer opponents that were drafting with you. + +4. In Quest Mode you start out with just a few cards. As you complete matches in your quest you will win more cards. In easy mode you get more cards after every game, whether you win or lose. Your goal is to become world champion. Once you reach the end of your quest you can continue to play additional matches and win even more cards or you can start a new quest at anytime. + +At the Quest Options screen you will be given a choice of four different difficulty levels. These difficulty levels control: + +1) the length of the quest in matches +2) the hardness of the AI deck that you will face as an opponent +3) the number of wins or losses needed to get more cards +4) the number of wins needed to advance a player to the next rank + + +Quick Games + +There may be occasions where you only have a few minutes to play a quick game or two. At the top of the list of submenus on the left, choose "Sanctioned Formats" and then "Constructed". For the least amount of setup, just accept the default settings for random decks, and click Start at the bottom of the page. + + +Abilities + +There are three kinds of abilities: Activated, Triggered, and Static. + +1. Activated abilities contain a colon that separates cost and effect, these can be played any time you could play an instant. An example is Elvish Piper's ability. That cost also contains the tap symbol. For creatures only, abilities containing the tap- or untap symbol can be played starting the turn after the creature came into play. Another common cost for an activated ability is sacrificing the card. You do that by putting it into your graveyard. Such abilities can only be played once. + +2. Triggered abilities aren't played, they simply trigger when their condition occurs. An example is Angel of Mercy: You don't play the ability, but gain 3 life when it comes into play. + +3. Static abilities are neither played, nor do they trigger. They still have an effect for as long as they are in play. An example is Glorious Anthem. There is no condition or cost, your creatures are just stronger. + + +Keyword Abilities + +1. Flying: Creatures with flying are harder to block. Only creatures with flying or reach can block other flyers. + +2. Haste: Haste lets a creature attack or use any abilities immediately during this turn. + +3. Fear: Creatures with fear can only be blocked by artifact or black creatures. Creatures with fear are harder to block. + +4. Cycling: When you cycle a card you pay some small cost (usually 2 or so) and then you discard that card and draw a new card. Cycling helps make your deck more versatile. + +5. Vigilance: This means that the creature will not tap when attacking. This creature can both attack and block during the same turn. + +6. Trample: If you use 2/1 creature to block an attacking 3/4 creature with trample, you will still receive 2 damage because the 3/4 trampled over your 2/1 creature. Trample damage is calculated by (attack - blocker's defense), in this case 3-1 which is 2. + +7. Deathtouch: When a creatures with deathtouch deals damage to a creature, that creature is destroyed. + +8. Defender: Creatures with defender can not attack, they can only block another attacker. + +9. First Strike and Double Strike: Creatures with first strike deals their combat damage first. Creatures with double strike deals their combat damage first, and then deals their combat damage a second time during the combat damage step. + +10. Flash: You can play a creature with flash anytime that you can play an Instant. + +11. Landwalk: Allows your creature to attack without being blocked if your opponent controls the appropriate land type. + +12. Lifelink: With lifeline you gain life equal to the amount of damage dealt. + +13. Protection: Can not be damaged, blocked or targeted by sources that match the protection type. + +14. Reach: Creatures with reach can block flying creatures. + +15. Shroud: Permanents with shroud can not be targeted by abilities or spells. + +16. Regenerate: Regenerate is an ability that some creatures have which prevents them from being destroyed and put into the graveyard. When you regenerate a creature, it acts like a shield until end of turn. + +17. Morph: A creature with morph can be played by usually paying 3 mana of any color and be treated as a 2/2 creature with no abilities rather than playing the creature's actual cost. This creature is placed face down in the battlefield and can be flipped face up anytime as long as you pay its morph cost which is indicated on the card. Once flipped face up the card is treated as the original card, the one that you would normally play with its original-full casting cost. + + +Have fun! diff --git a/res/lang/howTo/en.properties b/res/lang/howTo/en.properties deleted file mode 100644 index ca12037e84f..00000000000 --- a/res/lang/howTo/en.properties +++ /dev/null @@ -1,68 +0,0 @@ -title=How to Play -message=How to Play - (Revised: September 2009.)\n\n\n\ -Introduction\n\n\ -1. This game is similar to many other trading card games. You start out with 20 life and your goal is to reduce your opponents life to zero by attacking with your creatures. The game will end when your life or the computer's life is reduced to zero. You play \"matches\" against the computer as a set of \"best two out of three\" games."\n\n\ -2. You use land to pay for spells. You can play one land a turn.\n\n\ -3. Each land produces a different magical energy. This magical energy is shortened to one letter on cards.\n\n\ -\ Forests make G\n\ -\ Swamps make B\n\ -\ Plains make W\n\ -\ Islands make U\n\ -\ Mountains make R\n\n\ -4. Each non-land card has a name and a cost. The cost looks like this \"2GG\" A cost like that would require two Forest lands and two other lands. The number 2 can be paid for by any land. A cost like \"R\", would require a Mountain land.\n\n\ -5. Creature cards stay in play and can attack on the turn AFTER they are played. A creature's attack and defense is shown like 2/4 meaning that the creature has an attack power of 2 and a defense of 4. If this creature receives 4 damage it is put into the graveyard.\n\n\ -6. When you attack with your creatures the computer has a chance to block with his creatures. When you attack you \"tap\" your creatures by turning them sideways. Your creatures will untap during your next turn. When you block, only untapped creatures can block. Usually a creature cannot attack and block during the same turn.\n\n\ -7. Sorcery and Instant cards have an effect on the game. After you play any card it goes on the stack to the left, click OK and the stack will clear. Sorcery cards can only be played during your turn and when the stack is empty. Instant cards can be played at any time and are more versatile.\n\n\ -8. If a card has a target, you get to choose that target. If the target is a player, click on that player's life points.\n\n\ -9. When you mulligan, the cards in your hand are shuffled into you deck and you are given 1 less card.\n\n\n\ -Legendary Cards\n\n\ -Legendary cards are powerful cards that can be either creatures, enchantments, lands, artifacts or planeswalkers. These cards can only exist once in the battlefield, and if another copy of the legendary card is played, all copies of the card are destroyed and sent to the graveyard.\n\n\n\ -Planeswalkers\n\n\ -There are 7 planeswalkers (Ajani Goldmane; Liliana Vess; Garruk Wildspeaker; Chandra Nalaar; Nicol Bolas; Elspeth, Knight-Errant; Nissa Revane) and they have specific rules for their special abilities.\n\n\ -You can only use one ability a turn. A planeswalker can be attacked, but you can also block with your creatures. For each 1 damage a planeswalker receives, you remove 1 counter. When a planeswalker doesn't have any counters, it goes to the graveyard.\n\n\n\ -Hybrid Mana and Multicolored Cards\n\n\ -1. Hybrid Mana Cards are unique in their casting cost as seen in the card. Instead of seeing a single color per mana symbol, these cards have 2 colors per mana symbol indicating that the player has the choice of playing either of the two. There are also cases where numbers and colors are combined together in one mana symbol, which indicates that either colorless or colored mana can be paid for each symbol. Hybrid cards are treated as two colors and as such can be said to be multicolored.\n\n\ -2. Multicolored Cards are slightly different than hybrid mana cards, as they require two or more different colors of mana, which may or not be in a single mana symbol. An example would be a card like Lightning Helix which requires one red and one white mana to be played.\n\n\n\ -Game Types\n\n\ -1. In Constructed Deck mode you can use any of the cards to make your deck. To make a constructed deck, from the Deck Editor select \"New Deck \u2013 Constructed\". A list of all the cards will be displayed.\n\n\ -2. In Sealed Deck mode you are given 75 cards and you have to make your deck from just those cards.\n\n\ -3. In Booster Draft mode you select 1 card at a time and then make your deck from just those cards. After you are done drafting you have to type in a filename, then go to the Deck Editor and from the menu select \"Open Deck - Draft\" and find the filename. This will allow you to construct your deck. You can then play against the other 7 computer opponents that were drafting with you.\n\n\ -4. In Quest Mode you start out with 275 cards, 200 are Basic Lands. As you complete matches in your quest you will win more cards. In easy mode you get more cards after every game, whether you win or lose. Your goal is to become world champion. Once you reach the end of your quest you can continue to play additional matches and win even more cards or you can start a new quest at anytime.\n\n\ -At the Quest Options screen you will be given a choice of four different difficulty levels. These difficulty levels control:\n\n\ -1) the length of the quest in matches,\n\ -2) the hardness of the AI deck that you will face as an opponent,\n\ -3) the number of wins or loses needed to get more cards,\n\ -4) the number of wins needed to advance a player to the next rank.\n\n\n\ -Quick Games\n\n\ -There may be occasions where you only have a few minutes to play a quick game or two. At the top of the New Game window you will see the three different game types with radio buttons. Click on the Constructed (Easy) button and it will become highlighted.\n\n\ -In the middle area of the New Game window you will see two menus, one labeled \"Your Deck\" and the other \"Opponent\". For a quick game you should select the \"Generate Deck\" or the \"Random\" option for both you and the computer.\n\n\ -1. The \"Generate Deck\" option creates a 2 color deck. This option randomly picks cards and sometimes your mana curve may be too high.\n\n\ -2. The \"Random\" option will randomly select one of the constructed decks that appear in the two deck menus. You either construct these decks in the Deck Editor or you imported a .deck file from the Deck Editor.\n\n\ -If you select the \"Random\" option and click on the \"Start Game\" button and the match fails to begin \u2026 well, this happens if you fail to have any constructed decks saved to your all-decks2 file. You should choose the \"Generate Deck\" option instead.\n\n\n\ -Resizable Game Area & Stack AI Land\n\n\ -1. The \"Resizable Game Area\" check box should be set to on if your monitor will display more than 1024 x 768 pixels. The window containing the Battlefield and the informational displays will fill the entire screen.\n\n\ -2. The \"Stack AI Land\" option will make the computer a more difficult opponent to beat. The computer will draw non-land cards from it's library after it has drawn enough lands to cover the cost of it's spells. Set the check box to on for a stronger opponent and set the check box to off for a weaker opponent.\n\n\ -At times, you may notice that when you click the \"Start Game\" button that the match fails to begin. In this case you should turn the \"Stack AI Land\" option to off.\n\n\n\ -Abilities\n\n\ -There are three kinds of abilities: Activated, Triggered, and Static.\n\n\ -1. Activated abilities contain a colon that separates cost and effect, these can be played any time you could play an instant. An example is Elvish Piper's ability. That cost also contains the tap symbol. For creatures only, abilities containing the tap- or untap symbol can be played starting the turn after the creature came into play. Another common cost for an activated ability is sacrificing the card. You do that by putting it into your graveyard. Such abilities can only be played once.\n\n\n\ -2. Triggered abilities aren't played, they simply trigger when their condition occurs. An example is Angel of Mercy: You don't play the ability, but gain 3 life when it comes into play.\n\n\ -3. Static abilities are neither played, nor do they trigger. They still have an effect for as long as they are in play. An example is Glorious Anthem. There is no condition or cost, your creatures are just stronger.\n\n\n\ -Keyword Abilities\n\n\ -1. Flying: Creatures with flying are harder to block. Only creatures with flying or reach can block other flyers.\n\n\ -2. Haste: Haste lets a creature attack or use any abilities immediately during this turn.\n\n\ -3. Fear: Creatures with fear can only be blocked by artifact or black creatures. Creatures with fear are harder to block.\n\n\ -4. Cycling: When you cycle a card you pay some cost like 2 and then you discard that card, and then draw a new card. Cycling helps make your deck more versatile.\n\n\ -5. Vigilance: This means that the creature will not tap when attacking. This creature can both attack and block during the same turn.\n\n\ -6. Trample: If you use 2/1 creature to block an attacking 3/4 creature with trample, you will still receive 2 damage because the 3/4 trampled over your 2/1 creature. Trample damage is calculated by (attack - blocker's defense), in this case 3-1 which is 2.\n\n\ -7. Deathtouch: When a creatures with deathtouch deals damage to a creature, that creature is destroyed.\n\n\ -8. Defender: Creatures with defender can not attack, they can only block another attacker.\n\n\ -9. First Strike and Double Strike: Creatures with first strike deals their combat damage first. Creatures with double strike deals their combat damage first, and then deals their combat damage a second time during the combat damage step.\n\n\ -10. Flash: You can play a creature with flash anytime that you can play an Instant.\n\n\ -11. Landwalk: Allows your creature to attack without being blocked if your opponent controls the appropriate land type.\n\n\ -12. Lifelink: With lifeline you gain life equal to the amount of damage dealt.\n\n\ -13. Protection: Can not be damaged, blocked or targeted by sources that match the protection type.\n\n\ -14. Reach: Creatures with reach can block flying creatures.\n\n\ -15. Shroud: Permanents with shroud can not be targeted by abilities or spells.\n\n\ -16. Regenerate: Regenerate is an ability that some creatures have which prevents them from being destroyed and put into the graveyard. When you regenerate a creature, it acts like a shield until end of turn.\n\n\ -17. Morph: A creature with morph can be played by usually paying 3 mana of any color and be treated as a 2/2 creature with no abilities rather than playing the creature's actual cost. This creature is placed face down in the battlefield and can be flipped face up anytime as long as you pay its morph cost which is indicated on the card. Once flipped face up the card is treated as the original card, the one that you would normally play with its original-full casting cost. diff --git a/res/preferences/.project b/res/preferences/.project deleted file mode 100644 index 0dd752fd79a..00000000000 --- a/res/preferences/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - preferences - - - - - - - - diff --git a/res/preferences/main.properties b/res/preferences/main.properties deleted file mode 100644 index 2ae0ba5554a..00000000000 --- a/res/preferences/main.properties +++ /dev/null @@ -1,71 +0,0 @@ -program/howToReportBugsURL=http://tinyurl.com/3zzrnyb -program/cardforgeURL=http://cardforge.org - -showdeck/2color=false -showdeck/3color=false -showdeck/4color=false -showdeck/5color=false - -tokens--file=AllTokens.txt -mtg-data--file=mtg-data.txt - -decks--file=all-decks2 -booster-decks--file=booster-deck -decks-dir--file=../decks - -card-pictures--file=card-pictures.txt -token-images--file=../token-images.txt -card-pictures_a--file=../pics_link/card-pictures_a.txt -card-pictures_b--file=../pics_link/card-pictures_b.txt -card-pictures_c--file=../pics_link/card-pictures_c.txt -card-pictures_d--file=../pics_link/card-pictures_d.txt -card-pictures_e--file=../pics_link/card-pictures_e.txt -card-pictures_f--file=../pics_link/card-pictures_f.txt -card-pictures_g--file=../pics_link/card-pictures_g.txt -card-pictures_h--file=../pics_link/card-pictures_h.txt -card-pictures_i--file=../pics_link/card-pictures_i.txt -card-pictures_j--file=../pics_link/card-pictures_j.txt -card-pictures_k--file=../pics_link/card-pictures_k.txt -card-pictures_l--file=../pics_link/card-pictures_l.txt -card-pictures_m--file=../pics_link/card-pictures_m.txt -card-pictures_n--file=../pics_link/card-pictures_n.txt -card-pictures_o--file=../pics_link/card-pictures_o.txt -card-pictures_p--file=../pics_link/card-pictures_p.txt -card-pictures_q--file=../pics_link/card-pictures_q.txt -card-pictures_r--file=../pics_link/card-pictures_r.txt -card-pictures_s--file=../pics_link/card-pictures_s.txt -card-pictures_t--file=../pics_link/card-pictures_t.txt -card-pictures_u--file=../pics_link/card-pictures_u.txt -card-pictures_v--file=../pics_link/card-pictures_v.txt -card-pictures_w--file=../pics_link/card-pictures_w.txt -card-pictures_x--file=../pics_link/card-pictures_x.txt -card-pictures_y--file=../pics_link/card-pictures_y.txt -card-pictures_z--file=../pics_link/card-pictures_z.txt -card-pictures_other--file=../pics_link/card-pictures_other.txt -card-pictures_token_hq--file=../pics_link/card-pictures_token.txt -cards--file=cards.txt -cardsfolder--file=../cardsfolder -removed-cards--file=removedCards.txt - -regular/common--file=common.txt -regular/uncommon--file=uncommon.txt -regular/rare--file=rare.txt - -draft/rankings--file=../draft/rankings.txt - -name-mutator--file=name-mutator.txt - -quest--properties=../quest/quest.properties -draft--properties=../draft/draft.properties - -lang--transparent-properties=../lang/lang.properties - -image/base--file=../pics -image/token--file=../pics/tokens -image/icon--file=../pics/icons -image/product--file=../pics_product -pics/booster/images--file=../quest/booster-images.txt - -quest/opponent/icons--file=../quest/quest-opponent-icons.txt -quest/pet/icons--file=../quest/quest-pet-shop-icons.txt -quest/pet/tokens--file=../quest/quest-pet-token-images.txt diff --git a/res/product-images.txt b/res/product-images.txt deleted file mode 100644 index a37fe6ff83b..00000000000 --- a/res/product-images.txt +++ /dev/null @@ -1,106 +0,0 @@ -# Fat Packs -http://www.cardforge.org/fpics/products/fatpacks/5DN.jpg -http://www.cardforge.org/fpics/products/fatpacks/9ED.jpg -http://www.cardforge.org/fpics/products/fatpacks/10E.jpg -http://www.cardforge.org/fpics/products/fatpacks/ALA.jpg -http://www.cardforge.org/fpics/products/fatpacks/APC.jpg -http://www.cardforge.org/fpics/products/fatpacks/ARB.jpg -http://www.cardforge.org/fpics/products/fatpacks/BOK.jpg -http://www.cardforge.org/fpics/products/fatpacks/CFX.jpg -http://www.cardforge.org/fpics/products/fatpacks/CHK.jpg -http://www.cardforge.org/fpics/products/fatpacks/CSP.jpg -http://www.cardforge.org/fpics/products/fatpacks/DIS.jpg -http://www.cardforge.org/fpics/products/fatpacks/DKA.jpg -http://www.cardforge.org/fpics/products/fatpacks/DST.jpg -http://www.cardforge.org/fpics/products/fatpacks/EVE.jpg -http://www.cardforge.org/fpics/products/fatpacks/FUT.jpg -http://www.cardforge.org/fpics/products/fatpacks/GPT.jpg -http://www.cardforge.org/fpics/products/fatpacks/INV.jpg -http://www.cardforge.org/fpics/products/fatpacks/ISD.jpg -http://www.cardforge.org/fpics/products/fatpacks/JUD.jpg -http://www.cardforge.org/fpics/products/fatpacks/LGN.jpg -http://www.cardforge.org/fpics/products/fatpacks/LRW.jpg -http://www.cardforge.org/fpics/products/fatpacks/M10.jpg -http://www.cardforge.org/fpics/products/fatpacks/M10.png -http://www.cardforge.org/fpics/products/fatpacks/M11.jpg -http://www.cardforge.org/fpics/products/fatpacks/M11.png -http://www.cardforge.org/fpics/products/fatpacks/M12.jpg -http://www.cardforge.org/fpics/products/fatpacks/M12.png -http://www.cardforge.org/fpics/products/fatpacks/MBS.jpg -http://www.cardforge.org/fpics/products/fatpacks/MMQ.jpg -http://www.cardforge.org/fpics/products/fatpacks/MOR.jpg -http://www.cardforge.org/fpics/products/fatpacks/MRD.jpg -http://www.cardforge.org/fpics/products/fatpacks/NMS.jpg -http://www.cardforge.org/fpics/products/fatpacks/NPH.jpg -http://www.cardforge.org/fpics/products/fatpacks/ODY.jpg -http://www.cardforge.org/fpics/products/fatpacks/ONS.jpg -http://www.cardforge.org/fpics/products/fatpacks/PCY.jpg -http://www.cardforge.org/fpics/products/fatpacks/PLC.jpg -http://www.cardforge.org/fpics/products/fatpacks/PLS.JPG -http://www.cardforge.org/fpics/products/fatpacks/RAV.jpg -http://www.cardforge.org/fpics/products/fatpacks/ROE.jpg -http://www.cardforge.org/fpics/products/fatpacks/SCG.jpg -http://www.cardforge.org/fpics/products/fatpacks/SHM.jpg -http://www.cardforge.org/fpics/products/fatpacks/SOK.jpg -http://www.cardforge.org/fpics/products/fatpacks/SOM.jpg -http://www.cardforge.org/fpics/products/fatpacks/TOR.jpg -http://www.cardforge.org/fpics/products/fatpacks/TSP.jpg -http://www.cardforge.org/fpics/products/fatpacks/WWK.jpg -http://www.cardforge.org/fpics/products/fatpacks/ZEN.jpg - -# Precons -http://www.cardforge.org/fpics/products/precons/bant_on_the_march.jpg -http://www.cardforge.org/fpics/products/precons/battle_cries.jpg -http://www.cardforge.org/fpics/products/precons/blood-and-fire.jpg -http://www.cardforge.org/fpics/products/precons/breath_of_fire.jpg -http://www.cardforge.org/fpics/products/precons/carnival_of_blood.jpg -http://www.cardforge.org/fpics/products/precons/dead_ahead.jpg -http://www.cardforge.org/fpics/products/precons/deadspread.jpg -http://www.cardforge.org/fpics/products/precons/deathfed.jpg -http://www.cardforge.org/fpics/products/precons/devouring_skies.jpg -http://www.cardforge.org/fpics/products/precons/doom_inevitable.jpg -http://www.cardforge.org/fpics/products/precons/eldritch_onslaught.jpg -http://www.cardforge.org/fpics/products/precons/esper_air_assault.jpg -http://www.cardforge.org/fpics/products/precons/feast_of_flesh.jpg -http://www.cardforge.org/fpics/products/precons/grab-for-power.jpg -http://www.cardforge.org/fpics/products/precons/grave_power.jpg -http://www.cardforge.org/fpics/products/precons/grixis_shambling_army.jpg -http://www.cardforge.org/fpics/products/precons/invading_spawn.jpg -http://www.cardforge.org/fpics/products/precons/jund_appetite_for_war.jpg -http://www.cardforge.org/fpics/products/precons/levelers_glory.jpg -http://www.cardforge.org/fpics/products/precons/myr_of_mirrodin.jpg -http://www.cardforge.org/fpics/products/precons/naya_domain.jpg -http://www.cardforge.org/fpics/products/precons/path_of_blight.jpg -http://www.cardforge.org/fpics/products/precons/phyrexian_poison.jpg -http://www.cardforge.org/fpics/products/precons/reign_of_vampirism.jpg -http://www.cardforge.org/fpics/products/precons/relentless_dead.jpg -http://www.cardforge.org/fpics/products/precons/relic_breaker.jpg -http://www.cardforge.org/fpics/products/precons/repel_the_dark.jpg -http://www.cardforge.org/fpics/products/precons/spectral_legions.jpg -http://www.cardforge.org/fpics/products/precons/swift_justice.jpg -http://www.cardforge.org/fpics/products/precons/totem_power.jpg -http://www.cardforge.org/fpics/products/precons/unnatural_schemes.jpg - -# Tournament Packs -http://www.cardforge.org/fpics/products/tournamentpacks/2ED.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/3ED.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/4ED.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/5ED.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/6ED.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/ALA.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/CHK.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/ICE.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/INV.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/LEA.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/LEB.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/LRW.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/MIR.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/MMQ.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/MRD.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/ODY.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/ONS.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/RAV.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/SHM.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/TMP.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/TSP.jpg -http://www.cardforge.org/fpics/products/tournamentpacks/USG.jpg diff --git a/res/quest/fatpack-images.txt b/res/quest/fatpack-images.txt new file mode 100644 index 00000000000..3ecbd849b89 --- /dev/null +++ b/res/quest/fatpack-images.txt @@ -0,0 +1,52 @@ +http://www.cardforge.org/fpics/products/fatpacks/10E.jpg +http://www.cardforge.org/fpics/products/fatpacks/5DN.jpg +http://www.cardforge.org/fpics/products/fatpacks/9ED.jpg +http://www.cardforge.org/fpics/products/fatpacks/ALA.jpg +http://www.cardforge.org/fpics/products/fatpacks/APC.jpg +http://www.cardforge.org/fpics/products/fatpacks/ARB.jpg +http://www.cardforge.org/fpics/products/fatpacks/AVR.png +http://www.cardforge.org/fpics/products/fatpacks/BOK.jpg +http://www.cardforge.org/fpics/products/fatpacks/CFX.jpg +http://www.cardforge.org/fpics/products/fatpacks/CHK.jpg +http://www.cardforge.org/fpics/products/fatpacks/CSP.jpg +http://www.cardforge.org/fpics/products/fatpacks/DIS.jpg +http://www.cardforge.org/fpics/products/fatpacks/DKA.jpg +http://www.cardforge.org/fpics/products/fatpacks/DST.jpg +http://www.cardforge.org/fpics/products/fatpacks/EVE.jpg +http://www.cardforge.org/fpics/products/fatpacks/FUT.jpg +http://www.cardforge.org/fpics/products/fatpacks/GPT.jpg +http://www.cardforge.org/fpics/products/fatpacks/GTC.jpg +http://www.cardforge.org/fpics/products/fatpacks/INV.jpg +http://www.cardforge.org/fpics/products/fatpacks/ISD.jpg +http://www.cardforge.org/fpics/products/fatpacks/JUD.jpg +http://www.cardforge.org/fpics/products/fatpacks/LGN.jpg +http://www.cardforge.org/fpics/products/fatpacks/LRW.jpg +http://www.cardforge.org/fpics/products/fatpacks/M10.jpg +http://www.cardforge.org/fpics/products/fatpacks/M10.png +http://www.cardforge.org/fpics/products/fatpacks/M11.jpg +http://www.cardforge.org/fpics/products/fatpacks/M11.png +http://www.cardforge.org/fpics/products/fatpacks/M12.jpg +http://www.cardforge.org/fpics/products/fatpacks/M12.png +http://www.cardforge.org/fpics/products/fatpacks/M13.jpg +http://www.cardforge.org/fpics/products/fatpacks/MBS.jpg +http://www.cardforge.org/fpics/products/fatpacks/MMQ.jpg +http://www.cardforge.org/fpics/products/fatpacks/MOR.jpg +http://www.cardforge.org/fpics/products/fatpacks/MRD.jpg +http://www.cardforge.org/fpics/products/fatpacks/NMS.jpg +http://www.cardforge.org/fpics/products/fatpacks/NPH.jpg +http://www.cardforge.org/fpics/products/fatpacks/ODY.jpg +http://www.cardforge.org/fpics/products/fatpacks/ONS.jpg +http://www.cardforge.org/fpics/products/fatpacks/PCY.jpg +http://www.cardforge.org/fpics/products/fatpacks/PLC.jpg +http://www.cardforge.org/fpics/products/fatpacks/PLS.jpg +http://www.cardforge.org/fpics/products/fatpacks/RAV.jpg +http://www.cardforge.org/fpics/products/fatpacks/ROE.jpg +http://www.cardforge.org/fpics/products/fatpacks/RTR.jpg +http://www.cardforge.org/fpics/products/fatpacks/SCG.jpg +http://www.cardforge.org/fpics/products/fatpacks/SHM.jpg +http://www.cardforge.org/fpics/products/fatpacks/SOK.jpg +http://www.cardforge.org/fpics/products/fatpacks/SOM.jpg +http://www.cardforge.org/fpics/products/fatpacks/TOR.jpg +http://www.cardforge.org/fpics/products/fatpacks/TSP.jpg +http://www.cardforge.org/fpics/products/fatpacks/WWK.jpg +http://www.cardforge.org/fpics/products/fatpacks/ZEN.jpg diff --git a/res/quest/precon-images.txt b/res/quest/precon-images.txt new file mode 100644 index 00000000000..2454588eb26 --- /dev/null +++ b/res/quest/precon-images.txt @@ -0,0 +1,152 @@ +http://www.cardforge.org/fpics/products/precons/Bait_Bludgeon.jpg +http://www.cardforge.org/fpics/products/precons/Battle_Surge.jpg +http://www.cardforge.org/fpics/products/precons/Boggart_Feast.jpg +http://www.cardforge.org/fpics/products/precons/Bomber.jpg +http://www.cardforge.org/fpics/products/precons/Cho_Mannos_Resolve.jpg +http://www.cardforge.org/fpics/products/precons/Code_of_the_Orzhov.jpg +http://www.cardforge.org/fpics/products/precons/Critical_Mass.jpg +http://www.cardforge.org/fpics/products/precons/Crusher.jpg +http://www.cardforge.org/fpics/products/precons/Custom_Creatures.jpg +http://www.cardforge.org/fpics/products/precons/Dead_Again.jpg +http://www.cardforge.org/fpics/products/precons/Deaths_Minions.jpg +http://www.cardforge.org/fpics/products/precons/Decay.jpg +http://www.cardforge.org/fpics/products/precons/Deep_Freeze.jpg +http://www.cardforge.org/fpics/products/precons/Disrupter.jpg +http://www.cardforge.org/fpics/products/precons/Domain.jpg +http://www.cardforge.org/fpics/products/precons/Elvish_Rage.jpg +http://www.cardforge.org/fpics/products/precons/Evincars_Tyranny.jpg +http://www.cardforge.org/fpics/products/precons/Expulsion.jpg +http://www.cardforge.org/fpics/products/precons/Fangs_of_the_Bloodchief.jpg +http://www.cardforge.org/fpics/products/precons/Fate_Blaster.jpg +http://www.cardforge.org/fpics/products/precons/Fiendish_Nature.jpg +http://www.cardforge.org/fpics/products/precons/Golgari_Deathcreep.jpg +http://www.cardforge.org/fpics/products/precons/Golgari_Growth.jpg +http://www.cardforge.org/fpics/products/precons/Grave_Danger.jpg +http://www.cardforge.org/fpics/products/precons/Groundbreaker.jpg +http://www.cardforge.org/fpics/products/precons/Heavy_Hitters.jpg +http://www.cardforge.org/fpics/products/precons/Infestation.jpg +http://www.cardforge.org/fpics/products/precons/Izzet_Ingenuity.jpg +http://www.cardforge.org/fpics/products/precons/Kamahls_Temper.jpg +http://www.cardforge.org/fpics/products/precons/Kami_Reborn.jpg +http://www.cardforge.org/fpics/products/precons/Kithkin_Militia.jpg +http://www.cardforge.org/fpics/products/precons/Legion_Aloft.jpg +http://www.cardforge.org/fpics/products/precons/Life_Boost.jpg +http://www.cardforge.org/fpics/products/precons/Little_Bashers.jpg +http://www.cardforge.org/fpics/products/precons/Lofty_Heights.jpg +http://www.cardforge.org/fpics/products/precons/Master_Blaster.jpg +http://www.cardforge.org/fpics/products/precons/Mercenaries.jpg +http://www.cardforge.org/fpics/products/precons/Merrow_Riverways.jpg +http://www.cardforge.org/fpics/products/precons/Migraine.jpg +http://www.cardforge.org/fpics/products/precons/Molimos_Might.jpg +http://www.cardforge.org/fpics/products/precons/Phyrexian_Assault.jpg +http://www.cardforge.org/fpics/products/precons/Pummel.jpg +http://www.cardforge.org/fpics/products/precons/Radiants_Revenge.jpg +http://www.cardforge.org/fpics/products/precons/Rakdos_Bloodsport.jpg +http://www.cardforge.org/fpics/products/precons/Rakdos_Raid.jpg +http://www.cardforge.org/fpics/products/precons/Replicator.jpg +http://www.cardforge.org/fpics/products/precons/Rituals_of_Rebirth.jpg +http://www.cardforge.org/fpics/products/precons/Sacrificial_Bam.jpg +http://www.cardforge.org/fpics/products/precons/Selesnya_Surge.jpg +http://www.cardforge.org/fpics/products/precons/Selesnya_United.jpg +http://www.cardforge.org/fpics/products/precons/Shamanism.jpg +http://www.cardforge.org/fpics/products/precons/Sky_Slam.jpg +http://www.cardforge.org/fpics/products/precons/Sleeper.jpg +http://www.cardforge.org/fpics/products/precons/Sliver_Shivers.jpg +http://www.cardforge.org/fpics/products/precons/Snowscape.jpg +http://www.cardforge.org/fpics/products/precons/Spectral_Slam.jpg +http://www.cardforge.org/fpics/products/precons/Speed_Scorch.jpg +http://www.cardforge.org/fpics/products/precons/Spirit_Flames.jpg +http://www.cardforge.org/fpics/products/precons/Spiritcraft.jpg +http://www.cardforge.org/fpics/products/precons/Stampede.jpg +http://www.cardforge.org/fpics/products/precons/Sunburst.jpg +http://www.cardforge.org/fpics/products/precons/The_Spikes.jpg +http://www.cardforge.org/fpics/products/precons/The_Swarm.jpg +http://www.cardforge.org/fpics/products/precons/Time_Drain.jpg +http://www.cardforge.org/fpics/products/precons/Tombstone.jpg +http://www.cardforge.org/fpics/products/precons/Trounce-O-Matic.jpg +http://www.cardforge.org/fpics/products/precons/Truth_Seekers.jpg +http://www.cardforge.org/fpics/products/precons/Turnabout.jpg +http://www.cardforge.org/fpics/products/precons/Warriors_Code.jpg +http://www.cardforge.org/fpics/products/precons/Way_Wild.jpg +http://www.cardforge.org/fpics/products/precons/Wicked_Big.jpg +http://www.cardforge.org/fpics/products/precons/World_Aflame.jpg +http://www.cardforge.org/fpics/products/precons/Zombies_Unleashed.jpg +http://www.cardforge.org/fpics/products/precons/angelic_might.jpg +http://www.cardforge.org/fpics/products/precons/bant_exalted.jpg +http://www.cardforge.org/fpics/products/precons/bant_on_the_march.jpg +http://www.cardforge.org/fpics/products/precons/battle_blitz.jpg +http://www.cardforge.org/fpics/products/precons/battle_cries.jpg +http://www.cardforge.org/fpics/products/precons/blood_and_fire.jpg +http://www.cardforge.org/fpics/products/precons/bound_by_strength.jpg +http://www.cardforge.org/fpics/products/precons/breath_of_fire.jpg +http://www.cardforge.org/fpics/products/precons/carnival_of_blood.jpg +http://www.cardforge.org/fpics/products/precons/dark_sacrifice.jpg +http://www.cardforge.org/fpics/products/precons/dead_ahead.jpg +http://www.cardforge.org/fpics/products/precons/deadspread.jpg +http://www.cardforge.org/fpics/products/precons/deathfed.jpg +http://www.cardforge.org/fpics/products/precons/deathly_dominion.jpg +http://www.cardforge.org/fpics/products/precons/deaths_encroach.jpg +http://www.cardforge.org/fpics/products/precons/depths_of_power.jpg +http://www.cardforge.org/fpics/products/precons/devouring_skies.jpg +http://www.cardforge.org/fpics/products/precons/doom_inevitable.jpg +http://www.cardforge.org/fpics/products/precons/eldritch_onslaught.jpg +http://www.cardforge.org/fpics/products/precons/entangling_webs.jpg +http://www.cardforge.org/fpics/products/precons/esper_air_assault.jpg +http://www.cardforge.org/fpics/products/precons/esper_artifice.jpg +http://www.cardforge.org/fpics/products/precons/eternal_siege.jpg +http://www.cardforge.org/fpics/products/precons/feast_of_flesh.jpg +http://www.cardforge.org/fpics/products/precons/fiery_dawn.jpg +http://www.cardforge.org/fpics/products/precons/firebomber.jpg +http://www.cardforge.org/fpics/products/precons/flyover.jpg +http://www.cardforge.org/fpics/products/precons/gleeful_flames.jpg +http://www.cardforge.org/fpics/products/precons/grab-for-power.jpg +http://www.cardforge.org/fpics/products/precons/grave_power.jpg +http://www.cardforge.org/fpics/products/precons/grixis_shambling_army.jpg +http://www.cardforge.org/fpics/products/precons/grixis_undead.jpg +http://www.cardforge.org/fpics/products/precons/hold_the_line.jpg +http://www.cardforge.org/fpics/products/precons/infect_and_defile.jpg +http://www.cardforge.org/fpics/products/precons/into_the_breach.jpg +http://www.cardforge.org/fpics/products/precons/invading_spawn.jpg +http://www.cardforge.org/fpics/products/precons/jund_appetite_for_war.jpg +http://www.cardforge.org/fpics/products/precons/kor_armory.jpg +http://www.cardforge.org/fpics/products/precons/levelers_glory.jpg +http://www.cardforge.org/fpics/products/precons/levelers_scorn.jpg +http://www.cardforge.org/fpics/products/precons/metalcraft.jpg +http://www.cardforge.org/fpics/products/precons/mirromancy.jpg +http://www.cardforge.org/fpics/products/precons/mob_rule.jpg +http://www.cardforge.org/fpics/products/precons/monstrous_surprise.jpg +http://www.cardforge.org/fpics/products/precons/myr_of_mirrodin.jpg +http://www.cardforge.org/fpics/products/precons/mysterious_realms.jpg +http://www.cardforge.org/fpics/products/precons/mystical_might.jpg +http://www.cardforge.org/fpics/products/precons/naya_behemoths.jpg +http://www.cardforge.org/fpics/products/precons/naya_domain.jpg +http://www.cardforge.org/fpics/products/precons/path_of_blight.jpg +http://www.cardforge.org/fpics/products/precons/phyrexian_poison.jpg +http://www.cardforge.org/fpics/products/precons/presence_of_mind.jpg +http://www.cardforge.org/fpics/products/precons/primordial_jund.jpg +http://www.cardforge.org/fpics/products/precons/rapid_fire.jpg +http://www.cardforge.org/fpics/products/precons/ravaging_swarm.jpg +http://www.cardforge.org/fpics/products/precons/reign_of_vampirism.jpg +http://www.cardforge.org/fpics/products/precons/relentless_dead.jpg +http://www.cardforge.org/fpics/products/precons/relic_breaker.jpg +http://www.cardforge.org/fpics/products/precons/repeat_performance.jpg +http://www.cardforge.org/fpics/products/precons/repel_the_dark.jpg +http://www.cardforge.org/fpics/products/precons/rise_of_the_vampires.jpg +http://www.cardforge.org/fpics/products/precons/rot_from_within.jpg +http://www.cardforge.org/fpics/products/precons/rumbler.jpg +http://www.cardforge.org/fpics/products/precons/sacred_assault.jpg +http://www.cardforge.org/fpics/products/precons/slaughterhouse.jpg +http://www.cardforge.org/fpics/products/precons/sole_domination.jpg +http://www.cardforge.org/fpics/products/precons/solitary_fiends.jpg +http://www.cardforge.org/fpics/products/precons/spectral_legions.jpg +http://www.cardforge.org/fpics/products/precons/spiraling_doom.jpg +http://www.cardforge.org/fpics/products/precons/superabundance.jpg +http://www.cardforge.org/fpics/products/precons/sweet_revenge.jpg +http://www.cardforge.org/fpics/products/precons/swift_justice.jpg +http://www.cardforge.org/fpics/products/precons/the_adventurers.jpg +http://www.cardforge.org/fpics/products/precons/totem_power.jpg +http://www.cardforge.org/fpics/products/precons/unnatural_schemes.jpg +http://www.cardforge.org/fpics/products/precons/unstable_terrain.jpg +http://www.cardforge.org/fpics/products/precons/vampire_onslaught.jpg +http://www.cardforge.org/fpics/products/precons/war_of_attrition.jpg +http://www.cardforge.org/fpics/products/precons/wild_rush.jpg diff --git a/res/quest/quest.properties b/res/quest/quest.properties deleted file mode 100644 index 69e16353ae9..00000000000 --- a/res/quest/quest.properties +++ /dev/null @@ -1,19 +0,0 @@ -common--file=common.txt -uncommon--file=uncommon.txt -rare--file=rare.txt - -price--file=all-prices.txt -boosterprice--file=booster-prices.txt - -data-xml--file=questData.dat -data--file=questData -prefs--file=quest.preferences - -duels-dir--file=duels -challenges-dir--file=challenges -world-dir--file=world -data-dir--file=data -precons-dir--file=precons - -bazaar-dir--file=bazaar -bazaar--file=bazaar/index.xml diff --git a/res/quest/tournamentpack-images.txt b/res/quest/tournamentpack-images.txt new file mode 100644 index 00000000000..abbaddededa --- /dev/null +++ b/res/quest/tournamentpack-images.txt @@ -0,0 +1,22 @@ +http://www.cardforge.org/fpics/products/tournamentpacks/2ED.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/3ED.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/4ED.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/5ED.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/6ED.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/ALA.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/CHK.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/ICE.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/INV.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/LEA.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/LEB.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/LRW.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/MIR.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/MMQ.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/MRD.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/ODY.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/ONS.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/RAV.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/SHM.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/TMP.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/TSP.jpg +http://www.cardforge.org/fpics/products/tournamentpacks/USG.jpg diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index acb185935a5..bcac589e379 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -42,8 +42,8 @@ import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.Cost; -import forge.card.mana.ManaCostBeingPaid; import forge.card.mana.ManaCost; +import forge.card.mana.ManaCostBeingPaid; import forge.card.replacement.ReplaceMoved; import forge.card.replacement.ReplacementEffect; import forge.card.replacement.ReplacementResult; @@ -58,8 +58,8 @@ import forge.card.trigger.TriggerType; import forge.card.trigger.ZCTrigger; import forge.game.GameActionUtil; import forge.game.GlobalRuleChange; -import forge.game.event.CounterAddedEvent; import forge.game.event.CardEquippedEvent; +import forge.game.event.CounterAddedEvent; import forge.game.event.CounterRemovedEvent; import forge.game.event.SetTappedEvent; import forge.game.phase.Combat; diff --git a/src/main/java/forge/CardUtil.java b/src/main/java/forge/CardUtil.java index a5a46807d69..8b44b584570 100644 --- a/src/main/java/forge/CardUtil.java +++ b/src/main/java/forge/CardUtil.java @@ -17,7 +17,6 @@ */ package forge; -import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -39,7 +38,6 @@ import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.GuiDisplayUtil; import forge.item.IPaperCard; -import forge.properties.ForgeProps; import forge.properties.NewConstants; @@ -131,7 +129,7 @@ public final class CardUtil { final String set = card.getCurSetCode(); CardInSet neededSet = card.getRules().getEditionInfo(set); final int cntPictures = neededSet == null ? 1 : neededSet.getCopiesCount(); - return CardUtil.buildFilename(card.getName(), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token); + return CardUtil.buildFilename(GuiDisplayUtil.cleanString(card.getName()), card.getCurSetCode(), card.getRandomPicture(), cntPictures, token); } /** @@ -146,7 +144,7 @@ public final class CardUtil { final int maxIndex = cr.getEditionInfo(card.getEdition()).getCopiesCount(); // picture is named AssaultBattery.full.jpg String imageName = cr.getSplitType() != CardSplitType.Split ? card.getName() : buildSplitCardFilename(cr); - return CardUtil.buildFilename(imageName, card.getEdition(), card.getArtIndex(), maxIndex, false); + return CardUtil.buildFilename(GuiDisplayUtil.cleanString(imageName), card.getEdition(), card.getArtIndex(), maxIndex, false); } public static String buildSplitCardFilename(CardRules cr) { @@ -164,68 +162,18 @@ public final class CardUtil { */ public static String buildFilename(final IPaperCard card, final String nameToUse) { final int maxIndex = card.getRules().getEditionInfo(card.getEdition()).getCopiesCount(); - return CardUtil.buildFilename(nameToUse, card.getEdition(), card.getArtIndex(), maxIndex, false); + return CardUtil.buildFilename(GuiDisplayUtil.cleanString(nameToUse), card.getEdition(), card.getArtIndex(), maxIndex, false); } - private static String buildFilename(final String cardName, final String setName, final int artIndex, + public static String buildFilename(final String cleanCardName, final String setName, final int artIndex, final int artIndexMax, final boolean isToken) { - final File path = ForgeProps.getFile(isToken ? NewConstants.IMAGE_TOKEN : NewConstants.IMAGE_BASE); - final String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : ""; - final String cleanCardName = GuiDisplayUtil.cleanString(cardName); - - File f = null; - if (StringUtils.isNotBlank(setName)) { - final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName); - - // First, try 3 letter set code with MWS filename format - final String mwsSet3 = String.format("%s/%s%s.full", setName, mwsCardName, nn); - f = new File(path, mwsSet3 + ".jpg"); - if (f.exists()) { - return mwsSet3; - } - - // Second, try 2 letter set code with MWS filename format - final String mwsSet2 = String.format("%s/%s%s.full", Singletons.getModel().getEditions().getCode2ByCode(setName), mwsCardName, nn); - f = new File(path, mwsSet2 + ".jpg"); - if (f.exists()) { - return mwsSet2; - } - - // Third, try 3 letter set code with Forge filename format - final String forgeSet3 = String.format("%s/%s%s", setName, cleanCardName, nn); - f = new File(path, forgeSet3 + ".jpg"); - if (f.exists()) { - return forgeSet3; - } - } - - // Last, give up with set images, go with the old picture type - final String forgePlain = String.format("%s%s", cleanCardName, nn); - - f = new File(path, forgePlain + ".jpg"); - if (f.exists()) { - return forgePlain; - } - - // give up with art index - f = new File(path, cleanCardName + ".jpg"); - if (f.exists()) { - return cleanCardName; - } - - // if still no file, download if option enabled? - return "none"; + return String.format("%s%s%s%s.full", + isToken ? ImageCache.TOKEN_PREFIX : "", + StringUtils.isBlank(setName) ? "" : setName + "/", + cleanCardName, + artIndexMax <= 1 ? "" : String.valueOf(artIndex + 1)); } - /** - *

- * getShortColorsString. - *

- * - * @param colors - * a {@link java.util.ArrayList} object. - * @return a {@link java.lang.String} object. - */ public static String getShortColorsString(final ArrayList colors) { String colorDesc = ""; for (final String col : colors) { @@ -412,7 +360,7 @@ public final class CardUtil { ret.setName(""); ret.setType(types); - ret.setImageFilename(NewConstants.MORPH_IMAGE_FILE_NAME); + ret.setImageFilename(NewConstants.CACHE_MORPH_IMAGE_FILE); return ret; } diff --git a/src/main/java/forge/Constant.java b/src/main/java/forge/Constant.java index dedcda1983a..b672b8d65c7 100644 --- a/src/main/java/forge/Constant.java +++ b/src/main/java/forge/Constant.java @@ -22,9 +22,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import forge.properties.ForgeProps; -import forge.properties.NewConstants; - /** *

* Constant interface. @@ -34,9 +31,6 @@ import forge.properties.NewConstants; * @version $Id$ */ public final class Constant { - /** Constant ProgramName="Forge - http://cardforge.org". */ - public static final String PROGRAM_NAME = "Forge - " + ForgeProps.getProperty(NewConstants.CARDFORGE_URL); - // used to pass information between the GUI screens /** * The Class Runtime. diff --git a/src/main/java/forge/ImageCache.java b/src/main/java/forge/ImageCache.java index d0bfd66222b..75d629e7921 100644 --- a/src/main/java/forge/ImageCache.java +++ b/src/main/java/forge/ImageCache.java @@ -19,6 +19,7 @@ package forge; import java.awt.image.BufferedImage; import java.util.concurrent.ExecutionException; + import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader.InvalidCacheLoadException; import com.google.common.cache.LoadingCache; @@ -27,6 +28,7 @@ import com.mortennobel.imagescaling.ResampleOp; import forge.gui.GuiDisplayUtil; import forge.item.InventoryItem; import forge.properties.ForgePreferences.FPref; +import forge.properties.NewConstants; /** * This class stores ALL card images in a cache with soft values. this means @@ -43,18 +45,17 @@ import forge.properties.ForgePreferences.FPref; * @version $Id$ */ public class ImageCache { - /** Constant imageCache. */ - static final LoadingCache CACHE = CacheBuilder.newBuilder().softValues().build(new ImageLoader()); - /** Constant FULL_SIZE. */ - - public static final String SEALED_PRODUCT = "sealed://"; - public static final String TOKEN = "token://"; + // short prefixes to save memory + public static final String TOKEN_PREFIX = "t:"; + public static final String BOOSTER_PREFIX = "b:"; + public static final String FATPACK_PREFIX = "f:"; + public static final String PRECON_PREFIX = "p:"; + public static final String TOURNAMENTPACK_PREFIX = "o:"; + + static private final LoadingCache CACHE = CacheBuilder.newBuilder().softValues().build(new ImageLoader()); public static BufferedImage getImage(final Card card, final int width, final int height) { - //SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS"); - //System.out.printf("%s - load '%s' (%d x %d)\n", sdf.format(new Date()), card.getImageFilename(), width, height ); - - final String key = card.canBeShownTo(Singletons.getControl().getPlayer()) ? ImageCache.getKey(card) : "Morph"; + final String key = card.canBeShownTo(Singletons.getControl().getPlayer()) ? ImageCache.getKey(card) : NewConstants.CACHE_MORPH_IMAGE_FILE; return scaleImage(key, width, height); } @@ -70,12 +71,6 @@ public class ImageCache { return scaleImage(key, width, height); } - /** - * TODO: Write javadoc for this method. - * @param original - * @param scale - * @return - */ private static BufferedImage scaleImage(String key, final int width, final int height) { if (3 > width || 3 > height) { // picture too small; return a blank @@ -118,10 +113,6 @@ public class ImageCache { /** * Returns the Image corresponding to the key. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link java.awt.image.BufferedImage} object. */ private static BufferedImage getImage(final String key) { try { @@ -140,14 +131,10 @@ public class ImageCache { /** * Returns the map key for a card, without any suffixes for the image size. - * - * @param card - * a {@link forge.Card} object. - * @return a {@link java.lang.String} object. */ public static String getKey(final Card card) { if ((card.isToken() && !card.isCopiedToken()) || card.isFaceDown()) { - return ImageCache.TOKEN + GuiDisplayUtil.cleanString(card.getImageFilename()); + return ImageCache.TOKEN_PREFIX + GuiDisplayUtil.cleanString(card.getImageFilename()); } return card.getImageFilename(); // key; } @@ -155,5 +142,4 @@ public class ImageCache { public static String getKey(final InventoryItem ii) { return ii.getImageFilename(); } - } diff --git a/src/main/java/forge/ImageLoader.java b/src/main/java/forge/ImageLoader.java index 62a5d975e03..2053a2def90 100644 --- a/src/main/java/forge/ImageLoader.java +++ b/src/main/java/forge/ImageLoader.java @@ -3,70 +3,76 @@ package forge; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; + import javax.imageio.ImageIO; import com.google.common.cache.CacheLoader; import forge.error.BugReporter; -import forge.properties.ForgeProps; import forge.properties.NewConstants; -/** - * TODO: Write javadoc for this type. - * - */ final class ImageLoader extends CacheLoader { + // image file extensions for various formats in order of likelihood + private static final String[] _FILE_EXTENSIONS = { ".jpg", ".png" }; + @Override public BufferedImage load(String key) { - // original - File path; - String filename; - if (key.startsWith(ImageCache.TOKEN)) { - filename = key.substring(ImageCache.TOKEN.length()); - path = ForgeProps.getFile(NewConstants.IMAGE_TOKEN); - } else if (key.startsWith(ImageCache.SEALED_PRODUCT)) { - filename = key.substring(ImageCache.SEALED_PRODUCT.length()); - path = ForgeProps.getFile(NewConstants.IMAGE_SEALED_PRODUCT); + final String path; + final String filename; + if (key.startsWith(ImageCache.TOKEN_PREFIX)) { + filename = key.substring(ImageCache.TOKEN_PREFIX.length()); + path = NewConstants.CACHE_TOKEN_PICS_DIR; + } else if (key.startsWith(ImageCache.BOOSTER_PREFIX)) { + filename = key.substring(ImageCache.BOOSTER_PREFIX.length()); + path = NewConstants.CACHE_BOOSTER_PICS_DIR; + } else if (key.startsWith(ImageCache.FATPACK_PREFIX)) { + filename = key.substring(ImageCache.FATPACK_PREFIX.length()); + path = NewConstants.CACHE_FATPACK_PICS_DIR; + } else if (key.startsWith(ImageCache.PRECON_PREFIX)) { + filename = key.substring(ImageCache.PRECON_PREFIX.length()); + path = NewConstants.CACHE_PRECON_PICS_DIR; + } else if (key.startsWith(ImageCache.TOURNAMENTPACK_PREFIX)) { + filename = key.substring(ImageCache.TOURNAMENTPACK_PREFIX.length()); + path = NewConstants.CACHE_TOURNAMENTPACK_PICS_DIR; } else { filename = key; - path = ForgeProps.getFile(NewConstants.IMAGE_BASE); + path = NewConstants.CACHE_CARD_PICS_DIR; } - File file = null; - boolean isPng = filename.endsWith(".png"); - final String fName = isPng || filename.endsWith(".jpg") ? filename : filename + ".jpg"; - file = new File(path, fName); - if (!file.exists()) { - // DEBUG - //System.out.println("File not found, no image created: " - //+ file); - return null; + BufferedImage ret = _findFile(key, path, filename); + + // try without set prefix (if any) + if (null == ret && filename.contains("/")) { + ret = _findFile(key, path, filename.substring(filename.indexOf('/') + 1)); } - final BufferedImage image = getImage(file); - //ImageCache.IMAGE_CACHE.put(key, image); - return image; + + if (null == ret) { + System.out.println("File not found, no image created: " + key); + } + + return ret; } - /** - *

- * getImage. - *

- * - * @param file a {@link java.io.File} object. - * @return a {@link java.awt.image.BufferedImage} object. - * @throws IOException Signals that an I/O exception has occurred. - */ public static BufferedImage getImage(final File file) { - //System.out.printf("Loading from disk: %s\n", file.toString()); - - BufferedImage image; - //int format = useAlpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB; + BufferedImage image = null;; try { image = ImageIO.read(file); } catch (IOException ex) { BugReporter.reportException(ex, "Could not read image file " + file.getAbsolutePath() + " "); - return null; } return image; } + + private static BufferedImage _findFile(String key, String path, String filename) { + for (String ext : _FILE_EXTENSIONS) { + File file = new File(path, filename + ext); + if (file.exists()) { + System.out.println(String.format("Found %s at: %s", key, file.getAbsolutePath())); + return getImage(file); + } + } + + return null; + + } } \ No newline at end of file diff --git a/src/main/java/forge/Singletons.java b/src/main/java/forge/Singletons.java index e6376b3f204..96f3ce81dec 100644 --- a/src/main/java/forge/Singletons.java +++ b/src/main/java/forge/Singletons.java @@ -25,50 +25,22 @@ import forge.view.FView; * Provides global/static access to singleton instances. */ public final class Singletons { - - private static FModel model = null; - - private static FView view = null; - + private static FModel model = null; + private static FView view = null; private static FControl control = null; - /** - * Do not instantiate. - */ - private Singletons() { - // This line intentionally left blank. - } - - /** @return {@link forge.model.FModel} */ - public static FModel getModel() { - return Singletons.model; - } - - /** @param model0   {@link forge.model.FModel} */ - public static void setModel(final FModel model0) { - Singletons.model = model0; - } - /** * IMPORTANT - does not return view frame! Must call * getFrame() from FView for that. - * @return {@link forge.model.JFrame} */ - public static FView getView() { - return Singletons.view; - } + */ + public static FView getView() { return view; } + public static FControl getControl() { return control; } + public static FModel getModel() { return model; } - /** @param view0   {@link forge.model.FView} */ - public static void setView(final FView view0) { - Singletons.view = view0; - } + public static void setModel (FModel model0) { model = model0; } + public static void setView (FView view0) { view = view0; } + public static void setControl(FControl control0) { control = control0; } - /** @return {@link forge.control.FControl} */ - public static FControl getControl() { - return Singletons.control; - } - - /** @param control0   {@link forge.control.FControl} */ - public static void setControl(final FControl control0) { - Singletons.control = control0; - } + // disallow instantiation + private Singletons() { } } diff --git a/src/main/java/forge/StaticEffects.java b/src/main/java/forge/StaticEffects.java index 0ddbb669f96..65f1880ffcd 100644 --- a/src/main/java/forge/StaticEffects.java +++ b/src/main/java/forge/StaticEffects.java @@ -28,9 +28,9 @@ import com.esotericsoftware.minlog.Log; import forge.card.replacement.ReplacementEffect; import forge.card.spellability.SpellAbility; import forge.card.staticability.StaticAbility; +import forge.game.GlobalRuleChange; import forge.game.player.Player; import forge.game.zone.ZoneType; -import forge.game.GlobalRuleChange; /** *

diff --git a/src/main/java/forge/card/CardRulesPredicates.java b/src/main/java/forge/card/CardRulesPredicates.java index 87545fe01fe..a6723e4515a 100644 --- a/src/main/java/forge/card/CardRulesPredicates.java +++ b/src/main/java/forge/card/CardRulesPredicates.java @@ -2,6 +2,7 @@ package forge.card; import java.util.ArrayList; import java.util.List; + import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; diff --git a/src/main/java/forge/card/CardRulesReader.java b/src/main/java/forge/card/CardRulesReader.java index 02bc6b84a07..2731de073fa 100644 --- a/src/main/java/forge/card/CardRulesReader.java +++ b/src/main/java/forge/card/CardRulesReader.java @@ -23,9 +23,9 @@ import java.util.TreeMap; import org.apache.commons.lang3.StringUtils; -import forge.card.mana.ManaCostShard; import forge.card.mana.IParserManaCost; import forge.card.mana.ManaCost; +import forge.card.mana.ManaCostShard; /** @@ -87,10 +87,10 @@ public class CardRulesReader { public final CardRules getCard() { CardAiHints cah = new CardAiHints(removedFromAIDecks, removedFromRandomDecks, hints, needs ); faces[0].assignMissingFields(); - if ( null != faces[1] ) faces[1].assignMissingFields(); + if (null != faces[1]) faces[1].assignMissingFields(); final CardRules result = new CardRules(faces, altMode, cah, sets); result.setDlUrls(pictureUrl); - if ( StringUtils.isNotBlank(handLife)) + if (StringUtils.isNotBlank(handLife)) result.setVanguardProperties(handLife); return result; } @@ -114,13 +114,10 @@ public class CardRulesReader { * the line */ public final void parseLine(final String line) { - - int colonPos = line.indexOf(':'); String key = colonPos > 0 ? line.substring(0, colonPos) : line; String value = colonPos > 0 ? line.substring(1+colonPos).trim() : null; - switch(key.charAt(0)) { case 'A': if ("A".equals(key)) diff --git a/src/main/java/forge/card/FormatCollection.java b/src/main/java/forge/card/FormatCollection.java index 20d50a16bc0..14444b2dc15 100644 --- a/src/main/java/forge/card/FormatCollection.java +++ b/src/main/java/forge/card/FormatCollection.java @@ -20,6 +20,7 @@ package forge.card; import java.util.ArrayList; import java.util.Arrays; import java.util.List; + import forge.game.GameFormat; import forge.util.FileSection; import forge.util.storage.StorageReaderFile; diff --git a/src/main/java/forge/card/ability/AbilityFactory.java b/src/main/java/forge/card/ability/AbilityFactory.java index 8a002d833be..6a782de467f 100644 --- a/src/main/java/forge/card/ability/AbilityFactory.java +++ b/src/main/java/forge/card/ability/AbilityFactory.java @@ -21,9 +21,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; - import forge.Card; - import forge.card.cost.Cost; import forge.card.spellability.AbilitySub; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/ability/ApiType.java b/src/main/java/forge/card/ability/ApiType.java index 6ae52a03d81..946938322d3 100644 --- a/src/main/java/forge/card/ability/ApiType.java +++ b/src/main/java/forge/card/ability/ApiType.java @@ -4,7 +4,99 @@ package forge.card.ability; import java.util.Map; import java.util.TreeMap; -import forge.card.ability.ai.*; +import forge.card.ability.ai.AddPhaseAi; +import forge.card.ability.ai.AddTurnAi; +import forge.card.ability.ai.AlwaysPlayAi; +import forge.card.ability.ai.AnimateAi; +import forge.card.ability.ai.AnimateAllAi; +import forge.card.ability.ai.AttachAi; +import forge.card.ability.ai.BondAi; +import forge.card.ability.ai.CanPlayAsDrawbackAi; +import forge.card.ability.ai.CannotPlayAi; +import forge.card.ability.ai.ChangeZoneAi; +import forge.card.ability.ai.ChangeZoneAllAi; +import forge.card.ability.ai.CharmAi; +import forge.card.ability.ai.ChooseCardAi; +import forge.card.ability.ai.ChooseCardNameAi; +import forge.card.ability.ai.ChooseColorAi; +import forge.card.ability.ai.ChoosePlayerAi; +import forge.card.ability.ai.ChooseSourceAi; +import forge.card.ability.ai.ChooseTypeAi; +import forge.card.ability.ai.ClashAi; +import forge.card.ability.ai.CloneAi; +import forge.card.ability.ai.ControlExchangeAi; +import forge.card.ability.ai.ControlGainAi; +import forge.card.ability.ai.CopyPermanentAi; +import forge.card.ability.ai.CounterAi; +import forge.card.ability.ai.CountersMoveAi; +import forge.card.ability.ai.CountersProliferateAi; +import forge.card.ability.ai.CountersPutAi; +import forge.card.ability.ai.CountersPutAllAi; +import forge.card.ability.ai.CountersRemoveAi; +import forge.card.ability.ai.DamageAllAi; +import forge.card.ability.ai.DamageDealAi; +import forge.card.ability.ai.DamageEachAi; +import forge.card.ability.ai.DamagePreventAi; +import forge.card.ability.ai.DamagePreventAllAi; +import forge.card.ability.ai.DebuffAi; +import forge.card.ability.ai.DebuffAllAi; +import forge.card.ability.ai.DelayedTriggerAi; +import forge.card.ability.ai.DestroyAi; +import forge.card.ability.ai.DestroyAllAi; +import forge.card.ability.ai.DigAi; +import forge.card.ability.ai.DigUntilAi; +import forge.card.ability.ai.DiscardAi; +import forge.card.ability.ai.DrainManaAi; +import forge.card.ability.ai.DrawAi; +import forge.card.ability.ai.EffectAi; +import forge.card.ability.ai.EncodeAi; +import forge.card.ability.ai.EndTurnAi; +import forge.card.ability.ai.FightAi; +import forge.card.ability.ai.FogAi; +import forge.card.ability.ai.GameLossAi; +import forge.card.ability.ai.GameWinAi; +import forge.card.ability.ai.LifeExchangeAi; +import forge.card.ability.ai.LifeGainAi; +import forge.card.ability.ai.LifeLoseAi; +import forge.card.ability.ai.LifeSetAi; +import forge.card.ability.ai.MillAi; +import forge.card.ability.ai.MustAttackAi; +import forge.card.ability.ai.MustBlockAi; +import forge.card.ability.ai.PeekAndRevealAi; +import forge.card.ability.ai.PermanentCreatureAi; +import forge.card.ability.ai.PermanentNoncreatureAi; +import forge.card.ability.ai.PhasesAi; +import forge.card.ability.ai.PlayAi; +import forge.card.ability.ai.PoisonAi; +import forge.card.ability.ai.ProtectAi; +import forge.card.ability.ai.ProtectAllAi; +import forge.card.ability.ai.PumpAi; +import forge.card.ability.ai.PumpAllAi; +import forge.card.ability.ai.RearrangeTopOfLibraryAi; +import forge.card.ability.ai.RegenerateAi; +import forge.card.ability.ai.RegenerateAllAi; +import forge.card.ability.ai.RemoveFromCombatAi; +import forge.card.ability.ai.RepeatAi; +import forge.card.ability.ai.RepeatEachAi; +import forge.card.ability.ai.RestartGameAi; +import forge.card.ability.ai.RevealAi; +import forge.card.ability.ai.RevealHandAi; +import forge.card.ability.ai.SacrificeAi; +import forge.card.ability.ai.SacrificeAllAi; +import forge.card.ability.ai.ScryAi; +import forge.card.ability.ai.SetStateAi; +import forge.card.ability.ai.SetStateAllAi; +import forge.card.ability.ai.ShuffleAi; +import forge.card.ability.ai.StoreSVarAi; +import forge.card.ability.ai.TapAi; +import forge.card.ability.ai.TapAllAi; +import forge.card.ability.ai.TapOrUntapAi; +import forge.card.ability.ai.TapOrUntapAllAi; +import forge.card.ability.ai.TokenAi; +import forge.card.ability.ai.TwoPilesAi; +import forge.card.ability.ai.UnattachAllAi; +import forge.card.ability.ai.UntapAi; +import forge.card.ability.ai.UntapAllAi; import forge.card.ability.effects.*; import forge.util.ReflectionUtil; diff --git a/src/main/java/forge/card/ability/ai/AddTurnAi.java b/src/main/java/forge/card/ability/ai/AddTurnAi.java index c54bfb5503b..bfe7af83a88 100644 --- a/src/main/java/forge/card/ability/ai/AddTurnAi.java +++ b/src/main/java/forge/card/ability/ai/AddTurnAi.java @@ -19,10 +19,10 @@ package forge.card.ability.ai; import java.util.List; -import forge.card.spellability.SpellAbility; -import forge.card.spellability.Target; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityAi; +import forge.card.spellability.SpellAbility; +import forge.card.spellability.Target; import forge.game.player.AIPlayer; import forge.game.player.Player; diff --git a/src/main/java/forge/card/ability/ai/AttachAi.java b/src/main/java/forge/card/ability/ai/AttachAi.java index 8af929b570c..1283478ca3f 100644 --- a/src/main/java/forge/card/ability/ai/AttachAi.java +++ b/src/main/java/forge/card/ability/ai/AttachAi.java @@ -13,9 +13,9 @@ import com.google.common.base.Predicates; import forge.Card; import forge.CardLists; import forge.CardPredicates; +import forge.CardPredicates.Presets; import forge.CardUtil; import forge.Singletons; -import forge.CardPredicates.Presets; import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; import forge.card.ability.SpellAbilityAi; diff --git a/src/main/java/forge/card/ability/ai/BondAi.java b/src/main/java/forge/card/ability/ai/BondAi.java index 8c84b1a0335..5522307a289 100644 --- a/src/main/java/forge/card/ability/ai/BondAi.java +++ b/src/main/java/forge/card/ability/ai/BondAi.java @@ -17,8 +17,8 @@ */ package forge.card.ability.ai; -import forge.card.spellability.SpellAbility; import forge.card.ability.SpellAbilityAi; +import forge.card.spellability.SpellAbility; import forge.game.player.AIPlayer; /** diff --git a/src/main/java/forge/card/ability/ai/ChangeZoneAi.java b/src/main/java/forge/card/ability/ai/ChangeZoneAi.java index 7ae758ddf9c..bffaf12a087 100644 --- a/src/main/java/forge/card/ability/ai/ChangeZoneAi.java +++ b/src/main/java/forge/card/ability/ai/ChangeZoneAi.java @@ -12,10 +12,10 @@ import forge.Card; import forge.CardCharacteristicName; import forge.CardLists; import forge.CardPredicates; +import forge.CardPredicates.Presets; import forge.Constant; import forge.GameEntity; import forge.Singletons; -import forge.CardPredicates.Presets; import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; import forge.card.ability.SpellAbilityAi; @@ -28,10 +28,10 @@ import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellPermanent; import forge.card.spellability.Target; import forge.game.GlobalRuleChange; -import forge.game.ai.ComputerUtilCard; -import forge.game.ai.ComputerUtilCombat; import forge.game.ai.ComputerUtil; import forge.game.ai.ComputerUtilBlock; +import forge.game.ai.ComputerUtilCard; +import forge.game.ai.ComputerUtilCombat; import forge.game.ai.ComputerUtilCost; import forge.game.ai.ComputerUtilMana; import forge.game.phase.Combat; diff --git a/src/main/java/forge/card/ability/ai/CharmAi.java b/src/main/java/forge/card/ability/ai/CharmAi.java index bcdc1f4715d..c0229e560b1 100644 --- a/src/main/java/forge/card/ability/ai/CharmAi.java +++ b/src/main/java/forge/card/ability/ai/CharmAi.java @@ -5,7 +5,9 @@ import java.util.List; import java.util.Random; import org.apache.commons.lang.math.RandomUtils; -import forge.card.ability.SpellAbilityAi;import forge.card.ability.effects.CharmEffect; + +import forge.card.ability.SpellAbilityAi; +import forge.card.ability.effects.CharmEffect; import forge.card.spellability.AbilitySub; import forge.card.spellability.SpellAbility; import forge.game.player.AIPlayer; diff --git a/src/main/java/forge/card/ability/ai/ControlGainAi.java b/src/main/java/forge/card/ability/ai/ControlGainAi.java index 8515e0f8ff4..ad632f20567 100644 --- a/src/main/java/forge/card/ability/ai/ControlGainAi.java +++ b/src/main/java/forge/card/ability/ai/ControlGainAi.java @@ -24,7 +24,6 @@ import java.util.Map; import com.google.common.base.Predicate; import forge.Card; - import forge.CardLists; import forge.Singletons; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/ability/ai/CopyPermanentAi.java b/src/main/java/forge/card/ability/ai/CopyPermanentAi.java index f0c262920b7..0ca6e5bcc7f 100644 --- a/src/main/java/forge/card/ability/ai/CopyPermanentAi.java +++ b/src/main/java/forge/card/ability/ai/CopyPermanentAi.java @@ -8,8 +8,8 @@ import com.google.common.base.Predicate; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.ability.SpellAbilityAi; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; diff --git a/src/main/java/forge/card/ability/ai/CountersAi.java b/src/main/java/forge/card/ability/ai/CountersAi.java index 81a9bfbacb2..7bfec360550 100644 --- a/src/main/java/forge/card/ability/ai/CountersAi.java +++ b/src/main/java/forge/card/ability/ai/CountersAi.java @@ -22,7 +22,6 @@ import java.util.List; import com.google.common.base.Predicate; import forge.Card; - import forge.CardLists; import forge.CounterType; import forge.game.ai.ComputerUtilCard; diff --git a/src/main/java/forge/card/ability/ai/DrawAi.java b/src/main/java/forge/card/ability/ai/DrawAi.java index f39b9f8be7f..896dbc28131 100644 --- a/src/main/java/forge/card/ability/ai/DrawAi.java +++ b/src/main/java/forge/card/ability/ai/DrawAi.java @@ -22,9 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; - import forge.Card; - import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityAi; diff --git a/src/main/java/forge/card/ability/ai/EncodeAi.java b/src/main/java/forge/card/ability/ai/EncodeAi.java index 5dacfe2dd53..9b2ec6e9b8c 100644 --- a/src/main/java/forge/card/ability/ai/EncodeAi.java +++ b/src/main/java/forge/card/ability/ai/EncodeAi.java @@ -17,8 +17,8 @@ */ package forge.card.ability.ai; -import forge.card.spellability.SpellAbility; import forge.card.ability.SpellAbilityAi; +import forge.card.spellability.SpellAbility; import forge.game.player.AIPlayer; /** diff --git a/src/main/java/forge/card/ability/ai/LifeGainAi.java b/src/main/java/forge/card/ability/ai/LifeGainAi.java index 9b9d2006d7c..26b2797a0ca 100644 --- a/src/main/java/forge/card/ability/ai/LifeGainAi.java +++ b/src/main/java/forge/card/ability/ai/LifeGainAi.java @@ -10,8 +10,8 @@ import forge.card.cost.Cost; import forge.card.spellability.AbilitySub; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; -import forge.game.ai.ComputerUtilCombat; import forge.game.ai.ComputerUtil; +import forge.game.ai.ComputerUtilCombat; import forge.game.ai.ComputerUtilCost; import forge.game.ai.ComputerUtilMana; import forge.game.phase.PhaseType; diff --git a/src/main/java/forge/card/ability/ai/ProtectAi.java b/src/main/java/forge/card/ability/ai/ProtectAi.java index 507b60f36e8..dab19716fb8 100644 --- a/src/main/java/forge/card/ability/ai/ProtectAi.java +++ b/src/main/java/forge/card/ability/ai/ProtectAi.java @@ -3,6 +3,7 @@ package forge.card.ability.ai; import java.util.ArrayList; import java.util.Arrays; import java.util.List; + import com.google.common.base.Predicate; import forge.Card; diff --git a/src/main/java/forge/card/ability/ai/PumpAi.java b/src/main/java/forge/card/ability/ai/PumpAi.java index 1c135f4ed41..6de1ef7ed85 100644 --- a/src/main/java/forge/card/ability/ai/PumpAi.java +++ b/src/main/java/forge/card/ability/ai/PumpAi.java @@ -3,12 +3,13 @@ package forge.card.ability.ai; import java.util.ArrayList; import java.util.Arrays; import java.util.List; + import com.google.common.base.Predicate; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityAi; import forge.card.cost.Cost; diff --git a/src/main/java/forge/card/ability/ai/PumpAllAi.java b/src/main/java/forge/card/ability/ai/PumpAllAi.java index f1970c7e343..f9ce99a9e24 100644 --- a/src/main/java/forge/card/ability/ai/PumpAllAi.java +++ b/src/main/java/forge/card/ability/ai/PumpAllAi.java @@ -12,9 +12,9 @@ import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; +import forge.game.ai.ComputerUtil; import forge.game.ai.ComputerUtilCard; import forge.game.ai.ComputerUtilCombat; -import forge.game.ai.ComputerUtil; import forge.game.phase.CombatUtil; import forge.game.phase.PhaseType; import forge.game.player.AIPlayer; diff --git a/src/main/java/forge/card/ability/ai/RegenerateAi.java b/src/main/java/forge/card/ability/ai/RegenerateAi.java index bd246275627..d9c7924f906 100644 --- a/src/main/java/forge/card/ability/ai/RegenerateAi.java +++ b/src/main/java/forge/card/ability/ai/RegenerateAi.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.Singletons; diff --git a/src/main/java/forge/card/ability/ai/RepeatEachAi.java b/src/main/java/forge/card/ability/ai/RepeatEachAi.java index 66184930fa2..04dd1e76c78 100644 --- a/src/main/java/forge/card/ability/ai/RepeatEachAi.java +++ b/src/main/java/forge/card/ability/ai/RepeatEachAi.java @@ -7,8 +7,8 @@ import com.google.common.base.Predicate; import forge.Card; import forge.CardLists; -import forge.CounterType; import forge.CardPredicates.Presets; +import forge.CounterType; import forge.card.ability.SpellAbilityAi; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; diff --git a/src/main/java/forge/card/ability/ai/SacrificeAi.java b/src/main/java/forge/card/ability/ai/SacrificeAi.java index 8f04e0c08c8..cbd554a1bf7 100644 --- a/src/main/java/forge/card/ability/ai/SacrificeAi.java +++ b/src/main/java/forge/card/ability/ai/SacrificeAi.java @@ -1,6 +1,7 @@ package forge.card.ability.ai; import java.util.List; + import forge.Card; import forge.CardLists; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/ability/ai/StoreSVarAi.java b/src/main/java/forge/card/ability/ai/StoreSVarAi.java index 2cee5871435..252345b6d14 100644 --- a/src/main/java/forge/card/ability/ai/StoreSVarAi.java +++ b/src/main/java/forge/card/ability/ai/StoreSVarAi.java @@ -4,8 +4,8 @@ import forge.Card; import forge.Singletons; import forge.card.ability.SpellAbilityAi; import forge.card.spellability.SpellAbility; -import forge.game.ai.ComputerUtilCombat; import forge.game.ai.ComputerUtil; +import forge.game.ai.ComputerUtilCombat; import forge.game.player.AIPlayer; public class StoreSVarAi extends SpellAbilityAi { diff --git a/src/main/java/forge/card/ability/ai/TapAiBase.java b/src/main/java/forge/card/ability/ai/TapAiBase.java index 396a03f36e3..b2b8b493d17 100644 --- a/src/main/java/forge/card/ability/ai/TapAiBase.java +++ b/src/main/java/forge/card/ability/ai/TapAiBase.java @@ -8,8 +8,8 @@ import com.google.common.collect.Iterables; import forge.Card; import forge.CardLists; import forge.CardPredicates; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.ability.SpellAbilityAi; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; diff --git a/src/main/java/forge/card/ability/ai/TapAllAi.java b/src/main/java/forge/card/ability/ai/TapAllAi.java index be2b44ccd75..1bc058cdf26 100644 --- a/src/main/java/forge/card/ability/ai/TapAllAi.java +++ b/src/main/java/forge/card/ability/ai/TapAllAi.java @@ -8,8 +8,8 @@ import com.google.common.collect.Iterables; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.ability.SpellAbilityAi; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; diff --git a/src/main/java/forge/card/ability/ai/UntapAi.java b/src/main/java/forge/card/ability/ai/UntapAi.java index d6a16eaea47..3d30f3dd7be 100644 --- a/src/main/java/forge/card/ability/ai/UntapAi.java +++ b/src/main/java/forge/card/ability/ai/UntapAi.java @@ -5,8 +5,8 @@ import java.util.Random; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityAi; import forge.card.cost.Cost; diff --git a/src/main/java/forge/card/ability/effects/AnimateEffectBase.java b/src/main/java/forge/card/ability/effects/AnimateEffectBase.java index 60077d55439..85aab0ca95a 100644 --- a/src/main/java/forge/card/ability/effects/AnimateEffectBase.java +++ b/src/main/java/forge/card/ability/effects/AnimateEffectBase.java @@ -18,8 +18,8 @@ package forge.card.ability.effects; import java.util.ArrayList; -import forge.Card; +import forge.Card; import forge.card.ability.SpellAbilityEffect; import forge.card.spellability.SpellAbility; import forge.card.staticability.StaticAbility; diff --git a/src/main/java/forge/card/ability/effects/AttachEffect.java b/src/main/java/forge/card/ability/effects/AttachEffect.java index 0373b04112a..e5fadefd493 100644 --- a/src/main/java/forge/card/ability/effects/AttachEffect.java +++ b/src/main/java/forge/card/ability/effects/AttachEffect.java @@ -2,6 +2,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; + import forge.Card; import forge.CardLists; import forge.Command; diff --git a/src/main/java/forge/card/ability/effects/ChangeZoneEffect.java b/src/main/java/forge/card/ability/effects/ChangeZoneEffect.java index 8ac6861aad1..2f219da9e73 100644 --- a/src/main/java/forge/card/ability/effects/ChangeZoneEffect.java +++ b/src/main/java/forge/card/ability/effects/ChangeZoneEffect.java @@ -2,6 +2,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; + import com.google.common.base.Predicates; import forge.Card; diff --git a/src/main/java/forge/card/ability/effects/CharmEffect.java b/src/main/java/forge/card/ability/effects/CharmEffect.java index bddf06f663c..b6fc42d66db 100644 --- a/src/main/java/forge/card/ability/effects/CharmEffect.java +++ b/src/main/java/forge/card/ability/effects/CharmEffect.java @@ -2,6 +2,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; + import forge.Card; import forge.card.ability.AbilityFactory; import forge.card.ability.SpellAbilityEffect; diff --git a/src/main/java/forge/card/ability/effects/ChooseCardEffect.java b/src/main/java/forge/card/ability/effects/ChooseCardEffect.java index 578a6e08c0a..995c802b9bf 100644 --- a/src/main/java/forge/card/ability/effects/ChooseCardEffect.java +++ b/src/main/java/forge/card/ability/effects/ChooseCardEffect.java @@ -5,8 +5,8 @@ import java.util.List; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.CardType; import forge.card.ability.SpellAbilityEffect; import forge.card.cardfactory.CardFactoryUtil; diff --git a/src/main/java/forge/card/ability/effects/ChooseCardNameEffect.java b/src/main/java/forge/card/ability/effects/ChooseCardNameEffect.java index 6c2f15294c8..e82c6d9b737 100644 --- a/src/main/java/forge/card/ability/effects/ChooseCardNameEffect.java +++ b/src/main/java/forge/card/ability/effects/ChooseCardNameEffect.java @@ -12,8 +12,8 @@ import com.google.common.collect.Lists; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.CardRulesPredicates; import forge.card.ability.SpellAbilityEffect; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java b/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java index 171da6c69ae..58d326625cf 100644 --- a/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java +++ b/src/main/java/forge/card/ability/effects/ChooseGenericEffect.java @@ -6,6 +6,7 @@ import java.util.Map; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; + import forge.Card; import forge.card.ability.AbilityFactory; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java b/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java index bdf3b618aae..6b8fb0a4698 100644 --- a/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java +++ b/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Stack; +import com.google.common.base.Predicate; + import forge.Card; import forge.CardLists; import forge.Singletons; @@ -20,8 +22,6 @@ import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; -import com.google.common.base.Predicate; - public class ChooseSourceEffect extends SpellAbilityEffect { @Override protected String getStackDescription(SpellAbility sa) { diff --git a/src/main/java/forge/card/ability/effects/CounterEffect.java b/src/main/java/forge/card/ability/effects/CounterEffect.java index 04706603ce0..b9be2521da6 100644 --- a/src/main/java/forge/card/ability/effects/CounterEffect.java +++ b/src/main/java/forge/card/ability/effects/CounterEffect.java @@ -2,6 +2,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; + import forge.Card; import forge.Singletons; import forge.card.ability.SpellAbilityEffect; diff --git a/src/main/java/forge/card/ability/effects/PlayEffect.java b/src/main/java/forge/card/ability/effects/PlayEffect.java index d9c5f8b3a7d..2d37c52385b 100644 --- a/src/main/java/forge/card/ability/effects/PlayEffect.java +++ b/src/main/java/forge/card/ability/effects/PlayEffect.java @@ -14,8 +14,8 @@ import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityEffect; import forge.card.cost.Cost; -import forge.card.cost.CostPartMana; import forge.card.cost.CostPart; +import forge.card.cost.CostPartMana; import forge.card.mana.ManaCost; import forge.card.spellability.Spell; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/ability/effects/PumpEffect.java b/src/main/java/forge/card/ability/effects/PumpEffect.java index a98e8ec6e52..7691505f010 100644 --- a/src/main/java/forge/card/ability/effects/PumpEffect.java +++ b/src/main/java/forge/card/ability/effects/PumpEffect.java @@ -3,6 +3,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.Arrays; import java.util.List; + import forge.Card; import forge.CardUtil; import forge.Command; diff --git a/src/main/java/forge/card/ability/effects/RepeatEffect.java b/src/main/java/forge/card/ability/effects/RepeatEffect.java index 8b74ba1e22f..ff6c5de7ff9 100644 --- a/src/main/java/forge/card/ability/effects/RepeatEffect.java +++ b/src/main/java/forge/card/ability/effects/RepeatEffect.java @@ -2,6 +2,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; + import forge.Card; import forge.CardLists; import forge.Singletons; diff --git a/src/main/java/forge/card/ability/effects/RevealEffectBase.java b/src/main/java/forge/card/ability/effects/RevealEffectBase.java index da09f279000..cec1460eb55 100644 --- a/src/main/java/forge/card/ability/effects/RevealEffectBase.java +++ b/src/main/java/forge/card/ability/effects/RevealEffectBase.java @@ -20,9 +20,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; - import forge.Card; - import forge.card.ability.SpellAbilityEffect; import forge.game.player.Player; import forge.gui.GuiChoose; diff --git a/src/main/java/forge/card/ability/effects/TokenEffect.java b/src/main/java/forge/card/ability/effects/TokenEffect.java index d4d3dadbd5f..392bd4a3705 100644 --- a/src/main/java/forge/card/ability/effects/TokenEffect.java +++ b/src/main/java/forge/card/ability/effects/TokenEffect.java @@ -19,8 +19,8 @@ package forge.card.ability.effects; import java.util.Arrays; import java.util.List; -import forge.Card; +import forge.Card; import forge.Singletons; import forge.card.ability.AbilityFactory; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/ability/effects/TwoPilesEffect.java b/src/main/java/forge/card/ability/effects/TwoPilesEffect.java index 5c13c8b3d0c..bf5041617c0 100644 --- a/src/main/java/forge/card/ability/effects/TwoPilesEffect.java +++ b/src/main/java/forge/card/ability/effects/TwoPilesEffect.java @@ -2,6 +2,7 @@ package forge.card.ability.effects; import java.util.ArrayList; import java.util.List; + import javax.swing.JOptionPane; import forge.Card; diff --git a/src/main/java/forge/card/ability/effects/UntapEffect.java b/src/main/java/forge/card/ability/effects/UntapEffect.java index a715fffef9e..28999df9502 100644 --- a/src/main/java/forge/card/ability/effects/UntapEffect.java +++ b/src/main/java/forge/card/ability/effects/UntapEffect.java @@ -1,12 +1,13 @@ package forge.card.ability.effects; import java.util.List; + import org.apache.commons.lang3.StringUtils; import forge.Card; import forge.CardLists; -import forge.Singletons; import forge.CardPredicates.Presets; +import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityEffect; import forge.card.cardfactory.CardFactoryUtil; diff --git a/src/main/java/forge/card/cardfactory/CardFactory.java b/src/main/java/forge/card/cardfactory/CardFactory.java index 16caee3b83f..2639a575b82 100644 --- a/src/main/java/forge/card/cardfactory/CardFactory.java +++ b/src/main/java/forge/card/cardfactory/CardFactory.java @@ -17,7 +17,6 @@ */ package forge.card.cardfactory; -import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -31,7 +30,6 @@ import forge.Color; import forge.card.CardRules; import forge.card.CardSplitType; import forge.card.ICardFace; -import forge.card.ability.AbilityFactory; import forge.card.cost.Cost; import forge.card.mana.ManaCost; import forge.card.replacement.ReplacementHandler; @@ -46,7 +44,6 @@ import forge.game.player.Player; import forge.gui.GuiUtils; import forge.item.CardDb; import forge.item.IPaperCard; -import forge.properties.ForgeProps; import forge.properties.NewConstants; /** @@ -79,10 +76,10 @@ public class CardFactory { */ private final CardStorageReader reader; - public CardFactory(final File file) { + public CardFactory() { GuiUtils.checkEDT("CardFactory$constructor", false); - reader = new CardStorageReader(ForgeProps.getFile(NewConstants.CARDSFOLDER), true); + reader = new CardStorageReader(NewConstants.CARD_DATA_DIR.defaultLoc, true); try { // this fills in our map of card names to Card instances. final List listCardRules = reader.loadCards(); diff --git a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java index 2fd9dca9477..ff6ec2fdbde 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java @@ -7,7 +7,6 @@ import javax.swing.JOptionPane; import forge.Card; import forge.Command; - import forge.Singletons; import forge.card.cost.Cost; import forge.card.mana.ManaCost; diff --git a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java index 4950e234fd7..57d50f3f9be 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java @@ -19,6 +19,7 @@ package forge.card.cardfactory; import java.util.ArrayList; import java.util.List; + import javax.swing.JOptionPane; import com.google.common.base.Predicate; @@ -27,7 +28,6 @@ import com.google.common.collect.Iterables; import forge.Card; import forge.CardCharacteristicName; - import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; diff --git a/src/main/java/forge/card/cardfactory/CardFactoryLands.java b/src/main/java/forge/card/cardfactory/CardFactoryLands.java index 26772192c5b..6064b2dcfe3 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryLands.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryLands.java @@ -22,7 +22,6 @@ import java.util.List; import javax.swing.JOptionPane; import forge.Card; - import forge.CardLists; import forge.Command; import forge.Singletons; diff --git a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java index 25ce2580b0f..6638d5cea4b 100644 --- a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java +++ b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java @@ -42,8 +42,8 @@ import forge.card.cost.Cost; import forge.card.spellability.Spell; import forge.card.spellability.SpellAbility; import forge.control.input.Input; -import forge.control.input.InputPayManaSimple; import forge.control.input.InputPayManaExecuteCommands; +import forge.control.input.InputPayManaSimple; import forge.game.GameState; import forge.game.ai.ComputerUtil; import forge.game.player.Player; diff --git a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java index a30d9dcd13d..479cb118c7b 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java @@ -31,7 +31,6 @@ import com.google.common.collect.Lists; import forge.Card; import forge.CardCharacteristicName; - import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; @@ -46,9 +45,9 @@ import forge.card.ability.AbilityFactory; import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; import forge.card.cost.Cost; +import forge.card.mana.ManaCost; import forge.card.mana.ManaCostParser; import forge.card.mana.ManaCostShard; -import forge.card.mana.ManaCost; import forge.card.replacement.ReplacementEffect; import forge.card.replacement.ReplacementHandler; import forge.card.replacement.ReplacementLayer; @@ -81,7 +80,6 @@ import forge.game.zone.ZoneType; import forge.gui.GuiChoose; import forge.gui.match.CMatchUI; import forge.util.Aggregates; - import forge.view.ButtonUtil; /** diff --git a/src/main/java/forge/card/cardfactory/CardStorageReader.java b/src/main/java/forge/card/cardfactory/CardStorageReader.java index 3651f78a1c7..deffb368137 100644 --- a/src/main/java/forge/card/cardfactory/CardStorageReader.java +++ b/src/main/java/forge/card/cardfactory/CardStorageReader.java @@ -82,10 +82,12 @@ public class CardStorageReader { * if true, attempts to load cards from a zip file, if one * exists. */ - public CardStorageReader(final File theCardsFolder, final boolean useZip) { + public CardStorageReader(String cardDataDir, final boolean useZip) { // These read data for lightweight classes. this.rulesReader = new CardRulesReader(); + + File theCardsFolder = new File(cardDataDir); if (!theCardsFolder.exists()) { throw new RuntimeException("CardReader : constructor error -- file not found -- filename is " diff --git a/src/main/java/forge/card/cost/Cost.java b/src/main/java/forge/card/cost/Cost.java index 70176025dc7..f88f42e08b3 100644 --- a/src/main/java/forge/card/cost/Cost.java +++ b/src/main/java/forge/card/cost/Cost.java @@ -24,9 +24,9 @@ import java.util.regex.Pattern; import forge.Card; import forge.CounterType; import forge.Singletons; +import forge.card.mana.ManaCost; import forge.card.mana.ManaCostBeingPaid; import forge.card.mana.ManaCostParser; -import forge.card.mana.ManaCost; import forge.card.spellability.SpellAbility; import forge.game.zone.ZoneType; import forge.util.TextUtil; diff --git a/src/main/java/forge/card/cost/CostDiscard.java b/src/main/java/forge/card/cost/CostDiscard.java index a07e283391e..be6e4c495d2 100644 --- a/src/main/java/forge/card/cost/CostDiscard.java +++ b/src/main/java/forge/card/cost/CostDiscard.java @@ -23,10 +23,9 @@ import java.util.List; import com.google.common.base.Predicate; import forge.Card; +import forge.CardLists; import forge.CardPredicates; import forge.Singletons; - -import forge.CardLists; import forge.card.ability.AbilityUtils; import forge.card.spellability.SpellAbility; import forge.control.input.Input; diff --git a/src/main/java/forge/card/cost/CostExile.java b/src/main/java/forge/card/cost/CostExile.java index db2ec4875d9..88c39c9a7f0 100644 --- a/src/main/java/forge/card/cost/CostExile.java +++ b/src/main/java/forge/card/cost/CostExile.java @@ -22,7 +22,6 @@ import java.util.Iterator; import java.util.List; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.Singletons; diff --git a/src/main/java/forge/card/cost/CostMill.java b/src/main/java/forge/card/cost/CostMill.java index 35693ca5483..65919ae541c 100644 --- a/src/main/java/forge/card/cost/CostMill.java +++ b/src/main/java/forge/card/cost/CostMill.java @@ -22,7 +22,6 @@ import java.util.Iterator; import java.util.List; import forge.Card; - import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/cost/CostPartWithList.java b/src/main/java/forge/card/cost/CostPartWithList.java index 627770f09a6..6eca887197f 100644 --- a/src/main/java/forge/card/cost/CostPartWithList.java +++ b/src/main/java/forge/card/cost/CostPartWithList.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import forge.Card; - import forge.CardUtil; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/cost/CostPutCounter.java b/src/main/java/forge/card/cost/CostPutCounter.java index 84a6ae0fa21..6cd3ab9bda7 100644 --- a/src/main/java/forge/card/cost/CostPutCounter.java +++ b/src/main/java/forge/card/cost/CostPutCounter.java @@ -20,7 +20,6 @@ package forge.card.cost; import java.util.List; import forge.Card; - import forge.CardLists; import forge.CounterType; import forge.Singletons; diff --git a/src/main/java/forge/card/cost/CostRemoveCounter.java b/src/main/java/forge/card/cost/CostRemoveCounter.java index d0069a5eb43..66a619eef68 100644 --- a/src/main/java/forge/card/cost/CostRemoveCounter.java +++ b/src/main/java/forge/card/cost/CostRemoveCounter.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import forge.Card; - import forge.CardLists; import forge.CounterType; import forge.Singletons; diff --git a/src/main/java/forge/card/cost/CostReturn.java b/src/main/java/forge/card/cost/CostReturn.java index 18baa33084e..6db2dacf98f 100644 --- a/src/main/java/forge/card/cost/CostReturn.java +++ b/src/main/java/forge/card/cost/CostReturn.java @@ -23,7 +23,6 @@ import java.util.List; import javax.swing.JOptionPane; import forge.Card; - import forge.CardLists; import forge.Singletons; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/cost/CostReveal.java b/src/main/java/forge/card/cost/CostReveal.java index 0714f8356a0..45c01505105 100644 --- a/src/main/java/forge/card/cost/CostReveal.java +++ b/src/main/java/forge/card/cost/CostReveal.java @@ -21,9 +21,8 @@ import java.util.ArrayList; import java.util.List; import forge.Card; -import forge.Singletons; - import forge.CardLists; +import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.spellability.SpellAbility; import forge.control.input.Input; diff --git a/src/main/java/forge/card/cost/CostSacrifice.java b/src/main/java/forge/card/cost/CostSacrifice.java index 1cf0433ba17..13ad15a9960 100644 --- a/src/main/java/forge/card/cost/CostSacrifice.java +++ b/src/main/java/forge/card/cost/CostSacrifice.java @@ -23,7 +23,6 @@ import java.util.List; import javax.swing.JOptionPane; import forge.Card; - import forge.CardLists; import forge.Singletons; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/cost/CostTapType.java b/src/main/java/forge/card/cost/CostTapType.java index f535e172359..c08f2660054 100644 --- a/src/main/java/forge/card/cost/CostTapType.java +++ b/src/main/java/forge/card/cost/CostTapType.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import forge.Card; - import forge.CardLists; import forge.CardPredicates.Presets; import forge.Singletons; diff --git a/src/main/java/forge/card/cost/CostUntapType.java b/src/main/java/forge/card/cost/CostUntapType.java index 75ae457428e..57bffb896f0 100644 --- a/src/main/java/forge/card/cost/CostUntapType.java +++ b/src/main/java/forge/card/cost/CostUntapType.java @@ -20,7 +20,6 @@ package forge.card.cost; import java.util.List; import forge.Card; - import forge.CardLists; import forge.CardPredicates.Presets; import forge.Singletons; diff --git a/src/main/java/forge/card/mana/ManaCostBeingPaid.java b/src/main/java/forge/card/mana/ManaCostBeingPaid.java index 7f182318e70..9cb5a7ef730 100644 --- a/src/main/java/forge/card/mana/ManaCostBeingPaid.java +++ b/src/main/java/forge/card/mana/ManaCostBeingPaid.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; + import forge.Constant; import forge.card.MagicColor; diff --git a/src/main/java/forge/card/mana/ManaCostShard.java b/src/main/java/forge/card/mana/ManaCostShard.java index 789e44a11c9..acccd8915d4 100644 --- a/src/main/java/forge/card/mana/ManaCostShard.java +++ b/src/main/java/forge/card/mana/ManaCostShard.java @@ -17,8 +17,8 @@ */ package forge.card.mana; -import forge.card.MagicColor; import forge.card.ColorSet; +import forge.card.MagicColor; import forge.util.BinaryUtil; /** diff --git a/src/main/java/forge/card/spellability/AbilityActivated.java b/src/main/java/forge/card/spellability/AbilityActivated.java index fa510cfe81a..c3ef6e83912 100644 --- a/src/main/java/forge/card/spellability/AbilityActivated.java +++ b/src/main/java/forge/card/spellability/AbilityActivated.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import forge.Card; import forge.Singletons; - import forge.card.cost.Cost; import forge.card.cost.CostPayment; import forge.card.staticability.StaticAbility; diff --git a/src/main/java/forge/card/spellability/Spell.java b/src/main/java/forge/card/spellability/Spell.java index ce93eaa6430..2a4fbc7a990 100644 --- a/src/main/java/forge/card/spellability/Spell.java +++ b/src/main/java/forge/card/spellability/Spell.java @@ -21,9 +21,8 @@ import java.util.ArrayList; import java.util.List; import forge.Card; -import forge.Singletons; - import forge.CardLists; +import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.Cost; import forge.card.cost.CostPayment; diff --git a/src/main/java/forge/card/spellability/SpellAbilityCondition.java b/src/main/java/forge/card/spellability/SpellAbilityCondition.java index f176565fd2b..13b7e8e7469 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityCondition.java +++ b/src/main/java/forge/card/spellability/SpellAbilityCondition.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import forge.Card; - import forge.CardLists; import forge.Singletons; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java index ff6e8f092e4..7c0e7b742db 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java +++ b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import forge.Card; - import forge.CardLists; import forge.Singletons; import forge.card.ability.AbilityUtils; diff --git a/src/main/java/forge/card/spellability/SpellAbilityStackInstance.java b/src/main/java/forge/card/spellability/SpellAbilityStackInstance.java index e57b7a2be4c..c5afabcd99d 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityStackInstance.java +++ b/src/main/java/forge/card/spellability/SpellAbilityStackInstance.java @@ -21,7 +21,6 @@ import java.util.HashMap; import java.util.List; import forge.Card; - import forge.game.player.Player; /** diff --git a/src/main/java/forge/card/spellability/SpellPermanent.java b/src/main/java/forge/card/spellability/SpellPermanent.java index ed875842c93..4cb19cc6fc1 100644 --- a/src/main/java/forge/card/spellability/SpellPermanent.java +++ b/src/main/java/forge/card/spellability/SpellPermanent.java @@ -25,7 +25,6 @@ import com.google.common.base.Supplier; import com.google.common.collect.Iterables; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.Command; diff --git a/src/main/java/forge/card/spellability/TargetSelection.java b/src/main/java/forge/card/spellability/TargetSelection.java index d3f228f6084..03286649df0 100644 --- a/src/main/java/forge/card/spellability/TargetSelection.java +++ b/src/main/java/forge/card/spellability/TargetSelection.java @@ -24,9 +24,8 @@ import java.util.List; import com.google.common.base.Predicate; import forge.Card; -import forge.Singletons; - import forge.CardLists; +import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; import forge.control.input.Input; @@ -34,7 +33,6 @@ import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; import forge.gui.match.CMatchUI; - import forge.view.ButtonUtil; /** diff --git a/src/main/java/forge/card/staticability/StaticAbilityContinuous.java b/src/main/java/forge/card/staticability/StaticAbilityContinuous.java index 7b689b093c9..8d73256efee 100644 --- a/src/main/java/forge/card/staticability/StaticAbilityContinuous.java +++ b/src/main/java/forge/card/staticability/StaticAbilityContinuous.java @@ -23,10 +23,9 @@ import java.util.HashMap; import java.util.List; import forge.Card; -import forge.Singletons; - import forge.CardLists; import forge.CardUtil; +import forge.Singletons; import forge.StaticEffect; import forge.StaticEffects; import forge.card.CardType; diff --git a/src/main/java/forge/card/trigger/Trigger.java b/src/main/java/forge/card/trigger/Trigger.java index 354b35c2ab8..7b2c9b77a28 100644 --- a/src/main/java/forge/card/trigger/Trigger.java +++ b/src/main/java/forge/card/trigger/Trigger.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import forge.Card; - import forge.CardLists; import forge.CardUtil; import forge.Singletons; diff --git a/src/main/java/forge/card/trigger/TriggerAttackerBlocked.java b/src/main/java/forge/card/trigger/TriggerAttackerBlocked.java index 25d4b1abd2b..60e79e184aa 100644 --- a/src/main/java/forge/card/trigger/TriggerAttackerBlocked.java +++ b/src/main/java/forge/card/trigger/TriggerAttackerBlocked.java @@ -19,7 +19,6 @@ package forge.card.trigger; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerAttackerUnblocked.java b/src/main/java/forge/card/trigger/TriggerAttackerUnblocked.java index 571c6720651..ad653f08c9e 100644 --- a/src/main/java/forge/card/trigger/TriggerAttackerUnblocked.java +++ b/src/main/java/forge/card/trigger/TriggerAttackerUnblocked.java @@ -19,7 +19,6 @@ package forge.card.trigger; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerAttackersDeclared.java b/src/main/java/forge/card/trigger/TriggerAttackersDeclared.java index a5743bf5f92..afe631451cb 100644 --- a/src/main/java/forge/card/trigger/TriggerAttackersDeclared.java +++ b/src/main/java/forge/card/trigger/TriggerAttackersDeclared.java @@ -20,9 +20,7 @@ package forge.card.trigger; import java.util.List; import java.util.Map; - import forge.Card; - import forge.card.spellability.SpellAbility; /** diff --git a/src/main/java/forge/card/trigger/TriggerAttacks.java b/src/main/java/forge/card/trigger/TriggerAttacks.java index 60720158994..ab31df48034 100644 --- a/src/main/java/forge/card/trigger/TriggerAttacks.java +++ b/src/main/java/forge/card/trigger/TriggerAttacks.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Map; import forge.Card; - import forge.GameEntity; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerBecomesTarget.java b/src/main/java/forge/card/trigger/TriggerBecomesTarget.java index ff27e30faf1..8bc5096a1c2 100644 --- a/src/main/java/forge/card/trigger/TriggerBecomesTarget.java +++ b/src/main/java/forge/card/trigger/TriggerBecomesTarget.java @@ -19,7 +19,6 @@ package forge.card.trigger; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerBlocks.java b/src/main/java/forge/card/trigger/TriggerBlocks.java index 6adea6c4e1c..08c3b2dda94 100644 --- a/src/main/java/forge/card/trigger/TriggerBlocks.java +++ b/src/main/java/forge/card/trigger/TriggerBlocks.java @@ -19,7 +19,6 @@ package forge.card.trigger; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerClashed.java b/src/main/java/forge/card/trigger/TriggerClashed.java index e229f2a8522..941911ada39 100644 --- a/src/main/java/forge/card/trigger/TriggerClashed.java +++ b/src/main/java/forge/card/trigger/TriggerClashed.java @@ -19,7 +19,6 @@ package forge.card.trigger; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerHandler.java b/src/main/java/forge/card/trigger/TriggerHandler.java index fc292499db2..934b887e8e9 100644 --- a/src/main/java/forge/card/trigger/TriggerHandler.java +++ b/src/main/java/forge/card/trigger/TriggerHandler.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import forge.Card; - import forge.CardLists; import forge.Singletons; import forge.card.ability.AbilityFactory; @@ -40,9 +39,9 @@ import forge.game.GlobalRuleChange; import forge.game.ai.ComputerUtil; import forge.game.phase.PhaseType; import forge.game.player.AIPlayer; -//import forge.util.TextUtil; import forge.game.player.Player; import forge.game.zone.ZoneType; +//import forge.util.TextUtil; /** *

diff --git a/src/main/java/forge/card/trigger/TriggerLandPlayed.java b/src/main/java/forge/card/trigger/TriggerLandPlayed.java index c96cf976dc4..9a040810282 100644 --- a/src/main/java/forge/card/trigger/TriggerLandPlayed.java +++ b/src/main/java/forge/card/trigger/TriggerLandPlayed.java @@ -19,7 +19,6 @@ package forge.card.trigger; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java b/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java index eb67ab7087e..4ff63ed8b13 100644 --- a/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java +++ b/src/main/java/forge/card/trigger/TriggerSpellAbilityCast.java @@ -17,9 +17,8 @@ */ package forge.card.trigger; -import forge.Singletons; - import forge.Card; +import forge.Singletons; import forge.card.cost.Cost; import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbilityStackInstance; diff --git a/src/main/java/forge/control/FControl.java b/src/main/java/forge/control/FControl.java index 583f7d6e2f2..8b253932c66 100644 --- a/src/main/java/forge/control/FControl.java +++ b/src/main/java/forge/control/FControl.java @@ -46,7 +46,6 @@ import forge.gui.match.VMatchUI; import forge.gui.match.controllers.CDock; import forge.gui.toolbox.CardFaceSymbols; import forge.gui.toolbox.FSkin; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.data.QuestPreferences.QPref; import forge.quest.io.QuestDataIO; @@ -152,12 +151,11 @@ public enum FControl { // Does not use progress bar, due to be deprecated with battlefield refactoring. CardFaceSymbols.loadImages(); - this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts(); this.display = FView.SINGLETON_INSTANCE.getLpnDocument(); // Preload quest data if present - final File dirQuests = ForgeProps.getFile(NewConstants.Quest.DATA_DIR); + final File dirQuests = new File(NewConstants.QUEST_SAVE_DIR); final String questname = Singletons.getModel().getQuestPreferences().getPreference(QPref.CURRENT_QUEST); final File data = new File(dirQuests.getPath(), questname); if (data.exists()) { diff --git a/src/main/java/forge/control/input/InputAttack.java b/src/main/java/forge/control/input/InputAttack.java index ebc322595ea..74f47b2acd6 100644 --- a/src/main/java/forge/control/input/InputAttack.java +++ b/src/main/java/forge/control/input/InputAttack.java @@ -22,7 +22,6 @@ import java.util.List; import com.google.common.collect.Iterables; import forge.Card; - import forge.CardPredicates; import forge.Singletons; import forge.game.phase.CombatUtil; diff --git a/src/main/java/forge/control/input/InputBlock.java b/src/main/java/forge/control/input/InputBlock.java index 108013f8e63..b370740db37 100644 --- a/src/main/java/forge/control/input/InputBlock.java +++ b/src/main/java/forge/control/input/InputBlock.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.List; import forge.Card; - import forge.Singletons; import forge.control.FControl; import forge.game.GameState; diff --git a/src/main/java/forge/control/input/InputPayManaSimple.java b/src/main/java/forge/control/input/InputPayManaSimple.java index ddab1edd224..0b2bc6f3f7d 100644 --- a/src/main/java/forge/control/input/InputPayManaSimple.java +++ b/src/main/java/forge/control/input/InputPayManaSimple.java @@ -19,7 +19,6 @@ package forge.control.input; import forge.Card; import forge.Singletons; -//import forge.Singletons; import forge.card.mana.ManaCostBeingPaid; import forge.card.spellability.SpellAbility; import forge.game.GameState; @@ -27,6 +26,7 @@ import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.match.CMatchUI; import forge.view.ButtonUtil; +//import forge.Singletons; //pays the cost of a card played from the player's hand //the card is removed from the players hand if the cost is paid diff --git a/src/main/java/forge/control/input/InputPayManaX.java b/src/main/java/forge/control/input/InputPayManaX.java index 50a0029fbc1..9edb2ec4090 100644 --- a/src/main/java/forge/control/input/InputPayManaX.java +++ b/src/main/java/forge/control/input/InputPayManaX.java @@ -6,10 +6,10 @@ import forge.card.cost.CostPartMana; import forge.card.cost.CostPayment; import forge.card.mana.ManaCostBeingPaid; import forge.card.spellability.SpellAbility; +import forge.game.GameState; import forge.game.zone.ZoneType; import forge.gui.match.CMatchUI; import forge.view.ButtonUtil; -import forge.game.GameState; public class InputPayManaX extends InputPayManaBase { private static final long serialVersionUID = -6900234444347364050L; diff --git a/src/main/java/forge/control/input/InputPayReturnCost.java b/src/main/java/forge/control/input/InputPayReturnCost.java index 9764a89eccf..7793f08336e 100644 --- a/src/main/java/forge/control/input/InputPayReturnCost.java +++ b/src/main/java/forge/control/input/InputPayReturnCost.java @@ -20,7 +20,6 @@ package forge.control.input; import java.util.List; import forge.Card; - import forge.CardLists; import forge.Command; import forge.Singletons; diff --git a/src/main/java/forge/control/input/InputPaySacCost.java b/src/main/java/forge/control/input/InputPaySacCost.java index 2a6100fc79c..8141755d7ae 100644 --- a/src/main/java/forge/control/input/InputPaySacCost.java +++ b/src/main/java/forge/control/input/InputPaySacCost.java @@ -20,7 +20,6 @@ package forge.control.input; import java.util.List; import forge.Card; - import forge.CardLists; import forge.Command; import forge.Singletons; diff --git a/src/main/java/forge/deck/CardCollections.java b/src/main/java/forge/deck/CardCollections.java index 556a291c4e6..76ac32334e3 100644 --- a/src/main/java/forge/deck/CardCollections.java +++ b/src/main/java/forge/deck/CardCollections.java @@ -22,6 +22,7 @@ import java.io.File; import forge.deck.io.DeckGroupSerializer; import forge.deck.io.DeckSerializer; import forge.deck.io.OldDeckParser; +import forge.properties.NewConstants; import forge.util.storage.IStorage; import forge.util.storage.StorageImmediatelySerialized; @@ -42,18 +43,18 @@ public class CardCollections { * * @param file the file */ - public CardCollections(final File file) { - this.constructed = new StorageImmediatelySerialized(new DeckSerializer(new File(file, "constructed"), true)); - this.draft = new StorageImmediatelySerialized(new DeckGroupSerializer(new File(file, "draft"))); - this.sealed = new StorageImmediatelySerialized(new DeckGroupSerializer(new File(file, "sealed"))); - this.cube = new StorageImmediatelySerialized(new DeckSerializer(new File(file, "cube"))); - this.scheme = new StorageImmediatelySerialized(new DeckSerializer(new File(file, "scheme"))); - this.plane = new StorageImmediatelySerialized(new DeckSerializer(new File(file, "plane"))); + public CardCollections() { + this.constructed = new StorageImmediatelySerialized(new DeckSerializer(new File(NewConstants.DECK_CONSTRUCTED_DIR), true)); + this.draft = new StorageImmediatelySerialized(new DeckGroupSerializer(new File(NewConstants.DECK_DRAFT_DIR))); + this.sealed = new StorageImmediatelySerialized(new DeckGroupSerializer(new File(NewConstants.DECK_SEALED_DIR))); + this.cube = new StorageImmediatelySerialized(new DeckSerializer(new File(NewConstants.DECK_CUBE_DIR.defaultLoc))); + this.scheme = new StorageImmediatelySerialized(new DeckSerializer(new File(NewConstants.DECK_SCHEME_DIR))); + this.plane = new StorageImmediatelySerialized(new DeckSerializer(new File(NewConstants.DECK_PLANE_DIR))); System.out.printf("Read decks: %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar.%n", constructed.getCount(), sealed.getCount(), draft.getCount(), cube.getCount(), scheme.getCount(), plane.getCount()); // remove this after most people have been switched to new layout - final OldDeckParser oldParser = new OldDeckParser(file, this.constructed, this.draft, this.sealed, this.cube); + final OldDeckParser oldParser = new OldDeckParser(this.constructed, this.draft, this.sealed, this.cube); oldParser.tryParse(); } diff --git a/src/main/java/forge/deck/CardPool.java b/src/main/java/forge/deck/CardPool.java index 1c307ef6cb2..b66d50372e6 100644 --- a/src/main/java/forge/deck/CardPool.java +++ b/src/main/java/forge/deck/CardPool.java @@ -22,7 +22,6 @@ import java.util.Map.Entry; import java.util.NoSuchElementException; import forge.Card; - import forge.item.CardDb; import forge.item.CardPrinted; import forge.item.ItemPool; diff --git a/src/main/java/forge/deck/Deck.java b/src/main/java/forge/deck/Deck.java index cf0a3518e6d..7e0746ac57d 100644 --- a/src/main/java/forge/deck/Deck.java +++ b/src/main/java/forge/deck/Deck.java @@ -30,7 +30,6 @@ import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.apache.commons.lang3.StringUtils; import com.google.common.base.Function; diff --git a/src/main/java/forge/deck/DeckgenUtil.java b/src/main/java/forge/deck/DeckgenUtil.java index 95a5adfe313..30ee91d5028 100644 --- a/src/main/java/forge/deck/DeckgenUtil.java +++ b/src/main/java/forge/deck/DeckgenUtil.java @@ -9,6 +9,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; + import javax.swing.JList; import javax.swing.JOptionPane; diff --git a/src/main/java/forge/deck/generate/Generate2ColorDeck.java b/src/main/java/forge/deck/generate/Generate2ColorDeck.java index 448c563f2e2..b70dcae7386 100644 --- a/src/main/java/forge/deck/generate/Generate2ColorDeck.java +++ b/src/main/java/forge/deck/generate/Generate2ColorDeck.java @@ -20,14 +20,12 @@ package forge.deck.generate; import java.util.Arrays; import java.util.List; -import forge.card.MagicColor; import forge.card.ColorSet; +import forge.card.MagicColor; import forge.deck.generate.GenerateDeckUtil.FilterCMC; -import forge.error.BugReporter; import forge.game.player.PlayerType; import forge.item.CardPrinted; import forge.item.ItemPoolView; -import forge.properties.ForgeProps; /** *

@@ -101,9 +99,6 @@ public class Generate2ColorDeck extends GenerateColoredDeckBase { adjustDeckSize(size); tmpDeck.append("DeckSize:").append(tDeck.countAll()).append("\n"); - if (ForgeProps.getProperty("showdeck/2color", "false").equals("true")) { - BugReporter.reportBug(tmpDeck.toString()); - } return tDeck; } diff --git a/src/main/java/forge/deck/generate/Generate3ColorDeck.java b/src/main/java/forge/deck/generate/Generate3ColorDeck.java index 0e944c6a02c..a46684b9afa 100644 --- a/src/main/java/forge/deck/generate/Generate3ColorDeck.java +++ b/src/main/java/forge/deck/generate/Generate3ColorDeck.java @@ -20,14 +20,12 @@ package forge.deck.generate; import java.util.Arrays; import java.util.List; -import forge.card.MagicColor; import forge.card.ColorSet; +import forge.card.MagicColor; import forge.deck.generate.GenerateDeckUtil.FilterCMC; -import forge.error.BugReporter; import forge.game.player.PlayerType; import forge.item.CardPrinted; import forge.item.ItemPoolView; -import forge.properties.ForgeProps; /** *

@@ -99,9 +97,6 @@ public class Generate3ColorDeck extends GenerateColoredDeckBase { adjustDeckSize(size); tmpDeck.append("DeckSize:").append(tDeck.countAll()).append("\n"); - if (ForgeProps.getProperty("showdeck/3color", "false").equals("true")) { - BugReporter.reportBug(tmpDeck.toString()); - } return tDeck; } diff --git a/src/main/java/forge/deck/generate/Generate5ColorDeck.java b/src/main/java/forge/deck/generate/Generate5ColorDeck.java index 4e3865ab9a9..522340213fe 100644 --- a/src/main/java/forge/deck/generate/Generate5ColorDeck.java +++ b/src/main/java/forge/deck/generate/Generate5ColorDeck.java @@ -19,13 +19,12 @@ package forge.deck.generate; import java.util.Arrays; import java.util.List; + import forge.card.ColorSet; import forge.deck.generate.GenerateDeckUtil.FilterCMC; -import forge.error.BugReporter; import forge.game.player.PlayerType; import forge.item.CardPrinted; import forge.item.ItemPoolView; -import forge.properties.ForgeProps; /** *

@@ -88,9 +87,6 @@ public class Generate5ColorDeck extends GenerateColoredDeckBase { adjustDeckSize(size); tmpDeck.append("DeckSize:").append(tDeck.countAll()).append("\n"); - if (ForgeProps.getProperty("showdeck/5color", "false").equals("true")) { - BugReporter.reportBug(tmpDeck.toString()); - } return tDeck; } diff --git a/src/main/java/forge/deck/generate/GenerateColoredDeckBase.java b/src/main/java/forge/deck/generate/GenerateColoredDeckBase.java index 1743021a11c..db6c7afb024 100644 --- a/src/main/java/forge/deck/generate/GenerateColoredDeckBase.java +++ b/src/main/java/forge/deck/generate/GenerateColoredDeckBase.java @@ -28,12 +28,13 @@ import java.util.TreeMap; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; + import forge.Constant; import forge.Singletons; -import forge.card.MagicColor; -import forge.card.ColorSet; -import forge.card.CardRulesPredicates; import forge.card.CardRules; +import forge.card.CardRulesPredicates; +import forge.card.ColorSet; +import forge.card.MagicColor; import forge.deck.generate.GenerateDeckUtil.FilterCMC; import forge.game.player.PlayerType; import forge.item.CardDb; @@ -66,19 +67,6 @@ public abstract class GenerateColoredDeckBase { StringBuilder tmpDeck = new StringBuilder(); -// protected final float landsPercentage = 0.42f; -// protected float creatPercentage = 0.34f; -// protected float spellPercentage = 0.24f; - /** - *

- * Constructor for Generate2ColorDeck. - *

- * - * @param clr1 - * a {@link java.lang.String} object. - * @param clr2 - * a {@link java.lang.String} object. - */ public GenerateColoredDeckBase() { this.maxDuplicates = Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS) ? 1 : 4; tDeck = new ItemPool(CardPrinted.class); diff --git a/src/main/java/forge/deck/generate/GenerateDeckUtil.java b/src/main/java/forge/deck/generate/GenerateDeckUtil.java index 797e6a9f741..92df4b962dc 100644 --- a/src/main/java/forge/deck/generate/GenerateDeckUtil.java +++ b/src/main/java/forge/deck/generate/GenerateDeckUtil.java @@ -25,9 +25,9 @@ import java.util.Map.Entry; import com.google.common.base.Predicate; -import forge.card.MagicColor; -import forge.card.ColorSet; import forge.card.CardRules; +import forge.card.ColorSet; +import forge.card.MagicColor; import forge.card.mana.ManaCost; /** diff --git a/src/main/java/forge/deck/io/OldDeckParser.java b/src/main/java/forge/deck/io/OldDeckParser.java index 2958123c5f4..22ae1349e17 100644 --- a/src/main/java/forge/deck/io/OldDeckParser.java +++ b/src/main/java/forge/deck/io/OldDeckParser.java @@ -60,9 +60,9 @@ public class OldDeckParser { * @param sealed2 the sealed2 * @param cube2 the cube2 */ - public OldDeckParser(final File file, final IStorage constructed2, final IStorage draft2, + public OldDeckParser(final IStorage constructed2, final IStorage draft2, final IStorage sealed2, final IStorage cube2) { - this.deckDir = file; + this.deckDir = new File("res/decks"); this.sealed = sealed2; this.constructed = constructed2; this.cube = cube2; diff --git a/src/main/java/forge/error/BugReporter.java b/src/main/java/forge/error/BugReporter.java index 5a3c91908b3..f9fbd39adbf 100644 --- a/src/main/java/forge/error/BugReporter.java +++ b/src/main/java/forge/error/BugReporter.java @@ -54,8 +54,6 @@ import forge.gui.WrapLayout; import forge.gui.toolbox.FHyperlink; import forge.gui.toolbox.FLabel; import forge.model.BuildInfo; -import forge.properties.ForgeProps; -import forge.properties.NewConstants; /** * The class ErrorViewer. Enables showing and saving error messages that @@ -300,7 +298,7 @@ public class BugReporter { bw.close(); } catch (final IOException ex) { JOptionPane.showMessageDialog(area.getTopLevelAncestor(), - ForgeProps.getLocalized(NewConstants.Lang.ErrorViewer.ERRORS.SAVE_MESSAGE), + "There was an error during saving. Sorry!\n" + ex, "Error saving file", JOptionPane.ERROR_MESSAGE); } } diff --git a/src/main/java/forge/game/GameAction.java b/src/main/java/forge/game/GameAction.java index ee587c43a60..134f1748904 100644 --- a/src/main/java/forge/game/GameAction.java +++ b/src/main/java/forge/game/GameAction.java @@ -22,9 +22,11 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; + import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; + import forge.Card; import forge.CardCharacteristicName; import forge.CardLists; diff --git a/src/main/java/forge/game/GameActionPlay.java b/src/main/java/forge/game/GameActionPlay.java index 49e78212e9d..d8e72cb8f23 100644 --- a/src/main/java/forge/game/GameActionPlay.java +++ b/src/main/java/forge/game/GameActionPlay.java @@ -17,9 +17,9 @@ import forge.card.ability.ApiType; import forge.card.ability.effects.CharmEffect; import forge.card.cost.Cost; import forge.card.cost.CostPayment; +import forge.card.mana.ManaCost; import forge.card.mana.ManaCostBeingPaid; import forge.card.mana.ManaCostShard; -import forge.card.mana.ManaCost; import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellAbilityRequirements; import forge.card.spellability.Target; diff --git a/src/main/java/forge/game/GameActionUtil.java b/src/main/java/forge/game/GameActionUtil.java index 081ef2666ad..09142f57491 100644 --- a/src/main/java/forge/game/GameActionUtil.java +++ b/src/main/java/forge/game/GameActionUtil.java @@ -29,12 +29,12 @@ import com.google.common.collect.Lists; import forge.Card; import forge.CardLists; import forge.CardPredicates; +import forge.CardPredicates.Presets; import forge.CardUtil; import forge.Command; import forge.Constant; import forge.CounterType; import forge.Singletons; -import forge.CardPredicates.Presets; import forge.card.ability.AbilityFactory; import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; @@ -44,8 +44,8 @@ import forge.card.cost.CostDamage; import forge.card.cost.CostDiscard; import forge.card.cost.CostExile; import forge.card.cost.CostPart; -import forge.card.cost.CostPayLife; import forge.card.cost.CostPartMana; +import forge.card.cost.CostPayLife; import forge.card.cost.CostPutCounter; import forge.card.cost.CostRemoveCounter; import forge.card.cost.CostReturn; diff --git a/src/main/java/forge/game/GameNew.java b/src/main/java/forge/game/GameNew.java index e80a1fa73c2..eb765f0b3e9 100644 --- a/src/main/java/forge/game/GameNew.java +++ b/src/main/java/forge/game/GameNew.java @@ -26,8 +26,8 @@ import forge.card.trigger.TriggerType; import forge.control.input.Input; import forge.control.input.InputControl; import forge.control.input.InputMulligan; -import forge.deck.Deck; import forge.deck.CardPool; +import forge.deck.Deck; import forge.deck.DeckSection; import forge.error.BugReporter; import forge.game.event.FlipCoinEvent; diff --git a/src/main/java/forge/game/MatchController.java b/src/main/java/forge/game/MatchController.java index 4f0e9455979..1bb9120c175 100644 --- a/src/main/java/forge/game/MatchController.java +++ b/src/main/java/forge/game/MatchController.java @@ -7,8 +7,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import forge.Singletons; import forge.Constant.Preferences; +import forge.Singletons; import forge.control.FControl; import forge.control.input.InputControl; import forge.deck.Deck; @@ -32,8 +32,6 @@ import forge.gui.match.controllers.CStack; import forge.gui.match.nonsingleton.VField; import forge.gui.match.views.VAntes; import forge.properties.ForgePreferences.FPref; -import forge.properties.ForgeProps; -import forge.properties.NewConstants.Lang.GuiWinLose.WinLoseText; import forge.util.Aggregates; /** @@ -96,7 +94,7 @@ public class MatchController { // add result entries to the game log LobbyPlayer human = Singletons.getControl().getPlayer().getLobbyPlayer(); - String title = ForgeProps.getLocalized(result.isWinner(human) ? WinLoseText.WIN : WinLoseText.LOSE); + String title = result.isWinner(human) ? "You Win" : "You Lost"; game.getGameLog().add("Final", title, 0); List outcomes = new ArrayList(); @@ -109,8 +107,7 @@ public class MatchController { int humanWins = getGamesWonBy(human); int humanLosses = getPlayedGames().size() - humanWins; - String statsSummary = ForgeProps.getLocalized(WinLoseText.WON) + humanWins - + ForgeProps.getLocalized(WinLoseText.LOST) + humanLosses; + String statsSummary = "Won: " + humanWins + ", Lost: " + humanLosses; game.getGameLog().add("Final", statsSummary, 0); diff --git a/src/main/java/forge/game/PlanarDice.java b/src/main/java/forge/game/PlanarDice.java index e5be5b00ce5..80d9bde54f3 100644 --- a/src/main/java/forge/game/PlanarDice.java +++ b/src/main/java/forge/game/PlanarDice.java @@ -1,6 +1,7 @@ package forge.game; import java.util.HashMap; + import forge.Singletons; import forge.card.trigger.TriggerType; import forge.game.player.Player; diff --git a/src/main/java/forge/game/ai/AiAttackController.java b/src/main/java/forge/game/ai/AiAttackController.java index e2276310d9a..a3fdf7afc39 100644 --- a/src/main/java/forge/game/ai/AiAttackController.java +++ b/src/main/java/forge/game/ai/AiAttackController.java @@ -24,7 +24,6 @@ import java.util.Random; import com.google.common.base.Predicate; import forge.Card; - import forge.CardLists; import forge.CounterType; import forge.GameEntity; diff --git a/src/main/java/forge/game/ai/AiController.java b/src/main/java/forge/game/ai/AiController.java index 82615150ef1..9f328ce0102 100644 --- a/src/main/java/forge/game/ai/AiController.java +++ b/src/main/java/forge/game/ai/AiController.java @@ -30,11 +30,10 @@ import com.google.common.collect.Iterables; import forge.Card; import forge.CardLists; import forge.CardPredicates; -import forge.GameEntity; import forge.CardPredicates.Presets; import forge.Constant; +import forge.GameEntity; import forge.Singletons; - import forge.card.ability.ApiType; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.CostDiscard; diff --git a/src/main/java/forge/game/ai/ComputerUtil.java b/src/main/java/forge/game/ai/ComputerUtil.java index 4820a5e2c87..76554475bc8 100644 --- a/src/main/java/forge/game/ai/ComputerUtil.java +++ b/src/main/java/forge/game/ai/ComputerUtil.java @@ -22,7 +22,6 @@ import java.util.Collections; import java.util.List; import java.util.Random; - import com.google.common.base.Predicate; import forge.Card; @@ -36,8 +35,8 @@ import forge.card.ability.ApiType; import forge.card.ability.effects.CharmEffect; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.Cost; -import forge.card.cost.CostPartMana; import forge.card.cost.CostPart; +import forge.card.cost.CostPartMana; import forge.card.cost.CostPayment; import forge.card.cost.CostUtil; import forge.card.mana.ManaCost; diff --git a/src/main/java/forge/game/ai/ComputerUtilBlock.java b/src/main/java/forge/game/ai/ComputerUtilBlock.java index 49ddea84e56..85701996508 100644 --- a/src/main/java/forge/game/ai/ComputerUtilBlock.java +++ b/src/main/java/forge/game/ai/ComputerUtilBlock.java @@ -24,7 +24,6 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.CounterType; diff --git a/src/main/java/forge/game/ai/ComputerUtilMana.java b/src/main/java/forge/game/ai/ComputerUtilMana.java index cf8f1572d65..6d36605b3d2 100644 --- a/src/main/java/forge/game/ai/ComputerUtilMana.java +++ b/src/main/java/forge/game/ai/ComputerUtilMana.java @@ -19,10 +19,10 @@ import forge.card.ability.AbilityUtils; import forge.card.ability.ApiType; import forge.card.cost.Cost; import forge.card.cost.CostPayment; +import forge.card.mana.ManaCost; import forge.card.mana.ManaCostBeingPaid; import forge.card.mana.ManaCostShard; import forge.card.mana.ManaPool; -import forge.card.mana.ManaCost; import forge.card.spellability.AbilityManaPart; import forge.card.spellability.AbilitySub; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/game/limited/BoosterDraft.java b/src/main/java/forge/game/limited/BoosterDraft.java index a20e2d6851f..abbfb7a219f 100644 --- a/src/main/java/forge/game/limited/BoosterDraft.java +++ b/src/main/java/forge/game/limited/BoosterDraft.java @@ -30,7 +30,6 @@ import javax.swing.JOptionPane; import com.google.common.base.Function; - import forge.Card; import forge.Constant.Preferences; import forge.Singletons; @@ -45,7 +44,6 @@ import forge.item.CardPrinted; import forge.item.IPaperCard; import forge.item.ItemPool; import forge.item.ItemPoolView; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.FileUtil; import forge.util.HttpUtil; @@ -374,30 +372,18 @@ public final class BoosterDraft implements IBoosterDraft { /** This will upload drafting picks to cardforge HQ. */ @Override public void finishedDrafting() { - if (Preferences.UPLOAD_DRAFT) { - if (this.draftPicks.size() > 1) { - final ArrayList outDraftData = new ArrayList(); - - for (final Entry key : this.draftPicks.entrySet()) { - outDraftData.add(key.getValue() + "|" + key.getKey()); - } - Collections.sort(outDraftData); - FileUtil.writeFile("res/draft/tmpDraftData.txt", outDraftData); - - final HttpUtil poster = new HttpUtil(); - String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/submitDraftData.php?fmt="; - poster.upload(url + this.draftFormat, "res/draft/tmpDraftData.txt"); - } + if (!Preferences.UPLOAD_DRAFT || 1 >= draftPicks.size()) { + return; } + + ArrayList outDraftData = new ArrayList(); + for (Entry key : draftPicks.entrySet()) { + outDraftData.add(key.getValue() + "|" + key.getKey()); + } + Collections.sort(outDraftData); + HttpUtil.upload(NewConstants.URL_DRAFT_UPLOAD + "?fmt=" + draftFormat, outDraftData); } - /** - *

- * getSetCombos. - *

- * - * @return an ArrayList of the set choices. - */ private ArrayList getSetCombos(final String[] sets) { ArrayList setCombos = new ArrayList(); if (sets.length >= 2) { diff --git a/src/main/java/forge/game/limited/CardPoolLimitation.java b/src/main/java/forge/game/limited/CardPoolLimitation.java index e028a4ed0ef..6bc5d579332 100644 --- a/src/main/java/forge/game/limited/CardPoolLimitation.java +++ b/src/main/java/forge/game/limited/CardPoolLimitation.java @@ -17,18 +17,9 @@ */ package forge.game.limited; -/** - * TODO: Write javadoc for this type. - * - */ public enum CardPoolLimitation { - - /** The Full. */ Full, - /** The Block. */ Block, - /** The Fantasy Block. */ FantasyBlock, - /** The Custom. */ Custom } diff --git a/src/main/java/forge/game/limited/CardRatings.java b/src/main/java/forge/game/limited/CardRatings.java deleted file mode 100644 index 6606e4c7976..00000000000 --- a/src/main/java/forge/game/limited/CardRatings.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Forge: Play Magic: the Gathering. - * Copyright (C) 2011 Forge Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package forge.game.limited; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; - -import forge.properties.ForgeProps; -import forge.properties.NewConstants; -import forge.util.FileUtil; -import forge.util.HttpUtil; - -/** - * Contains Maps of card ratings. - */ -public class CardRatings { - private static Map fullRatings = new TreeMap(); - private static Map blockRatings = new TreeMap(); - private static Map customRatings = new TreeMap(); - - private static List tempRatings = new ArrayList(); - - /** - * Instantiates a new card ratings. - */ - public CardRatings() { - if (CardRatings.fullRatings.size() < 1) { - this.loadFullRatings(); - } - - if (CardRatings.blockRatings.size() < 1) { - this.loadBlockRatings(); - } - - if (CardRatings.customRatings.size() < 1) { - this.loadCustomRatings(); - } - - if (CardRatings.tempRatings.size() < 1) { - CardRatings.tempRatings = FileUtil.readFile("res/draft/tempRatings.dat"); - } - } - - private void loadFullRatings() { - final List sRatings = FileUtil.readFile("res/draft/fullRatings.dat"); - if (sRatings.size() > 1) { - for (final String s : sRatings) { - if (s.length() > 3) { - final String[] ss = s.split(":"); - if (ss.length > 1) { - CardRatings.fullRatings.put(ss[0], new Integer(ss[1])); - } - } - } - } - } - - private void loadBlockRatings() { - final List sRatings = FileUtil.readFile("res/draft/blockRatings.dat"); - if (sRatings.size() > 1) { - for (final String s : sRatings) { - if (s.length() > 3) { - final String[] ss = s.split(":"); - if (ss.length > 1) { - CardRatings.blockRatings.put(ss[0], new Integer(ss[1])); - } - } - } - } - } - - private void loadCustomRatings() { - final List sRatings = FileUtil.readFile("res/draft/customRatings.dat"); - if (sRatings.size() > 1) { - for (final String s : sRatings) { - if (s.length() > 3) { - final String[] ss = s.split(":"); - if (ss.length > 1) { - CardRatings.customRatings.put(ss[0], new Integer(ss[1])); - } - } - } - } - } - - /** - * Save ratings. - */ - public final void saveRatings() { - if (CardRatings.fullRatings.size() > 1) { - this.saveSingleRating(CardRatings.fullRatings, "res/draft/fullRatings.dat"); - } - - if (CardRatings.blockRatings.size() > 1) { - this.saveSingleRating(CardRatings.blockRatings, "res/draft/blockRatings.dat"); - } - - if (CardRatings.customRatings.size() > 1) { - this.saveSingleRating(CardRatings.customRatings, "res/draft/customRatings.dat"); - } - - if (CardRatings.tempRatings.size() > 1) { - Collections.sort(CardRatings.tempRatings); - FileUtil.writeFile("res/draft/tempRatings.dat", CardRatings.tempRatings); - } - } - - private void saveSingleRating(Map ratingData, String filename) { - final ArrayList ratings = new ArrayList(); - - for (final Entry k : ratingData.entrySet()) { - ratings.add(k.getKey() + ":" + k.getValue()); - } - - Collections.sort(ratings); - FileUtil.writeFile(filename, ratings); - } - - /** - * Gets the full rating. - * - * @param cardName - * the card name - * @return the full rating - */ - public final int getFullRating(final String cardName) { - if (CardRatings.fullRatings.containsKey(cardName)) { - return CardRatings.fullRatings.get(cardName); - } - - return 0; - } - - /** - * Gets the block rating. - * - * @param cardName - * the card name - * @param setCode - * the set code - * @return the block rating - */ - public final int getBlockRating(final String cardName, final String setCode) { - final String cNsC = cardName + "|" + setCode; - if (CardRatings.blockRatings.containsKey(cNsC)) { - return CardRatings.blockRatings.get(cNsC); - } - - return 0; - } - - /** - * Gets the custom ratings. - * - * @param cardName - * the card name - * @param custName - * the cust name - * @return the custom ratings - */ - public final int getCustomRatings(final String cardName, final String custName) { - final String cNcN = cardName + "|" + custName; - if (CardRatings.customRatings.containsKey(cNcN)) { - return CardRatings.customRatings.get(cNcN); - } - - return 0; - } - - /** - * Put full rating. - * - * @param cardName - * the card name - * @param rating - * the rating - */ - public final void putFullRating(final String cardName, final int rating) { - if (CardRatings.fullRatings.containsKey(cardName)) { - final int r = CardRatings.fullRatings.get(cardName); - final int nr = (r + rating) / 2; - CardRatings.fullRatings.put(cardName, nr); - } else { - CardRatings.fullRatings.put(cardName, rating); - } - - CardRatings.tempRatings.add("Full:" + cardName + ":" + rating); - } - - /** - * Put block rating. - * - * @param cardName - * the card name - * @param setCode - * the set code - * @param rating - * the rating - */ - public final void putBlockRating(final String cardName, final String setCode, final int rating) { - final String cNsC = cardName + "|" + setCode; - if (CardRatings.blockRatings.containsKey(cNsC)) { - final int r = CardRatings.blockRatings.get(cNsC); - final int nr = (r + rating) / 2; - CardRatings.blockRatings.put(cNsC, nr); - } else { - CardRatings.blockRatings.put(cNsC, rating); - } - - CardRatings.tempRatings.add("Block:" + cNsC + ":" + rating); - } - - /** - * Put custom rating. - * - * @param cardName - * the card name - * @param custName - * the cust name - * @param rating - * the rating - */ - public final void putCustomRating(final String cardName, final String custName, final int rating) { - final String cNcN = cardName + "|" + custName; - if (CardRatings.customRatings.containsKey(cNcN)) { - final int r = CardRatings.customRatings.get(cNcN); - final int nr = (r + rating) / 2; - CardRatings.customRatings.put(cNcN, nr); - } else { - CardRatings.customRatings.put(cNcN, rating); - } - - CardRatings.tempRatings.add("Custom:" + cNcN + ":" + rating); - } - - /** - * Upload ratings. - */ - public final void uploadRatings() { - Collections.sort(CardRatings.tempRatings); - FileUtil.writeFile("res/draft/tempRatings.dat", CardRatings.tempRatings); - - final HttpUtil httpPost = new HttpUtil(); - final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/submitRatingsData.php?"; - - httpPost.upload(url, "res/draft/tempRatings.dat"); - - FileUtil.writeFile("res/draft/tempRatings.dat", new ArrayList()); - } - - /** - * Download ratings. - */ - public final void downloadRatings() { - final HttpUtil httpGet = new HttpUtil(); - final ArrayList tmpList = new ArrayList(); - String tmpData = new String(); - - String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/getRatingsData.php?fmt=Full"; - tmpData = httpGet.getURL(url); - tmpList.add(tmpData); - Collections.sort(tmpList); - FileUtil.writeFile("res/draft/fullRatings.dat", tmpList); - CardRatings.fullRatings.clear(); - this.loadFullRatings(); - - tmpList.clear(); - - url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/getRatingsData.php?fmt=Block"; - tmpData = httpGet.getURL(url); - tmpList.add(tmpData); - Collections.sort(tmpList); - FileUtil.writeFile("res/draft/blockRatings.dat", tmpList); - CardRatings.blockRatings.clear(); - this.loadBlockRatings(); - - tmpList.clear(); - - url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/getRatingsData.php?fmt=Custom"; - tmpData = httpGet.getURL(url); - tmpList.add(tmpData); - Collections.sort(tmpList); - FileUtil.writeFile("res/draft/customRatings.dat", tmpList); - CardRatings.customRatings.clear(); - this.loadCustomRatings(); - } -} diff --git a/src/main/java/forge/game/limited/GauntletMini.java b/src/main/java/forge/game/limited/GauntletMini.java index 7de06155a15..b4a438edf87 100644 --- a/src/main/java/forge/game/limited/GauntletMini.java +++ b/src/main/java/forge/game/limited/GauntletMini.java @@ -17,12 +17,12 @@ */ package forge.game.limited; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; - import java.util.ArrayList; import java.util.List; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; + import forge.Singletons; import forge.control.Lobby; import forge.deck.Deck; diff --git a/src/main/java/forge/game/limited/LimitedDeck.java b/src/main/java/forge/game/limited/LimitedDeck.java index b4b1fe95943..577223037bf 100644 --- a/src/main/java/forge/game/limited/LimitedDeck.java +++ b/src/main/java/forge/game/limited/LimitedDeck.java @@ -19,13 +19,13 @@ import com.google.common.collect.Lists; import forge.Constant.Preferences; import forge.card.CardAiHints; -import forge.card.MagicColor; -import forge.card.ColorSet; import forge.card.CardRules; import forge.card.CardRulesPredicates; +import forge.card.ColorSet; import forge.card.DeckHints; -import forge.card.mana.ManaCostShard; +import forge.card.MagicColor; import forge.card.mana.ManaCost; +import forge.card.mana.ManaCostShard; import forge.deck.CardPool; import forge.deck.Deck; import forge.deck.DeckSection; diff --git a/src/main/java/forge/game/limited/ReadDraftRankings.java b/src/main/java/forge/game/limited/ReadDraftRankings.java index bbf5049920b..1517b353f3a 100644 --- a/src/main/java/forge/game/limited/ReadDraftRankings.java +++ b/src/main/java/forge/game/limited/ReadDraftRankings.java @@ -1,12 +1,11 @@ package forge.game.limited; -import java.io.File; import java.util.HashMap; +import java.util.List; import java.util.Map; import com.esotericsoftware.minlog.Log; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.FileUtil; @@ -29,7 +28,7 @@ public class ReadDraftRankings { */ public ReadDraftRankings() { this.setSizes = new HashMap(); - this.draftRankings = this.readFile(ForgeProps.getFile(NewConstants.Draft.RANKINGS)); + this.draftRankings = this.readFile(FileUtil.readFile(NewConstants.DRAFT_RANKINGS_FILE)); } // setup() /** @@ -41,10 +40,10 @@ public class ReadDraftRankings { * a {@link java.io.File} object. * @return a {@link java.util.Map} object. */ - private Map> readFile(final File file) { + private Map> readFile(List lines) { final Map> map = new HashMap>(); - for (String line : FileUtil.readFile(file)) { + for (String line : lines) { // stop reading if end of file or blank line is read if (line == null || line.length() == 0) { break; diff --git a/src/main/java/forge/game/limited/SealedDeck.java b/src/main/java/forge/game/limited/SealedDeck.java index fe71c48252b..d72da42c44c 100644 --- a/src/main/java/forge/game/limited/SealedDeck.java +++ b/src/main/java/forge/game/limited/SealedDeck.java @@ -11,9 +11,9 @@ import com.google.common.collect.Iterables; import forge.Constant; import forge.Constant.Color; -import forge.card.ColorSet; -import forge.card.CardRulesPredicates; import forge.card.CardRules; +import forge.card.CardRulesPredicates; +import forge.card.ColorSet; import forge.item.CardPrinted; import forge.util.MyRandom; diff --git a/src/main/java/forge/game/phase/Combat.java b/src/main/java/forge/game/phase/Combat.java index e593c54be6b..5ba241f5e81 100644 --- a/src/main/java/forge/game/phase/Combat.java +++ b/src/main/java/forge/game/phase/Combat.java @@ -27,7 +27,6 @@ import java.util.Set; import java.util.TreeMap; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.GameEntity; diff --git a/src/main/java/forge/game/phase/CombatUtil.java b/src/main/java/forge/game/phase/CombatUtil.java index 9525c72a756..4943781681c 100644 --- a/src/main/java/forge/game/phase/CombatUtil.java +++ b/src/main/java/forge/game/phase/CombatUtil.java @@ -29,7 +29,6 @@ import com.esotericsoftware.minlog.Log; import com.google.common.base.Predicate; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.Command; diff --git a/src/main/java/forge/game/phase/EndOfTurn.java b/src/main/java/forge/game/phase/EndOfTurn.java index 0faccb4c958..10f411dd34c 100644 --- a/src/main/java/forge/game/phase/EndOfTurn.java +++ b/src/main/java/forge/game/phase/EndOfTurn.java @@ -18,7 +18,6 @@ package forge.game.phase; import forge.Card; - import forge.Singletons; import forge.card.mana.ManaCost; import forge.card.spellability.Ability; diff --git a/src/main/java/forge/game/phase/Untap.java b/src/main/java/forge/game/phase/Untap.java index e207107b3b9..be3b4b90702 100644 --- a/src/main/java/forge/game/phase/Untap.java +++ b/src/main/java/forge/game/phase/Untap.java @@ -22,11 +22,11 @@ import java.util.List; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import forge.Card; +import forge.Card; import forge.CardLists; -import forge.CardPredicates.Presets; import forge.CardPredicates; +import forge.CardPredicates.Presets; import forge.CounterType; import forge.GameEntity; import forge.Singletons; @@ -38,7 +38,6 @@ import forge.game.zone.Zone; import forge.game.zone.ZoneType; import forge.gui.GuiDialog; import forge.gui.match.CMatchUI; - import forge.view.ButtonUtil; /** diff --git a/src/main/java/forge/game/phase/Upkeep.java b/src/main/java/forge/game/phase/Upkeep.java index 7dc959f3192..0279b65f9ae 100644 --- a/src/main/java/forge/game/phase/Upkeep.java +++ b/src/main/java/forge/game/phase/Upkeep.java @@ -33,8 +33,8 @@ import forge.CounterType; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.Cost; -import forge.card.mana.ManaCostParser; import forge.card.mana.ManaCost; +import forge.card.mana.ManaCostParser; import forge.card.spellability.Ability; import forge.card.spellability.AbilityManaPart; import forge.card.spellability.AbilityStatic; diff --git a/src/main/java/forge/game/player/AIPlayer.java b/src/main/java/forge/game/player/AIPlayer.java index 066b2482a67..8967c1df6d6 100644 --- a/src/main/java/forge/game/player/AIPlayer.java +++ b/src/main/java/forge/game/player/AIPlayer.java @@ -21,8 +21,8 @@ import java.util.List; import java.util.Random; import com.google.common.collect.Iterables; -import forge.Card; +import forge.Card; import forge.CardLists; import forge.CardPredicates; import forge.card.spellability.SpellAbility; diff --git a/src/main/java/forge/game/player/HumanPlayer.java b/src/main/java/forge/game/player/HumanPlayer.java index fe39a66595b..7cd245d6fa8 100644 --- a/src/main/java/forge/game/player/HumanPlayer.java +++ b/src/main/java/forge/game/player/HumanPlayer.java @@ -20,12 +20,11 @@ package forge.game.player; import java.util.List; import forge.Card; - import forge.Singletons; import forge.card.spellability.SpellAbility; import forge.control.input.Input; -import forge.game.GameType; import forge.game.GameState; +import forge.game.GameType; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; import forge.gui.GuiDialog; diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index a8d5cde84fd..ec723d369dc 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -34,7 +34,6 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; @@ -45,8 +44,8 @@ import forge.GameEntity; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.Cost; -import forge.card.mana.ManaPool; import forge.card.mana.ManaCost; +import forge.card.mana.ManaPool; import forge.card.replacement.ReplacementResult; import forge.card.spellability.Ability; import forge.card.spellability.Spell; diff --git a/src/main/java/forge/game/player/PlayerControllerHuman.java b/src/main/java/forge/game/player/PlayerControllerHuman.java index e749b87b238..3f2108b193d 100644 --- a/src/main/java/forge/game/player/PlayerControllerHuman.java +++ b/src/main/java/forge/game/player/PlayerControllerHuman.java @@ -14,8 +14,8 @@ import forge.control.input.Input; import forge.control.input.InputBlock; import forge.control.input.InputCleanup; import forge.control.input.InputPassPriority; -import forge.deck.Deck; import forge.deck.CardPool; +import forge.deck.Deck; import forge.deck.DeckSection; import forge.game.GameState; import forge.game.GameType; diff --git a/src/main/java/forge/game/player/PlayerUtil.java b/src/main/java/forge/game/player/PlayerUtil.java index 743822cc362..62809f0ee6b 100644 --- a/src/main/java/forge/game/player/PlayerUtil.java +++ b/src/main/java/forge/game/player/PlayerUtil.java @@ -27,7 +27,6 @@ import forge.control.input.Input; import forge.game.zone.Zone; import forge.game.zone.ZoneType; import forge.gui.match.CMatchUI; - import forge.view.ButtonUtil; /** diff --git a/src/main/java/forge/game/zone/MagicStack.java b/src/main/java/forge/game/zone/MagicStack.java index c71aa4108f8..82858987c60 100644 --- a/src/main/java/forge/game/zone/MagicStack.java +++ b/src/main/java/forge/game/zone/MagicStack.java @@ -26,7 +26,6 @@ import java.util.Stack; import com.esotericsoftware.minlog.Log; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; @@ -34,9 +33,9 @@ import forge.Command; import forge.Singletons; import forge.card.ability.AbilityUtils; import forge.card.cardfactory.CardFactoryUtil; +import forge.card.mana.ManaCost; import forge.card.mana.ManaCostBeingPaid; import forge.card.mana.ManaCostParser; -import forge.card.mana.ManaCost; import forge.card.spellability.Ability; import forge.card.spellability.AbilityStatic; import forge.card.spellability.AbilityTriggered; diff --git a/src/main/java/forge/game/zone/PlayerZone.java b/src/main/java/forge/game/zone/PlayerZone.java index abe7443bbc9..307cd991c63 100644 --- a/src/main/java/forge/game/zone/PlayerZone.java +++ b/src/main/java/forge/game/zone/PlayerZone.java @@ -18,7 +18,6 @@ package forge.game.zone; import forge.Card; - import forge.Singletons; import forge.game.player.Player; diff --git a/src/main/java/forge/game/zone/PlayerZoneBattlefield.java b/src/main/java/forge/game/zone/PlayerZoneBattlefield.java index b863a8bd342..291dd53f8cf 100644 --- a/src/main/java/forge/game/zone/PlayerZoneBattlefield.java +++ b/src/main/java/forge/game/zone/PlayerZoneBattlefield.java @@ -24,7 +24,6 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import forge.Card; - import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; diff --git a/src/main/java/forge/game/zone/Zone.java b/src/main/java/forge/game/zone/Zone.java index 1e790beeb98..9e84ec4e44d 100644 --- a/src/main/java/forge/game/zone/Zone.java +++ b/src/main/java/forge/game/zone/Zone.java @@ -25,7 +25,6 @@ import java.util.Observable; import java.util.Observer; import forge.Card; - import forge.Singletons; import forge.game.player.Player; import forge.util.MyObservable; diff --git a/src/main/java/forge/game/zone/ZoneType.java b/src/main/java/forge/game/zone/ZoneType.java index 8a5b0f0cb9e..fdce2f38509 100644 --- a/src/main/java/forge/game/zone/ZoneType.java +++ b/src/main/java/forge/game/zone/ZoneType.java @@ -8,30 +8,14 @@ import java.util.List; * The Enum Zone. */ public enum ZoneType { - - /** The Hand. */ Hand(true), - - /** The Library. */ Library(true), - - /** The Graveyard. */ Graveyard(false), - - /** The Battlefield. */ Battlefield(false), - - /** The Exile. */ Exile(false), - - /** The Command. */ Command(false), - - /** The Stack. */ Stack(false), - Sideboard(true), - /** Ante. */ Ante(false); public static final List STATIC_ABILITIES_SOURCE_ZONES = Arrays.asList(new ZoneType[]{Battlefield, Graveyard, Exile, Command/*, Hand*/}); @@ -41,7 +25,6 @@ public enum ZoneType { holdsHiddenInfo = holdsHidden; } - public static ZoneType smartValueOf(final String value) { if (value == null) { return null; @@ -96,5 +79,4 @@ public enum ZoneType { public static boolean isKnown(final String origin) { return !isHidden(origin); } - } diff --git a/src/main/java/forge/gui/ForgeAction.java b/src/main/java/forge/gui/ForgeAction.java index 7b3c1fcb010..5a91253866b 100644 --- a/src/main/java/forge/gui/ForgeAction.java +++ b/src/main/java/forge/gui/ForgeAction.java @@ -17,67 +17,44 @@ */ package forge.gui; -/** - * ForgeAction.java - * - * Created on 02.09.2009 - */ - import javax.swing.AbstractAction; import javax.swing.AbstractButton; import javax.swing.JMenuItem; -import forge.properties.ForgeProps; - -/** - * The class ForgeAction. - * - * @author Clemens Koza - * @version V0.0 02.09.2009 - */ +@SuppressWarnings("serial") public abstract class ForgeAction extends AbstractAction { - - /** Constant serialVersionUID=-1881183151063146955L. */ - private static final long serialVersionUID = -1881183151063146955L; - private final String property; - - /** - *

- * Constructor for ForgeAction. - *

- * - * @param property - * A Property key containing the keys "/button" and "/menu". - */ - public ForgeAction(final String property) { - super(ForgeProps.getLocalized(property + "/button")); - this.property = property; - this.putValue("buttonText", ForgeProps.getLocalized(property + "/button")); - this.putValue("menuText", ForgeProps.getLocalized(property + "/menu")); + public static enum MatchConstants { + ALWAYSACCEPT ("Always accept this trigger"), + ALWAYSDECLINE ("Always decline this trigger"), + ALWAYSASK ("Always ask"), + HUMANEXILED ("Player's Exile", "Exile:", "Player - View Exile"), + HUMANFLASHBACK("Play card with Flashback", "Flashback:", "Player - View Cards with Flashback"), + HUMANGRAVEYARD("Player's Graveyard", "Graveyard:", "Player - View Graveyard"), + HUMANHAND ("Player's Hand", "Hand:", "Player - View Hand"), + HUMANLIBRARY ("Player's Library", "Library:", "Player - View Library"); + + public final String title; + public final String button; + public final String menu; + + private MatchConstants(String title0) { + title = title0; + button = title0; + menu = title0; + } + private MatchConstants(String title0, String button0, String menu0) { + title = title0; + button = button0; + menu = menu0; + } + } + + public ForgeAction(MatchConstants property) { + super(property.button); + this.putValue("buttonText", property.button); + this.putValue("menuText", property.menu); } - /** - *

- * Getter for the field property. - *

- * - * @return a {@link java.lang.String} object. - */ - protected String getProperty() { - return this.property; - } - - /** - *

- * setupButton. - *

- * - * @param - * a T object. - * @param button - * a T object. - * @return a T object. - */ public T setupButton(final T button) { button.setAction(this); button.setText((String) this.getValue(button instanceof JMenuItem ? "menuText" : "buttonText")); diff --git a/src/main/java/forge/gui/GuiDisplayUtil.java b/src/main/java/forge/gui/GuiDisplayUtil.java index cd601122daa..ad24bb63a2c 100644 --- a/src/main/java/forge/gui/GuiDisplayUtil.java +++ b/src/main/java/forge/gui/GuiDisplayUtil.java @@ -41,7 +41,6 @@ import com.google.common.collect.Lists; import forge.Card; import forge.CardCharacteristicName; - import forge.CardLists; import forge.CardPredicates; import forge.CardUtil; @@ -61,29 +60,11 @@ import forge.item.CardDb; import forge.item.CardPrinted; import forge.item.IPaperCard; -/** - *

- * GuiDisplayUtil class. - *

- * - * @author Forge - * @version $Id$ - */ public final class GuiDisplayUtil { - private GuiDisplayUtil() { throw new AssertionError(); } - /** - *

- * getBorder. - *

- * - * @param card - * a {@link forge.Card} object. - * @return a {@link javax.swing.border.Border} object. - */ public static Border getBorder(final Card card) { // color info if (card == null) { @@ -137,11 +118,6 @@ public final class GuiDisplayUtil { } } - /** - *

- * devModeGenerateMana. - *

- */ public static void devModeGenerateMana() { final Card dummy = new Card(); final Player human = Singletons.getControl().getPlayer(); @@ -153,15 +129,6 @@ public final class GuiDisplayUtil { abMana.produceMana(null); } - /** - *

- * formatCardType. - *

- * - * @param card - * a {@link forge.Card} object. - * @return a {@link java.lang.String} object. - */ public static String formatCardType(final Card card) { final ArrayList list = card.getType(); final StringBuilder sb = new StringBuilder(); @@ -205,58 +172,20 @@ public final class GuiDisplayUtil { return sb.toString(); } - /** - *

- * cleanString. - *

- * - * @param in - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ public static String cleanString(final String in) { final StringBuffer out = new StringBuffer(); char c; for (int i = 0; i < in.length(); i++) { c = in.charAt(i); - if ((c == ' ') || (c == '-')) { + if ((c == ' ') || (c == '-') || (c == '_')) { out.append('_'); - } else if (Character.isLetterOrDigit(c) || (c == '_')) { + } else if (Character.isLetterOrDigit(c)) { out.append(c); } } return out.toString().toLowerCase(); } - /** - *

- * cleanStringMWS. - *

- * - * @param in - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public static String cleanStringMWS(final String in) { - final StringBuffer out = new StringBuffer(); - char c; - for (int i = 0; i < in.length(); i++) { - c = in.charAt(i); - if ((c == '"') || (c == '/') || (c == ':') || (c == '?')) { - out.append(""); - } else { - out.append(c); - } - } - return out.toString(); - } - - - /** - *

- * updateGUI. - *

- */ public static void updateGUI() { for (Player p : Singletons.getModel().getGame().getRegisteredPlayers()) { @@ -265,11 +194,6 @@ public final class GuiDisplayUtil { } } - /** - *

- * devSetupGameState. - *

- */ public static void devSetupGameState() { String tHumanLife = "-1"; String tComputerLife = "-1"; diff --git a/src/main/java/forge/gui/GuiImportPicture.java b/src/main/java/forge/gui/GuiImportPicture.java index 98991f53059..08c7a59e260 100644 --- a/src/main/java/forge/gui/GuiImportPicture.java +++ b/src/main/java/forge/gui/GuiImportPicture.java @@ -41,7 +41,6 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.event.MouseInputAdapter; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.CopyFiles; import forge.util.FileFinder; @@ -129,7 +128,7 @@ public class GuiImportPicture extends JDialog { this.jLabelHDDFree = new JLabel(); this.jLabelHDDFree.setBounds(new Rectangle(15, 119, 177, 16)); - final File file = ForgeProps.getFile(NewConstants.IMAGE_BASE); + final File file = new File(NewConstants.CACHE_CARD_PICS_DIR); final long freeSpace = file.getFreeSpace(); this.freeSpaceM = freeSpace / 1024 / 1024; @@ -223,7 +222,7 @@ public class GuiImportPicture extends JDialog { start = fName.indexOf("full"); fName = fName.substring(0, start - 1) + fName.substring(start + 4, fName.length() - 4); fName = GuiDisplayUtil.cleanString(fName) + ".jpg"; - final File file = new File(ForgeProps.getFile(NewConstants.IMAGE_BASE), fName); + final File file = new File(NewConstants.CACHE_CARD_PICS_DIR, fName); if (!file.exists()) { GuiImportPicture.this.filesForCopy = GuiImportPicture.this.filesForCopy + 1; filesToCopySize = filesToCopySize + GuiImportPicture.this.listFiles.get(i).length(); @@ -324,7 +323,7 @@ public class GuiImportPicture extends JDialog { start = fName.indexOf("full"); fName = fName.substring(0, start - 1) + fName.substring(start + 4, fName.length() - 4); fName = GuiDisplayUtil.cleanString(fName) + ".jpg"; - final File file = new File(ForgeProps.getFile(NewConstants.IMAGE_BASE), fName); + final File file = new File(NewConstants.CACHE_CARD_PICS_DIR, fName); if (!file.exists()) { GuiImportPicture.this.filesForCopy = GuiImportPicture.this.filesForCopy + 1; filesToCopySize = filesToCopySize + GuiImportPicture.this.listFiles.get(i).length(); diff --git a/src/main/java/forge/gui/deckeditor/DeckImport.java b/src/main/java/forge/gui/deckeditor/DeckImport.java index 69d02986828..d637217b51a 100644 --- a/src/main/java/forge/gui/deckeditor/DeckImport.java +++ b/src/main/java/forge/gui/deckeditor/DeckImport.java @@ -26,13 +26,13 @@ import java.util.List; import javax.swing.BorderFactory; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; -import javax.swing.JCheckBox; import javax.swing.border.TitledBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -44,8 +44,8 @@ import net.miginfocom.swing.MigLayout; import forge.deck.Deck; import forge.deck.DeckBase; import forge.deck.DeckRecognizer; -import forge.deck.DeckSection; import forge.deck.DeckRecognizer.TokenType; +import forge.deck.DeckSection; import forge.gui.GuiUtils; import forge.gui.deckeditor.controllers.ACEditorBase; import forge.item.CardPrinted; diff --git a/src/main/java/forge/gui/deckeditor/SEditorIO.java b/src/main/java/forge/gui/deckeditor/SEditorIO.java index 6c95d1f14ec..47208545ae3 100644 --- a/src/main/java/forge/gui/deckeditor/SEditorIO.java +++ b/src/main/java/forge/gui/deckeditor/SEditorIO.java @@ -1,11 +1,8 @@ package forge.gui.deckeditor; -import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -201,7 +198,7 @@ public class SEditorIO { */ private static void save() throws Exception { final XMLOutputFactory out = XMLOutputFactory.newInstance(); - final XMLEventWriter writer = out.createXMLEventWriter(new FileOutputStream(NewConstants.PREFS_EDITOR_FILE)); + final XMLEventWriter writer = out.createXMLEventWriter(new FileOutputStream(NewConstants.EDITOR_PREFERENCES_FILE.userPrefLoc)); writer.add(EVENT_FACTORY.createStartDocument()); writer.add(NEWLINE); @@ -252,37 +249,17 @@ public class SEditorIO { } private static void load() throws Exception { - // Preferences files have been consolidated into res/preferences/. - // This code is here temporarily to facilitate this transfer. - // After a while, this can be deleted. Doublestrike 21-5-12 - final File oldFile = new File("editor.preferences"); - if (oldFile.exists()) { - final File newFile = new File(NewConstants.PREFS_EDITOR_FILE); - final InputStream in = new FileInputStream(oldFile); - final OutputStream out = new FileOutputStream(newFile); - - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - in.close(); - out.close(); - - oldFile.delete(); - } // END TEMPORARY CONSOLIDATION FACILITATION - final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); PREFS.clear(); COLS.clear(); // read in defaults - loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.PREFS_DEFAULT_EDITOR_FILE))); + loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.EDITOR_PREFERENCES_FILE.defaultLoc))); try { // overwrite defaults with user preferences, if they exist - loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.PREFS_EDITOR_FILE))); + loadPrefs(inputFactory.createXMLEventReader(new FileInputStream(NewConstants.EDITOR_PREFERENCES_FILE.userPrefLoc))); } catch (FileNotFoundException e) { /* ignore; it's ok if this file doesn't exist */ } finally { diff --git a/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java b/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java index c074f39f145..d1b097fda6a 100644 --- a/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java +++ b/src/main/java/forge/gui/deckeditor/controllers/CCurrentDeck.java @@ -20,8 +20,6 @@ import forge.gui.deckeditor.tables.DeckController; import forge.gui.deckeditor.views.VCurrentDeck; import forge.gui.framework.ICDoc; import forge.gui.toolbox.FLabel; -import forge.properties.ForgeProps; -import forge.properties.NewConstants; /** * Controls the "current deck" panel in the deck editor UI. @@ -35,9 +33,7 @@ public enum CCurrentDeck implements ICDoc { private static File previousDirectory = null; - private File openStartDir = ForgeProps.getFile(NewConstants.NEW_DECKS); - - private JFileChooser fileChooser = new JFileChooser(""); + private JFileChooser fileChooser = new JFileChooser(); //========== Overridden methods @@ -166,8 +162,6 @@ public enum CCurrentDeck implements ICDoc { private File getImportFilename() { fileChooser.setDialogTitle("Import Deck"); - fileChooser.setCurrentDirectory(openStartDir); - final int returnVal = fileChooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { diff --git a/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java b/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java index 0275b377a99..a2683e15652 100644 --- a/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java +++ b/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java @@ -23,6 +23,7 @@ import java.util.Map; import com.google.common.base.Predicates; import com.google.common.base.Supplier; + import forge.Command; import forge.Singletons; import forge.card.CardRulesPredicates; diff --git a/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java b/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java index 5fd06fca47b..07c675c25bd 100644 --- a/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java +++ b/src/main/java/forge/gui/deckeditor/controllers/CStatistics.java @@ -6,10 +6,11 @@ import javax.swing.JLabel; import com.google.common.base.Predicate; import com.google.common.base.Predicates; + import forge.Command; -import forge.card.MagicColor; -import forge.card.CardRulesPredicates; import forge.card.CardRules; +import forge.card.CardRulesPredicates; +import forge.card.MagicColor; import forge.deck.DeckBase; import forge.gui.deckeditor.CDeckEditorUI; import forge.gui.deckeditor.SEditorUtil; diff --git a/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java b/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java index f818a466aef..97260b48fb3 100644 --- a/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java +++ b/src/main/java/forge/gui/deckeditor/tables/ManaCostRenderer.java @@ -24,8 +24,8 @@ import java.util.List; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; -import forge.card.mana.ManaCostShard; import forge.card.mana.ManaCost; +import forge.card.mana.ManaCostShard; import forge.gui.toolbox.CardFaceSymbols; /** diff --git a/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java b/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java index a30c993a678..1d6c2c531ba 100644 --- a/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java +++ b/src/main/java/forge/gui/deckeditor/tables/SColumnUtil.java @@ -31,9 +31,9 @@ import com.google.common.base.Function; import forge.Singletons; import forge.card.CardAiHints; -import forge.card.ColorSet; import forge.card.CardEdition; import forge.card.CardRarity; +import forge.card.ColorSet; import forge.card.mana.ManaCost; import forge.deck.DeckBase; import forge.game.limited.DraftRankCache; diff --git a/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java b/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java index f4ad0762fc2..a824fdbb5a0 100644 --- a/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java +++ b/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java @@ -26,7 +26,6 @@ import forge.card.ICardCharacteristics; import forge.gui.GuiDisplayUtil; import forge.item.CardDb; import forge.item.IPaperCard; -import forge.properties.ForgeProps; import forge.properties.NewConstants; /** @@ -37,10 +36,8 @@ import forge.properties.NewConstants; * @author Forge * @version $Id$ */ +@SuppressWarnings("serial") public class GuiDownloadPicturesLQ extends GuiDownloader { - - private static final long serialVersionUID = -2839597792999139007L; - private String baseFolder; private ArrayList downloads; /** @@ -59,13 +56,10 @@ public class GuiDownloadPicturesLQ extends GuiDownloader { * @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects. */ @Override - protected final DownloadObject[] getNeededImages() { - // This is called as a virtual method from constructor. - baseFolder = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath(); + protected final ArrayList getNeededImages() { downloads = new ArrayList(); for (final IPaperCard c : CardDb.instance().getUniqueCards()) { - //System.out.println(c.getName()); CardRules cardRules = c.getRules(); this.createDLObjects(cardRules.getPictureUrl(), cardRules.getMainPart().getName()); @@ -76,15 +70,13 @@ public class GuiDownloadPicturesLQ extends GuiDownloader { } // Add missing tokens to the list of things to download. - for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.TOKEN_IMAGES, - ForgeProps.getFile(NewConstants.IMAGE_TOKEN))) { + for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_TOKENS_FILE, NewConstants.CACHE_TOKEN_PICS_DIR)) { if (!element.getDestination().exists()) { downloads.add(element); } } - // Return all card names and URLs that are needed. - return downloads.toArray(new DownloadObject[downloads.size()]); + return downloads; } // getNeededImages() private void createDLObjects(final String url, final String cardName) { @@ -93,10 +85,10 @@ public class GuiDownloadPicturesLQ extends GuiDownloader { final String[] urls = url.split("\\\\"); final String sName = GuiDisplayUtil.cleanString(cardName); - addDownloadObject(urls[0], new File(baseFolder, sName + ".jpg")); + addDownloadObject(urls[0], new File(NewConstants.CACHE_CARD_PICS_DIR, sName + ".jpg")); for (int j = 1; j < urls.length; j++) { - addDownloadObject(urls[j], new File(baseFolder, sName + j + ".jpg")); + addDownloadObject(urls[j], new File(NewConstants.CACHE_CARD_PICS_DIR, sName + j + ".jpg")); } } } @@ -106,23 +98,4 @@ public class GuiDownloadPicturesLQ extends GuiDownloader { downloads.add(new DownloadObject(url, destFile)); } } - - /** - * Builds the ideal filename. - * - * @param cardName - * the card name - * @param artIndex - * the art index - * @param artIndexMax - * the art index max - * @return the string - */ - public static String buildIdealFilename(final String cardName, final int artIndex, final int artIndexMax) { - final String nn = artIndexMax > 1 ? Integer.toString(artIndex + 1) : ""; - final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName); - // 3 letter set code with MWS filename format - return String.format("%s%s.full.jpg", mwsCardName, nn); - } - } diff --git a/src/main/java/forge/gui/download/GuiDownloadPrices.java b/src/main/java/forge/gui/download/GuiDownloadPrices.java index 157dac80942..8e99ae9bd07 100644 --- a/src/main/java/forge/gui/download/GuiDownloadPrices.java +++ b/src/main/java/forge/gui/download/GuiDownloadPrices.java @@ -18,30 +18,21 @@ package forge.gui.download; import java.io.File; +import java.util.ArrayList; + +import com.google.common.collect.Lists; -import forge.properties.ForgeProps; import forge.properties.NewConstants; -/** */ @SuppressWarnings("serial") public class GuiDownloadPrices extends GuiDownloader { - - /** - * Constructor. - */ public GuiDownloadPrices() { super(); } - /* (non-Javadoc) - * @see forge.gui.download.GuiDownloader#getNeededImages() - */ @Override - protected DownloadObject[] getNeededImages() { - final File f = ForgeProps.getFile(NewConstants.Quest.PRICE); - final String url = "http://www.cardforge.org/MagicInfo/pricegen.php"; - final DownloadObject[] objects = {new DownloadObject(url, f)}; - return objects; + protected ArrayList getNeededImages() { + final File f = new File(NewConstants.QUEST_CARD_PRICE_FILE.userPrefLoc); + return Lists.newArrayList(new DownloadObject(NewConstants.URL_PRICE_DOWNLOAD, f)); } - -} // @jve:decl-index=0:visual-constraint="10,10" +} diff --git a/src/main/java/forge/gui/download/GuiDownloadQuestImages.java b/src/main/java/forge/gui/download/GuiDownloadQuestImages.java index 25ccf870a6b..7833ee49aae 100644 --- a/src/main/java/forge/gui/download/GuiDownloadQuestImages.java +++ b/src/main/java/forge/gui/download/GuiDownloadQuestImages.java @@ -18,9 +18,7 @@ package forge.gui.download; import java.util.ArrayList; -import java.util.List; -import forge.properties.ForgeProps; import forge.properties.NewConstants; /** */ @@ -43,39 +41,52 @@ public class GuiDownloadQuestImages extends GuiDownloader { * @return an array of {@link forge.gui.download.GuiDownloadSetPicturesLQ} objects. */ @Override - protected final DownloadObject[] getNeededImages() { + protected final ArrayList getNeededImages() { // read all card names and urls - final List urls = new ArrayList(); + final ArrayList urls = new ArrayList(); - for (final DownloadObject questOpponent : GuiDownloader.readFile(NewConstants.Quest.OPPONENT_ICONS, ForgeProps.getFile(NewConstants.Quest.OPPONENT_DIR))) { + for (final DownloadObject questOpponent : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE, NewConstants.CACHE_ICON_PICS_DIR)) { if (!questOpponent.getDestination().exists()) { urls.add(questOpponent); } } - for (final DownloadObject boosterImage : GuiDownloader.readFile(NewConstants.PICS_BOOSTER_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_SEALED_PRODUCT))) { - if (!boosterImage.getDestination().exists()) { - urls.add(boosterImage); + for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_BOOSTERS_FILE, NewConstants.CACHE_BOOSTER_PICS_DIR)) { + if (!packImage.getDestination().exists()) { + urls.add(packImage); } } - for (final DownloadObject petIcon : GuiDownloader.readFileWithNames(NewConstants.Quest.PET_SHOP_ICONS, ForgeProps.getFile(NewConstants.IMAGE_ICON))) { + for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_FATPACKS_FILE, NewConstants.CACHE_FATPACK_PICS_DIR)) { + if (!packImage.getDestination().exists()) { + urls.add(packImage); + } + } + + for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_PRECONS_FILE, NewConstants.CACHE_PRECON_PICS_DIR)) { + if (!packImage.getDestination().exists()) { + urls.add(packImage); + } + } + + for (final DownloadObject packImage : GuiDownloader.readFile(NewConstants.IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE, NewConstants.CACHE_TOURNAMENTPACK_PICS_DIR)) { + if (!packImage.getDestination().exists()) { + urls.add(packImage); + } + } + + for (final DownloadObject petIcon : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE, NewConstants.CACHE_ICON_PICS_DIR)) { if (!petIcon.getDestination().exists()) { urls.add(petIcon); } } - for (final DownloadObject questPet : GuiDownloader.readFileWithNames(NewConstants.Quest.PET_TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN))) { + for (final DownloadObject questPet : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_QUEST_TOKENS_FILE, NewConstants.CACHE_TOKEN_PICS_DIR)) { if (!questPet.getDestination().exists()) { urls.add(questPet); } } - // return all card names and urls that are needed - final DownloadObject[] out = new DownloadObject[urls.size()]; - urls.toArray(out); - - return out; - } // getNeededCards() - -} // end class GuiDownloadQuestImages + return urls; + } +} diff --git a/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java b/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java index 44b73ff4523..760c7d2b746 100644 --- a/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java +++ b/src/main/java/forge/gui/download/GuiDownloadSetPicturesLQ.java @@ -31,78 +31,51 @@ import forge.card.CardRules; import forge.card.CardSplitType; import forge.item.CardDb; import forge.item.CardPrinted; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.Base64Coder; -/** */ @SuppressWarnings("serial") public class GuiDownloadSetPicturesLQ extends GuiDownloader { - private String picturesPath; - - /** - *

- * Constructor for Gui_DownloadSetPictures_LQ. - *

- */ public GuiDownloadSetPicturesLQ() { super(); } - /** - * Adds the card to list. - * - * @param cList - * the c list - * @param c - * the c - * @param cardName - * the card name - */ - protected final void addCardToList(final ArrayList cList, final CardPrinted c, final String cardName) { + private final void addCardToList(ArrayList cList, CardPrinted c, String nameToUse) { + File file = new File(NewConstants.CACHE_CARD_PICS_DIR, CardUtil.buildFilename(c, nameToUse) + ".jpg"); + if (!file.exists()) { + cList.add(new DownloadObject(getCardPictureUrl(c, nameToUse), file)); + } + final String setCode3 = c.getEdition(); final CardEdition thisSet = Singletons.getModel().getEditions().get(setCode3); - final String setCode2 = thisSet.getCode2(); - final int artsCnt = c.getRules().getEditionInfo(setCode3).getCopiesCount(); - - final String imgFN = CardUtil.buildFilename(c, cardName); - final boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2); + System.out.println(String.format("%s [%s - %s]", nameToUse, setCode3, thisSet.getName())); + } - if (!foundSetImage) { - String url = getCardPictureUrl(c, cardName); - - final String filename = GuiDownloadPicturesLQ.buildIdealFilename(cardName, c.getArtIndex(), artsCnt); - cList.add(new DownloadObject(url, new File(this.picturesPath + File.separator + setCode3, filename))); - - System.out.println(String.format("%s [%s - %s]", cardName, setCode3, thisSet.getName())); + private static String cleanMWS(String in) { + final StringBuffer out = new StringBuffer(); + char c; + for (int i = 0; i < in.length(); i++) { + c = in.charAt(i); + if ((c == '"') || (c == '/') || (c == ':') || (c == '?')) { + out.append(""); + } else { + out.append(c); + } } + return out.toString(); } public static String getCardPictureUrl(final CardPrinted c, final String cardName) { - final String urlBase = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/fpics/"; + String setCode3 = c.getEdition(); + String setCode2 = Singletons.getModel().getEditions().get(setCode3).getCode2(); + int artsCnt = c.getRules().getEditionInfo(setCode3).getCopiesCount(); + String filename = CardUtil.buildFilename(cleanMWS(cardName), null, c.getArtIndex(), artsCnt, false) + ".jpg"; - final String setCode3 = c.getEdition(); - final CardEdition thisSet = Singletons.getModel().getEditions().get(setCode3); - final String setCode2 = thisSet.getCode2(); - - final int artsCnt = c.getRules().getEditionInfo(setCode3).getCopiesCount(); - final String filename = GuiDownloadPicturesLQ.buildIdealFilename(cardName, c.getArtIndex(), artsCnt); - return urlBase + setCode2 + "/" + Base64Coder.encodeString(filename, true); + return NewConstants.URL_PIC_DOWNLOAD + setCode2 + "/" + Base64Coder.encodeString(filename, true); } - /** - *

- * getNeededCards. - *

- * - * @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects. - */ @Override - protected final DownloadObject[] getNeededImages() { - if (this.picturesPath == null) { - this.picturesPath = ForgeProps.getFile(NewConstants.IMAGE_BASE).getPath(); - } - // read token names and urls + protected final ArrayList getNeededImages() { final ArrayList cList = new ArrayList(); Iterable allPrinted = Iterables.concat(CardDb.instance().getAllCards(), CardDb.variants().getAllCards()); @@ -112,26 +85,23 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader { if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) { continue; // we don't want cards from unknown sets } + CardRules cr = c.getRules(); String firstPartName = cr.getSplitType() == CardSplitType.Split ? CardUtil.buildSplitCardFilename(cr) : c.getName(); - this.addCardToList(cList, c, firstPartName); + addCardToList(cList, c, firstPartName); + if (cr.getSplitType() == CardSplitType.Transform) { - this.addCardToList(cList, c, cr.getOtherPart().getName()); + addCardToList(cList, c, cr.getOtherPart().getName()); } } // add missing tokens to the list of things to download - for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.TOKEN_IMAGES, ForgeProps.getFile(NewConstants.IMAGE_TOKEN))) { + for (final DownloadObject element : GuiDownloader.readFileWithNames(NewConstants.IMAGE_LIST_TOKENS_FILE, NewConstants.CACHE_TOKEN_PICS_DIR)) { if (!element.getDestination().exists()) { cList.add(element); } } - // return all card names and urls that are needed - final DownloadObject[] out = new DownloadObject[cList.size()]; - cList.toArray(out); - - return out; - } // getNeededImages() - -} // end class Gui_DownloadSetPictures_LQ + return cList; + } +} diff --git a/src/main/java/forge/gui/download/GuiDownloader.java b/src/main/java/forge/gui/download/GuiDownloader.java index 11c73adb0cd..9daf89a7c6e 100644 --- a/src/main/java/forge/gui/download/GuiDownloader.java +++ b/src/main/java/forge/gui/download/GuiDownloader.java @@ -65,8 +65,6 @@ import forge.gui.toolbox.FProgressBar; import forge.gui.toolbox.FRadioButton; import forge.gui.toolbox.FSkin; import forge.gui.toolbox.JXButtonPanel; -import forge.properties.ForgeProps; -import forge.properties.NewConstants; import forge.util.FileUtil; import forge.util.MyRandom; @@ -100,21 +98,21 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements private final FPanel pnlDialog = new FPanel(new MigLayout("insets 0, gap 0, wrap, ax center, ay center")); private final FProgressBar barProgress = new FProgressBar(); private final FButton btnStart = new FButton("Start"); - private final JTextField txfAddr = new JTextField(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.PROXY_ADDRESS)); - private final JTextField txfPort = new JTextField(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.PROXY_PORT)); + private final JTextField txfAddr = new JTextField("Proxy Address"); + private final JTextField txfPort = new JTextField("Proxy Port"); private final FLabel btnClose = new FLabel.Builder().text("X") .hoverable(true).fontAlign(SwingConstants.CENTER).cmdClick(cmdClose).build(); - private final JRadioButton radProxyNone = new FRadioButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.NO_PROXY)); - private final JRadioButton radProxySocks = new FRadioButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.SOCKS_PROXY)); - private final JRadioButton radProxyHTTP = new FRadioButton(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.HTTP_PROXY)); + private final JRadioButton radProxyNone = new FRadioButton("No Proxy"); + private final JRadioButton radProxySocks = new FRadioButton("SOCKS Proxy"); + private final JRadioButton radProxyHTTP = new FRadioButton("HTTP Proxy"); // Proxy info private int type; /** */ // Progress variables - private DownloadObject[] cards; /** */ + private ArrayList cards; /** */ private int card; /** */ private boolean cancel; /** */ private final long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /** */ @@ -174,18 +172,18 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements } private void readyToStart() { - if (this.cards.length == 0) { + if (this.cards.size() == 0) { barProgress.setString("All items have been downloaded."); btnStart.setVisible(true); btnStart.setText("OK"); btnStart.addActionListener(actOK); } else { - barProgress.setMaximum(this.cards.length); + barProgress.setMaximum(this.cards.size()); barProgress.setString( - this.cards.length == 1 + this.cards.size() == 1 ? "1 item found." - : this.cards.length + " items found."); + : this.cards.size() + " items found."); btnStart.setVisible(true); btnStart.addActionListener(actStartDownload); @@ -268,10 +266,10 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements final int a = GuiDownloader.this.getAverageTimePerObject(); - if (this.card != GuiDownloader.this.cards.length) { - sb.append(this.card + "/" + GuiDownloader.this.cards.length + " - "); + if (this.card != GuiDownloader.this.cards.size()) { + sb.append(this.card + "/" + GuiDownloader.this.cards.size() + " - "); - long t2Go = (GuiDownloader.this.cards.length - this.card) * a; + long t2Go = (GuiDownloader.this.cards.size() - this.card) * a; boolean secOnly = true; if (t2Go > 3600000) { @@ -290,12 +288,12 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements sb.append(String.format("0:%02d remaining.", t2Go / 1000)); } } else { - sb.append(String.format(ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.BAR_CLOSE), - this.card, GuiDownloader.this.cards.length)); + sb.append(String.format("%d of %d items finished! Please close!", + this.card, GuiDownloader.this.cards.size())); } GuiDownloader.this.barProgress.setString(sb.toString()); - System.out.println(this.card + "/" + GuiDownloader.this.cards.length + " - " + a); + System.out.println(this.card + "/" + GuiDownloader.this.cards.size() + " - " + a); } } EventQueue.invokeLater(new Worker(card)); @@ -322,7 +320,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements Integer.parseInt(this.txfPort.getText()))); } catch (final Exception ex) { BugReporter.reportException(ex, - ForgeProps.getLocalized(NewConstants.Lang.GuiDownloadPictures.Errors.PROXY_CONNECT), + "Proxy connection could not be established!\nProxy address: %s\nProxy port: %s", this.txfAddr.getText(), this.txfPort.getText()); return; } @@ -331,10 +329,9 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements if (p != null) { final byte[] buf = new byte[1024]; int len; - for (this.update(0); (this.card < this.cards.length) && !this.cancel; this.update(this.card + 1)) { - - final String url = this.cards[this.card].getSource(); - final File fileDest = this.cards[this.card].getDestination(); + for (this.update(0); (this.card < this.cards.size()) && !this.cancel; this.update(this.card + 1)) { + final String url = this.cards.get(this.card).getSource(); + final File fileDest = this.cards.get(this.card).getDestination(); final File base = fileDest.getParentFile(); try { @@ -406,7 +403,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements * * @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects. */ - protected abstract DownloadObject[] getNeededImages(); + protected abstract ArrayList getNeededImages(); /** *

@@ -419,8 +416,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements * a {@link java.util.File} object. * @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects. */ - protected static List readFile(final String urlsFile, final File dir) { - List fileLines = FileUtil.readFile(ForgeProps.getFile(urlsFile)); + protected static List readFile(final String urlsFile, String dir) { + List fileLines = FileUtil.readFile(urlsFile); final ArrayList list = new ArrayList(); final Pattern splitter = Pattern.compile(Pattern.quote("/")); final Pattern replacer = Pattern.compile(Pattern.quote("%20")); @@ -452,8 +449,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements * a {@link java.util.File} object. * @return an array of {@link forge.gui.download.GuiDownloader.DownloadObject} objects. */ - protected static ArrayList readFileWithNames(final String urlNamesFile, final File dir) { - List fileLines = FileUtil.readFile(ForgeProps.getFile(urlNamesFile)); + protected static ArrayList readFileWithNames(final String urlNamesFile, final String dir) { + List fileLines = FileUtil.readFile(urlNamesFile); final ArrayList list = new ArrayList(); final Pattern splitter = Pattern.compile(Pattern.quote(" ")); final Pattern replacer = Pattern.compile(Pattern.quote("%20")); diff --git a/src/main/java/forge/gui/framework/DragCell.java b/src/main/java/forge/gui/framework/DragCell.java index e2fafac1005..6697de1d12e 100644 --- a/src/main/java/forge/gui/framework/DragCell.java +++ b/src/main/java/forge/gui/framework/DragCell.java @@ -14,9 +14,10 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; +import net.miginfocom.swing.MigLayout; + import com.google.common.collect.Lists; -import net.miginfocom.swing.MigLayout; import forge.gui.toolbox.FPanel; import forge.gui.toolbox.FSkin; import forge.view.FView; diff --git a/src/main/java/forge/gui/framework/SLayoutIO.java b/src/main/java/forge/gui/framework/SLayoutIO.java index d46d4d0b686..ec42327b962 100644 --- a/src/main/java/forge/gui/framework/SLayoutIO.java +++ b/src/main/java/forge/gui/framework/SLayoutIO.java @@ -21,6 +21,7 @@ import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import forge.control.FControl; +import forge.properties.FileLocation; import forge.properties.NewConstants; import forge.view.FView; @@ -40,8 +41,7 @@ public final class SLayoutIO { doc } - private static String fileDefault = null; - private static String filePreferred = null; + private static FileLocation file = null; private static final XMLEventFactory EF = XMLEventFactory.newInstance(); private static final XMLEvent NEWLINE = EF.createDTD("\n"); private static final XMLEvent TAB = EF.createDTD("\t"); @@ -51,7 +51,7 @@ public final class SLayoutIO { * @return {@link java.lang.String} */ public static String getFilePreferred() { - return filePreferred; + return null == file ? null : file.userPrefLoc; } /** Publicly-accessible save method, to neatly handle exception handling. @@ -83,7 +83,10 @@ public final class SLayoutIO { SLayoutIO.setFilesForState(); if (f0 == null) { - fWriteTo = filePreferred; + if (null == file) { + return; + } + fWriteTo = file.userPrefLoc; } else { fWriteTo = f0.getPath(); @@ -144,12 +147,12 @@ public final class SLayoutIO { final XMLEventReader reader; if (f != null && f.exists()) { reader = inputFactory.createXMLEventReader(new FileInputStream(f)); - } - else if (new File(filePreferred).exists()) { - reader = inputFactory.createXMLEventReader(new FileInputStream(filePreferred)); - } - else { - reader = inputFactory.createXMLEventReader(new FileInputStream(fileDefault)); + } else if (null == file) { + reader = null; + } else if (new File(file.userPrefLoc).exists()) { + reader = inputFactory.createXMLEventReader(new FileInputStream(file.userPrefLoc)); + } else { + reader = inputFactory.createXMLEventReader(new FileInputStream(file.defaultLoc)); } view.removeAllDragCells(); @@ -160,7 +163,7 @@ public final class SLayoutIO { DragCell cell = null; double x0 = 0, y0 = 0, w0 = 0, h0 = 0; - while (reader.hasNext()) { + while (null != reader && reader.hasNext()) { event = reader.nextEvent(); if (event.isStartElement()) { @@ -217,28 +220,22 @@ public final class SLayoutIO { * Always called before a load or a save, to ensure file addresses are correct. */ private static void setFilesForState() { - final String dir = NewConstants.LAYOUT_DIR; - switch(FControl.SINGLETON_INSTANCE.getState()) { case HOME_SCREEN: - fileDefault = dir + "home_default.xml"; - filePreferred = dir + "home_preferred.xml"; + file = NewConstants.HOME_LAYOUT_FILE; break; case MATCH_SCREEN: - fileDefault = dir + "match_default.xml"; - filePreferred = dir + "match_preferred.xml"; + file = NewConstants.MATCH_LAYOUT_FILE; break; case DECK_EDITOR_CONSTRUCTED: case DECK_EDITOR_LIMITED: case DECK_EDITOR_QUEST: case DRAFTING_PROCESS: case QUEST_CARD_SHOP: - fileDefault = dir + "editor_default.xml"; - filePreferred = dir + "editor_preferred.xml"; + file = NewConstants.EDITOR_LAYOUT_FILE; break; case QUEST_BAZAAR: - fileDefault = dir + "bazaar_default.xml"; - filePreferred = dir + "bazaar_preferred.xml"; + file = null; break; default: throw new IllegalStateException("Layout load failed; UI state unknown."); diff --git a/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java b/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java index 4fe69dbf67d..8e4fb696072 100644 --- a/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java +++ b/src/main/java/forge/gui/home/quest/CSubmenuQuestData.java @@ -14,13 +14,12 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import forge.Command; +import forge.Singletons; import forge.deck.Deck; import forge.deck.DeckSection; -import forge.Singletons; import forge.game.GameFormat; import forge.gui.framework.ICDoc; import forge.item.CardPrinted; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.QuestController; import forge.quest.QuestMode; @@ -100,7 +99,7 @@ public enum CSubmenuQuestData implements ICDoc { @Override public void update() { final VSubmenuQuestData view = VSubmenuQuestData.SINGLETON_INSTANCE; - final File dirQuests = ForgeProps.getFile(NewConstants.Quest.DATA_DIR); + final File dirQuests = new File(NewConstants.QUEST_SAVE_DIR); final QuestController qc = Singletons.getModel().getQuest(); // Temporary transition code between v1.2.2 and v1.2.3. diff --git a/src/main/java/forge/gui/home/quest/PnlEvent.java b/src/main/java/forge/gui/home/quest/PnlEvent.java index 780eb3f17be..e7222732ea0 100644 --- a/src/main/java/forge/gui/home/quest/PnlEvent.java +++ b/src/main/java/forge/gui/home/quest/PnlEvent.java @@ -19,7 +19,6 @@ import net.miginfocom.swing.MigLayout; import forge.gui.toolbox.FRadioButton; import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FTextArea; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.QuestEvent; @@ -55,8 +54,7 @@ class PnlEvent extends JPanel { this.event = e0; // Icon - final File base = ForgeProps.getFile(NewConstants.IMAGE_ICON); - final File file = new File(base, event.getIconFilename()); + final File file = new File(NewConstants.CACHE_ICON_PICS_DIR, event.getIconFilename()); if (!file.exists()) { img = FSkin.getIcon(FSkin.InterfaceIcons.ICO_UNKNOWN).getImage(); diff --git a/src/main/java/forge/gui/home/quest/QuestFileLister.java b/src/main/java/forge/gui/home/quest/QuestFileLister.java index f6817303740..4964eac2439 100644 --- a/src/main/java/forge/gui/home/quest/QuestFileLister.java +++ b/src/main/java/forge/gui/home/quest/QuestFileLister.java @@ -20,7 +20,6 @@ import net.miginfocom.swing.MigLayout; import forge.Command; import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FSkin; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.data.QuestData; @@ -315,8 +314,8 @@ public class QuestFileLister extends JPanel { return; } else { - File newpath = new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR) + File.separator + questName + ".dat"); - File oldpath = new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR) + File.separator + s0 + ".dat"); + File newpath = new File(NewConstants.QUEST_SAVE_DIR, questName + ".dat"); + File oldpath = new File(NewConstants.QUEST_SAVE_DIR, s0 + ".dat"); oldpath.renameTo(newpath); } @@ -335,7 +334,7 @@ public class QuestFileLister extends JPanel { return; } - new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR) + File.separator + r0.getQuestData().getName() + ".dat").delete(); + new File(NewConstants.QUEST_SAVE_DIR, r0.getQuestData().getName() + ".dat").delete(); if (cmdRowDelete != null) { cmdRowDelete.execute(); } diff --git a/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java b/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java index c29ec99a05a..85529443409 100644 --- a/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java +++ b/src/main/java/forge/gui/home/sanctioned/VSubmenuConstructed.java @@ -3,6 +3,7 @@ package forge.gui.home.sanctioned; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JPanel; + import net.miginfocom.swing.MigLayout; import forge.game.player.PlayerType; import forge.gui.framework.DragCell; diff --git a/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java b/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java index 97fb6dcec49..4bc82a813fd 100644 --- a/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java +++ b/src/main/java/forge/gui/home/settings/VSubmenuDownloaders.java @@ -27,8 +27,8 @@ import forge.gui.toolbox.FPanel; import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FTextArea; -import forge.properties.ForgeProps; -import forge.properties.NewConstants.Lang; +import forge.properties.NewConstants; +import forge.util.FileUtil; /** * Assembles Swing components of utilities submenu singleton. @@ -175,7 +175,7 @@ public enum VSubmenuDownloaders implements IVSubmenu { } public void showHowToPlay() { - FTextArea directions = new FTextArea(ForgeProps.getLocalized(Lang.HowTo.MESSAGE)); + FTextArea directions = new FTextArea(FileUtil.readFileToString(NewConstants.TEXT_HOWTO_FILE)); final FScrollPane scr = new FScrollPane(directions, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scr.setBorder(null); diff --git a/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java b/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java index 084902e503f..fb0a074ec9b 100644 --- a/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java +++ b/src/main/java/forge/gui/home/settings/VSubmenuPreferences.java @@ -42,8 +42,6 @@ import forge.gui.toolbox.FList; import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FSkin; import forge.properties.ForgePreferences.FPref; -import forge.properties.ForgeProps; -import forge.properties.NewConstants.Lang.OldGuiNewGame.NewGameText; /** * Assembles Swing components of preferences submenu singleton. @@ -82,7 +80,7 @@ public enum VSubmenuPreferences implements IVSubmenu { private final JCheckBox cbUploadDraft = new OptionsCheckBox("Upload Draft Picks"); private final JCheckBox cbStackLand = new OptionsCheckBox("Stack AI Land"); private final JCheckBox cbManaBurn = new OptionsCheckBox("Mana Burn"); - private final JCheckBox cbDevMode = new OptionsCheckBox(ForgeProps.getLocalized(NewGameText.DEV_MODE)); + private final JCheckBox cbDevMode = new OptionsCheckBox("Developer Mode"); private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance"); private final JCheckBox cbTextMana = new OptionsCheckBox("Text / Mana Overlay"); private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger"); diff --git a/src/main/java/forge/gui/match/CMatchUI.java b/src/main/java/forge/gui/match/CMatchUI.java index 5d18f17ed69..930689a4825 100644 --- a/src/main/java/forge/gui/match/CMatchUI.java +++ b/src/main/java/forge/gui/match/CMatchUI.java @@ -42,7 +42,6 @@ import forge.gui.match.nonsingleton.VHand; import forge.gui.toolbox.FSkin; import forge.item.InventoryItem; import forge.properties.ForgePreferences.FPref; -import forge.properties.ForgeProps; import forge.properties.NewConstants; /** @@ -60,7 +59,7 @@ public enum CMatchUI { private Image getPlayerAvatar(final Player p, final int defaultIndex) { String strAvatarIcon = p.getLobbyPlayer().getPicture(); if (strAvatarIcon != null) { - final File f = new File(ForgeProps.getFile(NewConstants.IMAGE_ICON), strAvatarIcon); + final File f = new File(NewConstants.CACHE_ICON_PICS_DIR, strAvatarIcon); if (f.exists()) { return new ImageIcon(f.getPath()).getImage(); } diff --git a/src/main/java/forge/gui/match/ControlWinLose.java b/src/main/java/forge/gui/match/ControlWinLose.java index 8594496e076..3fb23292af5 100644 --- a/src/main/java/forge/gui/match/ControlWinLose.java +++ b/src/main/java/forge/gui/match/ControlWinLose.java @@ -11,8 +11,8 @@ import forge.Card; import forge.Singletons; import forge.control.FControl; import forge.deck.Deck; -import forge.game.GameType; import forge.game.GameOutcome; +import forge.game.GameType; import forge.game.MatchController; import forge.game.player.Player; import forge.game.zone.ZoneType; diff --git a/src/main/java/forge/gui/match/QuestWinLose.java b/src/main/java/forge/gui/match/QuestWinLose.java index 0c6c59ec5ee..c067a562465 100644 --- a/src/main/java/forge/gui/match/QuestWinLose.java +++ b/src/main/java/forge/gui/match/QuestWinLose.java @@ -17,22 +17,34 @@ package forge.gui.match; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Image; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; + +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.SwingConstants; + import forge.Card; import forge.Singletons; -import forge.control.FControl; - import forge.card.BoosterData; import forge.card.CardEdition; import forge.card.UnOpenedProduct; +import forge.control.FControl; import forge.game.GameEndReason; import forge.game.GameFormat; import forge.game.GameLossReason; import forge.game.GameOutcome; import forge.game.MatchController; import forge.game.player.LobbyPlayer; +import forge.game.player.Player; import forge.game.player.PlayerOutcome; import forge.game.player.PlayerStatistics; -import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; import forge.gui.ListChooser; @@ -47,28 +59,15 @@ import forge.item.InventoryItem; import forge.item.OpenablePack; import forge.item.TournamentPack; import forge.properties.ForgePreferences.FPref; -import forge.quest.QuestEventChallenge; +import forge.quest.IQuestRewardCard; import forge.quest.QuestController; import forge.quest.QuestEvent; -import forge.quest.IQuestRewardCard; +import forge.quest.QuestEventChallenge; import forge.quest.bazaar.QuestItemType; import forge.quest.data.QuestPreferences; import forge.quest.data.QuestPreferences.QPref; import forge.util.MyRandom; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Image; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map.Entry; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.SwingConstants; - /** *

* QuestWinLose. diff --git a/src/main/java/forge/gui/match/VAssignDamage.java b/src/main/java/forge/gui/match/VAssignDamage.java index 4fc26a3dbbc..e7180dae5d3 100644 --- a/src/main/java/forge/gui/match/VAssignDamage.java +++ b/src/main/java/forge/gui/match/VAssignDamage.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; diff --git a/src/main/java/forge/gui/match/ViewWinLose.java b/src/main/java/forge/gui/match/ViewWinLose.java index 81ff07f4922..be07ea41e60 100644 --- a/src/main/java/forge/gui/match/ViewWinLose.java +++ b/src/main/java/forge/gui/match/ViewWinLose.java @@ -24,8 +24,6 @@ import forge.gui.toolbox.FOverlay; import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FTextArea; -import forge.properties.ForgeProps; -import forge.properties.NewConstants.Lang.GuiWinLose.WinLoseText; /** * TODO: Write javadoc for this type. @@ -95,11 +93,11 @@ public class ViewWinLose { lblStats.setHorizontalAlignment(SwingConstants.CENTER); lblStats.setFont(FSkin.getFont().deriveFont(Font.PLAIN, 26)); - btnContinue.setText(ForgeProps.getLocalized(WinLoseText.CONTINUE)); + btnContinue.setText("Continue"); btnContinue.setFont(FSkin.getFont(22)); - btnRestart.setText(ForgeProps.getLocalized(WinLoseText.RESTART)); + btnRestart.setText("Restart"); btnRestart.setFont(FSkin.getFont(22)); - btnQuit.setText(ForgeProps.getLocalized(WinLoseText.QUIT)); + btnQuit.setText("Quit"); btnQuit.setFont(FSkin.getFont(22)); btnContinue.setEnabled(!match.isMatchOver()); diff --git a/src/main/java/forge/gui/match/nonsingleton/CCommand.java b/src/main/java/forge/gui/match/nonsingleton/CCommand.java index 0e19f4339c2..28fc6ed8aeb 100644 --- a/src/main/java/forge/gui/match/nonsingleton/CCommand.java +++ b/src/main/java/forge/gui/match/nonsingleton/CCommand.java @@ -26,7 +26,6 @@ import java.util.Observable; import java.util.Observer; import forge.Card; - import forge.Command; import forge.game.player.Player; import forge.game.zone.ZoneType; diff --git a/src/main/java/forge/gui/match/nonsingleton/CField.java b/src/main/java/forge/gui/match/nonsingleton/CField.java index 2e14f5e8dae..fb6c7bcf443 100644 --- a/src/main/java/forge/gui/match/nonsingleton/CField.java +++ b/src/main/java/forge/gui/match/nonsingleton/CField.java @@ -49,15 +49,12 @@ import forge.game.player.Player; import forge.game.zone.PlayerZone; import forge.game.zone.ZoneType; import forge.gui.ForgeAction; +import forge.gui.ForgeAction.MatchConstants; import forge.gui.GuiChoose; import forge.gui.framework.ICDoc; import forge.gui.match.CMatchUI; import forge.gui.match.controllers.CMessage; import forge.gui.toolbox.FLabel; -import forge.properties.ForgeProps; -import forge.properties.NewConstants; -import forge.properties.NewConstants.Lang.GuiDisplay.HumanHand; -import forge.properties.NewConstants.Lang.GuiDisplay.HumanLibrary; /** * Controls Swing components of a player's field instance. @@ -273,9 +270,9 @@ public class CField implements ICDoc { * @param property *   String obj */ - public ZoneAction(final PlayerZone zone, final String property) { + public ZoneAction(final PlayerZone zone, MatchConstants property) { super(property); - this.title = ForgeProps.getLocalized(property + "/title"); + this.title = property.title; this.zone = zone; } @@ -327,17 +324,15 @@ public class CField implements ICDoc { /** */ private void handAction() { if ( CField.this.player == playerViewer || Preferences.DEV_MODE || CField.this.player.hasKeyword("Play with your hand revealed.")) { - new ZoneAction(CField.this.player.getZone(ZoneType.Hand), HumanHand.BASE) + new ZoneAction(CField.this.player.getZone(ZoneType.Hand), MatchConstants.HUMANHAND) .actionPerformed(null); } } /** */ + @SuppressWarnings("serial") private void flashbackAction() { - new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), NewConstants.Lang.GuiDisplay.HUMAN_FLASHBACK) { - - private static final long serialVersionUID = 8120331222693706164L; - + new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), MatchConstants.HUMANFLASHBACK) { @Override protected List getCardsAsIterable() { return CardFactoryUtil.getExternalZoneActivationCards(player); @@ -356,23 +351,22 @@ public class CField implements ICDoc { } } }.actionPerformed(null); - } /** */ private void libraryAction() { if (!Preferences.DEV_MODE) { return; } - new ZoneAction(CField.this.player.getZone(ZoneType.Library), HumanLibrary.BASE).actionPerformed(null); + new ZoneAction(CField.this.player.getZone(ZoneType.Library), MatchConstants.HUMANLIBRARY).actionPerformed(null); } /** */ private void exiledAction() { - new ZoneAction(CField.this.player.getZone(ZoneType.Exile), NewConstants.Lang.GuiDisplay.HUMAN_EXILED).actionPerformed(null); + new ZoneAction(CField.this.player.getZone(ZoneType.Exile), MatchConstants.HUMANEXILED).actionPerformed(null); } private void graveyardAction() { - new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), NewConstants.Lang.GuiDisplay.HUMAN_GRAVEYARD).actionPerformed(null); + new ZoneAction(CField.this.player.getZone(ZoneType.Graveyard), MatchConstants.HUMANGRAVEYARD).actionPerformed(null); } private void avatarAction() { diff --git a/src/main/java/forge/gui/match/views/VPlayers.java b/src/main/java/forge/gui/match/views/VPlayers.java index c00103bb479..fa14bc82a4e 100644 --- a/src/main/java/forge/gui/match/views/VPlayers.java +++ b/src/main/java/forge/gui/match/views/VPlayers.java @@ -27,7 +27,6 @@ import javax.swing.border.MatteBorder; import net.miginfocom.swing.MigLayout; import forge.Card; - import forge.Singletons; import forge.game.player.Player; import forge.game.zone.ZoneType; diff --git a/src/main/java/forge/gui/match/views/VStack.java b/src/main/java/forge/gui/match/views/VStack.java index f652a9f3e9a..45364e7f5b9 100644 --- a/src/main/java/forge/gui/match/views/VStack.java +++ b/src/main/java/forge/gui/match/views/VStack.java @@ -36,6 +36,7 @@ import forge.Singletons; import forge.card.spellability.SpellAbilityStackInstance; import forge.game.zone.MagicStack; import forge.gui.ForgeAction; +import forge.gui.ForgeAction.MatchConstants; import forge.gui.framework.DragCell; import forge.gui.framework.DragTab; import forge.gui.framework.EDocID; @@ -43,7 +44,6 @@ import forge.gui.framework.IVDoc; import forge.gui.match.CMatchUI; import forge.gui.match.controllers.CStack; import forge.gui.toolbox.FSkin; -import forge.properties.NewConstants; /** * Assembles Swing components of stack report. @@ -230,34 +230,28 @@ public enum VStack implements IVDoc { //========= Custom class handling + @SuppressWarnings("serial") private class TriggerReactionMenu extends JPopupMenu { - private static final long serialVersionUID = 6665085414634139984L; private int workTrigID; public TriggerReactionMenu() { super(); - final ForgeAction actAccept = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSACCEPT) { - private static final long serialVersionUID = -3734674058185367612L; - + final ForgeAction actAccept = new ForgeAction(MatchConstants.ALWAYSACCEPT) { @Override public final void actionPerformed(final ActionEvent e) { Singletons.getModel().getGame().getTriggerHandler().setAlwaysAcceptTrigger(TriggerReactionMenu.this.workTrigID); } }; - final ForgeAction actDecline = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSDECLINE) { - private static final long serialVersionUID = -1983295769159971502L; - + final ForgeAction actDecline = new ForgeAction(MatchConstants.ALWAYSDECLINE) { @Override public final void actionPerformed(final ActionEvent e) { Singletons.getModel().getGame().getTriggerHandler().setAlwaysDeclineTrigger(TriggerReactionMenu.this.workTrigID); } }; - final ForgeAction actAsk = new ForgeAction(NewConstants.Lang.GuiDisplay.Trigger.ALWAYSASK) { - private static final long serialVersionUID = 5045255351332940821L; - + final ForgeAction actAsk = new ForgeAction(MatchConstants.ALWAYSASK) { @Override public final void actionPerformed(final ActionEvent e) { Singletons.getModel().getGame().getTriggerHandler().setAlwaysAskTrigger(TriggerReactionMenu.this.workTrigID); diff --git a/src/main/java/forge/gui/toolbox/CardFaceSymbols.java b/src/main/java/forge/gui/toolbox/CardFaceSymbols.java index a2e05e06e9f..7734d2d0906 100644 --- a/src/main/java/forge/gui/toolbox/CardFaceSymbols.java +++ b/src/main/java/forge/gui/toolbox/CardFaceSymbols.java @@ -24,11 +24,10 @@ import java.util.List; import java.util.Map; import java.util.StringTokenizer; - import com.esotericsoftware.minlog.Log; -import forge.card.mana.ManaCostShard; import forge.card.mana.ManaCost; +import forge.card.mana.ManaCostShard; /** *

diff --git a/src/main/java/forge/gui/toolbox/SaveOpenDialog.java b/src/main/java/forge/gui/toolbox/SaveOpenDialog.java index d70726f0637..e0624a87152 100644 --- a/src/main/java/forge/gui/toolbox/SaveOpenDialog.java +++ b/src/main/java/forge/gui/toolbox/SaveOpenDialog.java @@ -19,8 +19,9 @@ package forge.gui.toolbox; import java.io.File; -import javax.swing.JPanel; + import javax.swing.JFileChooser; +import javax.swing.JPanel; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; diff --git a/src/main/java/forge/item/BoosterPack.java b/src/main/java/forge/item/BoosterPack.java index c79592316ad..be3c86d43dc 100644 --- a/src/main/java/forge/item/BoosterPack.java +++ b/src/main/java/forge/item/BoosterPack.java @@ -40,7 +40,7 @@ public class BoosterPack extends OpenablePack { @Override public final String getImageFilename() { - return ImageCache.SEALED_PRODUCT + "booster/" + this.contents.getEdition() + ".png"; + return ImageCache.BOOSTER_PREFIX + this.contents.getEdition(); } @Override diff --git a/src/main/java/forge/item/CardDb.java b/src/main/java/forge/item/CardDb.java index 825c4433dd0..b3e058d4cc8 100644 --- a/src/main/java/forge/item/CardDb.java +++ b/src/main/java/forge/item/CardDb.java @@ -26,7 +26,6 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.TreeMap; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; diff --git a/src/main/java/forge/item/FatPack.java b/src/main/java/forge/item/FatPack.java index 8ae69aa3722..ff258c28f8d 100644 --- a/src/main/java/forge/item/FatPack.java +++ b/src/main/java/forge/item/FatPack.java @@ -53,7 +53,7 @@ public class FatPack extends OpenablePack { @Override public final String getImageFilename() { - return ImageCache.SEALED_PRODUCT + "fatpacks/" + this.contents.getEdition(); + return ImageCache.FATPACK_PREFIX + this.contents.getEdition(); } diff --git a/src/main/java/forge/item/IPaperCard.java b/src/main/java/forge/item/IPaperCard.java index e84345dba4e..3f6946aa329 100644 --- a/src/main/java/forge/item/IPaperCard.java +++ b/src/main/java/forge/item/IPaperCard.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Set; import com.google.common.base.Predicate; + import forge.Card; import forge.card.CardRarity; import forge.card.CardRules; diff --git a/src/main/java/forge/item/PreconDeck.java b/src/main/java/forge/item/PreconDeck.java index 3057a8072c4..108a430e19c 100644 --- a/src/main/java/forge/item/PreconDeck.java +++ b/src/main/java/forge/item/PreconDeck.java @@ -23,7 +23,6 @@ import java.util.Map; import com.google.common.base.Function; - import forge.ImageCache; import forge.Singletons; import forge.deck.Deck; @@ -61,7 +60,7 @@ public class PreconDeck implements InventoryItemFromSet { */ @Override public String getImageFilename() { - return ImageCache.SEALED_PRODUCT + "precons/" + this.imageFilename; + return ImageCache.PRECON_PREFIX + imageFilename; } /* diff --git a/src/main/java/forge/item/TournamentPack.java b/src/main/java/forge/item/TournamentPack.java index e842da23273..76c40616466 100644 --- a/src/main/java/forge/item/TournamentPack.java +++ b/src/main/java/forge/item/TournamentPack.java @@ -42,12 +42,6 @@ public class TournamentPack extends OpenablePack { } }; - /** - * Instantiates a new booster pack. - * - * @param set - * the set - */ public TournamentPack(final String name0, final BoosterData boosterData) { super(name0, boosterData); } @@ -55,7 +49,7 @@ public class TournamentPack extends OpenablePack { @Override public final String getImageFilename() { - return ImageCache.SEALED_PRODUCT + "tournamentpacks/" + this.contents.getEdition(); + return ImageCache.TOURNAMENTPACK_PREFIX + contents.getEdition(); } public final boolean isStarterDeck() { diff --git a/src/main/java/forge/model/FModel.java b/src/main/java/forge/model/FModel.java index 6e7df7681c8..f2de6f9a6ff 100644 --- a/src/main/java/forge/model/FModel.java +++ b/src/main/java/forge/model/FModel.java @@ -43,13 +43,10 @@ import forge.game.player.LobbyPlayer; import forge.gauntlet.GauntletData; import forge.properties.ForgePreferences; import forge.properties.ForgePreferences.FPref; -import forge.properties.ForgeProps; -import forge.properties.NewConstants; import forge.quest.QuestController; import forge.quest.QuestWorld; import forge.quest.data.QuestPreferences; import forge.util.FileUtil; -import forge.util.HttpUtil; import forge.util.MultiplexOutputStream; import forge.util.storage.IStorageView; import forge.util.storage.StorageView; @@ -64,16 +61,12 @@ import forge.util.storage.StorageView; * this class must be either private or public static final. */ public enum FModel { - - /** The SINGLETO n_ instance. */ SINGLETON_INSTANCE; - // private static final int NUM_INIT_PHASES = 1; private final PrintStream oldSystemOut; private final PrintStream oldSystemErr; private OutputStream logFileStream; - private final QuestPreferences questPreferences; private final ForgePreferences preferences; @@ -148,14 +141,11 @@ public enum FModel { // TODO - there's got to be a better place for this...oblivion? Preferences.DEV_MODE = this.preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED); - - testNetworkConnection(); - this.loadDynamicGamedata(); // Loads all cards (using progress bar). - this.cardFactory = new CardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)); - this.decks = new CardCollections(ForgeProps.getFile(NewConstants.NEW_DECKS)); + this.cardFactory = new CardFactory(); + this.decks = new CardCollections(); this.quest = new QuestController(); } @@ -163,24 +153,6 @@ public enum FModel { return quest; } - /** - * Tests if draft upload is technically possible. - * Separate thread, no more hangs when network connection is limited - */ - private void testNetworkConnection() { - - Runnable runNetworkTest = new Runnable() { - @Override - public void run() { - final HttpUtil pinger = new HttpUtil(); - final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php"; - Constant.Runtime.NET_CONN = pinger.getURL(url).equals("pong"); - } - }; - Thread testNetConnection = new Thread(runNetworkTest, "CheckRemoteDraftAI"); - testNetConnection.start(); - } - /** * Load dynamic gamedata. */ @@ -356,14 +328,10 @@ public enum FModel { * Finalizer, generally should be avoided, but here closes the log file * stream and resets the system output streams. */ - public final void close() { + public final void close() throws IOException { System.setOut(this.oldSystemOut); System.setErr(this.oldSystemErr); - try { - this.logFileStream.close(); - } catch (final IOException e) { - // ignored - } + logFileStream.close(); } /** @return {@link forge.util.storage.IStorageView}<{@link forge.card.CardBlock}> */ diff --git a/src/main/java/forge/properties/FileLocation.java b/src/main/java/forge/properties/FileLocation.java new file mode 100644 index 00000000000..e406a7c9d7c --- /dev/null +++ b/src/main/java/forge/properties/FileLocation.java @@ -0,0 +1,28 @@ +/* + * Forge: Play Magic: the Gathering. + * Copyright (C) 2011 Forge Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package forge.properties; + +public final class FileLocation { + public final String defaultLoc; + public final String userPrefLoc; + + FileLocation (String defaultPrefix, String userPrefix, String commonSuffix) { + defaultLoc = defaultPrefix + commonSuffix; + userPrefLoc = userPrefix + commonSuffix; + } +} diff --git a/src/main/java/forge/properties/ForgePreferences.java b/src/main/java/forge/properties/ForgePreferences.java index 71898429bac..a1c398d1624 100644 --- a/src/main/java/forge/properties/ForgePreferences.java +++ b/src/main/java/forge/properties/ForgePreferences.java @@ -18,7 +18,6 @@ package forge.properties; import java.io.BufferedWriter; -import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; @@ -26,8 +25,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.google.common.io.Files; - import forge.Constant; import forge.Constant.Preferences; import forge.gui.home.EMenuItem; @@ -162,37 +159,20 @@ public class ForgePreferences { /** Instantiates a ForgePreferences object. */ public ForgePreferences() { preferenceValues = new HashMap(); - try { - // Preferences files have been consolidated into res/prefs/. - // This code is here temporarily to facilitate this transfer. - // After a while, this can be deleted. Doublestrike 21-5-12 - final File oldFile = new File("forge.preferences"); + List lines = FileUtil.readFile(NewConstants.MAIN_PREFERENCES_FILE.userPrefLoc); + for (String line : lines) { - if (oldFile.exists()) { - final File newFile = new File(NewConstants.PREFS_GLOBAL_FILE); - Files.copy(oldFile, newFile); - oldFile.delete(); - } // END TEMPORARY CONSOLIDATION FACILITATION - - List lines = FileUtil.readFile(NewConstants.PREFS_GLOBAL_FILE); - for (String line : lines) { - - if (line.startsWith("#") || (line.length() == 0)) { - continue; - } - - final String[] split = line.split("="); - - if (split.length == 2) { - this.setPref(split[0], split[1]); - } else if (split.length == 1 && line.endsWith("=")) { - this.setPref(split[0], ""); - } + if (line.startsWith("#") || (line.length() == 0)) { + continue; + } + + final String[] split = line.split("="); + + if (split.length == 2) { + this.setPref(split[0], split[1]); + } else if (split.length == 1 && line.endsWith("=")) { + this.setPref(split[0], ""); } - } catch (FileNotFoundException ex) { - //ex.printStackTrace(); - } catch (IOException ex) { - //ex.printStackTrace(); } } @@ -287,7 +267,7 @@ public class ForgePreferences { BufferedWriter writer = null; try { - writer = new BufferedWriter(new FileWriter(NewConstants.PREFS_GLOBAL_FILE)); + writer = new BufferedWriter(new FileWriter(NewConstants.MAIN_PREFERENCES_FILE.userPrefLoc)); for (FPref key : FPref.values()) { writer.write(key + "=" + getPref(key)); writer.newLine(); diff --git a/src/main/java/forge/properties/ForgeProfileProperties.java b/src/main/java/forge/properties/ForgeProfileProperties.java new file mode 100644 index 00000000000..4a9e0d1e1e7 --- /dev/null +++ b/src/main/java/forge/properties/ForgeProfileProperties.java @@ -0,0 +1,100 @@ +/* + * Forge: Play Magic: the Gathering. + * Copyright (C) 2011 Forge Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package forge.properties; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.tuple.Pair; + +/** + * Determines the user data and cache dirs, first looking at the specified file for overrides + * then falling back to platform-specific defaults. Resulting dir strings are guaranteed to end in a slash + * so they can be easily appended with further path elements. + */ +public class ForgeProfileProperties { + public final String userDir; + public final String cacheDir; + + private final String _USER_DIR_KEY = "userDir"; + private final String _CACHE_DIR_KEY = "cacheDir"; + + public ForgeProfileProperties(String filename) { + Properties props = new Properties(); + File propFile = new File(filename); + try { + if (propFile.canRead()) { + props.load(new FileInputStream(propFile)); + } + } catch (IOException e) { + // ignore + } + + Pair defaults = _getDefaultDirs(); + + String propUserDir = props.getProperty(_USER_DIR_KEY, defaults.getLeft()); + String propCacheDir = props.getProperty(_CACHE_DIR_KEY, defaults.getRight()); + + // use defaults if the dirs are "defined" as empty strings in the properties file + propUserDir = StringUtils.isEmpty(propUserDir) ? defaults.getLeft() : propUserDir.trim(); + propCacheDir = StringUtils.isEmpty(propCacheDir) ? defaults.getRight() : propCacheDir.trim(); + + propUserDir += propUserDir.endsWith("/") || propUserDir.endsWith(File.pathSeparator) ? "" : "/"; + propCacheDir += propCacheDir.endsWith("/") || propCacheDir.endsWith(File.pathSeparator) ? "" : "/"; + + userDir = propUserDir; + cacheDir = propCacheDir; + } + + // returns a pair + private Pair _getDefaultDirs() { + String osName = System.getProperty("os.name"); + String homeDir = System.getProperty("user.home"); + + if (StringUtils.isEmpty(osName) || StringUtils.isEmpty(homeDir)) { + throw new RuntimeException("cannot determine OS and user home directory"); + } + + String fallbackDataDir = String.format("%s/.forge", homeDir); + + if (StringUtils.containsIgnoreCase("windows", osName)) { + // the split between appdata and localappdata on windows is relatively recent. If + // localappdata is not defined, use appdata for both. + String appRoot = System.getenv().get("APPDATA"); + if (StringUtils.isEmpty(appRoot)) { + appRoot = fallbackDataDir; + } + String cacheRoot = System.getenv().get("LOCALAPPDATA"); + if (StringUtils.isEmpty(cacheRoot)) { + cacheRoot = appRoot; + } + // just use '/' everywhere instead of file.separator. it always works + return Pair.of(String.format("%s/Forge", appRoot), + String.format("%s/Forge/Cache", cacheRoot)); + } else if (StringUtils.containsIgnoreCase("mac os x", osName)) { + return Pair.of(String.format("%s/Library/Application Support/Forge", homeDir), + String.format("%s/Library/Caches/Forge", homeDir)); + } + + // Linux and everything else + return Pair.of(fallbackDataDir, String.format("%s/.cache/forge", homeDir)); + } +} diff --git a/src/main/java/forge/properties/ForgeProps.java b/src/main/java/forge/properties/ForgeProps.java deleted file mode 100644 index 502e6c76813..00000000000 --- a/src/main/java/forge/properties/ForgeProps.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Forge: Play Magic: the Gathering. - * Copyright (C) 2011 Forge Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package forge.properties; - -/** - * ForgeProps.java - * - * Created on 30.08.2009 - */ - -import java.io.File; -import java.io.IOException; -import java.util.Locale; - -import forge.error.BugReporter; -import forge.util.TreeProperties; - -/** - * The class ForgeProps. Wrapper around TreeProperties to support the uses in - * forge. - * - * @author Forge - * @version $Id$ - */ -public class ForgeProps { - /** Constant properties. */ - private static final TreeProperties PROPERTIES; - - static { - TreeProperties p; - try { - p = new TreeProperties(NewConstants.PREFS_MAIN_PROPERTIES_FILE); - p.rethrow(); - } catch (final IOException ex) { - BugReporter.reportException(ex); - p = null; - } - PROPERTIES = p; - } - - /** - * Returns the tree properties of forge. - * - * @return a {@link forge.util.TreeProperties} object. - */ - public static TreeProperties getProperties() { - return ForgeProps.PROPERTIES; - } - - /** - * Returns the string property value, or null if there's no such property. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public static String getProperty(final String key) { - return ForgeProps.getProperty(key, null); - } - - /** - * Returns the string property value, or def if there's no such property. - * - * @param key - * a {@link java.lang.String} object. - * @param def - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public static String getProperty(final String key, final String def) { - String result; - try { - result = ForgeProps.getProperties().getProperty(key); - if (result == null) { - result = def; - } - } catch (final Exception ex) { - result = def; - } - return result; - } - - /** - * Returns the File property value, or null if there's no such property. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link java.io.File} object. - */ - public static File getFile(final String key) { - return ForgeProps.getFile(key, null); - } - - /** - * Returns the File property value, or def if there's no such property. - * - * @param key - * a {@link java.lang.String} object. - * @param def - * a {@link java.io.File} object. - * @return a {@link java.io.File} object. - */ - public static File getFile(final String key, final File def) { - File result; - try { - result = ForgeProps.getProperties().getFile(key); - if (result == null) { - result = def; - } - } catch (final Exception ex) { - result = def; - } - return result; - } - - /** - * Returns the localized version of the specified property. The key is a - * format string containing "%s", which is replaced with a language code - * (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured - * language is used. Second, the locale's code is used. If none of them - * contains the requested key, "en" is used as the language code. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public static String getLocalized(final String key) { - return ForgeProps.getLocalized(key, null); - } - - /** - * Returns the localized version of the specified property. The key is a - * format string containing "%s", which is replaced with a language code - * (ISO 639-1, see {@link Locale#getLanguage()}). First, the configured - * language is used. Second, the locale's code is used. If none of them - * contains the requested key, "en" is used as the language code. If even - * that has no value, the def parameter is returned. - * - * @param key - * a {@link java.lang.String} object. - * @param def - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public static String getLocalized(final String key, final String def) { - // the list of languages to look for, in the order to be used - // the first is the configured language - // the second is the default locale's language code - final String[] languages = { ForgeProps.getProperty(NewConstants.Lang.LANGUAGE), - Locale.getDefault().getLanguage(), "en" }; - try { - for (final String lang : languages) { - // could be if a property does not exist - // just skip it, and try the next - if (lang == null) { - continue; - } - final String result = ForgeProps.getProperty(String.format(key, lang)); - if (result != null) { - return result; - } - } - // exceptions are skipped here; also the error viewer uses this, and - // reporting exceptions may result - // in a more fatal error (stack overflow) - } catch (final Exception ex) { - } - // if no property was found, or an error occurred, return the default - // value - return def; - } -} diff --git a/src/main/java/forge/properties/NewConstants.java b/src/main/java/forge/properties/NewConstants.java index 6e6f51fce10..f77eb5f049e 100644 --- a/src/main/java/forge/properties/NewConstants.java +++ b/src/main/java/forge/properties/NewConstants.java @@ -17,1122 +17,107 @@ */ package forge.properties; -import org.apache.commons.lang.StringUtils; +import java.util.List; + +import com.google.common.collect.Lists; -/** - * NewConstants.java - * - * Created on 22.08.2009 - */ -/** - * These are mostly property keys. - * - * @author Clemens Koza - * @version V0.0 22.08.2009 - */ public final class NewConstants { - // General properties - /** - * Constant - * HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL". - */ - public static final String HOW_TO_REPORT_BUGS_URL = "program/howToReportBugsURL"; + public static final String PROFILE_FILE = "forge.profile.properties"; + public static final String PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example"; - /** Constant SHOW2CDECK="showdeck/2color". */ - public static final String SHOW2CDECK = "showdeck/2color"; - - /** Constant CARDFORGE_URL = "program/cardforgeURL". */ - public static final String CARDFORGE_URL = "program/cardforgeURL"; - - /** Default base path for user data (settings, decks, quest save files, custom worlds, etc.) */ - public static final String DEFAULT_USER_DATA_ROOT; - - /** Default base path for cached program data (downloaded pictures) */ - public static final String DEFAULT_CACHE_DATA_ROOT; - + // data tree roots + private static final String _USER_DIR; + private static final String _CACHE_DIR; static { - String osName = System.getProperty("os.name"); - String homeDir = System.getProperty("user.home"); - - if (StringUtils.isEmpty(osName) || StringUtils.isEmpty(homeDir)) { - throw new RuntimeException("cannot determine OS and user home directory"); - } - - String fallbackDataDir = String.format("%s/.forge", homeDir); - - if (StringUtils.containsIgnoreCase("windows", osName)) { - // the split between appdata and localappdata on windows is relatively recent. If - // localappdata is not defined, use appdata for both. - String appRoot = System.getenv().get("APPDATA"); - if (StringUtils.isEmpty(appRoot)) { - appRoot = fallbackDataDir; - } - String cacheRoot = System.getenv().get("LOCALAPPDATA"); - if (StringUtils.isEmpty(cacheRoot)) { - cacheRoot = appRoot; - } - // just use '/' everywhere instead of file.separator. it always works - DEFAULT_USER_DATA_ROOT = String.format("%s/Forge", appRoot); - DEFAULT_CACHE_DATA_ROOT = String.format("%s/Forge/Cache", cacheRoot); - } else if (StringUtils.containsIgnoreCase("mac os x", osName)) { - DEFAULT_USER_DATA_ROOT = String.format("%s/Library/Application Support/Forge", homeDir); - DEFAULT_CACHE_DATA_ROOT = String.format("%s/Library/Caches/Forge", homeDir); - } else { - // Linux or anything else - DEFAULT_USER_DATA_ROOT = fallbackDataDir; - DEFAULT_CACHE_DATA_ROOT = String.format("%s/.cache/forge", homeDir); - } + ForgeProfileProperties profileProps = new ForgeProfileProperties(PROFILE_FILE); + _USER_DIR = profileProps.userDir; + _CACHE_DIR = profileProps.cacheDir; } + private static final String _RES_ROOT = "res/"; + private static final String _DEFAULTS_DIR = _RES_ROOT + "defaults/"; + private static final String _QUEST_DIR = _RES_ROOT + "quest/"; + private static final String _USER_PREFS_DIR = _USER_DIR + "preferences/"; + private static final String _USER_QUEST_DIR = _USER_DIR + "quest/"; + private static final String _DB_DIR = _CACHE_DIR + "db/"; + + // data that is only in the program dir + public static final String IMAGE_LIST_TOKENS_FILE = _RES_ROOT + "token-images.txt"; + public static final String IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE = _QUEST_DIR + "quest-opponent-icons.txt"; + public static final String IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE = _QUEST_DIR + "quest-pet-shop-icons.txt"; + public static final String IMAGE_LIST_QUEST_TOKENS_FILE = _QUEST_DIR + "quest-pet-token-images.txt"; + public static final String IMAGE_LIST_QUEST_BOOSTERS_FILE = _QUEST_DIR + "booster-images.txt"; + public static final String IMAGE_LIST_QUEST_FATPACKS_FILE = _QUEST_DIR + "fatpack-images.txt"; + public static final String IMAGE_LIST_QUEST_PRECONS_FILE = _QUEST_DIR + "precon-images.txt"; + public static final String IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE = _QUEST_DIR + "tournamentpack-images.txt"; - /** Constant PREFS_GLOBAL_FILE = "forge.preferences". */ - public static final String PREFS_GLOBAL_FILE = "res/preferences/forge.preferences"; - /** Constant PREFS_GLOBAL_FILE = "editor.preferences". */ - public static final String PREFS_EDITOR_FILE = "res/preferences/editor.preferences"; - public static final String PREFS_DEFAULT_EDITOR_FILE = "res/preferences/editor.default.preferences"; - /** */ - public static final String PREFS_MAIN_PROPERTIES_FILE = "res/preferences/main.properties"; - - /** Constant LAYOUT_DIR = "res/layouts/". */ - public static final String LAYOUT_DIR = "res/layouts/"; - - /** Constant DECKS="decks". */ - public static final String DECKS = "decks"; - /** Constant BOOSTER_DECKS="booster-decks". */ - public static final String BOOSTER_DECKS = "booster-decks"; - /** Constant NEW_DECKS="decks-dir". */ - public static final String NEW_DECKS = "decks-dir"; - - /** Constant TOKENS="tokens". */ - public static final String TOKENS = "tokens"; - /** Constant CARD_PICTURES="card-pictures". */ - public static final String CARD_PICTURES = "card-pictures"; - /** Constant CARD_PICTURES_A="card-pictures_a". */ - - public static final class CardPicturesByLetter { - /** */ - public static final String CARD_PICTURES_A = "card-pictures_a"; - /** Constant CARD_PICTURES_B="card-pictures_b". */ - public static final String CARD_PICTURES_B = "card-pictures_b"; - /** Constant CARD_PICTURES_C="card-pictures_c". */ - public static final String CARD_PICTURES_C = "card-pictures_c"; - /** Constant CARD_PICTURES_D="card-pictures_d". */ - public static final String CARD_PICTURES_D = "card-pictures_d"; - /** Constant CARD_PICTURES_E="card-pictures_e". */ - public static final String CARD_PICTURES_E = "card-pictures_e"; - /** Constant CARD_PICTURES_F="card-pictures_f". */ - public static final String CARD_PICTURES_F = "card-pictures_f"; - /** Constant CARD_PICTURES_G="card-pictures_g". */ - public static final String CARD_PICTURES_G = "card-pictures_g"; - /** Constant CARD_PICTURES_H="card-pictures_h". */ - public static final String CARD_PICTURES_H = "card-pictures_h"; - /** Constant CARD_PICTURES_I="card-pictures_i". */ - public static final String CARD_PICTURES_I = "card-pictures_i"; - /** Constant CARD_PICTURES_J="card-pictures_j". */ - public static final String CARD_PICTURES_J = "card-pictures_j"; - /** Constant CARD_PICTURES_K="card-pictures_k". */ - public static final String CARD_PICTURES_K = "card-pictures_k"; - /** Constant CARD_PICTURES_L="card-pictures_l". */ - public static final String CARD_PICTURES_L = "card-pictures_l"; - /** Constant CARD_PICTURES_M="card-pictures_m". */ - public static final String CARD_PICTURES_M = "card-pictures_m"; - /** Constant CARD_PICTURES_N="card-pictures_n". */ - public static final String CARD_PICTURES_N = "card-pictures_n"; - /** Constant CARD_PICTURES_O="card-pictures_o". */ - public static final String CARD_PICTURES_O = "card-pictures_o"; - /** Constant CARD_PICTURES_P="card-pictures_p". */ - public static final String CARD_PICTURES_P = "card-pictures_p"; - /** Constant CARD_PICTURES_Q="card-pictures_q". */ - public static final String CARD_PICTURES_Q = "card-pictures_q"; - /** Constant CARD_PICTURES_R="card-pictures_r". */ - public static final String CARD_PICTURES_R = "card-pictures_r"; - /** Constant CARD_PICTURES_S="card-pictures_s". */ - public static final String CARD_PICTURES_S = "card-pictures_s"; - /** Constant CARD_PICTURES_T="card-pictures_t". */ - public static final String CARD_PICTURES_T = "card-pictures_t"; - /** Constant CARD_PICTURES_U="card-pictures_u". */ - public static final String CARD_PICTURES_U = "card-pictures_u"; - /** Constant CARD_PICTURES_V="card-pictures_v". */ - public static final String CARD_PICTURES_V = "card-pictures_v"; - /** Constant CARD_PICTURES_W="card-pictures_w". */ - public static final String CARD_PICTURES_W = "card-pictures_w"; - /** Constant CARD_PICTURES_X="card-pictures_x". */ - public static final String CARD_PICTURES_X = "card-pictures_x"; - /** Constant CARD_PICTURES_Y="card-pictures_y". */ - public static final String CARD_PICTURES_Y = "card-pictures_y"; - /** Constant CARD_PICTURES_Z="card-pictures_z". */ - public static final String CARD_PICTURES_Z = "card-pictures_z"; - } - - /** Constant TOKEN_IMAGES="token-images". */ - public static final String TOKEN_IMAGES = "token-images"; - /** Constant CARDSFOLDER="cardsfolder". */ - public static final String CARDSFOLDER = "cardsfolder"; - /** Constant REMOVED="removed-cards". */ - public static final String REMOVED = "removed-cards"; - /** Constant NAME_MUTATOR="name-mutator". */ - public static final String NAME_MUTATOR = "name-mutator"; - /** The file name of the image for face down cards on the battlefield. */ - public static final String MORPH_IMAGE_FILE_NAME = "morph"; - - /** The MTG_DATA. */ - public static final String MTG_DATA = "mtg-data"; - - /** The SYMBOLS_SMALL. */ - public static final String SYMBOLS_SMALL = "symbols/small"; - - /** Constant IMAGE_BASE="image/base". */ - public static final String IMAGE_BASE = "image/base"; - /** Constant IMAGE_TOKEN="image/token". */ - public static final String IMAGE_TOKEN = "image/token"; - /** Constant IMAGE_ICON="image/icon". */ - public static final String IMAGE_ICON = "image/icon"; - /** Constant IMAGE_SEALED_PRODUCT="image/product". */ - public static final String IMAGE_SEALED_PRODUCT = "image/product"; - /** Constant PICS_BOOSTER_IMAGES="pics/booster/images". */ - public static final String PICS_BOOSTER_IMAGES = "pics/booster/images"; - - /** - * These properties are for a regular game. - */ - public static class Regular { - /** Property path for a common card. */ - public static final String COMMON = "regular/common"; - /** Property path for an uncommon card. */ - public static final String UNCOMMON = "regular/uncommon"; - /** Property path for a rare card. */ - public static final String RARE = "regular/rare"; - } - - /** - * These properties are for a booster draft. - */ - public static class Draft { - /** Property path for a common card. */ - public static final String COMMON = "draft/common"; - /** Property path for an uncommon card. */ - public static final String UNCOMMON = "draft/uncommon"; - /** Property path for a rare card. */ - public static final String RARE = "draft/rare"; - /** Path for draft rankings. */ - public static final String RANKINGS = "draft/rankings"; - } - - /** - * These properties are for a quest game. - */ - public static class Quest { - /** Property path for a common card. */ - public static final String COMMON = "quest/common"; - /** Property path for an uncommon card. */ - public static final String UNCOMMON = "quest/uncommon"; - /** Property path for a rare card. */ - public static final String RARE = "quest/rare"; - - /** The PRICE. */ - public static final String PRICE = "quest/price"; - - /** The BOOSTER_PRICE. */ - public static final String BOOSTER_PRICE = "quest/boosterprice"; - - /** The DATA. */ - public static final String DATA = "quest/data"; - - /** The PREFS. */ - public static final String PREFS = "quest/prefs"; - - /** The DECKS. */ - public static final String DUELS = "quest/duels-dir"; - /** */ - public static final String CHALLENGES = "quest/challenges-dir"; - /** */ - public static final String WORLD = "quest/world-dir"; - - /** The XMLDATA. */ - public static final String XMLDATA = "quest/data-xml"; - - /** The XMLDATA. */ - public static final String DATA_DIR = "quest/data-dir"; - - /** The OPPONENT_ICONS. */ - public static final String OPPONENT_ICONS = "quest/opponent/icons"; - - /** The OPPONENT_DIR. */ - public static final String OPPONENT_DIR = "image/icon"; - - /** The PET_SHOP_ICONS. */ - public static final String PET_SHOP_ICONS = "quest/pet/icons"; - - /** The PET_TOKEN_IMAGES. */ - public static final String PET_TOKEN_IMAGES = "quest/pet/tokens"; - - /** */ - public static final String PRECONS = "quest/precons-dir"; - - /** */ - public static final String BAZAAR = "quest/bazaar"; - /** */ - public static final String BAZAAR_DIR = "quest/bazaar-dir"; - } - - /** - * These are localization properties. - */ - public static class Lang { - - /** The PROGRAM_NAME. */ - public static final String PROGRAM_NAME = "%s/program/name"; - - /** The LANGUAGE. */ - public static final String LANGUAGE = "lang"; - - /** - * The Interface HowTo. - */ - public static class HowTo { - - /** The TITLE. */ - public static final String TITLE = "%s/HowTo/title"; - - /** The MESSAGE. */ - public static final String MESSAGE = "%s/HowTo/message"; - } - - /** - * The Interface ErrorViewer. - */ - public static class ErrorViewer { - - /** The SHOW_ERROR. */ - public static final String SHOW_ERROR = "%s/ErrorViewer/show"; - - /** The TITLE. */ - public static final String TITLE = "%s/ErrorViewer/title"; - - /** The MESSAGE. */ - public static final String MESSAGE = "%s/ErrorViewer/message"; - - /** The BUTTON_SAVE. */ - public static final String BUTTON_SAVE = "%s/ErrorViewer/button/save"; - - /** The BUTTON_CLOSE. */ - public static final String BUTTON_CLOSE = "%s/ErrorViewer/button/close"; - - /** The BUTTON_EXIT. */ - public static final String BUTTON_EXIT = "%s/ErrorViewer/button/exit"; - - /** - * The Interface ERRORS. - */ - public static class ERRORS { - - /** The SAVE_MESSAGE. */ - public static final String SAVE_MESSAGE = "%s/ErrorViewer/errors/save/message"; - - /** The SHOW_MESSAGE. */ - public static final String SHOW_MESSAGE = "%s/ErrorViewer/errors/show/message"; - } - } - - /** - * The Interface GuiBoosterDraft. - */ - public static class GuiBoosterDraft { - - /** The CLOSE_MESSAGE. */ - public static final String CLOSE_MESSAGE = "%s/BoosterDraft/close/message"; - - /** The SAVE_MESSAGE. */ - public static final String SAVE_MESSAGE = "%s/BoosterDraft/save/message"; - - /** The SAVE_TITLE. */ - public static final String SAVE_TITLE = "%s/BoosterDraft/save/title"; - - /** The RENAME_MESSAGE. */ - public static final String RENAME_MESSAGE = "%s/BoosterDraft/rename/message"; - - /** The RENAME_TITLE. */ - public static final String RENAME_TITLE = "%s/BoosterDraft/rename/title"; - - /** The SAVE_DRAFT_MESSAGE. */ - public static final String SAVE_DRAFT_MESSAGE = "%s/BoosterDraft/saveDraft/message"; - - /** The SAVE_DRAFT_TITLE. */ - public static final String SAVE_DRAFT_TITLE = "%s/BoosterDraft/saveDraft/title"; - } - - /** - * The Interface GuiDisplay. - */ - public static class GuiDisplay { - - /** - * The Interface MenuBar. - */ - public static class MenuBar { - - /** - * The Interface Menu. - */ - public static class Menu { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/menu/title"; - } - - /** - * The Interface Phase. - */ - public static class PHASE { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/phase/title"; - } - - /** - * The Interface DEV. - */ - public static class DEV { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/dev/title"; - } - } - - /** The HUMAN_TITLE. */ - public static final String HUMAN_TITLE = "%s/Display/human/title"; - - /** The HUMAN_DECKLIST. */ - public static final String HUMAN_DECKLIST = "%s/Display/human/decklist"; - - /** - * The Interface HumanHand. - */ - public static class HumanHand { - - /** The BASE. */ - public static final String BASE = "%s/Display/human/hand"; - - /** The TITLE. */ - public static final String TITLE = "%s/Display/human/hand/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/human/hand/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/human/hand/menu"; - } - - /** - * The Interface HumanLibrary. - */ - public static class HumanLibrary { - - /** The BASE. */ - public static final String BASE = "%s/Display/human/library"; - - /** The TITLE. */ - public static final String TITLE = "%s/Display/human/library/title"; - - /** The MENU. */ - public static final String MENU = "%s/Display/human/library/menu"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/human/library/button"; - } - - /** The HUMAN_GRAVEYARD. */ - public static final String HUMAN_GRAVEYARD = "%s/Display/human/graveyard"; - - /** - * The Interface HumanGraveyard. - */ - public static class HumanGraveyard { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/human/graveyard/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/human/graveyard/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/human/graveyard/menu"; - } - - /** The HUMAN_EXILED. */ - public static final String HUMAN_EXILED = "%s/Display/human/exiled"; - - /** - * The Interface HumanRemoved. - */ - public static class HumanRemoved { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/human/exiled/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/human/exiled/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/human/exiled/menu"; - } - - /** The COMBAT. */ - public static final String COMBAT = "%s/Display/combat/title"; - - /** The HUMAN_FLASHABCK. */ - public static final String HUMAN_FLASHBACK = "%s/Display/human/flashback"; - - /** The COMPUTER_FLASHBACK. */ - public static final String COMPUTER_FLASHBACK = "%s/Display/computer/flashback"; - - /** - * The Interface HumanFlashback. - */ - public static class HumanFlashback { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/human/flashback/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/human/flashback/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/human/flashback/menu"; - } - - /** - * The Interface ComputerFlashback. - */ - public static class ComputerFlashback { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/computer/flashback/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/computer/flashback/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/computer/flashback/menu"; - } - - /** The COMPUTER_TITLE. */ - public static final String COMPUTER_TITLE = "%s/Display/computer/title"; - - /** - * The Interface ComputerHand. - */ - public static class ComputerHand { - - /** The BASE. */ - public static final String BASE = "%s/Display/computer/hand"; - - /** The TITLE. */ - public static final String TITLE = "%s/Display/computer/hand/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/computer/hand/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/computer/hand/menu"; - } - - /** - * The Interface CopmuterLibrary. - */ - public static class ComputerLibrary { - - /** The BASE. */ - public static final String BASE = "%s/Display/computer/library"; - - /** The TITLE. */ - public static final String TITLE = "%s/Display/computer/library/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/computer/library/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/computer/library/menu"; - } - - /** The COMPUTER_GRAVEYARD. */ - public static final String COMPUTER_GRAVEYARD = "%s/Display/computer/graveyard"; - - /** - * The Interface ComputerGraveyard. - */ - public static class ComputerGraveyard { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/computer/graveyard/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/computer/graveyard/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/computer/graveyard/menu"; - } - - /** The COMPUTER_EXILED. */ - public static final String COMPUTER_EXILED = "%s/Display/computer/exiled"; - - /** - * The Interface CopmuterRemoved. - */ - public static class ComputerRemoved { - - /** The TITLE. */ - public static final String TITLE = "%s/Display/computer/exiled/title"; - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/computer/exiled/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/computer/exiled/menu"; - } - - /** The CONCEDE. */ - public static final String CONCEDE = "%s/Display/concede"; - - /** - * The Interface Concede. - */ - public static class Concede { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/concede/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/concede/menu"; - } - - /** The MANAGEN. */ - public static final String MANAGEN = "%s/Display/managen"; - - /** - * The Interface Managen. - */ - public static class Managen { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/managen/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/managen/menu"; - } - - /** The SETUPBATTLEFIELD. */ - public static final String SETUPBATTLEFIELD = "%s/Display/setupbattlefield"; - - /** - * The Interface SetupBattlefield. - */ - public static class SetupBattlefield { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/setupbattlefield/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/setupbattlefield/menu"; - } - - /** The TUTOR. */ - public static final String TUTOR = "%s/Display/tutor"; - - /** - * The Interface Tutor. - */ - public static class Tutor { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/tutor/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/tutor/menu"; - } - - /** The ADDCOUNTER. */ - public static final String ADDCOUNTER = "%s/Display/addcounter"; - - /** - * The Interface AddCounter. - */ - public static class AddCounter { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/addcounter/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/addcounter/menu"; - } - - /** The TAPPERM. */ - public static final String TAPPERM = "%s/Display/tapperm"; - - /** - * The Interface Tapperm. - */ - public static class Tapperm { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/tapperm/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/tapperm/menu"; - } - - /** The UNTAPPERM. */ - public static final String UNTAPPERM = "%s/Display/untapperm"; - - /** - * The Interface Untapperm. - */ - public static class Untapperm { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/untapperm/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/untapperm/menu"; - } - - /** The NOLANDLIMIT. */ - public static final String NOLANDLIMIT = "%s/Display/nolandlimit"; - - /** - * The Interface NoLandLimit. - */ - public static class NoLandLimit { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/nolandlimit/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/nolandlimit/menu"; - } - - /** The SETLIFE. */ - public static final String SETLIFE = "%s/Display/setlife"; - - /** - * The Interface SetLife. - */ - public static class SetLife { - - /** The BUTTON. */ - public static final String BUTTON = "%s/Display/setlife/button"; - - /** The MENU. */ - public static final String MENU = "%s/Display/setlife/menu"; - } - - /** - * The Interface Trigger. - */ - public static class Trigger { - - /** The ALWAYSACCEPT. */ - public static final String ALWAYSACCEPT = "%s/Display/alwaysaccept"; - - /** The ALWAYSDECLINE. */ - public static final String ALWAYSDECLINE = "%s/Display/alwaysdecline"; - - /** The ALWAYSASK. */ - public static final String ALWAYSASK = "%s/Display/alwaysask"; - } - } - - /** - * The Interface GuiDownloadPictures. - */ - public static class GuiDownloadPictures { - - /** The TITLE. */ - public static final String TITLE = "%s/DownloadPictures/title"; - - /** The PROXY_ADDRESS. */ - public static final String PROXY_ADDRESS = "%s/DownloadPictures/proxy/address"; - - /** The PROXY_PORT. */ - public static final String PROXY_PORT = "%s/DownloadPictures/proxy/port"; - - /** The NO_PROXY. */ - public static final String NO_PROXY = "%s/DownloadPictures/proxy/type/none"; - - /** The HTTP_PROXY. */ - public static final String HTTP_PROXY = "%s/DownloadPictures/proxy/type/http"; - - /** The SOCKS_PROXY. */ - public static final String SOCKS_PROXY = "%s/DownloadPictures/proxy/type/socks"; - - /** The NO_MORE. */ - public static final String NO_MORE = "%s/DownloadPictures/no-more"; - - /** The BAR_BEFORE_START. */ - public static final String BAR_BEFORE_START = "%s/DownloadPictures/bar/before-start"; - - /** The BAR_WAIT. */ - public static final String BAR_WAIT = "%s/DownloadPictures/bar/wait"; - - /** The BAR_CLOSE. */ - public static final String BAR_CLOSE = "%s/DownloadPictures/bar/close"; - - /** - * The Interface Buttons. - */ - public static class Buttons { - - /** The START. */ - public static final String START = "%s/DownloadPictures/button/start"; - - /** The CANCEL. */ - public static final String CANCEL = "%s/DownloadPictures/button/cancel"; - - /** The CLOSE. */ - public static final String CLOSE = "%s/DownloadPictures/button/close"; - } - - /** - * The Interface Errors. - */ - public static class Errors { - - /** The PROXY_CONNECT. */ - public static final String PROXY_CONNECT = "%s/DownloadPictures/errors/proxy/connect"; - - /** The OTHER. */ - public static final String OTHER = "%s/DownloadPictures/errors/other"; - } - } - - /** - * The Interface OldGuiNewGame. - */ - public static class OldGuiNewGame { - - /** - * The Interface NewGameText. - */ - public static class NewGameText { - - /** The GAMETYPE. */ - public static final String GAMETYPE = "%s/NewGame/gametype"; - - /** The LIBRARY. */ - public static final String LIBRARY = "%s/NewGame/library"; - - /** The SETTINGS. */ - public static final String SETTINGS = "%s/NewGame/settings"; - - /** The NEW_GAME. */ - public static final String NEW_GAME = "%s/NewGame/new_game"; - - /** The CONSTRUCTED_TEXT. */ - public static final String CONSTRUCTED_TEXT = "%s/NewGame/constructed_text"; - - /** The SEALED_TEXT. */ - public static final String SEALED_TEXT = "%s/NewGame/sealed_text"; - - /** The BOOSTER_TEXT. */ - public static final String BOOSTER_TEXT = "%s/NewGame/booster_text"; - - /** The YOURDECK. */ - public static final String YOURDECK = "%s/NewGame/yourdeck"; - - /** The OPPONENT. */ - public static final String OPPONENT = "%s/NewGame/opponent"; - - /** The DECK_EDITOR. */ - public static final String DECK_EDITOR = "%s/NewGame/deckeditor"; - - /** The AI_LAND. */ - public static final String AI_LAND = "%s/NewGame/ailand"; - - /** The DEV_MODE. */ - public static final String DEV_MODE = "%s/NewGame/devmode"; - - /** The QUEST_MODE. */ - public static final String QUEST_MODE = "%s/NewGame/questmode"; - - /** The START_GAME. */ - public static final String START_GAME = "%s/NewGame/startgame"; - - /** The SAVE_SEALED_MSG. */ - public static final String SAVE_SEALED_MSG = "%s/NewGame/savesealed_msg"; - - /** The SAVE_SEALED_TTL. */ - public static final String SAVE_SEALED_TTL = "%s/NewGame/savesealed_ttl"; - - } - - /** - * The Interface MenuBar. - */ - public static class MenuBar { - - /** - * The Interface Menu. - */ - public static class Menu { - - /** The TITLE. */ - public static final String TITLE = "%s/NewGame/menu/title"; - - /** The DOWNLOADPRICE. */ - public static final String DOWNLOADPRICE = "%s/NewGame/menu/downloadPrice"; - - /** The DOWNLOAD. */ - public static final String DOWNLOAD = "%s/NewGame/menu/download"; - - /** The DOWNLOADLQ. */ - public static final String DOWNLOADLQ = "%s/NewGame/menu/downloadlq"; - - /** The DOWNLOADSETLQ. */ - public static final String DOWNLOADSETLQ = "%s/NewGame/menu/downloadsetlq"; - - /** The DOWNLOADQUESTIMG. */ - public static final String DOWNLOADQUESTIMG = "%s/NewGame/menu/downloadquest"; - - /** The IMPORTPICTURE. */ - public static final String IMPORTPICTURE = "%s/NewGame/menu/importPicture"; - - /** The CARD_SIZES. */ - public static final String CARD_SIZES = "%s/NewGame/menu/cardSizes"; - - /** The CARD_STACK. */ - public static final String CARD_STACK = "%s/NewGame/menu/cardStack"; - - /** The CARD_STACK_OFFSET. */ - public static final String CARD_STACK_OFFSET = "%s/NewGame/menu/cardStackOffset"; - - /** The ABOUT. */ - public static final String ABOUT = "%s/NewGame/menu/about"; - - /** The EXIT. */ - public static final String EXIT = "%s/NewGame/menu/exit"; - } - - /** - * The Interface Options. - */ - public static class Options { - - /** The TITLE. */ - public static final String TITLE = "%s/NewGame/options/title"; - - /** The FONT. */ - public static final String FONT = "%s/NewGame/options/font"; - - /** The CARD_OVERLAY. */ - public static final String CARD_OVERLAY = "%s/NewGame/options/cardOverlay"; - - /** The CARD_SCALE. */ - public static final String CARD_SCALE = "%s/NewGame/options/cardScale"; - - /** - * The Interface Generate. - */ - public static class Generate { - - /** The TITLE. */ - public static final String TITLE = "%s/NewGame/options/generate/title"; - - /** The Constant SINGLETONS. */ - public static final String SINGLETONS = "%s/NewGame/options/generate/singletons"; - - /** The REMOVE_SMALL. */ - public static final String REMOVE_SMALL = "%s/NewGame/options/generate/removeSmall"; - - /** The REMOVE_ARTIFACTS. */ - public static final String REMOVE_ARTIFACTS = "%s/NewGame/options/generate/removeArtifacts"; - } - } - - /** - * The Interface Help. - */ - public static class Help { - - /** The TITLE. */ - public static final String TITLE = "%s/NewGame/help/title"; - } - - } - - /** - * The Interface Errors. - */ - public static class Errors { - } - } - - /** - * The Interface WinLoseFrame. - */ - public static class WinLoseFrame { - - /** - * The Interface WinLoseText. - */ - public static class WinLoseText { - - /** The WON. */ - public static final String WON = "%s/WinLose/won"; - - /** The LOST. */ - public static final String LOST = "%s/WinLose/lost"; - - /** The WIN. */ - public static final String WIN = "%s/WinLose/win"; - - /** The LOSE. */ - public static final String LOSE = "%s/WinLose/lose"; - - /** The CONTINUE. */ - public static final String CONTINUE = "%s/WinLose/continue"; - - /** The RESTART. */ - public static final String RESTART = "%s/WinLose/restart"; - - /** The QUIT. */ - public static final String QUIT = "%s/WinLose/quit"; - } - } - - // end - - // Doublestrike 02-10-11 - this is soon to be deprecated. - /** - * The Interface GuiWinLose. - */ - public static class GuiWinLose { - - /** - * The Interface WinLoseText. - */ - public static class WinLoseText { - - /** The WON. */ - public static final String WON = "%s/WinLose/won"; - - /** The LOST. */ - public static final String LOST = "%s/WinLose/lost"; - - /** The WIN. */ - public static final String WIN = "%s/WinLose/win"; - - /** The LOSE. */ - public static final String LOSE = "%s/WinLose/lose"; - - /** The CONTINUE. */ - public static final String CONTINUE = "%s/WinLose/continue"; - - /** The RESTART. */ - public static final String RESTART = "%s/WinLose/restart"; - - /** The QUIT. */ - public static final String QUIT = "%s/WinLose/quit"; - } - } - - /** - * The Interface GuiDownloadPrices. - */ - public static class GuiDownloadPrices { - - /** - * The Interface DownloadPrices. - */ - public static class DownloadPrices { - - /** The TITLE. */ - public static final String TITLE = "%s/DownloadPrices/title"; - - /** The START_UPDATE. */ - public static final String START_UPDATE = "%s/DownloadPrices/startupdate"; - - /** The DOWNLOADING. */ - public static final String DOWNLOADING = "%s/DownloadPrices/downloading"; - - /** The COMPILING. */ - public static final String COMPILING = "%s/DownloadPrices/compiling"; - } - } - - /** - * The Interface GameAction. - */ - public static class GameAction { - - /** - * The Interface GameActionText. - */ - public static class GameActionText { - - /** The HEADS. */ - public static final String HEADS = "%s/GameAction/heads"; - - /** The TAILS. */ - public static final String TAILS = "%s/GameAction/tails"; - - /** The HEADS_OR_TAILS. */ - public static final String HEADS_OR_TAILS = "%s/GameAction/heads_or_tails"; - - /** The COIN_TOSS. */ - public static final String COIN_TOSS = "%s/GameAction/coin_toss"; - - /** The HUMAN_WIN. */ - public static final String HUMAN_WIN = "%s/GameAction/human_win"; - - /** The COMPUTER_WIN. */ - public static final String COMPUTER_WIN = "%s/GameAction/computer_win"; - - /** The COMPUTER_STARTS. */ - public static final String COMPUTER_STARTS = "%s/GameAction/computer_starts"; - - /** The HUMAN_STARTS. */ - public static final String HUMAN_STARTS = "%s/GameAction/human_starts"; - - /** The HUMAN_MANA_COST. */ - public static final String HUMAN_MANA_COST = "%s/GameAction/human_mana_cost"; - - /** The COMPUTER_MANA_COST. */ - public static final String COMPUTER_MANA_COST = "%s/GameAction/computer_mana_cost"; - - /** The COMPUTER_CUT. */ - public static final String COMPUTER_CUT = "%s/GameAction/computer_cut"; - - /** The HUMAN_CUT. */ - public static final String HUMAN_CUT = "%s/GameAction/human_cut"; - - /** The CUT_NUMBER. */ - public static final String CUT_NUMBER = "%s/GameAction/cut_number"; - - /** The RESOLVE_STARTER. */ - public static final String RESOLVE_STARTER = "%s/GameAction/resolve_starter"; - - /** The EQUAL_CONVERTED_MANA. */ - public static final String EQUAL_CONVERTED_MANA = "%s/GameAction/equal_converted_mana"; - - /** The CUTTING_AGAIN. */ - public static final String CUTTING_AGAIN = "%s/GameAction/cutting_again"; - - /** The YES. */ - public static final String YES = "%s/GameAction/yes"; - - /** The NO. */ - public static final String NO = "%s/GameAction/no"; - - /** The WANT_DREDGE. */ - public static final String WANT_DREDGE = "%s/GameAction/want_dredge"; - - /** The SELECT_DREDGE. */ - public static final String SELECT_DREDGE = "%s/GameAction/select_dredge"; - - /** The CHOOSE_2ND_LAND. */ - public static final String CHOOSE_2ND_LAND = "%s/GameAction/choose_2nd_land"; - - } - } - } + public static final String TEXT_HOWTO_FILE = _RES_ROOT + "howto.txt"; + public static final String DRAFT_RANKINGS_FILE = _RES_ROOT + "draft/rankings.txt"; + public static final String PRICES_BOOSTER_FILE = _QUEST_DIR + "booster-prices.txt"; + public static final String BAZAAR_FILE = _QUEST_DIR + "bazaar/index.xml"; + + public static final String CARD_DATA_PETS_DIR = _QUEST_DIR + "bazaar/"; + public static final String DEFAULT_DUELS_DIR = _QUEST_DIR + "duels"; + public static final String DEFAULT_CHALLENGES_DIR = _QUEST_DIR + "challenges"; + + // data that has defaults in the program dir but overrides/additions in the user dir + public static final FileLocation MAIN_PREFERENCES_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "forge.preferences"); + public static final FileLocation EDITOR_PREFERENCES_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "editor.preferences"); + public static final FileLocation QUEST_PREFERENCES_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "quest.preferences"); + + public static final FileLocation HOME_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "home.xml"); + public static final FileLocation MATCH_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "match.xml"); + public static final FileLocation EDITOR_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "editor.xml"); + + public static final FileLocation QUEST_CARD_PRICE_FILE = new FileLocation(_DEFAULTS_DIR, _DB_DIR, "all-prices.txt"); + + public static final FileLocation CARD_DATA_DIR = new FileLocation(_RES_ROOT, _USER_DIR, "cardsfolder/"); + public static final FileLocation DECK_CUBE_DIR = new FileLocation(_DEFAULTS_DIR, _USER_DIR, "cube"); + public static final FileLocation QUEST_WORLD_DIR = new FileLocation(_QUEST_DIR, _USER_QUEST_DIR, "worlds/"); + public static final FileLocation QUEST_PRECON_DIR = new FileLocation(_QUEST_DIR, _USER_QUEST_DIR, "precons/"); + + // data that is only in the user dir + public static final String DECK_CONSTRUCTED_DIR = _USER_DIR + "constructed/"; + public static final String DECK_DRAFT_DIR = _USER_DIR + "draft/"; + public static final String DECK_SEALED_DIR = _USER_DIR + "sealed/"; + public static final String DECK_SCHEME_DIR = _USER_DIR + "scheme/"; + public static final String DECK_PLANE_DIR = _USER_DIR + "plane/"; + public static final String QUEST_SAVE_DIR = _USER_DIR + "quest/saves"; + + // data that is only in the cached dir + public static final String CACHE_CARD_PICS_DIR = _CACHE_DIR + "pics/cards/"; + public static final String CACHE_TOKEN_PICS_DIR = _CACHE_DIR + "pics/tokens/"; + public static final String CACHE_ICON_PICS_DIR = _CACHE_DIR + "pics/icons/"; + public static final String CACHE_BOOSTER_PICS_DIR = _CACHE_DIR + "pics/boosters/"; + public static final String CACHE_FATPACK_PICS_DIR = _CACHE_DIR + "pics/fatpacks/"; + public static final String CACHE_PRECON_PICS_DIR = _CACHE_DIR + "pics/precons/"; + public static final String CACHE_TOURNAMENTPACK_PICS_DIR = _CACHE_DIR + "pics/tournamentpacks/"; + public static final String CACHE_MORPH_IMAGE_FILE = CACHE_TOKEN_PICS_DIR + "morph.jpg"; + + public static final List PROFILE_DIRS = Lists.newArrayList( + _USER_PREFS_DIR, + _DB_DIR, + CARD_DATA_DIR.userPrefLoc, + DECK_CUBE_DIR.userPrefLoc, + QUEST_WORLD_DIR.userPrefLoc, + QUEST_PRECON_DIR.userPrefLoc, + DECK_CONSTRUCTED_DIR, + DECK_DRAFT_DIR, + DECK_SEALED_DIR, + DECK_SCHEME_DIR, + DECK_PLANE_DIR, + QUEST_SAVE_DIR, + CACHE_CARD_PICS_DIR, + CACHE_TOKEN_PICS_DIR, + CACHE_ICON_PICS_DIR, + CACHE_BOOSTER_PICS_DIR, + CACHE_FATPACK_PICS_DIR, + CACHE_PRECON_PICS_DIR, + CACHE_TOURNAMENTPACK_PICS_DIR); + + // URLs + private static final String _URL_CARDFORGE = "http://cardforge.org"; + public static final String URL_DRAFT_UPLOAD = _URL_CARDFORGE + "/draftAI/submitDraftData.php"; + public static final String URL_PIC_DOWNLOAD = _URL_CARDFORGE + "/fpics/"; + public static final String URL_PRICE_DOWNLOAD = _URL_CARDFORGE + "/MagicInfo/pricegen.php"; } diff --git a/src/main/java/forge/quest/BoosterUtils.java b/src/main/java/forge/quest/BoosterUtils.java index d613ac373fd..9f5c2687f2d 100644 --- a/src/main/java/forge/quest/BoosterUtils.java +++ b/src/main/java/forge/quest/BoosterUtils.java @@ -18,7 +18,6 @@ package forge.quest; import java.util.ArrayList; - import java.util.Collections; import java.util.List; @@ -32,8 +31,8 @@ import com.google.common.collect.Lists; import forge.Singletons; import forge.card.BoosterGenerator; -import forge.card.CardRulesPredicates; import forge.card.CardRules; +import forge.card.CardRulesPredicates; import forge.card.UnOpenedProduct; import forge.item.BoosterPack; import forge.item.CardDb; diff --git a/src/main/java/forge/quest/QuestController.java b/src/main/java/forge/quest/QuestController.java index eba2527010d..555cf86b339 100644 --- a/src/main/java/forge/quest/QuestController.java +++ b/src/main/java/forge/quest/QuestController.java @@ -24,14 +24,13 @@ import com.google.common.base.Predicates; import forge.Singletons; import forge.deck.Deck; -import forge.quest.data.GameFormatQuest; import forge.game.GameFormat; import forge.item.CardPrinted; import forge.item.PreconDeck; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.bazaar.QuestBazaarManager; import forge.quest.bazaar.QuestPetStorage; +import forge.quest.data.GameFormatQuest; import forge.quest.data.QuestAchievements; import forge.quest.data.QuestAssets; import forge.quest.data.QuestData; @@ -169,7 +168,7 @@ public class QuestController { */ public static IStorageView getPrecons() { if (null == preconManager) { - preconManager = new StorageView(new PreconReader(ForgeProps.getFile(NewConstants.Quest.PRECONS))); + preconManager = new StorageView(new PreconReader(new File(NewConstants.QUEST_PRECON_DIR.defaultLoc))); } return QuestController.preconManager; @@ -339,7 +338,7 @@ public class QuestController { */ public final QuestBazaarManager getBazaar() { if (null == this.bazaar) { - this.bazaar = new QuestBazaarManager(ForgeProps.getFile(NewConstants.Quest.BAZAAR)); + this.bazaar = new QuestBazaarManager(new File(NewConstants.BAZAAR_FILE)); } return this.bazaar; } @@ -374,12 +373,12 @@ public class QuestController { */ public void resetDuelsManager() { if (this.model == null || this.model.getWorldId() == null) { - this.duelManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.DUELS)); + this.duelManager = new QuestEventManager(new File(NewConstants.DEFAULT_DUELS_DIR)); } else { QuestWorld world = Singletons.getModel().getWorlds().get(this.model.getWorldId()); if (world == null || world.getDuelsDir() == null) { - this.duelManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.DUELS)); + this.duelManager = new QuestEventManager(new File(NewConstants.DEFAULT_DUELS_DIR)); } else { this.duelManager = new QuestEventManager(new File("res/quest/world/" + world.getDuelsDir())); } @@ -392,13 +391,13 @@ public class QuestController { */ public void resetChallengesManager() { if (this.model == null || this.model.getWorldId() == null) { - this.challengesManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.CHALLENGES)); + this.challengesManager = new QuestEventManager(new File(NewConstants.DEFAULT_CHALLENGES_DIR)); } else { QuestWorld world = Singletons.getModel().getWorlds().get(this.model.getWorldId()); if (world == null || world.getChallengesDir() == null) { - this.challengesManager = new QuestEventManager(ForgeProps.getFile(NewConstants.Quest.CHALLENGES)); + this.challengesManager = new QuestEventManager(new File(NewConstants.DEFAULT_CHALLENGES_DIR)); } else { this.challengesManager = new QuestEventManager(new File("res/quest/world/" + world.getChallengesDir())); } @@ -412,7 +411,7 @@ public class QuestController { */ public QuestPetStorage getPetsStorage() { if (this.pets == null) { - this.pets = new QuestPetStorage(ForgeProps.getFile(NewConstants.Quest.BAZAAR)); + this.pets = new QuestPetStorage(new File(NewConstants.CARD_DATA_PETS_DIR)); } return this.pets; @@ -435,5 +434,4 @@ public class QuestController { return unlocksAvaliable > unlocksSpent ? Math.min(unlocksAvaliable - unlocksSpent, cntLocked) : 0; } - } diff --git a/src/main/java/forge/quest/QuestRewardCardChooser.java b/src/main/java/forge/quest/QuestRewardCardChooser.java index 2f31e4cf0ba..2a17e9f75b9 100644 --- a/src/main/java/forge/quest/QuestRewardCardChooser.java +++ b/src/main/java/forge/quest/QuestRewardCardChooser.java @@ -1,19 +1,19 @@ package forge.quest; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.Iterables; - import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Iterables; + import forge.Singletons; +import forge.card.CardRules; import forge.item.CardDb; import forge.item.CardPrinted; import forge.item.IPaperCard; -import forge.card.CardRules; import forge.item.InventoryItem; import forge.item.ItemPool; diff --git a/src/main/java/forge/quest/QuestUtil.java b/src/main/java/forge/quest/QuestUtil.java index d787962e38f..e3795614a94 100644 --- a/src/main/java/forge/quest/QuestUtil.java +++ b/src/main/java/forge/quest/QuestUtil.java @@ -17,8 +17,10 @@ */ package forge.quest; -import forge.Card; +import java.util.ArrayList; +import java.util.List; +import forge.Card; import forge.card.CardEdition; import forge.card.CardRulesReader; import forge.item.CardDb; @@ -26,9 +28,6 @@ import forge.item.CardToken; import forge.item.IPaperCard; import forge.quest.bazaar.QuestPetController; -import java.util.ArrayList; -import java.util.List; - /** *

* QuestUtil class. @@ -144,7 +143,7 @@ public class QuestUtil { script.add("Types:" + properties[5].replace(';', ' ')); script.add("Oracle:"); // tokens don't have texts yet // c.setManaCost(properties[1]); - String fileName = properties[1] + " " + properties[2] + " " + properties[3] + " " + properties[4]; + String fileName = properties[1] + "_" + properties[2] + "_" + properties[3] + "_" + properties[4]; final CardToken c = new CardToken(CardRulesReader.parseSingleCard(script), CardEdition.UNKNOWN.getCode(), fileName); return c; } diff --git a/src/main/java/forge/quest/QuestUtilUnlockSets.java b/src/main/java/forge/quest/QuestUtilUnlockSets.java index 2de5e3e16c1..5d070330d82 100644 --- a/src/main/java/forge/quest/QuestUtilUnlockSets.java +++ b/src/main/java/forge/quest/QuestUtilUnlockSets.java @@ -22,9 +22,11 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; + import javax.swing.JOptionPane; import org.apache.commons.lang3.tuple.ImmutablePair; + import com.google.common.collect.Iterables; import com.google.common.collect.Lists; diff --git a/src/main/java/forge/quest/QuestWorld.java b/src/main/java/forge/quest/QuestWorld.java index e0dfb175035..0f7d7ce6d44 100644 --- a/src/main/java/forge/quest/QuestWorld.java +++ b/src/main/java/forge/quest/QuestWorld.java @@ -24,7 +24,6 @@ import java.util.List; import com.google.common.base.Function; import forge.quest.data.GameFormatQuest; -import forge.util.FileSection; import forge.util.storage.StorageReaderFile; /** diff --git a/src/main/java/forge/quest/bazaar/QuestItemType.java b/src/main/java/forge/quest/bazaar/QuestItemType.java index 941394b5438..1c20ef7f92c 100644 --- a/src/main/java/forge/quest/bazaar/QuestItemType.java +++ b/src/main/java/forge/quest/bazaar/QuestItemType.java @@ -18,6 +18,7 @@ package forge.quest.bazaar; import com.thoughtworks.xstream.annotations.XStreamAlias; + import forge.quest.data.QuestItemCondition; /** diff --git a/src/main/java/forge/quest/bazaar/QuestPetController.java b/src/main/java/forge/quest/bazaar/QuestPetController.java index 0f2981cc1a3..b1b8b83b111 100644 --- a/src/main/java/forge/quest/bazaar/QuestPetController.java +++ b/src/main/java/forge/quest/bazaar/QuestPetController.java @@ -17,7 +17,6 @@ */ package forge.quest.bazaar; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -27,7 +26,6 @@ import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import forge.item.CardToken; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.data.QuestAssets; @@ -122,7 +120,7 @@ public class QuestPetController implements IQuestBazaarItem { */ @Override public final ImageIcon getIcon(final QuestAssets qA) { - final String path = ForgeProps.getFile(NewConstants.IMAGE_TOKEN).getAbsolutePath() + File.separator; + final String path = NewConstants.CACHE_TOKEN_PICS_DIR; final int level = this.getPetLevel(qA); return new ImageIcon(path + this.levels.get(level < this.maxLevel ? level + 1 : level).getPicture() + ".jpg"); } diff --git a/src/main/java/forge/quest/bazaar/QuestPetStats.java b/src/main/java/forge/quest/bazaar/QuestPetStats.java index b518e377271..054d227c324 100644 --- a/src/main/java/forge/quest/bazaar/QuestPetStats.java +++ b/src/main/java/forge/quest/bazaar/QuestPetStats.java @@ -10,7 +10,6 @@ import forge.card.CardEdition; import forge.card.CardRules; import forge.card.CardRulesReader; import forge.item.CardToken; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.FileUtil; @@ -59,7 +58,7 @@ public class QuestPetStats { public final CardToken getCard() { if (null == petCard) { - List cardLines = FileUtil.readFile(new File(ForgeProps.getFile(NewConstants.Quest.BAZAAR_DIR), cardFile)); + List cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_PETS_DIR, cardFile)); CardRules rules = CardRulesReader.parseSingleCard(cardLines); petCard = new CardToken(rules, CardEdition.UNKNOWN.getCode(), picture.replace('_', ' ')); } diff --git a/src/main/java/forge/quest/data/GameFormatQuest.java b/src/main/java/forge/quest/data/GameFormatQuest.java index 92cb2e71e24..a2bab1c49fc 100644 --- a/src/main/java/forge/quest/data/GameFormatQuest.java +++ b/src/main/java/forge/quest/data/GameFormatQuest.java @@ -17,8 +17,8 @@ */ package forge.quest.data; -import java.util.List; import java.util.ArrayList; +import java.util.List; import com.google.common.base.Predicate; diff --git a/src/main/java/forge/quest/data/QuestPreferences.java b/src/main/java/forge/quest/data/QuestPreferences.java index 30b055ced42..adbe4783153 100644 --- a/src/main/java/forge/quest/data/QuestPreferences.java +++ b/src/main/java/forge/quest/data/QuestPreferences.java @@ -26,8 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import forge.properties.ForgeProps; -import forge.properties.NewConstants.Quest; +import forge.properties.NewConstants; import forge.util.FileUtil; /** @@ -192,7 +191,7 @@ public class QuestPreferences implements Serializable { public QuestPreferences() { this.preferenceValues = new HashMap(); - List lines = FileUtil.readFile(ForgeProps.getFile(Quest.PREFS)); + List lines = FileUtil.readFile(NewConstants.QUEST_PREFERENCES_FILE.defaultLoc); for (String line : lines) { if (line.startsWith("#") || (line.length() == 0)) { @@ -212,7 +211,7 @@ public class QuestPreferences implements Serializable { BufferedWriter writer = null; try { - writer = new BufferedWriter(new FileWriter(ForgeProps.getFile(Quest.PREFS))); + writer = new BufferedWriter(new FileWriter(NewConstants.QUEST_PREFERENCES_FILE.defaultLoc)); for (final QPref key : QPref.values()) { if (key.getDefault().equals("DIFFICULTY_INDEX_REQD")) { writer.newLine(); diff --git a/src/main/java/forge/quest/io/QuestDataIO.java b/src/main/java/forge/quest/io/QuestDataIO.java index 310ca38eb0e..7705b0cb90f 100644 --- a/src/main/java/forge/quest/io/QuestDataIO.java +++ b/src/main/java/forge/quest/io/QuestDataIO.java @@ -59,7 +59,6 @@ import forge.deck.CardPool; import forge.deck.Deck; import forge.deck.DeckSection; import forge.error.BugReporter; -import forge.quest.data.GameFormatQuest; import forge.item.BoosterPack; import forge.item.CardDb; import forge.item.CardPrinted; @@ -68,11 +67,11 @@ import forge.item.InventoryItem; import forge.item.ItemPool; import forge.item.PreconDeck; import forge.item.TournamentPack; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.quest.QuestController; import forge.quest.QuestMode; import forge.quest.bazaar.QuestItemType; +import forge.quest.data.GameFormatQuest; import forge.quest.data.QuestAchievements; import forge.quest.data.QuestAssets; import forge.quest.data.QuestData; @@ -356,7 +355,7 @@ public class QuestDataIO { try { final XStream xStream = QuestDataIO.getSerializer(false); - final File f = new File(ForgeProps.getFile(NewConstants.Quest.DATA_DIR), qd.getName()); + final File f = new File(NewConstants.QUEST_SAVE_DIR, qd.getName()); QuestDataIO.savePacked(f + ".dat", xStream, qd); // QuestDataIO.saveUnpacked(f + ".xml", xStream, qd); diff --git a/src/main/java/forge/quest/io/ReadPriceList.java b/src/main/java/forge/quest/io/ReadPriceList.java index 3a509b58527..13e7a4701a5 100644 --- a/src/main/java/forge/quest/io/ReadPriceList.java +++ b/src/main/java/forge/quest/io/ReadPriceList.java @@ -17,7 +17,6 @@ */ package forge.quest.io; -import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +24,6 @@ import java.util.Random; import com.esotericsoftware.minlog.Log; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.FileUtil; import forge.util.MyRandom; @@ -60,8 +58,8 @@ public class ReadPriceList { *

*/ private void setup() { - this.priceMap = this.readFile(ForgeProps.getFile(NewConstants.Quest.PRICE)); - this.priceMap.putAll(this.readFile(ForgeProps.getFile(NewConstants.Quest.BOOSTER_PRICE))); + this.priceMap = this.readFile(NewConstants.QUEST_CARD_PRICE_FILE.defaultLoc); + this.priceMap.putAll(this.readFile(NewConstants.PRICES_BOOSTER_FILE)); } // setup() @@ -74,7 +72,7 @@ public class ReadPriceList { * a {@link java.io.File} object. * @return a {@link java.util.HashMap} object. */ - private HashMap readFile(final File file) { + private HashMap readFile(String file) { final HashMap map = new HashMap(); final Random r = MyRandom.getRandom(); diff --git a/src/main/java/forge/sound/EventVisualizer.java b/src/main/java/forge/sound/EventVisualizer.java index af981f788b3..e10c5a10700 100644 --- a/src/main/java/forge/sound/EventVisualizer.java +++ b/src/main/java/forge/sound/EventVisualizer.java @@ -4,10 +4,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import forge.Card; import forge.card.spellability.SpellAbility; -import forge.game.event.CounterAddedEvent; import forge.game.event.BlockerAssignedEvent; import forge.game.event.CardDamagedEvent; import forge.game.event.CardDestroyedEvent; @@ -15,6 +13,8 @@ import forge.game.event.CardDiscardedEvent; import forge.game.event.CardEquippedEvent; import forge.game.event.CardRegeneratedEvent; import forge.game.event.CardSacrificedEvent; +import forge.game.event.CounterAddedEvent; +import forge.game.event.CounterRemovedEvent; import forge.game.event.DrawCardEvent; import forge.game.event.DuelOutcomeEvent; import forge.game.event.EndOfTurnEvent; @@ -23,7 +23,6 @@ import forge.game.event.FlipCoinEvent; import forge.game.event.LandPlayedEvent; import forge.game.event.LifeLossEvent; import forge.game.event.PoisonCounterEvent; -import forge.game.event.CounterRemovedEvent; import forge.game.event.SetTappedEvent; import forge.game.event.ShuffleEvent; import forge.game.event.SpellResolvedEvent; diff --git a/src/main/java/forge/util/CopyFiles.java b/src/main/java/forge/util/CopyFiles.java index e94b1df33d3..ebd270394ee 100644 --- a/src/main/java/forge/util/CopyFiles.java +++ b/src/main/java/forge/util/CopyFiles.java @@ -30,7 +30,6 @@ import javax.swing.JProgressBar; import javax.swing.SwingWorker; import forge.gui.GuiDisplayUtil; -import forge.properties.ForgeProps; import forge.properties.NewConstants; /** @@ -96,8 +95,7 @@ public class CopyFiles extends SwingWorker { cName = name.substring(0, name.length() - 8); cName = GuiDisplayUtil.cleanString(cName) + ".jpg"; final File sourceFile = new File(source); - final File base = ForgeProps.getFile(NewConstants.IMAGE_BASE); - final File reciever = new File(base, cName); + final File reciever = new File(NewConstants.CACHE_CARD_PICS_DIR, cName); reciever.delete(); try { diff --git a/src/main/java/forge/util/FileUtil.java b/src/main/java/forge/util/FileUtil.java index 1113976b6a9..2a652f28c0b 100644 --- a/src/main/java/forge/util/FileUtil.java +++ b/src/main/java/forge/util/FileUtil.java @@ -20,21 +20,21 @@ package forge.util; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; -import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; +import java.io.PrintWriter; import java.io.Reader; import java.net.Proxy; import java.net.URL; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import javax.swing.JOptionPane; + import forge.error.BugReporter; -import forge.properties.ForgeProps; -import forge.properties.NewConstants.Lang.GuiDownloadPictures.Errors; /** *

@@ -92,31 +92,27 @@ public final class FileUtil { * @param data * a {@link java.util.List} object. */ - public static void writeFile(final File file, final List data) { + public static void writeFile(File file, Collection data) { try { - final BufferedWriter io = new BufferedWriter(new FileWriter(file)); - for (int i = 0; i < data.size(); i++) { - io.write(data.get(i)); - io.write("\r\n"); + PrintWriter p = new PrintWriter(file); + for (Object o : data) { + p.println(o); } - - io.flush(); - io.close(); + p.close(); } catch (final Exception ex) { BugReporter.reportException(ex); throw new RuntimeException("FileUtil : writeFile() error, problem writing file - " + file + " : " + ex); } } // writeAllDecks() - /** - *

- * readFile. - *

- * - * @param filename - * a {@link java.lang.String} object. - * @return a {@link java.util.ArrayList} object. - */ + public static String readFileToString(String filename) { + StringBuilder s = new StringBuilder(); + for (String line : readFile(filename)) { + s.append(line).append('\n'); + } + return s.toString(); + } + public static List readFile(final String filename) { return FileUtil.readFile(new File(filename)); } @@ -181,14 +177,6 @@ public final class FileUtil { return list; } - /** - * Download url into file. - * - * @param url - * the url - * @param target - * the target - */ public static void downloadUrlIntoFile(final String url, final File target) { try { final byte[] buf = new byte[1024]; @@ -201,14 +189,13 @@ public final class FileUtil { // while - read and write file while ((len = in.read(buf)) != -1) { out.write(buf, 0, len); - } // while - read and write file in.close(); out.flush(); out.close(); } catch (final IOException ioex) { - BugReporter.reportException(ioex, ForgeProps.getLocalized(Errors.OTHER), "deck_temp.html", url); + JOptionPane.showMessageDialog(null, String.format("Error connecting to: %s", url), + "Download error", JOptionPane.ERROR_MESSAGE); } - } } diff --git a/src/main/java/forge/util/HttpUtil.java b/src/main/java/forge/util/HttpUtil.java index cb9e6d183d5..0e198efc33d 100644 --- a/src/main/java/forge/util/HttpUtil.java +++ b/src/main/java/forge/util/HttpUtil.java @@ -26,33 +26,34 @@ import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.util.Collection; import forge.Constant.Preferences; -/** - *

- * HttpUtil class. - *

- * - * @author Forge - * @version $Id$ - * @since 1.0.15 - */ public class HttpUtil { private static final String BOUNDARY = "--7d021a37605f0"; - /** - *

- * upload. - *

- * - * @param sURL - * a {@link java.lang.String} object. - * @param file - * a {@link java.lang.String} object. - */ - public final void upload(final String sURL, final String file) { + public static void upload(String sURL, String file) { + upload(sURL, new File(file)); + } + + public static void upload(String url, Collection data) { + File tempFile = null; + try { + tempFile = File.createTempFile("forge.upload", null); + FileUtil.writeFile(tempFile, data); + HttpUtil.upload(url, tempFile); + } catch (IOException e) { + System.err.println("unable to write to temp file for upload"); + } finally { + if (null != tempFile) { + tempFile.delete(); + } + } + } + + public static void upload(String sURL, File f) { URL url = null; try { url = new URL(sURL); @@ -80,7 +81,6 @@ public class HttpUtil { return; } - final File f = new File(file); final String str = "--" + HttpUtil.BOUNDARY + "\r\n" + "Content-Disposition: form-data;name=\"data\"; filename=\"" + f.getName() + "\"\r\n" + "Content-Type: text/plain\r\n\r\n"; @@ -155,16 +155,7 @@ public class HttpUtil { } } - /** - *

- * getURL. - *

- * - * @param sURL - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public final String getURL(final String sURL) { + public static String getURL(final String sURL) { URL url = null; try { url = new URL(sURL); @@ -189,4 +180,7 @@ public class HttpUtil { return buffer.toString(); } + + // disable instantiation + private HttpUtil () { } } diff --git a/src/main/java/forge/util/ThreadUtil.java b/src/main/java/forge/util/ThreadUtil.java index 8260fd98851..4abc7967ae9 100644 --- a/src/main/java/forge/util/ThreadUtil.java +++ b/src/main/java/forge/util/ThreadUtil.java @@ -21,6 +21,7 @@ package forge.util; import java.lang.reflect.InvocationTargetException; + import javax.swing.SwingUtilities; /** diff --git a/src/main/java/forge/util/TreeProperties.java b/src/main/java/forge/util/TreeProperties.java deleted file mode 100644 index 598775ede4f..00000000000 --- a/src/main/java/forge/util/TreeProperties.java +++ /dev/null @@ -1,531 +0,0 @@ -/* - * Forge: Play Magic: the Gathering. - * Copyright (C) 2009 Clemens Koza - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package forge.util; - -/** - * TreeProperties.java - * - * Created on 19.08.2009 - */ - -import static java.lang.String.format; -import static java.util.Collections.unmodifiableList; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.Properties; -import java.util.Set; - - -/** - * The class TreeProperties. This class allows for a tree-like structure of - * properties-files. This class lays some restrictions on the keys used in - * properties-files: - *
    - *
  • The use of "--" is forbidden
  • - *
  • The suffixes "--properties" and "--transparent-properties" are reserved - * for specifying additional properties-files in the tree (relative paths are - * relative to the properties-file where they are referenced)
  • - *
  • Other suffixes are used by {@link PropertyType}s. PropertyTypes are - * registered or unregistered using {@link #addType(PropertyType)} or - * {@link #removeType(PropertyType)}.
  • - *
- * Take a look at these files: - *

- * - *

- * #root.properties
- * title=directions
- * icons--properties=img/icons.properties
- * 
- * #img/icons.properties
- * left--file=left.jpg
- * right--file=right.jpg
- * up--file=up.jpg
- * down--file=down.jpg
- * #note that the path does not contain "img/"
- * size--transparent-properties=size.properties
- * 
- * #img/size.properties
- * width=20
- * height=20
- * 
- *

- * These properties are retrieved with - *

- * - *

- * getProperty("title") //directions
- * getFile("icons/left") //img/left.jpg
- * getFile("icons/right") //img/right.jpg
- * getFile("icons/up") //img/up.jpg
- * getFile("icons/down") //img/down.jpg
- * getProperty("icons/width") //20
- * getProperty("icons/height") //20
- * 
- *

- * As you can see, a properties file included with "--transparent-properties" - * hides its existence from the user. A file included with "--properties" is not - * hidden. The child properties are accessible as if their keys were prepended - * with the parent key, separated by a slash. - *

- * Note that --file, --properties and --transparent-properties entries will be - * relative to the included file, even if the properties file is transparent. - *

- * Also, the TreeProperties can be retrieved: - *

- * - *

- * getChildProperties("icons")
- * getTransparentProperties("icons/size")
- * 
- *

- *

- * TODO add edit & save support - * - * @author Clemens Koza - * @version V0.0 19.08.2009 - * @see Properties - */ -public class TreeProperties /* implements Iterable */ { - /** Constant suffixes. */ - private static final Map> SUFFIXES; - /** Constant types. */ - private static final Map, PropertyType> TYPES; - - /** Constant transparent="transparent-properties". */ - private static final String TRANSPARENT = "transparent-properties"; - /** Constant child="properties". */ - private static final String CHILD = "properties"; - - static { - TYPES = new HashMap, PropertyType>(); - SUFFIXES = new HashMap>(); - PropertyType[] pt = {new FileType()}; - for (PropertyType type : pt) { - addType(type); - } - } - - private File path; - private Map, PropertyType> instanceTypes; - private Map> instanceSuffixes; - private HashMap properties; - private List exceptions; - - /** - *

- * addType. - *

- * - * @param type - * a {@link tree.properties.PropertyType} object. - */ - public static void addType(final PropertyType type) { - TYPES.put(type.getType(), type); - SUFFIXES.put(type.getSuffix(), type); - } - - /** - *

- * removeType. - *

- * - * @param type - * a {@link tree.properties.PropertyType} object. - */ - public static void removeType(final PropertyType type) { - TYPES.remove(type.getType()); - SUFFIXES.remove(type.getSuffix()); - } - - /** - * Delegate to {@link #TreeProperties(File)} with a new. - * - * @param f a {@link java.lang.String} object. - * @throws IOException Signals that an I/O exception has occurred. - * {@link File#File(String)}. - */ - public TreeProperties(final String f) throws IOException { - this(new File(f)); - } - - /** - * Delegate to {@link #TreeProperties(File)} with a new. - * - * @param parent a {@link java.io.File} object. - * @param f a {@link java.lang.String} object. - * @throws IOException Signals that an I/O exception has occurred. - * {@link File#File(File, String)}. - */ - public TreeProperties(final File parent, final String f) throws IOException { - this(new File(parent, f)); - } - - /** - * The constructor is forgiving in the way that Exceptions are not directly - * forwarded. The only fatal exception is if the parameter is null or not - * found. Instead, the rest of the properties are processed, so that the - * erroneous properties are the only ones not present in this - * TreeProperties. Afterwards, the exceptions can be accessed. - * - * @param f a {@link java.io.File} object. - * @throws IOException Signals that an I/O exception has occurred. - */ - public TreeProperties(final File f) throws IOException { - if (f == null) { - throw new FileNotFoundException("null"); - } - this.path = f.getParentFile(); - instanceTypes = new HashMap, PropertyType>(TYPES); - instanceSuffixes = new HashMap>(SUFFIXES); - Properties p = new Properties(); - - // BufferedReader r = new BufferedReader(new FileReader(f)); - // p.load(r); - // r.close(); - BufferedInputStream is = new BufferedInputStream(new FileInputStream(f)); - p.load(is); - is.close(); - - Set> entries = p.entrySet(); - properties = new HashMap(); - List exceptions = new ArrayList(); - this.exceptions = unmodifiableList(exceptions); - for (Entry entry : entries) { - String key = (String) entry.getKey(); - String value = (String) entry.getValue(); - try { - String[] parts = key.split("--", 2); - Object result; - if (parts.length == 1) { - // Regular - result = value; - } else { - // suffix - if (parts[1].equals(TRANSPARENT) || parts[1].equals(CHILD)) { - TreeProperties child = new TreeProperties(path, FileType.getPath(value)); - exceptions.addAll(child.exceptions); - result = child; - } else { - PropertyType t = instanceSuffixes.get(parts[1]); - if (t == null) { - throw new IllegalArgumentException("No content type: " + parts[1]); - } - result = t.toObject(this, value); - } - } - properties.put(key, result); - } catch (Exception ex) { - exceptions.add(new Exception(format("File '%s', Property '%s':%n %s", f, key, ex.getMessage()), ex - .getCause())); - } - } - } - - /** - * Returns the exceptions that were thrown while creating the tree - * properties. - * - * @return a {@link java.util.List} object. - */ - public final List getExceptions() { - return exceptions; - } - - /** - * If exceptions occurred during construction, this method throws an - * IOException that combines the messages of those exceptions. - * - * @throws IOException Signals that an I/O exception has occurred. - */ - public final void rethrow() throws IOException { - if (exceptions.isEmpty()) { - return; - } - StringBuilder sb = new StringBuilder("The following exceptions occurred:"); - for (Exception ex : exceptions) { - sb.append("\n"); - sb.append(ex.getMessage()); - } - throw new IOException(sb.toString()); - } - - /** - * Returns the parent directory of this TreeProperties. - * - * @return a {@link java.io.File} object. - */ - public final File getPath() { - return path; - } - - /** - * Checks if the key is valid for a query and throws an - * {@link IllegalArgumentException} if not. Slashes are allowed in this - * method, but suffixes are not - * - * @param key - * a {@link java.lang.String} object. - */ - private void checkQueryKey(final String key) { - if (key.contains("--")) { - throw new IllegalArgumentException("Invalid key: " + key); - } - } - - /** - * Retrieves the string property for the given key. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public final String getProperty(final String key) { - return getProperty(key, String.class); - } - - /** - * Convenience for {@code getProperty(key, File.class)}. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link java.io.File} object. - */ - public final File getFile(final String key) { - return getProperty(key, File.class); - } - - /** - * Retrieves the child properties for the given key. Transparent properties - * can't be retrieved this way. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link forge.util.TreeProperties} object. - */ - public final TreeProperties getChildProperties(final String key) { - return (TreeProperties) getProperty(key, "--" + CHILD, true); - } - - /** - * Retrieves the child properties for the given key. - * - * @param key - * a {@link java.lang.String} object. - * @return a {@link forge.util.TreeProperties} object. - */ - public final TreeProperties getTransparentProperties(final String key) { - return (TreeProperties) getProperty(key, "--" + TRANSPARENT, true); - } - - /** - * Returns a property of the given type. This does not work to retrieve tree - * properties. - * - * @param a T object. - * @param key a {@link java.lang.String} object. - * @param cls a {@link java.lang.Class} object. - * @return a T object. - */ - @SuppressWarnings("unchecked") - public final T getProperty(final String key, final Class cls) { - String suffix; - if (cls == String.class) { - suffix = ""; - } else { - PropertyType t = instanceTypes.get(cls); - suffix = "--" + t.getSuffix(); - } - return (T) getProperty(key, suffix, true); - } - - /** - *

- * getProperty. - *

- * - * @param key - * a {@link java.lang.String} object. - * @param suffix - * a {@link java.lang.String} object. - * @param top - * a boolean. - * @return a {@link java.lang.Object} object. - */ - private Object getProperty(final String key, final String suffix, final boolean top) { - checkQueryKey(key); - // first, try the key in the current file, as if there were no slash - // No subpath - either directly in the properties... - Object result = properties.get(key + suffix); - if (result != null) { - return result; - } - - // ...or in a transparent properties - - // look for all --transparent-properties - for (Entry entry : properties.entrySet()) { - if (entry.getKey().endsWith("--" + TRANSPARENT)) { - TreeProperties p = (TreeProperties) entry.getValue(); - result = p.getProperty(key, suffix, false); - if (result != null) { - return result; - } - } - } - - // if there is no immediate containment, try the children - // try every combination - // for a/b/c, there could be a child "a/b--properties" that contains "c" - // or "a--properties" with "b/c" - int index = -1; - while ((index = key.indexOf('/', index + 1)) != -1) { - String first = key.substring(0, index), second = key.substring(index + 1); - - TreeProperties p = (TreeProperties) getProperty(first, "--" + CHILD, false); - if (p == null) { - continue; - } - result = p.getProperty(second, suffix, false); - if (result != null) { - return result; - } - } - if (top) { - Exception ex = new Exception("TreeProperties returns null for " + key + suffix); - // ex.printStackTrace(); - System.err.println(ex); - } - return null; - } - - public interface PropertyType { - /** - * The suffix, not including "--", that identifies this content type. - * - * @return a {@link java.lang.String} object. - */ - String getSuffix(); - - /** - * The class that identifies this content type. - * - * @return a {@link java.lang.Class} object. - */ - Class getType(); - - /** - * Returns an object for the specified value, in the context of a - * TreeProperties. - * - * @param p - * a {@link forge.util.TreeProperties} object. - * @param s - * a {@link java.lang.String} object. - * @return a T object. - */ - T toObject(TreeProperties p, String s); - } - - public static class FileType implements PropertyType { - /** Constant suffix="file". */ - public static final String SUFFIX = "file"; - /** Constant type. */ - public static final Class TYPE = File.class; - - /** - *

- * Getter for the field suffix. - *

- * - * @return a {@link java.lang.String} object. - */ - @Override - public final String getSuffix() { - return SUFFIX; - } - - /** - *

- * Getter for the field type. - *

- * - * @return a {@link java.lang.Class} object. - */ - @Override - public final Class getType() { - return TYPE; - } - - /** {@inheritDoc} */ - @Override - public final File toObject(final TreeProperties p, final String s) { - String path = getPath(s); - File f = new File(path); - if (f.isAbsolute()) { - return f; - } else { - return new File(p.getPath(), path); - } - } - - /** - * Returns a path path from a property value. Three substitutions are - * applied: - *
    - *
  • A "~/" or "~\" at the beginning is replaced with the user's home - * directory
  • - *
  • A "$$" anywhere is replaced with a single "$"
  • - *
  • A "${*}", where * is any string without "}", is replaced by - * - * @param s a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - * {@link System#getProperty(String)}
  • - *
- */ - public static String getPath(String s) { - if (s.startsWith("~/")) { - s = System.getProperty("user.home") + "/" + s.substring(2); - } else if (s.startsWith("~\\")) { - s = System.getProperty("user.home") + "\\" + s.substring(2); - } - Matcher m = Pattern.compile("\\$\\$|\\$\\{([^\\}]*)\\}").matcher(s); - StringBuffer result = new StringBuffer(); - while (m.find()) { - if (m.group().equals("$$")) { - m.appendReplacement(result, Matcher.quoteReplacement("$")); - } else { - m.appendReplacement(result, Matcher.quoteReplacement(System.getProperty(m.group(1)))); - } - } - m.appendTail(result); - return result.toString(); - } - } -} diff --git a/src/main/java/forge/util/storage/StorageReaderFile.java b/src/main/java/forge/util/storage/StorageReaderFile.java index b8fa69965a0..82b420d787e 100644 --- a/src/main/java/forge/util/storage/StorageReaderFile.java +++ b/src/main/java/forge/util/storage/StorageReaderFile.java @@ -23,7 +23,6 @@ import java.util.TreeMap; import javax.swing.JOptionPane; - import org.apache.commons.lang3.StringUtils; import com.google.common.base.Function; diff --git a/src/main/java/forge/util/storage/StorageReaderFolder.java b/src/main/java/forge/util/storage/StorageReaderFolder.java index 5672145acc3..9d20500396f 100644 --- a/src/main/java/forge/util/storage/StorageReaderFolder.java +++ b/src/main/java/forge/util/storage/StorageReaderFolder.java @@ -28,7 +28,6 @@ import java.util.TreeMap; import javax.swing.JOptionPane; - import org.apache.commons.lang3.StringUtils; import com.google.common.base.Function; diff --git a/src/main/java/forge/view/FView.java b/src/main/java/forge/view/FView.java index c0924131f9e..5869b9bb78b 100644 --- a/src/main/java/forge/view/FView.java +++ b/src/main/java/forge/view/FView.java @@ -16,7 +16,6 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; import net.miginfocom.swing.MigLayout; - import forge.Singletons; import forge.control.FControl; import forge.gui.deckeditor.VDeckEditorUI; diff --git a/src/main/java/forge/view/Main.java b/src/main/java/forge/view/Main.java index afc01838272..0eb7890cdad 100644 --- a/src/main/java/forge/view/Main.java +++ b/src/main/java/forge/view/Main.java @@ -17,32 +17,36 @@ */ package forge.view; +import java.io.File; + import forge.Singletons; import forge.control.FControl; import forge.model.FModel; +import forge.properties.NewConstants; /** * Main class for Forge's swing application view. */ public final class Main { - /** - * Do not instantiate. - */ - private Main() { - // Intentionally blank. - } - - /** - * Main method for Forge. - * - * @param args - * an array of {@link java.lang.String} objects. + * Main entrypoint for Forge */ public static void main(final String[] args) { // HACK - temporary solution to "Comparison method violates it's general contract!" crash System.setProperty("java.util.Arrays.useLegacyMergeSort", "true"); + // create profile dirs if they don't already exist + for (String dname : NewConstants.PROFILE_DIRS) { + File path = new File(dname); + if (path.isDirectory()) { + // already exists + continue; + } + if (!path.mkdirs()) { + throw new RuntimeException("cannot create profile directory: " + dname); + } + } + // Start splash screen first, then data models, then controller. Singletons.setView(FView.SINGLETON_INSTANCE); Singletons.setModel(FModel.SINGLETON_INSTANCE); @@ -52,14 +56,15 @@ public final class Main { Singletons.getControl().initialize(); } - /** @throws Throwable */ @Override protected void finalize() throws Throwable { - try { } catch (Exception e) { } - finally { - super.finalize(); - //more code can be written here as per need of application + try { Singletons.getModel().close(); + } finally { + super.finalize(); } } + + // disallow instantiation + private Main() { } } diff --git a/src/main/java/forge/view/arcane/PlayArea.java b/src/main/java/forge/view/arcane/PlayArea.java index 62acf479920..24fb2530a25 100644 --- a/src/main/java/forge/view/arcane/PlayArea.java +++ b/src/main/java/forge/view/arcane/PlayArea.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; import javax.swing.JScrollPane; + import forge.Card; import forge.view.arcane.util.Animation; import forge.view.arcane.util.CardPanelMouseListener; diff --git a/src/test/java/forge/ReadDraftRankingsTest.java b/src/test/java/forge/ReadDraftRankingsTest.java index 00d6822d4d1..f155282001d 100644 --- a/src/test/java/forge/ReadDraftRankingsTest.java +++ b/src/test/java/forge/ReadDraftRankingsTest.java @@ -10,7 +10,6 @@ import org.testng.annotations.Test; import forge.card.CardRules; import forge.card.CardRulesReader; import forge.game.limited.ReadDraftRankings; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.FileUtil; @@ -31,20 +30,20 @@ public class ReadDraftRankingsTest { CardRulesReader cr = new CardRulesReader(); - List cardLines = FileUtil.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/g", "garruk_primal_hunter.txt")); + List cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR.defaultLoc + "/g", "garruk_primal_hunter.txt")); CardRules c = cr.readCard(cardLines); Assert.assertEquals(1.0 / 234.0, rdr.getRanking(c.getName(), "M13").doubleValue()); - cardLines = FileUtil.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/c", "clone.txt")); + cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR.defaultLoc + "/c", "clone.txt")); c = cr.readCard(cardLines); Assert.assertEquals(38.0 / 234.0, rdr.getRanking(c.getName(), "M13").doubleValue()); - cardLines = FileUtil.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/t", "tamiyo_the_moon_sage.txt")); + cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR.defaultLoc + "/t", "tamiyo_the_moon_sage.txt")); c = cr.readCard(cardLines); Assert.assertEquals(1.0 / 234.0, rdr.getRanking(c.getName(), "AVR").doubleValue()); // Mikaeus, the Lunarch has a comma in its name in the rankings file - cardLines = FileUtil.readFile(new File(ForgeProps.getFile(NewConstants.CARDSFOLDER) + "/m", "mikaeus_the_lunarch.txt")); + cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR.defaultLoc + "/m", "mikaeus_the_lunarch.txt")); c = cr.readCard(cardLines); Assert.assertEquals(4.0 / 255.0, rdr.getRanking(c.getName(), "ISD").doubleValue()); diff --git a/src/test/java/forge/item/DeckHintsTest.java b/src/test/java/forge/item/DeckHintsTest.java index df1795f658f..ccdcea02fd7 100644 --- a/src/test/java/forge/item/DeckHintsTest.java +++ b/src/test/java/forge/item/DeckHintsTest.java @@ -11,7 +11,6 @@ import org.testng.annotations.Test; import forge.card.CardRarity; import forge.card.CardRulesReader; import forge.card.DeckHints; -import forge.properties.ForgeProps; import forge.properties.NewConstants; import forge.util.FileUtil; @@ -131,7 +130,7 @@ public class DeckHintsTest { */ protected CardPrinted readCard(String filename) { String firstLetter = filename.substring(0, 1); - File dir = new File(ForgeProps.getFile(NewConstants.CARDSFOLDER), firstLetter); + File dir = new File(NewConstants.CARD_DATA_DIR.defaultLoc, firstLetter); File txtFile = new File(dir, filename); CardRulesReader crr = new CardRulesReader(); diff --git a/src/test/java/forge/model/FModelTest.java b/src/test/java/forge/model/FModelTest.java index 247e2f97d65..b6ce037db4c 100644 --- a/src/test/java/forge/model/FModelTest.java +++ b/src/test/java/forge/model/FModelTest.java @@ -1,6 +1,7 @@ package forge.model; import java.io.FileNotFoundException; +import java.io.IOException; import org.testng.Assert; import org.testng.annotations.AfterTest; @@ -52,7 +53,7 @@ public class FModelTest { * if something is really wrong */ @Test(enabled = false) - public final void test_ctor_close_ctor() throws FileNotFoundException { + public final void test_ctor_close_ctor() throws IOException { // by // Braids // on