diff --git a/.gitattributes b/.gitattributes index 5f19988d661..d0cd306df1e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2611,6 +2611,7 @@ res/cardsfolder/d/diamond_valley.txt svneol=native#text/plain res/cardsfolder/d/didgeridoo.txt svneol=native#text/plain res/cardsfolder/d/diligent_farmhand.txt svneol=native#text/plain res/cardsfolder/d/diluvian_primordial.txt -text +res/cardsfolder/d/dimensional_breach.txt -text res/cardsfolder/d/diminish.txt svneol=native#text/plain res/cardsfolder/d/diminishing_returns.txt svneol=native#text/plain res/cardsfolder/d/dimir_aqueduct.txt svneol=native#text/plain @@ -3299,6 +3300,7 @@ res/cardsfolder/e/ethersworn_canonist.txt -text res/cardsfolder/e/ethersworn_shieldmage.txt -text res/cardsfolder/e/etherwrought_page.txt -text svneol=unset#text/plain res/cardsfolder/e/eunuchs_intrigues.txt -text +res/cardsfolder/e/eureka.txt -text res/cardsfolder/e/evacuation.txt svneol=native#text/plain res/cardsfolder/e/evaporate.txt svneol=native#text/plain res/cardsfolder/e/evasive_action.txt svneol=native#text/plain @@ -3491,6 +3493,7 @@ res/cardsfolder/f/feed_the_pack.txt -text res/cardsfolder/f/feedback.txt svneol=native#text/plain res/cardsfolder/f/feedback_bolt.txt svneol=native#text/plain res/cardsfolder/f/feeding_frenzy.txt svneol=native#text/plain +res/cardsfolder/f/feeding_grounds.txt -text res/cardsfolder/f/feeling_of_dread.txt -text res/cardsfolder/f/feint.txt -text res/cardsfolder/f/feldons_cane.txt svneol=native#text/plain @@ -4946,6 +4949,7 @@ res/cardsfolder/h/hope_charm.txt svneol=native#text/plain res/cardsfolder/h/hopping_automaton.txt svneol=native#text/plain res/cardsfolder/h/horde_of_boggarts.txt -text res/cardsfolder/h/horde_of_notions.txt svneol=native#text/plain +res/cardsfolder/h/horizon_boughs.txt -text res/cardsfolder/h/horizon_canopy.txt svneol=native#text/plain res/cardsfolder/h/horizon_drake.txt svneol=native#text/plain res/cardsfolder/h/horizon_seed.txt -text @@ -5049,6 +5053,7 @@ res/cardsfolder/h/hydrosurge.txt -text res/cardsfolder/h/hyena_umbra.txt svneol=native#text/plain res/cardsfolder/h/hymn_of_rebirth.txt svneol=native#text/plain res/cardsfolder/h/hymn_to_tourach.txt svneol=native#text/plain +res/cardsfolder/h/hypergenesis.txt -text res/cardsfolder/h/hyperion_blacksmith.txt svneol=native#text/plain res/cardsfolder/h/hypersonic_dragon.txt -text res/cardsfolder/h/hypervolt_grasp.txt svneol=native#text/plain @@ -6037,6 +6042,7 @@ res/cardsfolder/l/lim_dul_the_necromancer.txt svneol=native#text/plain res/cardsfolder/l/lim_duls_cohort.txt svneol=native#text/plain res/cardsfolder/l/lim_duls_high_guard.txt svneol=native#text/plain res/cardsfolder/l/lim_duls_paladin.txt -text +res/cardsfolder/l/lim_duls_vault.txt -text res/cardsfolder/l/limestone_golem.txt svneol=native#text/plain res/cardsfolder/l/limited_resources.txt -text res/cardsfolder/l/lin_sivvi_defiant_hero.txt svneol=native#text/plain @@ -14530,7 +14536,6 @@ src/main/java/forge/view/arcane/package-info.java svneol=native#text/plain src/main/java/forge/view/arcane/util/Animation.java svneol=native#text/plain src/main/java/forge/view/arcane/util/CardPanelMouseListener.java svneol=native#text/plain src/main/java/forge/view/arcane/util/GlowText.java svneol=native#text/plain -src/main/java/forge/view/arcane/util/UI.java svneol=native#text/plain src/main/java/forge/view/arcane/util/package-info.java svneol=native#text/plain src/main/java/forge/view/package-info.java svneol=native#text/plain src/main/resources/proxy-template.ftl -text diff --git a/res/blockdata/blocks.txt b/res/blockdata/blocks.txt index ca2be21257f..f7ed6355888 100644 --- a/res/blockdata/blocks.txt +++ b/res/blockdata/blocks.txt @@ -1,53 +1,53 @@ -Index:0|Set0:LEA|Name:Alpha|DraftPacks:3|LandSetCode:LEA|SealedPacks:6 -Index:1|Set0:LEB|Name:Beta|DraftPacks:3|LandSetCode:LEB|SealedPacks:6 -Index:2|Set0:2ED|Name:Unlimited|DraftPacks:3|LandSetCode:2ED|SealedPacks:6 -Index:3|Set0:ARN|Name:Arabian Nights|DraftPacks:5|LandSetCode:2ED|SealedPacks:9 -Index:4|Set0:ATQ|Name:Antiquities|DraftPacks:5|LandSetCode:2ED|SealedPacks:9 -Index:5|Set0:3ED|Name:Revised|DraftPacks:3|LandSetCode:3ED|SealedPacks:6 -Index:6|Set0:LEG|Name:Legends|DraftPacks:3|LandSetCode:3ED|SealedPacks:6 -Index:7|Set0:DRK|Name:The Dark|DraftPacks:5|LandSetCode:3ED|SealedPacks:9 -Index:8|Set0:FEM|Name:Fallen Empires|DraftPacks:5|LandSetCode:3ED|SealedPacks:9 -Index:9|Set0:4ED|Name:Fourth Edition|DraftPacks:3|LandSetCode:4ED|SealedPacks:6 +Set0:LEA|Name:Alpha|DraftPacks:3|LandSetCode:LEA|SealedPacks:6 +Set0:LEB|Name:Beta|DraftPacks:3|LandSetCode:LEB|SealedPacks:6 +Set0:2ED|Name:Unlimited|DraftPacks:3|LandSetCode:2ED|SealedPacks:6 +Set0:ARN|Name:Arabian Nights|DraftPacks:5|LandSetCode:2ED|SealedPacks:9 +Set0:ATQ|Name:Antiquities|DraftPacks:5|LandSetCode:2ED|SealedPacks:9 +Set0:3ED|Name:Revised|DraftPacks:3|LandSetCode:3ED|SealedPacks:6 +Set0:LEG|Name:Legends|DraftPacks:3|LandSetCode:3ED|SealedPacks:6 +Set0:DRK|Name:The Dark|DraftPacks:5|LandSetCode:3ED|SealedPacks:9 +Set0:FEM|Name:Fallen Empires|DraftPacks:5|LandSetCode:3ED|SealedPacks:9 +Set0:4ED|Name:Fourth Edition|DraftPacks:3|LandSetCode:4ED|SealedPacks:6 -Index:10|Set0:ICE|Set1:ALL|Set2:CSP|Name:Ice Age|DraftPacks:3|LandSetCode:ICE|SealedPacks:6 -Index:11|Set0:HML|Name:Homelands|DraftPacks:5|LandSetCode:4ED|SealedPacks:9 -Index:12|Set0:MIR|Set1:VIS|Set2:WTH|Name:Mirage|DraftPacks:3|LandSetCode:MIR|SealedPacks:6 -Index:13|Set0:5ED|Name:Fifth Edition|DraftPacks:3|LandSetCode:5ED|SealedPacks:6 -Index:14|Set0:POR|Name:Portal|DraftPacks:3|LandSetCode:POR|SealedPacks:6 -Index:15|Set0:TMP|Set1:STH|Set2:EXO|Name:Tempest|DraftPacks:3|LandSetCode:TMP|SealedPacks:6 -Index:16|Set0:PO2|Name:Portal Second Age|DraftPacks:3|LandSetCode:PO2|SealedPacks:6 -Index:17|Set0:USG|Set1:ULG|Set2:UDS|Name:Urza|DraftPacks:3|LandSetCode:USG|SealedPacks:6 -Index:18|Set0:6ED|Name:Sixth Edition|DraftPacks:3|LandSetCode:6ED|SealedPacks:6 -Index:19|Set0:PTK|Name:Portal Three Kingdoms|DraftPacks:5|LandSetCode:PTK|SealedPacks:9 +Set0:ICE|Set1:ALL|Set2:CSP|Name:Ice Age|DraftPacks:3|LandSetCode:ICE|SealedPacks:6 +Set0:HML|Name:Homelands|DraftPacks:5|LandSetCode:4ED|SealedPacks:9 +Set0:MIR|Set1:VIS|Set2:WTH|Name:Mirage|DraftPacks:3|LandSetCode:MIR|SealedPacks:6 +Set0:5ED|Name:Fifth Edition|DraftPacks:3|LandSetCode:5ED|SealedPacks:6 +Set0:POR|Name:Portal|DraftPacks:3|LandSetCode:POR|SealedPacks:6 +Set0:TMP|Set1:STH|Set2:EXO|Name:Tempest|DraftPacks:3|LandSetCode:TMP|SealedPacks:6 +Set0:PO2|Name:Portal Second Age|DraftPacks:3|LandSetCode:PO2|SealedPacks:6 +Set0:USG|Set1:ULG|Set2:UDS|Name:Urza|DraftPacks:3|LandSetCode:USG|SealedPacks:6 +Set0:6ED|Name:Sixth Edition|DraftPacks:3|LandSetCode:6ED|SealedPacks:6 +Set0:PTK|Name:Portal Three Kingdoms|DraftPacks:5|LandSetCode:PTK|SealedPacks:9 -Index:20|Set0:MMQ|Set1:NMS|Set2:PCY|Name:Masques|DraftPacks:3|LandSetCode:MMQ|SealedPacks:6 -Index:21|Set0:INV|Set1:PLS|Set2:APC|Name:Invasion|DraftPacks:3|LandSetCode:INV|SealedPacks:6 -Index:22|Set0:7ED|Name:Seventh Edition|DraftPacks:3|LandSetCode:7ED|SealedPacks:6 -Index:23|Set0:ODY|Set1:TOR|Set2:JUD|Name:Odyssey|DraftPacks:3|LandSetCode:ODY|SealedPacks:6 -Index:24|Set0:ONS|Set1:LGN|Set2:SCG|Name:Onslaught|DraftPacks:3|LandSetCode:ONS|SealedPacks:6 -Index:25|Set0:8ED|Name:Eighth Edition|DraftPacks:3|LandSetCode:8ED|SealedPacks:6 -Index:26|Set0:MRD|Set1:DST|Set2:5DN|Name:Mirrodin|DraftPacks:3|LandSetCode:MRD|SealedPacks:6 -Index:27|Set0:CHK|Set1:BOK|Set2:SOK|Name:Kamigawa|DraftPacks:3|LandSetCode:CHK|SealedPacks:6 -Index:28|Set0:9ED|Name:Ninth Edition|DraftPacks:3|LandSetCode:9ED|SealedPacks:6 -Index:29|Set0:RAV|Set1:GPT|Set2:DIS|Name:Ravnica|DraftPacks:3|LandSetCode:RAV|SealedPacks:6 +Set0:MMQ|Set1:NMS|Set2:PCY|Name:Masques|DraftPacks:3|LandSetCode:MMQ|SealedPacks:6 +Set0:INV|Set1:PLS|Set2:APC|Name:Invasion|DraftPacks:3|LandSetCode:INV|SealedPacks:6 +Set0:7ED|Name:Seventh Edition|DraftPacks:3|LandSetCode:7ED|SealedPacks:6 +Set0:ODY|Set1:TOR|Set2:JUD|Name:Odyssey|DraftPacks:3|LandSetCode:ODY|SealedPacks:6 +Set0:ONS|Set1:LGN|Set2:SCG|Name:Onslaught|DraftPacks:3|LandSetCode:ONS|SealedPacks:6 +Set0:8ED|Name:Eighth Edition|DraftPacks:3|LandSetCode:8ED|SealedPacks:6 +Set0:MRD|Set1:DST|Set2:5DN|Name:Mirrodin|DraftPacks:3|LandSetCode:MRD|SealedPacks:6 +Set0:CHK|Set1:BOK|Set2:SOK|Name:Kamigawa|DraftPacks:3|LandSetCode:CHK|SealedPacks:6 +Set0:9ED|Name:Ninth Edition|DraftPacks:3|LandSetCode:9ED|SealedPacks:6 +Set0:RAV|Set1:GPT|Set2:DIS|Name:Ravnica|DraftPacks:3|LandSetCode:RAV|SealedPacks:6 -Index:30|Set0:CSP|Name:Coldsnap|DraftPacks:3|LandSetCode:9ED|SealedPacks:6 -Index:31|Set0:TSP|Set1:PLC|Set2:FUT|Name:Time Spiral|DraftPacks:3|LandSetCode:TSP|SealedPacks:6 -Index:32|Set0:10E|Name:Tenth Edition|DraftPacks:3|LandSetCode:10E|SealedPacks:6 -Index:33|Set0:LRW|Set1:MOR|Name:Lorwyn|DraftPacks:3|LandSetCode:LRW|SealedPacks:6 -Index:34|Set0:SHM|Set1:EVE|Name:Shadowmoor|DraftPacks:3|LandSetCode:SHM|SealedPacks:6 -Index:35|Set0:ALA|Set1:CFX|Set2:ARB|Name:Shards of Alara|DraftPacks:3|LandSetCode:ALA|SealedPacks:6 -Index:36|Set0:M10|Name:Magic 2010|DraftPacks:3|LandSetCode:M10|SealedPacks:6 -Index:37|Set0:ZEN|Set1:WWK|Name:Zendikar|DraftPacks:3|LandSetCode:ZEN|SealedPacks:6 -Index:38|Set0:ROE|Name:Rise of the Eldrazi|DraftPacks:3|LandSetCode:ROE|SealedPacks:6 -Index:39|Set0:M11|Name:Magic 2011|DraftPacks:3|LandSetCode:M11|SealedPacks:6 +Set0:CSP|Name:Coldsnap|DraftPacks:3|LandSetCode:9ED|SealedPacks:6 +Set0:TSP|Set1:PLC|Set2:FUT|Name:Time Spiral|DraftPacks:3|LandSetCode:TSP|SealedPacks:6 +Set0:10E|Name:Tenth Edition|DraftPacks:3|LandSetCode:10E|SealedPacks:6 +Set0:LRW|Set1:MOR|Name:Lorwyn|DraftPacks:3|LandSetCode:LRW|SealedPacks:6 +Set0:SHM|Set1:EVE|Name:Shadowmoor|DraftPacks:3|LandSetCode:SHM|SealedPacks:6 +Set0:ALA|Set1:CFX|Set2:ARB|Name:Shards of Alara|DraftPacks:3|LandSetCode:ALA|SealedPacks:6 +Set0:M10|Name:Magic 2010|DraftPacks:3|LandSetCode:M10|SealedPacks:6 +Set0:ZEN|Set1:WWK|Name:Zendikar|DraftPacks:3|LandSetCode:ZEN|SealedPacks:6 +Set0:ROE|Name:Rise of the Eldrazi|DraftPacks:3|LandSetCode:ROE|SealedPacks:6 +Set0:M11|Name:Magic 2011|DraftPacks:3|LandSetCode:M11|SealedPacks:6 -Index:40|Set0:SOM|Set1:MBS|Set2:NPH|Name:Scars of Mirrodin|DraftPacks:3|LandSetCode:SOM|SealedPacks:6 -Index:41|Set0:M12|Name:Magic 2012|DraftPacks:3|LandSetCode:M12|SealedPacks:6 -Index:42|Set0:ISD|Set1:DKA|Name:Innistrad|DraftPacks:3|LandSetCode:ISD|SealedPacks:6 -Index:43|Set0:AVR|Name:Avacyn Restored|DraftPacks:3|LandSetCode:AVR|SealedPacks:6 -Index:44|Set0:M13|Name:Magic 2013|DraftPacks:3|LandSetCode:M13|SealedPacks:6 -Index:45|Set0:RTR|Name:Return to Ravnica|DraftPacks:3|LandSetCode:RTR|SealedPacks:6 -Index:46|Set0:RTR|Set1:RTR|Set2:RTR|Set3:RTR|Set4:RTR|Meta0:CHOOSE1/CUBE/RtRGuildAzorius/Azorius Guild;CUBE/RtRGuildIzzet/Izzet Guild;CUBE/RtRGuildRakdos/Rakdos Guild;CUBE/RtRGuildGolgari/Golgari Guild;CUBE/RtRGuildSelesnya/Selesnya Guild/GUILD|Meta1:CHOOSE1/CUBE/RtRPromoAzorius/Azorius Guild;CUBE/RtRPromoIzzet/Izzet Guild;CUBE/RtRPromoRakdos/Rakdos Guild;CUBE/RtRPromoGolgari/Golgari Guild;CUBE/RtRPromoSelesnya/Selesnya Guild/PROMO|Name:Return to Ravnica Guild Sealed|DraftPacks:3|LandSetCode:RTR|SealedPacks:7 -Index:47|Set0:GTC|Name:Gatecrash|DraftPacks:3|LandSetCode:RTR|SealedPacks:6 -Index:48|Set0:GTC|Set1:GTC|Set2:GTC|Set3:GTC|Set4:GTC|Meta0:CHOOSE1/CUBE/GtcGuildBoros/Boros Guild;CUBE/GtcGuildDimir/Dimir Guild;CUBE/GtcGuildGruul/Gruul Guild;CUBE/GtcGuildOrzhov/Orzhov Guild;CUBE/GtcGuildSimic/Simic Guild/GUILD|Meta1:CHOOSE1/CUBE/GtcPromoBoros/Boros Guild;CUBE/GtcPromoDimir/Dimir Guild;CUBE/GtcPromoGruul/Gruul Guild;CUBE/GtcPromoOrzhov/Orzhov Guild;CUBE/GtcPromoSimic/Simic Guild/PROMO|Name:Gatecrash Guild Sealed|DraftPacks:3|LandSetCode:RTR|SealedPacks:7 +Set0:SOM|Set1:MBS|Set2:NPH|Name:Scars of Mirrodin|DraftPacks:3|LandSetCode:SOM|SealedPacks:6 +Set0:M12|Name:Magic 2012|DraftPacks:3|LandSetCode:M12|SealedPacks:6 +Set0:ISD|Set1:DKA|Name:Innistrad|DraftPacks:3|LandSetCode:ISD|SealedPacks:6 +Set0:AVR|Name:Avacyn Restored|DraftPacks:3|LandSetCode:AVR|SealedPacks:6 +Set0:M13|Name:Magic 2013|DraftPacks:3|LandSetCode:M13|SealedPacks:6 +Set0:RTR|Name:Return to Ravnica|DraftPacks:3|LandSetCode:RTR|SealedPacks:6 +Set0:RTR|Set1:RTR|Set2:RTR|Set3:RTR|Set4:RTR|Meta0:CHOOSE1/CUBE/RtRGuildAzorius/Azorius Guild;CUBE/RtRGuildIzzet/Izzet Guild;CUBE/RtRGuildRakdos/Rakdos Guild;CUBE/RtRGuildGolgari/Golgari Guild;CUBE/RtRGuildSelesnya/Selesnya Guild/GUILD|Meta1:CHOOSE1/CUBE/RtRPromoAzorius/Azorius Guild;CUBE/RtRPromoIzzet/Izzet Guild;CUBE/RtRPromoRakdos/Rakdos Guild;CUBE/RtRPromoGolgari/Golgari Guild;CUBE/RtRPromoSelesnya/Selesnya Guild/PROMO|Name:Return to Ravnica Guild Sealed|DraftPacks:3|LandSetCode:RTR|SealedPacks:7 +Set0:GTC|Name:Gatecrash|DraftPacks:3|LandSetCode:RTR|SealedPacks:6 +Set0:GTC|Set1:GTC|Set2:GTC|Set3:GTC|Set4:GTC|Meta0:CHOOSE1/CUBE/GtcGuildBoros/Boros Guild;CUBE/GtcGuildDimir/Dimir Guild;CUBE/GtcGuildGruul/Gruul Guild;CUBE/GtcGuildOrzhov/Orzhov Guild;CUBE/GtcGuildSimic/Simic Guild/GUILD|Meta1:CHOOSE1/CUBE/GtcPromoBoros/Boros Guild;CUBE/GtcPromoDimir/Dimir Guild;CUBE/GtcPromoGruul/Gruul Guild;CUBE/GtcPromoOrzhov/Orzhov Guild;CUBE/GtcPromoSimic/Simic Guild/PROMO|Name:Gatecrash Guild Sealed|DraftPacks:3|LandSetCode:RTR|SealedPacks:7 diff --git a/res/blockdata/setdata.txt b/res/blockdata/setdata.txt index f6b95befc23..28fa4f6cc7d 100644 --- a/res/blockdata/setdata.txt +++ b/res/blockdata/setdata.txt @@ -1,97 +1,97 @@ -Index:0|Code2:MBP|Code3:MBP|Type:Other|Name:Media Insert Promo|Alias:PRO -Index:1|Code2:A|Code3:LEA|Type:Core|Name:Limited Edition Alpha -Index:2|Code2:B|Code3:LEB|Type:Core|Name:Limited Edition Beta -Index:3|Code2:U|Code3:2ED|Type:Core|Border:White|Name:Unlimited Edition -Index:4|Code2:AN|Code3:ARN|Type:Expansion|Name:Arabian Nights -Index:5|Code2:AQ|Code3:ATQ|Type:Expansion|Name:Antiquities -Index:6|Code2:R|Code3:3ED|Type:Core|Border:White|Name:Revised Edition -Index:7|Code2:LG|Code3:LEG|Type:Expansion|Name:Legends -Index:8|Code2:DK|Code3:DRK|Type:Expansion|Name:The Dark -Index:9|Code2:FE|Code3:FEM|Type:Expansion|Name:Fallen Empires +Code2:MBP|Code3:MBP|Type:Other|Name:Media Insert Promo|Alias:PRO +Code2:A|Code3:LEA|Type:Core|Name:Limited Edition Alpha +Code2:B|Code3:LEB|Type:Core|Name:Limited Edition Beta +Code2:U|Code3:2ED|Type:Core|Border:White|Name:Unlimited Edition +Code2:AN|Code3:ARN|Type:Expansion|Name:Arabian Nights +Code2:AQ|Code3:ATQ|Type:Expansion|Name:Antiquities +Code2:R|Code3:3ED|Type:Core|Border:White|Name:Revised Edition +Code2:LG|Code3:LEG|Type:Expansion|Name:Legends +Code2:DK|Code3:DRK|Type:Expansion|Name:The Dark +Code2:FE|Code3:FEM|Type:Expansion|Name:Fallen Empires -Index:10|Code2:4E|Code3:4ED|Type:Core|Border:White|Name:Fourth Edition -Index:11|Code2:IA|Code3:ICE|Type:Expansion|Name:Ice Age -Index:12|Code2:CH|Code3:CHR|Type:Reprint|Border:White|Name:Chronicles -Index:13|Code2:HL|Code3:HML|Type:Expansion|Name:Homelands -Index:14|Code2:AL|Code3:ALL|Type:Expansion|Name:Alliances -Index:15|Code2:MI|Code3:MIR|Type:Expansion|Name:Mirage -Index:16|Code2:VI|Code3:VIS|Type:Expansion|Name:Visions -Index:17|Code2:5E|Code3:5ED|Type:Core|Border:White|Name:Fifth Edition -Index:18|Code2:PT|Code3:POR|Type:Starter|Name:Portal -Index:19|Code2:WL|Code3:WTH|Type:Expansion|Name:Weatherlight +Code2:4E|Code3:4ED|Type:Core|Border:White|Name:Fourth Edition +Code2:IA|Code3:ICE|Type:Expansion|Name:Ice Age +Code2:CH|Code3:CHR|Type:Reprint|Border:White|Name:Chronicles +Code2:HL|Code3:HML|Type:Expansion|Name:Homelands +Code2:AL|Code3:ALL|Type:Expansion|Name:Alliances +Code2:MI|Code3:MIR|Type:Expansion|Name:Mirage +Code2:VI|Code3:VIS|Type:Expansion|Name:Visions +Code2:5E|Code3:5ED|Type:Core|Border:White|Name:Fifth Edition +Code2:PT|Code3:POR|Type:Starter|Name:Portal +Code2:WL|Code3:WTH|Type:Expansion|Name:Weatherlight -Index:20|Code2:TE|Code3:TMP|Type:Expansion|Name:Tempest -Index:21|Code2:SH|Code3:STH|Type:Expansion|Name:Stronghold -Index:22|Code2:EX|Code3:EXO|Type:Expansion|Name:Exodus -Index:23|Code2:P2|Code3:PO2|Type:Starter|Name:Portal Second Age|Alias:P02 -Index:24|Code2:US|Code3:USG|Type:Expansion|Name:Urza's Saga -Index:25|Code2:UL|Code3:ULG|Type:Expansion|Name:Urza's Legacy -Index:26|Code2:6E|Code3:6ED|Type:Core|Border:White|Name:Classic (Sixth Edition) -Index:27|Code2:UD|Code3:UDS|Type:Expansion|Name:Urza's Destiny -Index:28|Code2:P3|Code3:PTK|Type:Starter|Border:White|Name:Portal Three Kingdoms -Index:29|Code2:ST|Code3:S99|Type:Starter|Border:White|Name:Starter 1999 +Code2:TE|Code3:TMP|Type:Expansion|Name:Tempest +Code2:SH|Code3:STH|Type:Expansion|Name:Stronghold +Code2:EX|Code3:EXO|Type:Expansion|Name:Exodus +Code2:P2|Code3:PO2|Type:Starter|Name:Portal Second Age|Alias:P02 +Code2:US|Code3:USG|Type:Expansion|Name:Urza's Saga +Code2:UL|Code3:ULG|Type:Expansion|Name:Urza's Legacy +Code2:6E|Code3:6ED|Type:Core|Border:White|Name:Classic (Sixth Edition) +Code2:UD|Code3:UDS|Type:Expansion|Name:Urza's Destiny +Code2:P3|Code3:PTK|Type:Starter|Border:White|Name:Portal Three Kingdoms +Code2:ST|Code3:S99|Type:Starter|Border:White|Name:Starter 1999 -Index:30|Code2:MM|Code3:MMQ|Type:Expansion|Name:Mercadian Masques -Index:31|Code2:NE|Code3:NMS|Type:Expansion|Name:Nemesis|Alias:NEM -Index:32|Code2:S2K|Code3:S00|Type:Starter|Border:White|Name:Starter 2000 -Index:33|Code2:PY|Code3:PCY|Type:Expansion|Name:Prophecy -Index:34|Code2:IN|Code3:INV|Type:Expansion|Name:Invasion -Index:35|Code2:PS|Code3:PLS|Type:Expansion|Name:Planeshift -Index:36|Code2:7E|Code3:7ED|Type:Core|Border:White|Name:Seventh Edition -Index:37|Code2:AP|Code3:APC|Type:Expansion|Name:Apocalypse -Index:38|Code2:OD|Code3:ODY|Type:Expansion|Name:Odyssey -Index:39|Code2:TO|Code3:TOR|Type:Expansion|Name:Torment +Code2:MM|Code3:MMQ|Type:Expansion|Name:Mercadian Masques +Code2:NE|Code3:NMS|Type:Expansion|Name:Nemesis|Alias:NEM +Code2:S2K|Code3:S00|Type:Starter|Border:White|Name:Starter 2000 +Code2:PY|Code3:PCY|Type:Expansion|Name:Prophecy +Code2:IN|Code3:INV|Type:Expansion|Name:Invasion +Code2:PS|Code3:PLS|Type:Expansion|Name:Planeshift +Code2:7E|Code3:7ED|Type:Core|Border:White|Name:Seventh Edition +Code2:AP|Code3:APC|Type:Expansion|Name:Apocalypse +Code2:OD|Code3:ODY|Type:Expansion|Name:Odyssey +Code2:TO|Code3:TOR|Type:Expansion|Name:Torment -Index:40|Code2:JU|Code3:JUD|Type:Expansion|Name:Judgment -Index:41|Code2:ON|Code3:ONS|Type:Expansion|Name:Onslaught -Index:42|Code2:LE|Code3:LGN|Type:Expansion|Name:Legions -Index:43|Code2:SC|Code3:SCG|Type:Expansion|Name:Scourge -Index:44|Code2:8E|Code3:8ED|Type:Core|Border:White|Name:Core Set - Eighth Edition -Index:45|Code2:MR|Code3:MRD|Type:Expansion|Name:Mirrodin -Index:46|Code2:DS|Code3:DST|Type:Expansion|Name:Darksteel -Index:47|Code2:FD|Code3:5DN|Type:Expansion|Name:Fifth Dawn -Index:48|Code2:CHK|Code3:CHK|Type:Expansion|Name:Champions of Kamigawa -Index:49|Code2:BOK|Code3:BOK|Type:Expansion|Name:Betrayers of Kamigawa +Code2:JU|Code3:JUD|Type:Expansion|Name:Judgment +Code2:ON|Code3:ONS|Type:Expansion|Name:Onslaught +Code2:LE|Code3:LGN|Type:Expansion|Name:Legions +Code2:SC|Code3:SCG|Type:Expansion|Name:Scourge +Code2:8E|Code3:8ED|Type:Core|Border:White|Name:Core Set - Eighth Edition +Code2:MR|Code3:MRD|Type:Expansion|Name:Mirrodin +Code2:DS|Code3:DST|Type:Expansion|Name:Darksteel +Code2:FD|Code3:5DN|Type:Expansion|Name:Fifth Dawn +Code2:CHK|Code3:CHK|Type:Expansion|Name:Champions of Kamigawa +Code2:BOK|Code3:BOK|Type:Expansion|Name:Betrayers of Kamigawa -Index:50|Code2:SOK|Code3:SOK|Type:Expansion|Name:Saviors of Kamigawa -Index:51|Code2:9E|Code3:9ED|Type:Core|Border:White|Name:Core Set - Ninth Edition -Index:52|Code2:RAV|Code3:RAV|Type:Expansion|Name:Ravnica: City of Guilds -Index:53|Code2:GP|Code3:GPT|Type:Expansion|Name:Guildpact -Index:54|Code2:DIS|Code3:DIS|Type:Expansion|Name:Dissension -Index:55|Code2:CS|Code3:CSP|Type:Expansion|Name:Coldsnap -Index:56|Code2:TSP|Code3:TSP|Type:Expansion|Name:Time Spiral -Index:57|Code2:TSB|Code3:TSB|Type:Expansion|Name:Time Spiral Timeshifted -Index:58|Code2:PLC|Code3:PLC|Type:Expansion|Name:Planar Chaos -Index:59|Code2:FUT|Code3:FUT|Type:Expansion|Name:Future Sight +Code2:SOK|Code3:SOK|Type:Expansion|Name:Saviors of Kamigawa +Code2:9E|Code3:9ED|Type:Core|Border:White|Name:Core Set - Ninth Edition +Code2:RAV|Code3:RAV|Type:Expansion|Name:Ravnica: City of Guilds +Code2:GP|Code3:GPT|Type:Expansion|Name:Guildpact +Code2:DIS|Code3:DIS|Type:Expansion|Name:Dissension +Code2:CS|Code3:CSP|Type:Expansion|Name:Coldsnap +Code2:TSP|Code3:TSP|Type:Expansion|Name:Time Spiral +Code2:TSB|Code3:TSB|Type:Expansion|Name:Time Spiral Timeshifted +Code2:PLC|Code3:PLC|Type:Expansion|Name:Planar Chaos +Code2:FUT|Code3:FUT|Type:Expansion|Name:Future Sight -Index:60|Code2:10E|Code3:10E|Type:Core|Name:Core Set - Tenth Edition -Index:61|Code2:LRW|Code3:LRW|Type:Expansion|Name:Lorwyn -Index:62|Code2:MOR|Code3:MOR|Type:Expansion|Name:Morningtide -Index:63|Code2:SHM|Code3:SHM|Type:Expansion|Name:Shadowmoor -Index:64|Code2:EVE|Code3:EVE|Type:Expansion|Name:Eventide|Alias:EVT -Index:65|Code2:ALA|Code3:ALA|Type:Expansion|Name:Shards of Alara -Index:66|Code2:CFX|Code3:CFX|Type:Expansion|Name:Conflux|Alias:CON -Index:67|Code2:ARB|Code3:ARB|Type:Expansion|Name:Alara Reborn -Index:68|Code2:M10|Code3:M10|Type:Core|Name:Magic 2010 -Index:69|Code2:ZEN|Code3:ZEN|Type:Expansion|Name:Zendikar +Code2:10E|Code3:10E|Type:Core|Name:Core Set - Tenth Edition +Code2:LRW|Code3:LRW|Type:Expansion|Name:Lorwyn +Code2:MOR|Code3:MOR|Type:Expansion|Name:Morningtide +Code2:SHM|Code3:SHM|Type:Expansion|Name:Shadowmoor +Code2:EVE|Code3:EVE|Type:Expansion|Name:Eventide|Alias:EVT +Code2:ALA|Code3:ALA|Type:Expansion|Name:Shards of Alara +Code2:CFX|Code3:CFX|Type:Expansion|Name:Conflux|Alias:CON +Code2:ARB|Code3:ARB|Type:Expansion|Name:Alara Reborn +Code2:M10|Code3:M10|Type:Core|Name:Magic 2010 +Code2:ZEN|Code3:ZEN|Type:Expansion|Name:Zendikar -Index:70|Code2:WWK|Code3:WWK|Type:Expansion|Name:Worldwake -Index:71|Code2:ROE|Code3:ROE|Type:Expansion|Name:Rise of the Eldrazi -Index:72|Code2:M11|Code3:M11|Type:Core|Name:Magic 2011 -Index:73|Code2:SOM|Code3:SOM|Type:Expansion|Name:Scars of Mirrodin -Index:74|Code2:MBS|Code3:MBS|Type:Expansion|Name:Mirrodin Besieged -Index:75|Code2:NPH|Code3:NPH|Type:Expansion|Name:New Phyrexia -Index:76|Code2:COM|Code3:COM|Type:Other|Name:Commander -Index:77|Code2:M12|Code3:M12|Type:Core|Name:Magic 2012 -Index:78|Code2:ISD|Code3:ISD|Type:Expansion|Name:Innistrad -Index:79|Code2:DKA|Code3:DKA|Type:Expansion|Name:Dark Ascension +Code2:WWK|Code3:WWK|Type:Expansion|Name:Worldwake +Code2:ROE|Code3:ROE|Type:Expansion|Name:Rise of the Eldrazi +Code2:M11|Code3:M11|Type:Core|Name:Magic 2011 +Code2:SOM|Code3:SOM|Type:Expansion|Name:Scars of Mirrodin +Code2:MBS|Code3:MBS|Type:Expansion|Name:Mirrodin Besieged +Code2:NPH|Code3:NPH|Type:Expansion|Name:New Phyrexia +Code2:COM|Code3:COM|Type:Other|Name:Commander +Code2:M12|Code3:M12|Type:Core|Name:Magic 2012 +Code2:ISD|Code3:ISD|Type:Expansion|Name:Innistrad +Code2:DKA|Code3:DKA|Type:Expansion|Name:Dark Ascension -Index:80|Code2:AVR|Code3:AVR|Type:Expansion|Name:Avacyn Restored -Index:81|Code2:PC2|Code3:PC2|Type:Other|Name:Planechase 2012 Edition -Index:82|Code2:M13|Code3:M13|Type:Core|Name:Magic 2013 -Index:83|Code2:RTR|Code3:RTR|Type:Expansion|Name:Return to Ravnica -Index:84|Code2:GTC|Code3:GTC|Type:Expansion|Name:Gatecrash +Code2:AVR|Code3:AVR|Type:Expansion|Name:Avacyn Restored +Code2:PC2|Code3:PC2|Type:Other|Name:Planechase 2012 Edition +Code2:M13|Code3:M13|Type:Core|Name:Magic 2013 +Code2:RTR|Code3:RTR|Type:Expansion|Name:Return to Ravnica +Code2:GTC|Code3:GTC|Type:Expansion|Name:Gatecrash -Index:86|Code2:VAN|Code3:VAN|Type:Other|Name:Vanguard -Index:87|Code2:ARC|Code3:ARC|Type:Other|Name:Archenemy -Index:88|Code2:HOP|Code3:HOP|Type:Other|Name:Planechase +Code2:VAN|Code3:VAN|Type:Other|Name:Vanguard +Code2:ARC|Code3:ARC|Type:Other|Name:Archenemy +Code2:HOP|Code3:HOP|Type:Other|Name:Planechase diff --git a/res/cardsfolder/d/dimensional_breach.txt b/res/cardsfolder/d/dimensional_breach.txt new file mode 100644 index 00000000000..2e5360c8b13 --- /dev/null +++ b/res/cardsfolder/d/dimensional_breach.txt @@ -0,0 +1,16 @@ +Name:Dimensional Breach +ManaCost:5 W W +Types:Sorcery +A:SP$ ChangeZoneAll | Cost$ 5 W W | ChangeType$ Permanent | Origin$ Battlefield | Destination$ Exile | RememberChanged$ True | SubAbility$ DBEffect | SpellDescription$ Exile all permanents. For as long as any of those cards remain exiled, at the beginning of each player's upkeep, that player returns one of the exiled cards he or she owns to the battlefield. +SVar:DBEffect:DB$ Effect | Name$ Dimensional Breach Effect | Triggers$ TrigUpkeep,TrigCleanup | SVars$ BreachReturn,BreachCleanup,MoveChosen,BreachX | RememberObjects$ Remembered | Duration$ Permanent | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:TrigUpkeep:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ BreachReturn | TriggerZones$ Command | TriggerController$ TriggeredPlayer | CheckSVar$ BreachX | SVarCompare$ GE1 | TriggerDescription$ At the beginning of each player's upkeep, that player returns one of the exiled cards he or she owns to the battlefield. +SVar:BreachReturn:AB$ ChooseCard | Cost$ 0 | Defined$ TriggeredPlayer | Amount$ 1 | Mandatory$ True | ChoiceTitle$ Choose a card to return to the battlefield | Choices$ Card.IsRemembered+ActivePlayerCtrl | ChoiceZone$ Exile | SubAbility$ MoveChosen +SVar:MoveChosen:DB$ ChangeZone | Origin$ Exile | Destination$ Battlefield | Defined$ ChosenCard | ForgetChanged$ True +SVar:TrigCleanup:Mode$ Always | CheckSVar$ BreachX | SVarCompare$ EQ0 | Static$ True | Execute$ BreachCleanup | TriggerZones$ Command +SVar:BreachCleanup:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile +SVar:BreachX:Count$ValidExile Card.IsRemembered +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/dimensional_breach.jpg +SetInfo:SCG|Rare|http://magiccards.info/scans/en/sc/9.jpg +Oracle:Exile all permanents. For as long as any of those cards remain exiled, at the beginning of each player's upkeep, that player returns one of the exiled cards he or she owns to the battlefield. diff --git a/res/cardsfolder/e/eureka.txt b/res/cardsfolder/e/eureka.txt new file mode 100644 index 00000000000..eb67b5629fb --- /dev/null +++ b/res/cardsfolder/e/eureka.txt @@ -0,0 +1,21 @@ +Name:Eureka +ManaCost:2 G G +Types:Sorcery +A:SP$ Repeat | Cost$ 2 G G | RepeatSubAbility$ ResetCheck | RepeatCheckSVar$ NumPlayerGiveup | RepeatSVarCompare$ LTTotalPlayer | SubAbility$ DBChangeZoneAll | StackDescription$ SpellDescription | SpellDescription$ Starting with you, each player may put a permanent card from his or her hand onto the battlefield. Repeat this process until no one puts a card onto the battlefield. +SVar:ResetCheck:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ Number | Expression$ 0 | SubAbility$ DBRepeatChoice +SVar:DBRepeatChoice:DB$ RepeatEach | RepeatSubAbility$ DBChoice | RepeatPlayers$ Player +SVar:DBChoice:DB$ GenericChoice | Choices$ DBCheckHand,DBNoChange | Defined$ Player.IsRemembered +SVar:DBCheckHand:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ CountSVar | Expression$ NumPlayerGiveup/Plus.1 | ConditionCheckSVar$ CheckHand | ConditionSVarCompare$ EQ0 | SubAbility$ DBChoose | ChoiceDescription$ Choose a permanent to put onto the battlefield +SVar:DBChoose:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Permanent.IsNotRemembered+RememberedPlayerCtrl | ChoiceZone$ Hand | Amount$ 1 | RememberChosen$ True | Mandatory$ True | ConditionCheckSVar$ CheckHand | ConditionSVarCompare$ GE1 +SVar:DBNoChange:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ CountSVar | Expression$ NumPlayerGiveup/Plus.1 | ChoiceDescription$ Do not put a permanent onto the battlefield +SVar:DBChangeZoneAll:DB$ ChangeZoneAll | Origin$ Hand | Destination$ Battlefield | ChangeType$ Card.IsRemembered | SubAbility$ FinalReset +SVar:FinalReset:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ Number | Expression$ 0 | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:NumPlayerGiveup:Number$0 +SVar:TotalPlayer:PlayerCountPlayers$Amount +SVar:CheckHand:Count$ValidHand Permanent.IsNotRemembered+RememberedPlayerCtrl +SVar:RemAIDeck:True +SVar:RemRandomDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/eureka.jpg +SetInfo:LEG|Rare|http://magiccards.info/scans/en/lg/99.jpg +Oracle:Starting with you, each player may put a permanent card from his or her hand onto the battlefield. Repeat this process until no one puts a card onto the battlefield. diff --git a/res/cardsfolder/f/feeding_grounds.txt b/res/cardsfolder/f/feeding_grounds.txt new file mode 100644 index 00000000000..dbe580dcf5d --- /dev/null +++ b/res/cardsfolder/f/feeding_grounds.txt @@ -0,0 +1,13 @@ +Name:Feeding Grounds +ManaCost:no cost +Types:Plane Muraganda +S:Mode$ ReduceCost | EffectZone$ Command | ValidCard$ Card.Green | Type$ Spell | Amount$ 1 | Description$ Green spells cost 1 less to cast. +S:Mode$ ReduceCost | EffectZone$ Command | ValidCard$ Card.Red | Type$ Spell | Amount$ 1 | Description$ Red spells cost 1 less to cast. +T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ DBPutCounter | TriggerDescription$ Whenever you roll Chaos, put X +1/+1 counters on target creature, where X is that creature's converted mana cost. +T:Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Execute$ RolledWalk | Secondary$ True | TriggerDescription$ Whenever you roll Planeswalk, put this card on the bottom of its owner's planar deck face down, then move the top card of your planar deck off that planar deck and turn it face up +SVar:RolledWalk:AB$ Planeswalk | Cost$ 0 +SVar:DBPutCounter:DB$PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature | CounterType$ P1P1 | CounterNum$ X +SVar:X:Targeted$CardManaCost +SVar:Picture:http://www.wizards.com/global/images/magic/general/feeding_grounds.jpg +SetInfo:HOP|Common|http://magiccards.info/extras/plane/planechase/feeding-grounds.jpg +Oracle:Red spells cost {1} less to cast.\nGreen spells cost {1} less to cast.\nWhenever you roll {C}, put X +1/+1 counters on target creature, where X is that creature's converted mana cost. diff --git a/res/cardsfolder/g/grisly_spectacle.txt b/res/cardsfolder/g/grisly_spectacle.txt index 5f8ce043b74..0bcbb7a9ff7 100644 --- a/res/cardsfolder/g/grisly_spectacle.txt +++ b/res/cardsfolder/g/grisly_spectacle.txt @@ -4,7 +4,6 @@ Types:Instant A:SP$ Destroy | Cost$ 2 B B | ValidTgts$ Creature.nonArtifact | TgtPrompt$ Select target nonartifact creature | SubAbility$ DBMill | SpellDescription$ Destroy target nonartifact creature. Its controller puts a number of cards equal to that creature's power from the top of his or her library into his or her graveyard. SVar:DBMill:DB$ Mill | NumCards$ X | Defined$ TargetedController | References$ X SVar:X:Targeted$CardPower -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/grisly_spectacle.jpg SetInfo:GTC|Common|http://magiccards.info/scans/en/gtc/66.jpg diff --git a/res/cardsfolder/h/hecatomb.txt b/res/cardsfolder/h/hecatomb.txt index f9f7d6166d1..b2faa648ee3 100644 --- a/res/cardsfolder/h/hecatomb.txt +++ b/res/cardsfolder/h/hecatomb.txt @@ -8,6 +8,8 @@ SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:X:Remembered$Amount A:AB$ DealDamage | Cost$ tapXType<1/Swamp> | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature or player. SVar:RemAIDeck:True +SVar:NeedsToPlayVar:Creats GE4 +SVar:Creats:Count$Valid Creature.YouCtrl SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/hecatomb.jpg SetInfo:5ED|Rare|http://magiccards.info/scans/en/5e/29.jpg diff --git a/res/cardsfolder/h/horizon_boughs.txt b/res/cardsfolder/h/horizon_boughs.txt new file mode 100644 index 00000000000..8b0b55ac43d --- /dev/null +++ b/res/cardsfolder/h/horizon_boughs.txt @@ -0,0 +1,11 @@ +Name:Horizon Boughs +ManaCost:no cost +Types:Plane Pyrulea +S:Mode$ Continuous | EffectZone$ Command | Affected$ Permanent | AddHiddenKeyword$ CARDNAME untaps during each other player's untap step. | Description$ All permanents untap during each player's untap step. +T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ DBFetch | TriggerDescription$ Whenever you roll Chaos, you may search your library for up to three basic land cards, put them onto the battlefield tapped, then shuffle your library. +T:Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Execute$ RolledWalk | Secondary$ True | TriggerDescription$ Whenever you roll Planeswalk, put this card on the bottom of its owner's planar deck face down, then move the top card of your planar deck off that planar deck and turn it face up +SVar:RolledWalk:AB$ Planeswalk | Cost$ 0 +SVar:DBFetch:DB$ChangeZone | Origin$ Library | Destination$ Battlefield | Tapped$ True | ChangeType$ Land.Basic | ChangeNum$ 3 +SVar:Picture:http://www.wizards.com/global/images/magic/general/horizon_boughs.jpg +SetInfo:HOP|Common|http://magiccards.info/extras/plane/planechase/horizon-boughs.jpg +Oracle:All permanents untap during each player's untap step.\nWhenever you roll {C}, you may search your library for up to three basic land cards, put them onto the battlefield tapped, then shuffle your library. diff --git a/res/cardsfolder/h/hypergenesis.txt b/res/cardsfolder/h/hypergenesis.txt new file mode 100644 index 00000000000..94ca133900b --- /dev/null +++ b/res/cardsfolder/h/hypergenesis.txt @@ -0,0 +1,23 @@ +Name:Hypergenesis +ManaCost:no cost +Types:Sorcery +Colors:green +K:Suspend:3:1 G G +A:SP$ Repeat | Cost$ 0 | RepeatSubAbility$ ResetCheck | RepeatCheckSVar$ NumPlayerGiveup | RepeatSVarCompare$ LTTotalPlayer | SubAbility$ DBChangeZoneAll | StackDescription$ SpellDescription | SpellDescription$ Starting with you, each player may put an artifact, creature, enchantment, or land card from his or her hand onto the battlefield. Repeat this process until no one puts a card onto the battlefield. +SVar:ResetCheck:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ Number | Expression$ 0 | SubAbility$ DBRepeatChoice +SVar:DBRepeatChoice:DB$ RepeatEach | RepeatSubAbility$ DBChoice | RepeatPlayers$ Player +SVar:DBChoice:DB$ GenericChoice | Choices$ DBCheckHand,DBNoChange | Defined$ Player.IsRemembered +SVar:DBCheckHand:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ CountSVar | Expression$ NumPlayerGiveup/Plus.1 | ConditionCheckSVar$ CheckHand | ConditionSVarCompare$ EQ0 | SubAbility$ DBChoose | ChoiceDescription$ Choose an artifact, creature, enchantment, or land card from your hand onto the battlefield +SVar:DBChoose:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Artifact.IsNotRemembered+RememberedPlayerCtrl,Creature.IsNotRemembered+RememberedPlayerCtrl,Enchantment.IsNotRemembered+RememberedPlayerCtrl,Land.IsNotRemembered+RememberedPlayerCtrl | ChoiceZone$ Hand | Amount$ 1 | RememberChosen$ True | Mandatory$ True | ConditionCheckSVar$ CheckHand | ConditionSVarCompare$ GE1 +SVar:DBNoChange:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ CountSVar | Expression$ NumPlayerGiveup/Plus.1 | ChoiceDescription$ Do not put an artifact, creature, enchantment, or land card from your hand onto the battlefield +SVar:DBChangeZoneAll:DB$ ChangeZoneAll | Origin$ Hand | Destination$ Battlefield | ChangeType$ Card.IsRemembered | SubAbility$ FinalReset +SVar:FinalReset:DB$ StoreSVar | SVar$ NumPlayerGiveup | Type$ Number | Expression$ 0 | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:NumPlayerGiveup:Number$0 +SVar:TotalPlayer:PlayerCountPlayers$Amount +SVar:CheckHand:Count$ValidHand Artifact.IsNotRemembered+RememberedPlayerCtrl,Creature.IsNotRemembered+RememberedPlayerCtrl,Enchantment.IsNotRemembered+RememberedPlayerCtrl,Land.IsNotRemembered+RememberedPlayerCtrl +SVar:RemRandomDeck:True +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/hypergenesis.jpg +SetInfo:TSP|Rare|http://magiccards.info/scans/en/ts/201.jpg +Oracle:Sorcery\nSuspend 3- {1}{G}{G} (Rather than cast this card from your hand, pay {1}{G}{G} and exile it with three time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.)\nStarting with you, each player may put an artifact, creature, enchantment, or land card from his or her hand onto the battlefield. Repeat this process until no one puts a card onto the battlefield. diff --git a/res/cardsfolder/l/lim_duls_vault.txt b/res/cardsfolder/l/lim_duls_vault.txt new file mode 100644 index 00000000000..a21c925e950 --- /dev/null +++ b/res/cardsfolder/l/lim_duls_vault.txt @@ -0,0 +1,17 @@ +Name:Lim-Dul's Vault +ManaCost:U B +Types:Instant +A:SP$ Dig | Cost$ U B | DigNum$ 5 | NoMove$ True | SubAbility$ DBRepeat | RememberRevealed$ True | StackDescription$ SpellDescription | SpellDescription$ Look at the top five cards of your library. As many times as you choose, you may pay 1 life, put those cards on the bottom of your library in any order, then look at the top five cards of your library. Then shuffle your library and put the last cards you looked at this way on top of it in any order. +SVar:DBRepeat:DB$ Repeat | RepeatSubAbility$ CheckLifePaid | RepeatCheckSVar$ LifePaid | RepeatSVarCompare$ EQ0 | SubAbility$ DBShuffle | StackDescription$ None +SVar:CheckLifePaid:DB$ StoreSVar | SVar$ LifePaid | Type$ Number | Expression$ 1 | UnlessPayer$ You | UnlessCost$ PayLife<1> | UnlessResolveSubs$ WhenPaid | UnlessAI$ Never | SubAbility$ DBResetRem | StackDescription$ No move +SVar:DBResetRem:DB$ Cleanup | ClearRemembered$ True | SubAbility$ GoToBottom +SVar:GoToBottom:DB$ Dig | DigNum$ 5 | ChangeNum$ All | DestinationZone$ Library | LibraryPosition$ -1 | NoLooking$ True | SubAbility$ DBLookAgain | StackDescription$ None +SVar:DBLookAgain:DB$ Dig | DigNum$ 5 | NoMove$ True | RememberRevealed$ True | StackDescription$ None +SVar:DBShuffle:DB$ ChangeZone | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Card.IsRemembered | ChangeNum$ 5 | SubAbility$ DBReset | Hidden$ True | SelectPrompt$ Pick 1 on the top of library | Mandatory$ True | NoReveal$ True | StackDescription$ None +SVar:DBReset:DB$ StoreSVar | SVar$ LifePaid | Type$ Number | Expression$ 0 | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:LifePaid:Number$0 +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/lim_duls_vault.jpg +SetInfo:ALL|Uncommon|http://magiccards.info/scans/en/ai/190.jpg +Oracle:Look at the top five cards of your library. As many times as you choose, you may pay 1 life, put those cards on the bottom of your library in any order, then look at the top five cards of your library. Then shuffle your library and put the last cards you looked at this way on top of it in any order. diff --git a/res/cardsfolder/r/ratcatcher.txt b/res/cardsfolder/r/ratcatcher.txt index 993629d14e4..735558d4c4f 100644 --- a/res/cardsfolder/r/ratcatcher.txt +++ b/res/cardsfolder/r/ratcatcher.txt @@ -6,7 +6,6 @@ PT:4/4 K:Fear T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigChange | TriggerDescription$ At the beginning of your upkeep, you may search your library for a Rat card, reveal it, and put it into your hand. If you do, shuffle your library. SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Hand | ChangeType$ Card.Rat | ChangeNum$ 1 -SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/ratcatcher.jpg SetInfo:DIS|Rare|http://magiccards.info/scans/en/di/52.jpg diff --git a/res/cardsfolder/s/soldevi_golem.txt b/res/cardsfolder/s/soldevi_golem.txt index 50d58deb86f..e3641c596f8 100644 --- a/res/cardsfolder/s/soldevi_golem.txt +++ b/res/cardsfolder/s/soldevi_golem.txt @@ -4,7 +4,7 @@ Types:Artifact Creature Golem PT:5/3 K:CARDNAME doesn't untap during your untap step. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | OptionalDecider$ You | Execute$ TrigUntap | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, you may untap target tapped creature an opponent controls. If you do, untap CARDNAME. -SVar:TrigUntap:AB$ Untap | Cost$ 0 | ValidTgts$ Creature.| SubAbility$ DBCleanup+tapped | TgtPrompt$ Select target tapped creature an opponent controls | SubAbility$ DBUntap +SVar:TrigUntap:AB$ Untap | Cost$ 0 | ValidTgts$ Creature.OppCtrl+tapped | TgtPrompt$ Select target tapped creature an opponent controls | SubAbility$ DBUntap SVar:DBUntap:DB$ Untap | Defined$ Self SVar:RemAIDeck:True SVar:Rarity:Uncommon diff --git a/src/main/java/forge/card/BoosterData.java b/src/main/java/forge/card/BoosterData.java index fd8596b19c5..b1294a3d3fa 100644 --- a/src/main/java/forge/card/BoosterData.java +++ b/src/main/java/forge/card/BoosterData.java @@ -180,7 +180,7 @@ public class BoosterData { * @see forge.util.StorageReaderFile#read(java.lang.String) */ @Override - protected BoosterData read(String line) { + protected BoosterData read(String line, int i) { final FileSection section = FileSection.parse(line, ":", "|"); int nC = section.getInt("Commons", 0); int nU = section.getInt("Uncommons", 0); diff --git a/src/main/java/forge/card/CardBlock.java b/src/main/java/forge/card/CardBlock.java index e49658acb44..3ff4691e6b7 100644 --- a/src/main/java/forge/card/CardBlock.java +++ b/src/main/java/forge/card/CardBlock.java @@ -229,11 +229,11 @@ public final class CardBlock implements Comparable { * @see forge.util.StorageReaderFile#read(java.lang.String) */ @Override - protected CardBlock read(String line) { + protected CardBlock read(String line, int i) { final String[] sParts = line.trim().split("\\|"); String name = null; - int index = -1; + int index = 1+i; final List sets = new ArrayList(9); // add support for up to 9 different sets in a block! final ArrayList metas = new ArrayList(); CardEdition landSet = null; @@ -245,8 +245,6 @@ public final class CardBlock implements Comparable { final String key = kv[0].toLowerCase(); if ("name".equals(key)) { name = kv[1]; - } else if ("index".equals(key)) { - index = Integer.parseInt(kv[1]); } else if ("set0".equals(key) || "set1".equals(key) || "set2".equals(key) || "set3".equals(key) || "set4".equals(key) || "set5".equals(key) || "set6".equals(key) || "set7".equals(key) || "set8".equals(key)) { diff --git a/src/main/java/forge/card/CardEdition.java b/src/main/java/forge/card/CardEdition.java index 4d8fff6582f..9f514a01dca 100644 --- a/src/main/java/forge/card/CardEdition.java +++ b/src/main/java/forge/card/CardEdition.java @@ -208,9 +208,9 @@ public final class CardEdition implements Comparable { // immutable } @Override - protected CardEdition read(String line) { + protected CardEdition read(String line, int i) { FileSection section = FileSection.parse(line, ":", "|"); - int index = section.getInt("index", -1); + int index = 1+i; String code2 = section.get("code2"); String code = section.get("code3"); String type = section.get("type"); diff --git a/src/main/java/forge/card/FatPackData.java b/src/main/java/forge/card/FatPackData.java index 233eaa61e7a..ac0c1998b4d 100644 --- a/src/main/java/forge/card/FatPackData.java +++ b/src/main/java/forge/card/FatPackData.java @@ -57,7 +57,7 @@ public class FatPackData { * @see forge.util.StorageReaderFile#read(java.lang.String) */ @Override - protected FatPackData read(String line) { + protected FatPackData read(String line, int i) { final FileSection section = FileSection.parse(line, ":", "|"); int nBoosters = section.getInt("Boosters", 0); int nLand = section.getInt("BasicLands", 0); diff --git a/src/main/java/forge/card/FormatCollection.java b/src/main/java/forge/card/FormatCollection.java index 2e4a1deb1ee..20d50a16bc0 100644 --- a/src/main/java/forge/card/FormatCollection.java +++ b/src/main/java/forge/card/FormatCollection.java @@ -93,7 +93,7 @@ public final class FormatCollection extends StorageView { * @see forge.util.StorageReaderFile#read(java.lang.String) */ @Override - protected GameFormat read(String line) { + protected GameFormat read(String line, int i) { final List sets = new ArrayList(); // default: all sets allowed final List bannedCards = new ArrayList(); // default: // nothing @@ -101,7 +101,7 @@ public final class FormatCollection extends StorageView { FileSection section = FileSection.parse(line, ":", "|"); String name = section.get("name"); - int index = section.getInt("index", 0); + int index = 1 + i; String strSets = section.get("sets"); if ( null != strSets ) { sets.addAll(Arrays.asList(strSets.split(", "))); diff --git a/src/main/java/forge/card/ability/ai/ChangeZoneAi.java b/src/main/java/forge/card/ability/ai/ChangeZoneAi.java index ef3944cc27a..703011b7a44 100644 --- a/src/main/java/forge/card/ability/ai/ChangeZoneAi.java +++ b/src/main/java/forge/card/ability/ai/ChangeZoneAi.java @@ -1319,8 +1319,9 @@ public class ChangeZoneAi extends SpellAbilityAi { player.shuffle(); } - if ((!ZoneType.Battlefield.equals(destination) && !"Card".equals(type) && !defined) - || (sa.hasParam("Reveal") && !fetched.isEmpty())) { + if (((!ZoneType.Battlefield.equals(destination) && !"Card".equals(type) && !defined) + || (sa.hasParam("Reveal") && !fetched.isEmpty())) + && !sa.hasParam("NoReveal")) { final String picked = player + " picked:"; if (fetched.size() > 0) { GuiChoose.one(picked, fetched); diff --git a/src/main/java/forge/card/ability/effects/DigEffect.java b/src/main/java/forge/card/ability/effects/DigEffect.java index fa4be8cc5ee..6d143710bab 100644 --- a/src/main/java/forge/card/ability/effects/DigEffect.java +++ b/src/main/java/forge/card/ability/effects/DigEffect.java @@ -143,7 +143,7 @@ public class DigEffect extends SpellAbilityEffect { } // Singletons.getModel().getGameAction().revealToCopmuter(top.toArray()); // - for when it exists - } else if (choser.isHuman()) { + } else if (choser.isHuman() && !sa.hasParam("NoLooking")) { // show the user the revealed cards GuiChoose.one("Looking at cards from library", top); } diff --git a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java index 5f846c66748..3851f04a5a1 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java @@ -11,7 +11,6 @@ import forge.card.spellability.AbilityActivated; import forge.card.spellability.Target; import forge.control.input.Input; import forge.control.input.InputSelectManyCards; -import forge.game.ai.ComputerUtil; import forge.game.player.Player; import forge.game.zone.PlayerZone; import forge.game.zone.Zone; @@ -54,8 +53,10 @@ class CardFactoryArtifacts { @Override public boolean canPlayAI() { this.getTarget().resetTargets(); - final List libList = getActivatingPlayer().getOpponent().getCardsIn(ZoneType.Library); - return !libList.isEmpty() && ComputerUtil.targetHumanAI(this); + Player human = getActivatingPlayer().getOpponent(); + final List libList = human.getCardsIn(ZoneType.Library); + this.getTarget().addTarget(human); + return !libList.isEmpty() && canTarget(human); } @Override @@ -98,6 +99,7 @@ class CardFactoryArtifacts { sb.append("Put the top two cards of target player's library into that player's graveyard. "); sb.append("If both cards share a color, repeat this process."); ab1.setDescription(sb.toString()); + ab1.setStackDescription(sb.toString()); card.addSpellAbility(ab1); } // *************** END ************ END ************************** diff --git a/src/main/java/forge/card/cost/Cost.java b/src/main/java/forge/card/cost/Cost.java index c1355b6324b..7bc61487139 100644 --- a/src/main/java/forge/card/cost/Cost.java +++ b/src/main/java/forge/card/cost/Cost.java @@ -78,7 +78,7 @@ public class Cost { * @return a boolean. */ public final boolean hasNoManaCost() { - return this.getTotalMana().toString().equals(ManaCost.ZERO.toString()); + return this.getTotalMana().isZero(); } /** diff --git a/src/main/java/forge/card/mana/ManaCost.java b/src/main/java/forge/card/mana/ManaCost.java index 200bbec7044..2fab180f2ab 100644 --- a/src/main/java/forge/card/mana/ManaCost.java +++ b/src/main/java/forge/card/mana/ManaCost.java @@ -183,6 +183,10 @@ public final class ManaCost implements Comparable { return this.shards.isEmpty() && !this.isNoCost(); } + public boolean isZero() { + return genericCost == 0 && isPureGeneric(); + } + /* * (non-Javadoc) * diff --git a/src/main/java/forge/card/spellability/SpellAbility.java b/src/main/java/forge/card/spellability/SpellAbility.java index 70d586e8991..655fe32f10c 100644 --- a/src/main/java/forge/card/spellability/SpellAbility.java +++ b/src/main/java/forge/card/spellability/SpellAbility.java @@ -51,7 +51,6 @@ public abstract class SpellAbility implements ISpellAbility { // choices for constructor isPermanent argument private String description = ""; - private Player targetPlayer = null; private String stackDescription = ""; private ManaCost manaCost = null; private ManaCost multiKickerManaCost = null; @@ -1111,7 +1110,6 @@ public abstract class SpellAbility implements ISpellAbility { if (tgt != null) { tgt.addTarget(card); } else { - this.targetPlayer = null; // reset setTargetPlayer() this.targetCard = card; } String desc = ""; @@ -1124,74 +1122,6 @@ public abstract class SpellAbility implements ISpellAbility { this.setStackDescription(desc); } -// /** -// *

-// * Getter for the field targetList. -// *

-// * -// * @return a {@link forge.CardList} object. -// */ -// public List getTargetList() { -// return this.targetList; -// } - -// /** -// *

-// * Setter for the field targetList. -// *

-// * -// * @param list -// * a {@link forge.CardList} object. -// */ -// public void setTargetList(final List list) { -// // The line below started to create a null error at -// // forge.CardFactoryUtil.canBeTargetedBy(CardFactoryUtil.java:3329) -// // after ForgeSVN r2699. I hope that commenting out the line below will -// // not result in other bugs. :) -// // targetPlayer = null;//reset setTargetPlayer() -// -// this.targetList = list; -// final StringBuilder sb = new StringBuilder(); -// sb.append(this.getSourceCard().getName()).append(" - targeting "); -// for (int i = 0; i < this.targetList.size(); i++) { -// -// if (!this.targetList.get(i).isFaceDown()) { -// sb.append(this.targetList.get(i)); -// } else { -// sb.append("Morph(").append(this.targetList.get(i).getUniqueNumber()).append(")"); -// } -// -// if (i < (this.targetList.size() - 1)) { -// sb.append(", "); -// } -// } -// this.setStackDescription(sb.toString()); -// } - - /** - *

- * Setter for the field targetPlayer. - *

- * - * @param p - * a {@link forge.game.player.Player} object. - */ - public void setTargetPlayer(final Player p) { - if (p == null) { - throw new RuntimeException("SpellAbility : setTargetPlayer() error, argument is " + p + " source card is " - + this.getSourceCard()); - } - - final Target tgt = this.getTarget(); - if (tgt != null) { - tgt.addTarget(p); - } else { - this.targetCard = null; // reset setTargetCard() - this.targetPlayer = p; - } - this.setStackDescription(this.getSourceCard().getName() + " - targeting " + p); - } - /** *

* Getter for the field targetPlayer. @@ -1200,18 +1130,15 @@ public abstract class SpellAbility implements ISpellAbility { * @return a {@link forge.game.player.Player} object. */ public Player getTargetPlayer() { - if (this.targetPlayer == null) { - final Target tgt = this.getTarget(); - if (tgt != null) { - final ArrayList list = tgt.getTargetPlayers(); + final Target tgt = this.getTarget(); + if (tgt != null) { + final ArrayList list = tgt.getTargetPlayers(); - if (!list.isEmpty()) { - return list.get(0); - } + if (!list.isEmpty()) { + return list.get(0); } - return null; } - return this.targetPlayer; + return null; } /** diff --git a/src/main/java/forge/card/trigger/WrappedAbility.java b/src/main/java/forge/card/trigger/WrappedAbility.java index 35a5f6127bf..cf2b05b8bfa 100644 --- a/src/main/java/forge/card/trigger/WrappedAbility.java +++ b/src/main/java/forge/card/trigger/WrappedAbility.java @@ -340,16 +340,6 @@ public class WrappedAbility extends Ability implements ISpellAbility { sa.setTargetCard(card); } -// @Override -// public void setTargetList(final List list) { -// sa.setTargetList(list); -// } - - @Override - public void setTargetPlayer(final Player p) { - sa.setTargetPlayer(p); - } - @Override public void setType(final String s) { sa.setType(s); diff --git a/src/main/java/forge/control/input/InputBlock.java b/src/main/java/forge/control/input/InputBlock.java index 108013f8e63..d28f60d2cc1 100644 --- a/src/main/java/forge/control/input/InputBlock.java +++ b/src/main/java/forge/control/input/InputBlock.java @@ -106,6 +106,7 @@ public class InputBlock extends Input { currentAttacker = null; allBlocking.clear(); + stop(); FControl.SINGLETON_INSTANCE.getPlayer().getController().passPriority(); } } diff --git a/src/main/java/forge/control/input/InputCleanup.java b/src/main/java/forge/control/input/InputCleanup.java index a478cca5575..808a940efe3 100644 --- a/src/main/java/forge/control/input/InputCleanup.java +++ b/src/main/java/forge/control/input/InputCleanup.java @@ -59,6 +59,7 @@ public class InputCleanup extends Input { // goes to the next phase if (active.isUnlimitedHandSize() || n <= max || n <= 0 || active != turnOwner) { active.getController().passPriority(); + stop(); return; } ButtonUtil.disableAll(); diff --git a/src/main/java/forge/control/input/InputMulligan.java b/src/main/java/forge/control/input/InputMulligan.java index 85c82714684..ef7d36e8d7d 100644 --- a/src/main/java/forge/control/input/InputMulligan.java +++ b/src/main/java/forge/control/input/InputMulligan.java @@ -174,11 +174,12 @@ public class InputMulligan extends Input { next.initPlane(); } - //Set Field shown to current player. + //Set Field shown to current player. VField nextField = CMatchUI.SINGLETON_INSTANCE.getFieldViewFor(next); SDisplayUtil.showTab(nextField); game.getPhaseHandler().nextPhase(); + stop(); } @Override diff --git a/src/main/java/forge/control/input/InputPassPriority.java b/src/main/java/forge/control/input/InputPassPriority.java index 77ce4595bb0..80d02562045 100644 --- a/src/main/java/forge/control/input/InputPassPriority.java +++ b/src/main/java/forge/control/input/InputPassPriority.java @@ -75,6 +75,7 @@ public class InputPassPriority extends Input { @Override public final void selectButtonOK() { FControl.SINGLETON_INSTANCE.getPlayer().getController().passPriority(); + stop(); } /** {@inheritDoc} */ diff --git a/src/main/java/forge/deck/CardPool.java b/src/main/java/forge/deck/CardPool.java index 115585b39ef..1c307ef6cb2 100644 --- a/src/main/java/forge/deck/CardPool.java +++ b/src/main/java/forge/deck/CardPool.java @@ -19,6 +19,7 @@ package forge.deck; import java.util.List; import java.util.Map.Entry; +import java.util.NoSuchElementException; import forge.Card; @@ -139,7 +140,7 @@ public class CardPool extends ItemPool { if ( cp != null) this.add(cp); else - throw new RuntimeException(String.format("Card %s is not supported by Forge, as it's neither a known common card nor one of casual variants' card.", cardName)); + throw new NoSuchElementException(String.format("Card %s is not supported by Forge, as it's neither a known common card nor one of casual variants' card.", cardName)); } /** diff --git a/src/main/java/forge/deck/io/DeckSerializer.java b/src/main/java/forge/deck/io/DeckSerializer.java index acee3a48715..cf0ea4e49b9 100644 --- a/src/main/java/forge/deck/io/DeckSerializer.java +++ b/src/main/java/forge/deck/io/DeckSerializer.java @@ -46,7 +46,7 @@ import freemarker.template.Template; import freemarker.template.TemplateException; /** - * TODO: Write javadoc for this type. + * This class knows how to make a file out of a deck object and vice versa. * */ public class DeckSerializer extends StorageReaderFolder implements IItemSerializer { diff --git a/src/main/java/forge/game/ai/AiInputCommon.java b/src/main/java/forge/game/ai/AiInputCommon.java index c96048e34b8..391ebad1b06 100644 --- a/src/main/java/forge/game/ai/AiInputCommon.java +++ b/src/main/java/forge/game/ai/AiInputCommon.java @@ -108,6 +108,7 @@ public class AiInputCommon extends Input { } } player.getController().passPriority(); + stop(); } // getMessage(); /** diff --git a/src/main/java/forge/game/ai/ComputerUtil.java b/src/main/java/forge/game/ai/ComputerUtil.java index b9227e63be3..ed0074b056a 100644 --- a/src/main/java/forge/game/ai/ComputerUtil.java +++ b/src/main/java/forge/game/ai/ComputerUtil.java @@ -945,19 +945,6 @@ public class ComputerUtil { return false; } - - public static boolean targetHumanAI(final SpellAbility sa) { - if (sa == null || sa.getActivatingPlayer() == null) { - return false; - } - Player human = sa.getActivatingPlayer().getOpponent(); - if (!sa.canTarget(human)) { - return false; - } - sa.setTargetPlayer(human); - return true; - } - // returns true if it's better to wait until blockers are declared /** *

diff --git a/src/main/java/forge/game/zone/IZone.java b/src/main/java/forge/game/zone/IZone.java index efc7ea554dd..4f5252416fd 100644 --- a/src/main/java/forge/game/zone/IZone.java +++ b/src/main/java/forge/game/zone/IZone.java @@ -30,24 +30,6 @@ import forge.Card; * @version $Id$ */ interface IZone { - /** - *

- * setUpdate. - *

- * - * @param b - * a boolean. - */ - void setUpdate(boolean b); - - /** - *

- * getUpdate. - *

- * - * @return a boolean. - */ - boolean getUpdate(); /** *

@@ -101,7 +83,7 @@ interface IZone { * @param o * a {@link java.lang.Object} object. */ - void remove(Object o); + void remove(Card o); /** *

diff --git a/src/main/java/forge/game/zone/MagicStack.java b/src/main/java/forge/game/zone/MagicStack.java index ae0f536a52c..c71aa4108f8 100644 --- a/src/main/java/forge/game/zone/MagicStack.java +++ b/src/main/java/forge/game/zone/MagicStack.java @@ -680,7 +680,7 @@ public class MagicStack extends MyObservable { // Create a new object, since the triggers aren't happening right away runParams = new HashMap(); runParams.put("SourceSA", sp); - if (chosenTargets.size() > 0) { + if (!chosenTargets.isEmpty()) { HashSet distinctObjects = new HashSet(); for (final TargetChoices tc : chosenTargets) { if ((tc != null) && (tc.getTargetCards() != null)) { @@ -704,10 +704,6 @@ public class MagicStack extends MyObservable { else if (sp.getTargetCard() != null) { runParams.put("Target", sp.getTargetCard()); - game.getTriggerHandler().runTrigger(TriggerType.BecomesTarget, runParams, false); - } else if (sp.getTargetPlayer() != null) { - runParams.put("Target", sp.getTargetPlayer()); - game.getTriggerHandler().runTrigger(TriggerType.BecomesTarget, runParams, false); } } @@ -1075,9 +1071,6 @@ public class MagicStack extends MyObservable { else if (sa.getTargetCard() != null) { fizzle = !CardFactoryUtil.isTargetStillValid(sa, sa.getTargetCard()); } - else if (sa.getTargetPlayer() != null) { - fizzle = !sa.getTargetPlayer().canBeTargetedBy(sa); - } else { // Set fizzle to the same as the parent if there's no target info fizzle = parentFizzled; diff --git a/src/main/java/forge/game/zone/PlayerZoneBattlefield.java b/src/main/java/forge/game/zone/PlayerZoneBattlefield.java index dc4108ae337..b863a8bd342 100644 --- a/src/main/java/forge/game/zone/PlayerZoneBattlefield.java +++ b/src/main/java/forge/game/zone/PlayerZoneBattlefield.java @@ -17,7 +17,6 @@ */ package forge.game.zone; -import java.util.ArrayList; import java.util.List; import com.google.common.base.Predicate; @@ -181,7 +180,7 @@ public class PlayerZoneBattlefield extends PlayerZone { /** {@inheritDoc} */ @Override - public final void remove(final Object o) { + public final void remove(final Card o) { super.remove(o); @@ -244,30 +243,6 @@ public class PlayerZoneBattlefield extends PlayerZone { } } - /** - *

- * Setter for the field trigger. - *

- * - * @param b - * a boolean. - */ - public final void setTrigger(final boolean b) { - this.trigger = b; - } - - /** - *

- * Setter for the field leavesTrigger. - *

- * - * @param b - * a boolean. - */ - public final void setLeavesTrigger(final boolean b) { - this.leavesTrigger = b; - } - /** *

* setTriggers. @@ -300,7 +275,7 @@ public class PlayerZoneBattlefield extends PlayerZone { // getCards(false) to get Phased Out cards if (!filter) { - return new ArrayList(cardList); + return super.getCards(false); } return Lists.newArrayList(Iterables.filter(cardList, isNotPhased)); diff --git a/src/main/java/forge/game/zone/Zone.java b/src/main/java/forge/game/zone/Zone.java index 6b2c30a0418..1e790beeb98 100644 --- a/src/main/java/forge/game/zone/Zone.java +++ b/src/main/java/forge/game/zone/Zone.java @@ -66,6 +66,8 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria public Zone(final ZoneType zone) { this.zoneName = zone; this.roCardList = Collections.unmodifiableList(cardList); + + //System.out.println(zoneName + " (ct) " + Integer.toHexString(System.identityHashCode(roCardList))); } // ************ BEGIN - these methods fire updateObservers() ************* @@ -191,7 +193,7 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria * an Object */ @Override - public void remove(final Object c) { + public void remove(final Card c) { this.cardList.remove(c); this.update(); } @@ -287,6 +289,7 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria */ @Override public final List getCards() { + //System.out.println(zoneName + ": " + Integer.toHexString(System.identityHashCode(roCardList))); return this.getCards(true); } @@ -322,29 +325,6 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria } } - /** - * Sets the update. - * - * @param b - * a boolean. - */ - @Override - public final void setUpdate(final boolean b) { - this.update = b; - } - - /** - *

- * Getter for the field update. - *

- * - * @return a boolean. - */ - @Override - public final boolean getUpdate() { - return this.update; - } - /** *

* toString. diff --git a/src/main/java/forge/gui/GuiDisplayUtil.java b/src/main/java/forge/gui/GuiDisplayUtil.java index 3c0012d13cc..cd601122daa 100644 --- a/src/main/java/forge/gui/GuiDisplayUtil.java +++ b/src/main/java/forge/gui/GuiDisplayUtil.java @@ -18,7 +18,6 @@ package forge.gui; import java.awt.Color; -import java.awt.Rectangle; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; @@ -61,8 +60,6 @@ import forge.game.zone.ZoneType; import forge.item.CardDb; import forge.item.CardPrinted; import forge.item.IPaperCard; -import forge.view.arcane.PlayArea; -import forge.view.arcane.util.Animation; /** *

@@ -255,91 +252,6 @@ public final class GuiDisplayUtil { } - /** - *

- * setupPlayZone. - *

- * - * @param p - * a {@link forge.view.arcane.PlayArea} object. - * @param c - * an array of {@link forge.Card} objects. - */ - public static void setupPlayZone(final PlayArea p, final List c) { - List tmp, diff; - tmp = new ArrayList(); - for (final forge.view.arcane.CardPanel cpa : p.getCardPanels()) { - tmp.add(cpa.getGameCard()); - } - diff = new ArrayList(tmp); - diff.removeAll(c); - if (diff.size() == p.getCardPanels().size()) { - p.clear(); - } else { - for (final Card card : diff) { - p.removeCardPanel(p.getCardPanel(card.getUniqueNumber())); - } - } - diff = new ArrayList(c); - diff.removeAll(tmp); - - List panelList = new ArrayList(); - for (final Card card : diff) { - panelList.add(p.addCard(card)); - } - if (!diff.isEmpty()) { - p.doLayout(); - } - for (final forge.view.arcane.CardPanel toPanel : panelList) { - p.scrollRectToVisible(new Rectangle(toPanel.getCardX(), toPanel.getCardY(), toPanel - .getCardWidth(), toPanel.getCardHeight())); - Animation.moveCard(toPanel); - } - - for (final Card card : c) { - final forge.view.arcane.CardPanel toPanel = p.getCardPanel(card.getUniqueNumber()); - if (card.isTapped()) { - toPanel.setTapped(true); - toPanel.setTappedAngle(forge.view.arcane.CardPanel.TAPPED_ANGLE); - } else { - toPanel.setTapped(false); - toPanel.setTappedAngle(0); - } - toPanel.getAttachedPanels().clear(); - if (card.isEnchanted()) { - final ArrayList enchants = card.getEnchantedBy(); - for (final Card e : enchants) { - final forge.view.arcane.CardPanel cardE = p.getCardPanel(e.getUniqueNumber()); - if (cardE != null) { - toPanel.getAttachedPanels().add(cardE); - } - } - } - - if (card.isEquipped()) { - final ArrayList enchants = card.getEquippedBy(); - for (final Card e : enchants) { - final forge.view.arcane.CardPanel cardE = p.getCardPanel(e.getUniqueNumber()); - if (cardE != null) { - toPanel.getAttachedPanels().add(cardE); - } - } - } - - if (card.isEnchantingCard()) { - toPanel.setAttachedToPanel(p.getCardPanel(card.getEnchantingCard().getUniqueNumber())); - } else if (card.isEquipping()) { - toPanel.setAttachedToPanel(p.getCardPanel(card.getEquipping().get(0).getUniqueNumber())); - } else { - toPanel.setAttachedToPanel(null); - } - - toPanel.setCard(toPanel.getGameCard()); - } - p.invalidate(); - p.repaint(); - } - /** *

* updateGUI. diff --git a/src/main/java/forge/gui/match/nonsingleton/CCommand.java b/src/main/java/forge/gui/match/nonsingleton/CCommand.java index e7bf41f086a..0e19f4339c2 100644 --- a/src/main/java/forge/gui/match/nonsingleton/CCommand.java +++ b/src/main/java/forge/gui/match/nonsingleton/CCommand.java @@ -29,9 +29,7 @@ import forge.Card; import forge.Command; import forge.game.player.Player; -import forge.game.zone.PlayerZone; import forge.game.zone.ZoneType; -import forge.gui.GuiDisplayUtil; import forge.gui.framework.ICDoc; import forge.gui.match.CMatchUI; import forge.gui.match.controllers.CMessage; @@ -55,8 +53,7 @@ public class CCommand implements ICDoc { private final Observer observerPlay = new Observer() { @Override public void update(final Observable a, final Object b) { - final PlayerZone pZone = (PlayerZone) a; - GuiDisplayUtil.setupPlayZone(CCommand.this.view.getTabletop(), pZone.getCards(false)); + CCommand.this.view.getTabletop().setupPlayZone(); } }; @@ -118,7 +115,7 @@ public class CCommand implements ICDoc { if (c != null && c.isInZone(ZoneType.Command)) { //TODO: Cast commander/activate avatar/roll planar dice here. - CMessage.SINGLETON_INSTANCE.getInputControl().getInput().selectCard(c); + CMessage.SINGLETON_INSTANCE.getInputControl().selectCard(c, player.getZone(ZoneType.Command)); } } diff --git a/src/main/java/forge/gui/match/nonsingleton/CField.java b/src/main/java/forge/gui/match/nonsingleton/CField.java index 0d62d09c590..2e14f5e8dae 100644 --- a/src/main/java/forge/gui/match/nonsingleton/CField.java +++ b/src/main/java/forge/gui/match/nonsingleton/CField.java @@ -50,7 +50,6 @@ import forge.game.zone.PlayerZone; import forge.game.zone.ZoneType; import forge.gui.ForgeAction; import forge.gui.GuiChoose; -import forge.gui.GuiDisplayUtil; import forge.gui.framework.ICDoc; import forge.gui.match.CMatchUI; import forge.gui.match.controllers.CMessage; @@ -147,8 +146,7 @@ public class CField implements ICDoc { private final Observer observerPlay = new Observer() { @Override public void update(final Observable a, final Object b) { - final PlayerZone pZone = (PlayerZone) a; - GuiDisplayUtil.setupPlayZone(CField.this.view.getTabletop(), pZone.getCards(false)); + CField.this.view.getTabletop().setupPlayZone(); } }; diff --git a/src/main/java/forge/gui/match/nonsingleton/VCommand.java b/src/main/java/forge/gui/match/nonsingleton/VCommand.java index b4dc3be18ac..17711a00c6c 100644 --- a/src/main/java/forge/gui/match/nonsingleton/VCommand.java +++ b/src/main/java/forge/gui/match/nonsingleton/VCommand.java @@ -23,6 +23,7 @@ import javax.swing.border.MatteBorder; import net.miginfocom.swing.MigLayout; import forge.game.player.Player; +import forge.game.zone.ZoneType; import forge.gui.framework.DragCell; import forge.gui.framework.DragTab; import forge.gui.framework.EDocID; @@ -66,7 +67,7 @@ public class VCommand implements IVDoc { // TODO player is hard-coded into tabletop...should be dynamic // (haven't looked into it too deeply). Doublestrike 12-04-12 - tabletop = new PlayArea(scroller, id0 == EDocID.COMMAND_0); + tabletop = new PlayArea(scroller, id0 == EDocID.COMMAND_0, player.getZone(ZoneType.Command).getCards(false)); control = new CCommand(player, this); diff --git a/src/main/java/forge/gui/match/nonsingleton/VField.java b/src/main/java/forge/gui/match/nonsingleton/VField.java index bfc435f4828..1efc4e95d9f 100644 --- a/src/main/java/forge/gui/match/nonsingleton/VField.java +++ b/src/main/java/forge/gui/match/nonsingleton/VField.java @@ -121,7 +121,7 @@ public class VField implements IVDoc { // TODO player is hard-coded into tabletop...should be dynamic // (haven't looked into it too deeply). Doublestrike 12-04-12 - tabletop = new PlayArea(scroller, id0 == EDocID.FIELD_1); + tabletop = new PlayArea(scroller, id0 == EDocID.FIELD_1, player.getZone(ZoneType.Battlefield).getCards(false)); control = new CField(player, this, playerViewer); diff --git a/src/main/java/forge/gui/toolbox/CardFaceSymbols.java b/src/main/java/forge/gui/toolbox/CardFaceSymbols.java index fa4ba43a539..a2e05e06e9f 100644 --- a/src/main/java/forge/gui/toolbox/CardFaceSymbols.java +++ b/src/main/java/forge/gui/toolbox/CardFaceSymbols.java @@ -29,7 +29,6 @@ import com.esotericsoftware.minlog.Log; import forge.card.mana.ManaCostShard; import forge.card.mana.ManaCost; -import forge.view.arcane.util.UI; /** *

@@ -167,11 +166,11 @@ public class CardFaceSymbols { * @param w an int * @param h and int */ - public static void draw(final Graphics g, String s, int x, final int y, final int w, final int h) { + public static void drawOther(final Graphics g, String s, int x, final int y, final int w, final int h) { if (s.length() == 0) { return; } - s = UI.getDisplayManaCost(s); + StringTokenizer tok = new StringTokenizer(s, " "); while (tok.hasMoreTokens()) { String symbol = tok.nextToken(); diff --git a/src/main/java/forge/quest/QuestWorld.java b/src/main/java/forge/quest/QuestWorld.java index 5c00b5d54b3..e0dfb175035 100644 --- a/src/main/java/forge/quest/QuestWorld.java +++ b/src/main/java/forge/quest/QuestWorld.java @@ -24,6 +24,7 @@ import java.util.List; import com.google.common.base.Function; import forge.quest.data.GameFormatQuest; +import forge.util.FileSection; import forge.util.storage.StorageReaderFile; /** @@ -121,7 +122,7 @@ public class QuestWorld implements Comparable{ * @see forge.util.StorageReaderFile#read(java.lang.String) */ @Override - protected QuestWorld read(String line) { + protected QuestWorld read(String line, int i) { String useName = null; String useDir = null; GameFormatQuest useFormat = null; @@ -129,9 +130,13 @@ public class QuestWorld implements Comparable{ final List sets = new ArrayList(); final List bannedCards = new ArrayList(); // if both empty, no format + // This is what you need to use here => + // FileSection.parse(line, ":", "|"); + final String[] sParts = line.trim().split("\\|"); for (final String sPart : sParts) { + final String[] kv = sPart.split(":", 2); final String key = kv[0].toLowerCase(); if ("name".equals(key)) { diff --git a/src/main/java/forge/util/storage/StorageReaderFile.java b/src/main/java/forge/util/storage/StorageReaderFile.java index d788337e8f1..ae743e7010c 100644 --- a/src/main/java/forge/util/storage/StorageReaderFile.java +++ b/src/main/java/forge/util/storage/StorageReaderFile.java @@ -70,12 +70,13 @@ public abstract class StorageReaderFile implements IItemReader { public Map readAll() { final Map result = new TreeMap(); + int idx = 0; for (final String s : FileUtil.readFile(this.file)) { if (!this.lineContainsObject(s)) { continue; } - final T item = this.read(s); + final T item = this.read(s, idx); if (null == item) { final String msg = "An object stored in " + this.file.getPath() + " failed to load.\nPlease submit this as a bug with the mentioned file attached."; @@ -83,6 +84,7 @@ public abstract class StorageReaderFile implements IItemReader { continue; } + idx++; result.put(this.keySelector.apply(item), item); } @@ -95,8 +97,8 @@ public abstract class StorageReaderFile implements IItemReader { * @param line * the line * @return the t - */ - protected abstract T read(String line); + */ + protected abstract T read(String line, int idx); /** * Line contains object. diff --git a/src/main/java/forge/view/arcane/CardPanel.java b/src/main/java/forge/view/arcane/CardPanel.java index 83e6c53fcad..cbbbe3dcb32 100644 --- a/src/main/java/forge/view/arcane/CardPanel.java +++ b/src/main/java/forge/view/arcane/CardPanel.java @@ -415,7 +415,7 @@ public class CardPanel extends JPanel implements CardContainer { if (this.getCard() != null && this.getGameCard().getFoil() > 0) { final String fl = String.format("foil%02d", this.getCard().getFoil()); final int z = Math.round(this.cardWidth * CardPanel.BLACK_BORDER_SIZE); - CardFaceSymbols.draw(g, fl, this.cardXOffset + z, this.cardYOffset + z, this.cardWidth - (2 * z), + CardFaceSymbols.drawOther(g, fl, this.cardXOffset + z, this.cardYOffset + z, this.cardWidth - (2 * z), this.cardHeight - (2 * z)); } } diff --git a/src/main/java/forge/view/arcane/CardPanelContainer.java b/src/main/java/forge/view/arcane/CardPanelContainer.java index f08d46d8c34..340ee24c277 100644 --- a/src/main/java/forge/view/arcane/CardPanelContainer.java +++ b/src/main/java/forge/view/arcane/CardPanelContainer.java @@ -18,10 +18,12 @@ package forge.view.arcane; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -33,7 +35,6 @@ import forge.Card; import forge.Constant; import forge.gui.match.CMatchUI; import forge.view.arcane.util.CardPanelMouseListener; -import forge.view.arcane.util.UI; /** * Manages mouse events and common functionality for CardPanel containing @@ -296,7 +297,7 @@ public abstract class CardPanelContainer extends JPanel { * a {@link forge.view.arcane.CardPanel} object. */ public final void removeCardPanel(final CardPanel fromPanel) { - UI.invokeAndWait(new Runnable() { + CardPanelContainer.invokeAndWait(new Runnable() { @Override public void run() { if (CardPanelContainer.this.getMouseDragPanel() != null) { @@ -321,7 +322,7 @@ public abstract class CardPanelContainer extends JPanel { *

*/ public final void clear() { - UI.invokeAndWait(new Runnable() { + CardPanelContainer.invokeAndWait(new Runnable() { @Override public void run() { CardPanelContainer.this.getCardPanels().clear(); @@ -623,4 +624,25 @@ public abstract class CardPanelContainer extends JPanel { public void setMouseDragPanel(final CardPanel mouseDragPanel0) { this.mouseDragPanel = mouseDragPanel0; } + + /** + *

+ * invokeAndWait. + *

+ * + * @param runnable + * a {@link java.lang.Runnable} object. + */ + public static void invokeAndWait(final Runnable runnable) { + if (EventQueue.isDispatchThread()) { + runnable.run(); + return; + } + try { + EventQueue.invokeAndWait(runnable); + } catch (InterruptedException ex) { + } catch (InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } } diff --git a/src/main/java/forge/view/arcane/PlayArea.java b/src/main/java/forge/view/arcane/PlayArea.java index 3f60b16ff68..b15772cdd1b 100644 --- a/src/main/java/forge/view/arcane/PlayArea.java +++ b/src/main/java/forge/view/arcane/PlayArea.java @@ -23,12 +23,11 @@ import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.List; import javax.swing.JScrollPane; - import forge.Card; +import forge.view.arcane.util.Animation; import forge.view.arcane.util.CardPanelMouseListener; /** @@ -67,6 +66,8 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen private int extraCardSpacingX, cardSpacingX, cardSpacingY; private int stackSpacingX, stackSpacingY; + private List model; + /** *

* Constructor for PlayArea. @@ -76,11 +77,13 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen * a {@link javax.swing.JScrollPane} object. * @param mirror * a boolean. + * @param modelRef */ - public PlayArea(final JScrollPane scrollPane, final boolean mirror) { + public PlayArea(final JScrollPane scrollPane, final boolean mirror, List modelRef) { super(scrollPane); this.setBackground(Color.white); this.mirror = mirror; + this.model = modelRef; } private final CardStackRow collectAllLands() { @@ -196,46 +199,40 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen this.playAreaWidth = rect.width; this.playAreaHeight = rect.height; - final CardStackRow allLands = collectAllLands(); - final CardStackRow allTokens = collectAllTokens(); - final CardStackRow allCreatures = new CardStackRow(this.getCardPanels(), RowType.creatureNonToken); - final CardStackRow allOthers = new CardStackRow(this.getCardPanels(), RowType.other); + final CardStackRow lands = collectAllLands(); + final CardStackRow tokens = collectAllTokens(); + final CardStackRow creatures = new CardStackRow(this.getCardPanels(), RowType.CreatureNonToken); + final CardStackRow others = new CardStackRow(this.getCardPanels(), RowType.Other); // should find an appropriate width of card - this.cardWidth = this.getCardWidthMax(); int maxCardWidth = this.getCardWidthMax(); + setCardWidth(maxCardWidth); int minCardWidth = this.getCardWidthMin(); int lastGoodCardWidth = minCardWidth; int deltaCardWidth = (maxCardWidth - minCardWidth) / 2; - boolean workedLastTime = false; - //boolean isFirstRun = true; + List lastTemplate = null; while (deltaCardWidth > 0) { - final CardStackRow creatures = (CardStackRow) allCreatures.clone(); - final CardStackRow tokens = (CardStackRow) allTokens.clone(); - final CardStackRow lands = (CardStackRow) allLands.clone(); - CardStackRow others = (CardStackRow) allOthers.clone(); - workedLastTime = canAdjustWidth(lands, tokens, creatures, others); - - deltaCardWidth = (cardWidth - lastGoodCardWidth) / 2; - if (workedLastTime) { - lastGoodCardWidth = cardWidth; - cardWidth += deltaCardWidth; + List template = tryArrangePilesOfWidth(lands, tokens, creatures, others); + + deltaCardWidth = (getCardWidth() - lastGoodCardWidth) / 2; + if (template != null) { + lastTemplate = template; + lastGoodCardWidth = getCardWidth(); + setCardWidth(getCardWidth() + deltaCardWidth); if (lastGoodCardWidth == maxCardWidth) { break; } } else { - cardWidth -= deltaCardWidth; + setCardWidth(getCardWidth() - deltaCardWidth); } } - cardWidth = lastGoodCardWidth; - final CardStackRow creatures = (CardStackRow) allCreatures.clone(); - final CardStackRow tokens = (CardStackRow) allTokens.clone(); - final CardStackRow lands = (CardStackRow) allLands.clone(); - CardStackRow others = (CardStackRow) allOthers.clone(); - workedLastTime = canAdjustWidth(lands, tokens, creatures, others); + setCardWidth(lastGoodCardWidth); + if ( null == lastTemplate ) + lastTemplate = tryArrangePilesOfWidth(lands, tokens, creatures, others); + this.rows = lastTemplate; // Get size of all the rows. int x, y = PlayArea.GUTTER_Y; int maxRowWidth = 0; @@ -252,25 +249,26 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen } this.setPreferredSize(new Dimension(maxRowWidth - this.cardSpacingX, y - this.cardSpacingY)); this.revalidate(); - positionAllCards(); + positionAllCards(lastTemplate); } - private void positionAllCards() { + private void positionAllCards(List template) { // Position all card panels. int x = 0; int y = PlayArea.GUTTER_Y; - for (final CardStackRow row : this.rows) { + for (final CardStackRow row : template) { int rowBottom = 0; x = PlayArea.GUTTER_X; for (int stackIndex = 0, stackCount = row.size(); stackIndex < stackCount; stackIndex++) { final CardStack stack = row.get(stackIndex); // Align others to the right. - if (RowType.other.isType(stack.get(0).getGameCard())) { + if (RowType.Other.isGoodFor(stack.get(0).getGameCard())) { x = (this.playAreaWidth - PlayArea.GUTTER_X) + this.extraCardSpacingX; for (int i = stackIndex, n = row.size(); i < n; i++) { - x -= row.get(i).getWidth(); + CardStack r = row.get(i); + x -= r.getWidth(); } } for (int panelIndex = 0, panelCount = stack.size(); panelIndex < panelCount; panelIndex++) { @@ -279,68 +277,62 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen this.setComponentZOrder(panel, panelIndex); final int panelX = x + (stackPosition * this.stackSpacingX); final int panelY = y + (stackPosition * this.stackSpacingY); - panel.setCardBounds(panelX, panelY, this.cardWidth, this.cardHeight); + panel.setCardBounds(panelX, panelY, this.getCardWidth(), this.cardHeight); } rowBottom = Math.max(rowBottom, y + stack.getHeight()); - x += stack.getWidth(); + x += stack.getWidth() + cardSpacingX; } y = rowBottom; } } - private boolean canAdjustWidth(final CardStackRow lands, final CardStackRow tokens, final CardStackRow creatures, CardStackRow others) { - this.rows.clear(); - this.cardHeight = Math.round(this.cardWidth * CardPanel.ASPECT_RATIO); - this.extraCardSpacingX = Math.round(this.cardWidth * PlayArea.EXTRA_CARD_SPACING_X); - this.cardSpacingX = (this.cardHeight - this.cardWidth) + this.extraCardSpacingX; - this.cardSpacingY = Math.round(this.cardHeight * PlayArea.CARD_SPACING_Y); - this.stackSpacingX = Math.round(this.cardWidth * PlayArea.STACK_SPACING_X); - this.stackSpacingY = Math.round(this.cardHeight * PlayArea.STACK_SPACING_Y); - + private List tryArrangePilesOfWidth(final CardStackRow lands, final CardStackRow tokens, final CardStackRow creatures, CardStackRow others) { + List template = new ArrayList(); + int afterFirstRow; + boolean landsFit, tokensFit, creaturesFit; if (this.mirror) { // Wrap all creatures and lands. - this.wrap(lands, this.rows, -1); - afterFirstRow = this.rows.size(); - this.wrap(tokens, this.rows, afterFirstRow); - this.wrap(creatures, this.rows, this.rows.size()); + landsFit = this.planRow(lands, template, -1); + afterFirstRow = template.size(); + tokensFit = this.planRow(tokens, template, afterFirstRow); + creaturesFit = this.planRow(creatures, template, template.size()); } else { // Wrap all creatures and lands. - this.wrap(creatures, this.rows, -1); - afterFirstRow = this.rows.size(); - this.wrap(tokens, this.rows, afterFirstRow); - this.wrap(lands, this.rows, this.rows.size()); + creaturesFit = this.planRow(creatures, template, -1); + afterFirstRow = template.size(); + tokensFit = this.planRow(tokens, template, afterFirstRow); + landsFit = this.planRow(lands, template, template.size()); } - // Store the current rows and others. - final List storedRows = new ArrayList(this.rows.size()); - for (final CardStackRow row : this.rows) { - try { - storedRows.add((CardStackRow) row.clone()); - } - catch (NullPointerException e) { - System.out.println("Null pointer exception in Row Spacing. Possibly also part of the issue."); - } + + if ( !landsFit || !creaturesFit || !tokensFit ) + return null; + + // Other cards may be stored at end of usual rows or on their own row. + int cntOthers = others.size(); + + // Copy the template for the case 1st approach won't work + final List templateCopy = new ArrayList(template.size()); + for (final CardStackRow row : template) { + templateCopy.add((CardStackRow) row.clone()); } - final CardStackRow storedOthers = (CardStackRow) others.clone(); + // Fill in all rows with others. - for (final CardStackRow row : this.rows) { - this.fillRow(others, this.rows, row); + int nextOther = 0; + for (final CardStackRow row : template) { + nextOther = this.planOthersRow(others, nextOther, template, row); + if ( nextOther == cntOthers ) + return template; // everything was successfully placed } - // Stop if everything fits, otherwise revert back to the stored - // values. - if (creatures.isEmpty() && tokens.isEmpty() && lands.isEmpty() && others.isEmpty()) { - return true; - } - this.rows = storedRows; - others = storedOthers; - // Try to put others on their own row(s) and fill in the rest. - this.wrap(others, this.rows, afterFirstRow); - for (final CardStackRow row : this.rows) { - this.fillRow(others, this.rows, row); - } - // If that still doesn't fit, scale down. - return creatures.isEmpty() && tokens.isEmpty() && lands.isEmpty() && others.isEmpty(); + + template = templateCopy; + // Try to put others on their own row(s) + if ( this.planRow(others, template, afterFirstRow) ) + return template; + + + return null; // Cannot fit everything with that width; } /** @@ -350,69 +342,53 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen * * @param sourceRow * a {@link forge.view.arcane.PlayArea.CardStackRow} object. - * @param rows + * @param template * a {@link java.util.List} object. * @param insertIndex * a int. * @return a int. */ -// private int cntRepaints = 0; - private int wrap(final CardStackRow sourceRow, final List rows, final int insertIndex) { + // Won't modify the first parameter + private boolean planRow(final CardStackRow sourceRow, final List template, final int insertIndex) { // The cards are sure to fit (with vertical scrolling) at the minimum // card width. - final boolean allowHeightOverflow = this.cardWidth == this.getCardWidthMin(); + final boolean isMinimalSize = this.getCardWidth() == this.getCardWidthMin(); // System.err.format("[%d] @ %d - Repaint playarea - %s %n", new Date().getTime(), cntRepaints++, mirror ? "MIRROR" : "DIRECT"); CardStackRow currentRow = new CardStackRow(); - for (int i = 0, n = sourceRow.size() - 1; i <= n; i++) { - final CardStack stack = sourceRow.get(i); - // If the row is not empty and this stack doesn't fit, add the row. + for (final CardStack stack : sourceRow) { final int rowWidth = currentRow.getWidth(); - if (!currentRow.isEmpty() && ((rowWidth + stack.getWidth()) > this.playAreaWidth)) { + // If the row is not empty and this stack doesn't fit, add the row. + if (rowWidth + stack.getWidth() > this.playAreaWidth && !currentRow.isEmpty() ) { + // Stop processing if the row is too wide or tall. - if (!allowHeightOverflow && (rowWidth > this.playAreaWidth)) { - break; - } - if (!allowHeightOverflow && ((this.getRowsHeight(rows) + sourceRow.getHeight()) > this.playAreaHeight)) { - break; - } - try { - rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow); - } - catch (ArrayIndexOutOfBoundsException e) { - System.out.println("ArrayIndex Out of Bounds when trying to add row in PlayArea. Someone fix this logic, " - + " I believe it causes the no cards loading in issue we've noticed."); - // TODO: There's a crash here, maybe when rows == [null] and currentRow == [[Plant Wall]] and insertIndex is 0 + if (rowWidth > this.playAreaWidth || this.getRowsHeight(template) + sourceRow.getHeight() > this.playAreaHeight) { + if ( !isMinimalSize ) + return false; } + + if ( insertIndex == -1) + template.add(currentRow); + else + template.add(insertIndex, currentRow); + currentRow = new CardStackRow(); } + currentRow.add(stack); } // Add the last row if it is not empty and it fits. if (!currentRow.isEmpty()) { final int rowWidth = currentRow.getWidth(); - if (allowHeightOverflow - || (rowWidth <= this.playAreaWidth) - && (allowHeightOverflow || ((this.getRowsHeight(rows) + sourceRow.getHeight()) <= this.playAreaHeight))) { - try { - rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow); - } - catch (ArrayIndexOutOfBoundsException e) { - System.out.println("ArrayIndex Out of Bounds when trying to add row in PlayArea. Someone fix this logic, " - + " I believe it causes the no cards loading in issue we've noticed."); - // TODO: There's a crash here, maybe when rows == [null] and currentRow == [[Plant Wall]] and insertIndex is 0 - } - } + if (isMinimalSize || rowWidth <= this.playAreaWidth && this.getRowsHeight(template) + sourceRow.getHeight() <= this.playAreaHeight) { + if ( insertIndex == -1) + template.add(currentRow); + else + template.add(insertIndex, currentRow); + } else return false; } - // Remove the wrapped stacks from the source row. - for (int iRow = 0; iRow < rows.size(); iRow++) { - CardStackRow row = rows.get(iRow); - if (row != null) { - sourceRow.removeAll(row); - } - } - return insertIndex; + return true; } @@ -423,32 +399,30 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen * * @param sourceRow * a {@link forge.view.arcane.PlayArea.CardStackRow} object. - * @param rows + * @param template * a {@link java.util.List} object. - * @param rows + * @param template * a {@link java.util.List} object. - * @param row + * @param rowToFill * a {@link forge.view.arcane.PlayArea.CardStackRow} object. */ - private void fillRow(final CardStackRow sourceRow, final List rows, final CardStackRow row) { - int rowWidth = row.getWidth(); + private int planOthersRow(final List sourceRow, final int firstPile, final List template, final CardStackRow rowToFill) { + int rowWidth = rowToFill.getWidth(); - final Iterator itr = sourceRow.iterator(); - - while (itr.hasNext()) { - final CardStack stack = itr.next(); + for (int i = firstPile; i < sourceRow.size(); i++ ) { + CardStack stack = sourceRow.get(i); rowWidth += stack.getWidth(); - if (rowWidth > this.playAreaWidth) { - break; + if (rowWidth > this.playAreaWidth) return i; // cannot add any more piles in a row + + if (stack.getHeight() > rowToFill.getHeight()) { // if row becomes taller + int newAllRowsHeight = this.getRowsHeight(template) - rowToFill.getHeight() + stack.getHeight(); + if ( newAllRowsHeight > this.playAreaHeight) + return i; // refuse to add here because it won't fit in height } - if (stack.getHeight() > row.getHeight() - && (((this.getRowsHeight(rows) - row.getHeight()) + stack.getHeight()) > this.playAreaHeight)) { - break; - } - row.add(stack); - itr.remove(); + rowToFill.add(stack); } + return sourceRow.size(); } /** @@ -508,21 +482,102 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen super.mouseLeftClicked(panel, evt); } - private static enum RowType { - land, creature, creatureNonToken, other; + /** + *

+ * setupPlayZone. + *

+ * + * @param newList + * an array of {@link forge.Card} objects. + */ + public void setupPlayZone() { + List oldCards, toDelete; + oldCards = new ArrayList(); + for (final CardPanel cpa : getCardPanels()) { + oldCards.add(cpa.getGameCard()); + } + toDelete = new ArrayList(oldCards); + toDelete.removeAll(model); + if (toDelete.size() == getCardPanels().size()) { + clear(); + } else { + for (final Card card : toDelete) { + removeCardPanel(getCardPanel(card.getUniqueNumber())); + } + } + + List toAdd = new ArrayList(model); + toAdd.removeAll(oldCards); + + List newPanels = new ArrayList(); + for (final Card card : toAdd) { + newPanels.add(addCard(card)); + } + if (!toAdd.isEmpty()) { + doLayout(); + } + for (final CardPanel toPanel : newPanels) { + scrollRectToVisible(new Rectangle(toPanel.getCardX(), toPanel.getCardY(), toPanel.getCardWidth(), toPanel.getCardHeight())); + Animation.moveCard(toPanel); + } + + for (final Card card : model) { + final CardPanel toPanel = getCardPanel(card.getUniqueNumber()); + if (card.isTapped()) { + toPanel.setTapped(true); + toPanel.setTappedAngle(forge.view.arcane.CardPanel.TAPPED_ANGLE); + } else { + toPanel.setTapped(false); + toPanel.setTappedAngle(0); + } + toPanel.getAttachedPanels().clear(); + if (card.isEnchanted()) { + final ArrayList enchants = card.getEnchantedBy(); + for (final Card e : enchants) { + final forge.view.arcane.CardPanel cardE = getCardPanel(e.getUniqueNumber()); + if (cardE != null) { + toPanel.getAttachedPanels().add(cardE); + } + } + } + + if (card.isEquipped()) { + final ArrayList enchants = card.getEquippedBy(); + for (final Card e : enchants) { + final forge.view.arcane.CardPanel cardE = getCardPanel(e.getUniqueNumber()); + if (cardE != null) { + toPanel.getAttachedPanels().add(cardE); + } + } + } + + if (card.isEnchantingCard()) { + toPanel.setAttachedToPanel(getCardPanel(card.getEnchantingCard().getUniqueNumber())); + } else if (card.isEquipping()) { + toPanel.setAttachedToPanel(getCardPanel(card.getEquipping().get(0).getUniqueNumber())); + } else { + toPanel.setAttachedToPanel(null); + } + + toPanel.setCard(toPanel.getGameCard()); + } + invalidate(); + repaint(); + } - public boolean isType(final Card card) { + private static enum RowType { + Land, + Creature, + CreatureNonToken, + Other; + + public boolean isGoodFor(final Card card) { switch (this) { - case land: - return card.isLand(); - case creature: - return card.isCreature(); - case creatureNonToken: - return card.isCreature() && !card.isToken(); - case other: - return !card.isLand() && !card.isCreature(); - default: - throw new RuntimeException("Unhandled type: " + this); + case Land: return card.isLand(); + case Creature: return card.isCreature(); + case CreatureNonToken: return card.isCreature() && !card.isToken(); + case Other: return !card.isLand() && !card.isCreature(); + default: throw new RuntimeException("Unhandled type: " + this); } } } @@ -541,7 +596,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen private void addAll(final List cardPanels, final RowType type) { for (final CardPanel panel : cardPanels) { - if (!type.isType(panel.getGameCard()) || (panel.getAttachedToPanel() != null)) { + if (!type.isGoodFor(panel.getGameCard()) || (panel.getAttachedToPanel() != null)) { continue; } final CardStack stack = new CardStack(); @@ -606,4 +661,17 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen + PlayArea.this.cardSpacingY; } } + private int getCardWidth() { + return cardWidth; + } + + private void setCardWidth(int cardWidth0) { + this.cardWidth = cardWidth0; + this.cardHeight = Math.round(this.cardWidth * CardPanel.ASPECT_RATIO); + this.extraCardSpacingX = Math.round(this.cardWidth * PlayArea.EXTRA_CARD_SPACING_X); + this.cardSpacingX = (this.cardHeight - this.cardWidth) + this.extraCardSpacingX; + this.cardSpacingY = Math.round(this.cardHeight * PlayArea.CARD_SPACING_Y); + this.stackSpacingX = Math.round(this.cardWidth * PlayArea.STACK_SPACING_X); + this.stackSpacingY = Math.round(this.cardHeight * PlayArea.STACK_SPACING_Y); + } } diff --git a/src/main/java/forge/view/arcane/util/Animation.java b/src/main/java/forge/view/arcane/util/Animation.java index 933c50f5b46..75a28688315 100644 --- a/src/main/java/forge/view/arcane/util/Animation.java +++ b/src/main/java/forge/view/arcane/util/Animation.java @@ -140,6 +140,18 @@ public abstract class Animation { protected void end() { } + /** + *

+ * invokeLater. + *

+ * + * @param runnable + * a {@link java.lang.Runnable} object. + */ + public static void invokeLater(final Runnable runnable) { + EventQueue.invokeLater(runnable); + } + /** * Uses averaging of the time between the past few frames to provide smooth * animation. @@ -248,7 +260,7 @@ public abstract class Animation { public static void moveCardToPlay(final int startX, final int startY, final int startWidth, final int endX, final int endY, final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane, final int speed) { - UI.invokeLater(new Runnable() { + Animation.invokeLater(new Runnable() { @Override public void run() { final int startHeight = Math.round(startWidth * CardPanel.ASPECT_RATIO); @@ -343,7 +355,7 @@ public abstract class Animation { public static void moveCard(final int startX, final int startY, final int startWidth, final int endX, final int endY, final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane, final int speed) { - UI.invokeLater(new Runnable() { + Animation.invokeLater(new Runnable() { @Override public void run() { final int startHeight = Math.round(startWidth * CardPanel.ASPECT_RATIO); @@ -397,19 +409,14 @@ public abstract class Animation { * a {@link forge.view.arcane.CardPanel} object. */ public static void moveCard(final CardPanel placeholder) { - UI.invokeLater(new Runnable() { + Animation.invokeLater(new Runnable() { @Override public void run() { - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - if (placeholder != null) { - placeholder.setDisplayEnabled(true); - // placeholder.setImage(imagePanel); - placeholder.setCard(placeholder.getGameCard()); - } - } - }); + if (placeholder != null) { + placeholder.setDisplayEnabled(true); + // placeholder.setImage(imagePanel); + placeholder.setCard(placeholder.getGameCard()); + } } }); } diff --git a/src/main/java/forge/view/arcane/util/UI.java b/src/main/java/forge/view/arcane/util/UI.java deleted file mode 100644 index 83c01378127..00000000000 --- a/src/main/java/forge/view/arcane/util/UI.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Forge: Play Magic: the Gathering. - * Copyright (C) 2011 Nate - * - * 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.view.arcane.util; - -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.EventQueue; -import java.awt.Font; -import java.awt.Image; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Toolkit; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collections; -import java.util.concurrent.ConcurrentMap; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JEditorPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; -import javax.swing.JViewport; -import javax.swing.ScrollPaneConstants; -import javax.swing.UIManager; -import javax.swing.ViewportLayout; -import javax.swing.border.Border; -import javax.swing.border.TitledBorder; -import javax.swing.text.Element; -import javax.swing.text.StyleConstants; -import javax.swing.text.View; -import javax.swing.text.ViewFactory; -import javax.swing.text.html.HTML; -import javax.swing.text.html.HTMLEditorKit; -import javax.swing.text.html.ImageView; - -import com.google.common.collect.MapMaker; - -/** - * UI utility functions. - * - * @author Forge - * @version $Id$ - */ -public class UI { - /** Constant imageCache. */ - private static ConcurrentMap imageCache = new MapMaker().softValues().makeMap(); - - /** - *

- * getToggleButton. - *

- * - * @return a {@link javax.swing.JToggleButton} object. - */ - public static JToggleButton getToggleButton() { - JToggleButton button = new JToggleButton(); - button.setMargin(new Insets(2, 4, 2, 4)); - return button; - } - - /** - *

- * getButton. - *

- * - * @return a {@link javax.swing.JButton} object. - */ - public static JButton getButton() { - JButton button = new JButton(); - button.setMargin(new Insets(2, 4, 2, 4)); - return button; - } - - /** - *

- * setTitle. - *

- * - * @param panel - * a {@link javax.swing.JPanel} object. - * @param title - * a {@link java.lang.String} object. - */ - public static void setTitle(final JPanel panel, final String title) { - Border border = panel.getBorder(); - if (border instanceof TitledBorder) { - ((TitledBorder) panel.getBorder()).setTitle(title); - panel.repaint(); - } else { - panel.setBorder(BorderFactory.createTitledBorder(title)); - } - } - - /** - *

- * getFileURL. - *

- * - * @param path - * a {@link java.lang.String} object. - * @return a {@link java.net.URL} object. - */ - public static URL getFileURL(final String path) { - File file = new File(path); - if (file.exists()) { - try { - return file.toURI().toURL(); - } catch (MalformedURLException ignored) { - } - } - return UI.class.getResource(path); - } - - /** - *

- * getImageIcon. - *

- * - * @param path - * a {@link java.lang.String} object. - * @return a {@link javax.swing.ImageIcon} object. - */ - public static ImageIcon getImageIcon(final String path) { - InputStream stream = null; - try { - try { - stream = UI.class.getResourceAsStream(path); - if (stream == null && new File(path).exists()) { - stream = new FileInputStream(path); - } - if (stream == null) { - throw new RuntimeException("Image not found: " + path); - } - byte[] data = new byte[stream.available()]; - stream.read(data); - return new ImageIcon(data); - } finally { - if (stream != null) { - stream.close(); - } - } - } catch (IOException ex) { - throw new RuntimeException("Error reading image: " + path); - } - } - - /** - *

- * setHTMLEditorKit. - *

- * - * @param editorPane - * a {@link javax.swing.JEditorPane} object. - */ - public static void setHTMLEditorKit(final JEditorPane editorPane) { - editorPane.getDocument().putProperty("imageCache", imageCache); // Read - // internally - // by - // ImageView, - // but - // never - // written. - // Extend all this shit to cache images. - editorPane.setEditorKit(new HTMLEditorKit() { - private static final long serialVersionUID = -562969765076450440L; - - @Override - public ViewFactory getViewFactory() { - return new HTMLFactory() { - @Override - public View create(final Element elem) { - Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute); - if (o instanceof HTML.Tag) { - HTML.Tag kind = (HTML.Tag) o; - if (kind == HTML.Tag.IMG) { - return new ImageView(elem) { - @Override - public URL getImageURL() { - URL url = super.getImageURL(); - // Put an image into the cache to be - // read by other ImageView methods. - if (url != null && imageCache.get(url) == null) { - try { - imageCache.put(url.toURI(), Toolkit.getDefaultToolkit() - .createImage(url)); - } catch (URISyntaxException e) { - } - } - return url; - } - }; - } - } - return super.create(elem); - } - }; - } - }); - } - - /** - *

- * setVerticalScrollingView. - *

- * - * @param scrollPane - * a {@link javax.swing.JScrollPane} object. - * @param view - * a {@link java.awt.Component} object. - */ - public static void setVerticalScrollingView(final JScrollPane scrollPane, final Component view) { - final JViewport viewport = new JViewport(); - viewport.setLayout(new ViewportLayout() { - private static final long serialVersionUID = -4436977380450713628L; - - @Override - public void layoutContainer(final Container parent) { - viewport.setViewPosition(new Point(0, 0)); - Dimension viewportSize = viewport.getSize(); - int width = viewportSize.width; - int height = Math.max(view.getPreferredSize().height, viewportSize.height); - viewport.setViewSize(new Dimension(width, height)); - } - }); - viewport.setView(view); - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setViewport(viewport); - } - - /** - *

- * getDisplayManaCost. - *

- * - * @param manaCost - * a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public static String getDisplayManaCost(String manaCost) { - manaCost = manaCost.replace("/", ""); - manaCost = manaCost.replace("X 0", "X"); - // A pipe in the cost means - // "process left of the pipe as the card color, but display right of the pipe as the cost". - int pipePosition = manaCost.indexOf("{|}"); - if (pipePosition != -1) { - manaCost = manaCost.substring(pipePosition + 3); - } - return manaCost; - } - - /** - *

- * invokeLater. - *

- * - * @param runnable - * a {@link java.lang.Runnable} object. - */ - public static void invokeLater(final Runnable runnable) { - EventQueue.invokeLater(runnable); - } - - /** - *

- * invokeAndWait. - *

- * - * @param runnable - * a {@link java.lang.Runnable} object. - */ - public static void invokeAndWait(final Runnable runnable) { - if (EventQueue.isDispatchThread()) { - runnable.run(); - return; - } - try { - EventQueue.invokeAndWait(runnable); - } catch (InterruptedException ex) { - } catch (InvocationTargetException ex) { - throw new RuntimeException(ex); - } - } - - /** - *

- * setDefaultFont. - *

- * - * @param font - * a {@link java.awt.Font} object. - */ - public static void setDefaultFont(final Font font) { - for (Object key : Collections.list(UIManager.getDefaults().keys())) { - Object value = UIManager.get(key); - if (value instanceof javax.swing.plaf.FontUIResource) { - UIManager.put(key, font); - } - } - } -}