Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 29th, 2020 242 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: (function(){/* no need to enter power,just run */ var prelude=false;var totalWar=false;var preparingForWarTile=false;var researchTile=false;var password="";var t=document.getElementsByTagName("textarea")[0];var tTemp="";var powArray=["DE","UK","JA","SU","IT","US"]; var treaty_variant=false;var qmg11_variant=false;var constructedDeck=false; var re=new RegExp("\\[size=\\d\\]\\[color=#FFFFFF\\]New seed: \\S+\\[/color\\]\\[/size\\]","g");var seed=re.exec(t.value);if(seed===null){seed="";}else {seed=seed[0].slice(32,-15);}var tr=true,fa=false; function option_list(){var thelist="1. DONE: proceed with setup\n";var num=2;if(prelude){thelist+=num+". YES - Prelude\n";}else {thelist+=num+". NO  - Prelude\n";}num+=1;if(researchTile){thelist+=num+". YES - Research Promo Tile\n";}else {thelist+=num+". NO  - Research Promo Tile\n";}num+=1;if(preparingForWarTile){thelist+=num+". YES - Preparing For War! Promo Tile\n";}else {thelist+=num+". NO  - Preparing For War! Promo Tile\n";}return thelist;}function refSortDeck(ref,deck){for(var i=0;i < deck[power].length;i++){ref.push({text:cNam(i+1),oind:i});}ref.sort(compareTitle);}function origToSorted(map,size){for(var i=0;i < size;i++){map[i]=-1;}}function addNind(ref,map){for(var i=0;i < ref.length;i++){ref[i].nind=i;map[refSortedDeck[i].oind]=i;}ref.sort(compareTitleNind);}function exp_used_list(){var expused="\n";if(constructedDeck) expused+="Constructed Decks\n";if(totalWar) expused+="Total War\n";if(prelude) expused+="Prelude\n";if(researchTile) expused+="Research Promo Tile\n";if(preparingForWarTile) expused+="Preparing For War! Promo Tile\n";if(treaty_variant) expused+="Treaty Variant\n";if(qmg11_variant) expused+="QMG 1.1 Variant\n";if(expused == "\n") expused="\nNone";return expused;}function jsonp(spl,n){return JSON.parse("["+spl[n].replace(/(^,)|(,$)/g,"")+"]");}var preluding=fa;var runs=0;var power="";var spl,drawDeck,hand,prepared,status,history,discards,unused,armaments,preHand,preDeck,preDisc,variables;if(seed===""){var done_with_options=false;var options_array=["1","2","3","4"];while (!done_with_options){var prompt00=prompt("QMG 2nd Edition - Option selection\n\nToggle the options by entering its number and pressing ENTER or OK. Select the DONE option to proceed.\n\n"+option_list());if(prompt00===null){return 0;}else if(prompt00===options_array[0]){expused=exp_used_list();done_with_options=true;}else if(options_array.includes(prompt00)){switch (prompt00){case "2": prelude=!prelude;break;case "3": researchTile=!researchTile;break;case "4": preparingForWarTile=!preparingForWarTile;break;}}}}else {spl=window.atob(seed).split("|");drawDeck=jsonp(spl,0);hand=jsonp(spl,1);prepared=jsonp(spl,2);status=jsonp(spl,3);history=jsonp(spl,4);discards=jsonp(spl,5);unused=jsonp(spl,6);armaments=jsonp(spl,7);preHand=jsonp(spl,8);preDeck=jsonp(spl,9);preDisc=jsonp(spl,10);variables=jsonp(spl,11);preluding=variables[0];runs=variables[1]+1;power=powArray[variables[2]];constructedDeck=variables[3];totalWar=variables[4];prelude=variables[5];researchTile=variables[6];preparingForWarTile=variables[7];treaty_variant=variables[8];qmg11_variant=variables[9];}if(prelude) preluding=tr; var deckSize=0,pName="",actions="",discardNum=3,constructStart=fa,deckReady=fa;if(totalWar){discardNum=5;}if(treaty_variant){totalWar=tr;qmg11_variant=fa;}if(qmg11_variant){totalWar=tr;treaty_variant=fa;}var BA="Build Army",BN="Build Navy",LB="Land Battle",SB="Sea Battle",ST="Status",EW="Economic Warfare",EV="Event",RE="Response",BO="Bolster",AP="Air Power",HI="History",AR="Armament",vn=" (variant)",vs=" (variant sub)",sub=" (substitute)",drt="discrevtype",alltypes=[BA,BN,LB,SB,AP,EW,EV,BO,ST,RE,HI,AR],allD={DE:[],UK:[],JA:[],SU:[],IT:[],US:[]},prelD={DE:[],UK:[],JA:[],SU:[],IT:[],US:[]},Pl="Play",Af="Air Force",Vi="Victory",Di="Discard",Dr="Draw",Su="Supply",aPl="anyone's Play",BoDn="bolsterdown",constructedDeckSizeNonAir={DE:40,UK:39,JA:33,SU:34,IT:30,US:40},constructedDeckSizeAir={DE:10,UK:8,JA:10,SU:8,IT:8,US:10},version="v8.0 ";alph="abcdefghijklmnopqrstuvwxyz";oldseedpr=fa; var myUsername="";var usernameRE=/a href="\/collection\/user\/(.*?)">Collection/.exec(document.body.innerHTML);if(usernameRE){myUsername=usernameRE[1];}function getPName(power){switch (power){case "DE": pName="Germany";break;case "UK": pName="United Kingdom";break;case "JA": pName="Japan";break;case "SU": pName="Soviet Union";break;case "IT": pName="Italy";break;case "US": pName="United States";break;default: alert("Error: incorrect power code: "+power+"\n\nChoose from DE,UK,JA,SU,IT,US");return 0;}return pName;}function isNumber(num){return !isNaN(parseFloat(num))&&isFinite(num);}function p2D(dest,nation,data){var i=0;if( !isInList(data[i],alltypes) ){alert("push ERROR");return 0;}while (i < data.length){var olen=0,found=fa,obj={},n=0;while(!found){n+=1;if(i+n===data.length||isInList(data[i+n],alltypes) ){olen=n;found=tr;}}obj.type=data[i];if(n > 4){alert("p2D error size "+nation+" "+n);}if(n===1){obj.title=data[i];}else if(n > 1){obj.title=data[i+1];}var rep=1;if(n===2&&!isNaN(parseFloat(data[i+1]))&&isFinite(data[i+1])){rep=data[i+1];obj.title=data[i];}if(n===3){if(isArray(data[i+2])){obj.special=data[i+2];}else {obj.step=data[i+2];}}if(n===4){obj.special=data[i+2];obj.step=data[i+3];}for(var j=0;j < rep;j++){dest[nation].push(obj);}i+=n;}}function removeCards(nation,data){data.forEach(function(titlem){var cardPos=fa,name="";for(var i=0;i < allD[nation].length;i++){name=allD[nation][i].title;if(name===titlem){allD[nation].splice(i,1);cardPos=tr;}}if(!cardPos) alert("remove error "+nation+" "+name+" "+titlem);});}function isArray(obj){return !!obj&&obj.constructor===Array;}p2D(allD,"DE",[BA,6,BN,2,EW,"Submarines Enforce Blockade",EW,"Submarines Lead the Battle of the Atlantic",EW,"Submarines of the Monsoon Group",EW,"Submarines Prey on Unprotected Shipping",EW,"Submarines Raid Murmansk Convoy",EW,"V-Weapons",EV,"Broad Front",EV,"Forced Conscription",EV,"Guns and Butter",EV,"Military Dictatorships In The Balkans",EV,"Plunder",EV,"The Autobahn",LB,7,SB,2,ST,"Abundant Resources",ST,"Atlantic Wall",ST,"Bias For Action",ST,"Blitzkrieg",ST,"Conscription",ST,"Dive Bombers",ST,"Jet Fighters",ST,"Superior Planning",Pl,ST,"Swedish Iron Ore",ST,"Synthetic Fuel",ST,"Volksturm",Pl,ST,"Wolf Packs" ]); p2D(allD,"UK",[BA,5,BN,5,EW,"Bomber Command",EW,"Malta Submarines",EV,"Dutch East Indies",EV,"General Smuts Strengthens Ties to UK",EV,"Increased Commonwealth Support",EV,"King Peter Enthroned in Yugoslavia",EV,"Ledo and Burma Roads",EV,"Singapore Fortified",RE,"ASW Tactics",RE,"Defensive Posture",RE,"Destroyers",RE,"Enigma Code Cracked",RE,"Loyal To The Crown",RE,"RAF",RE,"Rationing",SB,5,ST,"Australia Forms The Directorate of Manpower",ST,"Free France",ST,"Lord Linlithgow Declares India to be at War",ST,"Mackenzie King Drafts the National Resources Mobilization Act",ST,"Resistance",ST,"The Royal Navy",LB,4]); p2D(allD,"JA",[BA,4,BN,6,EW,"Indian Ocean Patrols",EW,"Submarines Support Pacific Islands",LB,3,RE,"Banzai Charge",RE,"Battleship Repair",RE,"China Offensive",RE,"Destroyer Transport",RE,"Fall of Singapore",RE,"Kamikaze",RE,"Kwantung Army",RE,"Mobile Force",RE,"Special Naval Landing Forces",RE,"Surprise Attack",RE,"Truk",SB,4,ST,"Forward Bases",ST,"Greater East Asia Co-prosperity Sphere",ST,"Imperial Designs",ST,"Unimpeded Merchant Shipping"]); p2D(allD,"SU",[BA,8,BN,1,EV,"General Winter",EV,"German-Soviet Treat of Friendship, Cooperation, and Demarcation",EV,"Mao Tse-tung",EV,"Tito’s Partisans",EV,"Trans Siberian Railroad",EV,"Vasilevsky Takes Command in the Far East",LB,6,RE,"Defense of the Motherland",RE,"Leningrad",RE,"Moscow",RE,"Rasputitsa",RE,"Stalingrad",SB,2,ST,"Frontal Assault",ST,"Guards",   ST,"Scorched Earth",ST,"Shvernik’s Evacuation Council",ST,"Stavka Forms Artillery Corps",ST,"Women Conscripts"]); p2D(allD,"IT",[BA,4,BN,3,EW,"Decima Flottiglia MAS (Frogmen)",EW,"Regia Marina Closes Shipping Lanes",EV,"Afrika Corps",EV,"Division Azul",EV,"German Aid In Greece",EV,"Italian East Africa",EV,"Italy Attacks Communists",EV,"Plunder",LB,4,RE,"German Reinforcements Counterattack",RE,"Monte Cassino",RE,"Romanian Reinforcements",RE,"Skilled Pilots",SB,2,ST,"Anti-Communist Sentiment",ST,"Balkan Resources",ST,"Bravado",ST,"Impero Italiano",ST,"Mare Nostrum"]); p2D(allD,"US",[BA,5,BN,5,EW,"B-24 Liberator",EW,"B-26 Marauder",EW,"B-29 Superfortress",EW,"Firestorm Bombers",EW,"SBD Dauntless",EV,"Arsenal of Democracy",EV,"Fleet Deployed To Pearl Harbor",EV,"Flexible Resources",[ ["playdisc"] ],EV,"Free French Allies",EV,"Guadalcanal",EV,"Lend Lease",EV,"Murmansk Convoy",EV,"Operation Magic",EV,"Patton Advances",EV,"Theater Shift",LB,4,SB,4,ST,"Aircraft Carriers",ST,"American Volunteer Group Expands",ST,"Amphibious Landings",ST,"Flying Fortresses",ST,"Radar",ST,"Rosie the Riveter",Di,ST,"Superior Shipyards",ST,"Wartime Production"]); if(totalWar){p2D(allD,"DE",[BO,"12.8cm Flakzwilling 40",BO,"Admiral Graf Spee",BO,"Cloud Cover",Pl,BO,"Ju-52's Airlift Supplies",Pl,BO,"Ju-87",BO,"Operation Weserubung",Vi,BO,"Tactical Innovations",[ ["discstat"],["play"] ],Pl,BO,"The Blitz",BO,"Fallschirmjager",Pl,BO,"G7e Torpedo",AP,5,EV,"Ardennes Offensive",EV,"Fall Weiss",EV,"Sea Lion",EV,"Strategic Planning",[ ["pickdraw"],["pickdraw"],["discard"] ],EV,"Sweden Supports Finland",EV,"Turkey Joins Axis",EW,"Arkhangelsk Overrun",EW,"Elektroboot Submarines",LB,ST,"Landkreuzers",ST,"Westwall"]); removeCards("UK",["Dutch East Indies","Free France","Ledo and Burma Roads"]);p2D(allD,"UK",[BO,"Bletchley Park",[ [drt,"any"] ],BO,"British Colonial Forces",[ [drt,"any","any"] ],BO,"Keep Calm and Carry"+" "+"O"+"n",[ [drt,"any"] ],BO,"Warsaw Uprising",[ [drt,"any","any"] ],Vi,AP,4,BO,"Armee de l'Air",Af,BO,"Maginot Line",[ [drt,"any","any","any","any"] ],BO,"Special Air Service Raids Airfields",[ [drt,"any","any"] ],Pl,BN,EV,"Armee de Terre",EV,"Dutch East Indies"+sub,EV,"Foreign Legions",EV,"France Combattante",EV,"Free Forces of the Low Countries",EV,"Free French Allies"+sub,EV,"La Royale",EV,"Les Forces Navales Françaises Libres",EV,"Polskie Panstwo Podziemne",EV,"Rhin et Danube",RE,"French Patriots Join Allies",RE,"Elan",ST,"Free France"+sub,ST,"Government in Exile",ST,"Hobart's Funnies",ST,"Polish Sovereignty",ST,"Senegalese Tirailleurs"]); p2D(allD,"JA",[BO,"Imperial Japanese Navy",[ [drt,RE] ],BO,"Island Fortresses",[ [drt,RE] ],Vi,BO,"Nagumo Commands the First Air Fleet",[ [drt,RE] ],BO,"The Pacific Empire",Vi,BO,"Tora",[ [drt,RE] ],BO,"Yamamoto aboard the Yamato",[ [drt,RE] ],Pl,AP,5,BO,"Code of Bushido",[ [drt,RE] ],BO,"Mitsubishi J8M",BN,EW,"Bombing of Chongqing",EW,"Fu-Go Balloon Bombs",EW,"Japanese Fleet Blockades Vladivostok",RE,"Chinese Civil War",Pl,RE,"Imperial Manchukuo Army",Pl,RE,"Japan Arms Indian Nationalists",RE,"Kantai Kessen",Pl,RE,"Marco Polo Bridge Incident",Pl,RE,"SNLF Paratroopers",RE,"Submarines Support Fleet",RE,"Thailand",Pl,ST,"Absolute National Defense Sphere",ST,"Hokushin-ron",ST,"Japanese Mandate for the South Seas Islands"]); p2D(allD,"SU",[BO,"Asian Reserves",[ ["draw2BAdisc"] ],Dr,BO,"Battle of Moscow",[ [drt,BA] ],BO,"Fortress Rebuilt",[ [drt,BA],["playdisc"] ],Dr,BO,"Paratroops",[ [drt,BA] ],BO,"Zhukov Drives West",[ [drt,BA] ],AP,3,BO,"Cavalry Corps",[ [drt,BA] ],BO,"Operation Zet",Af,BO,"Vitebsk Gate",[ [drt,BA,"any","any"] ],Vi,BA,EV,"Battles of Khalkhin Gol",EV,"Kuril Islands Landing Operation",EV,"Siberian Transfer",LB,RE,"Endless Expanses",RE,"Heavy Tanks",RE,"Retreat and Regroup",ST,"Attrition",Di,ST,"Government Evacuates to Kuibyshev",ST,"People's Liberation Army",ST,"Quantity Has a Quality All its Own",ST,"Tank Desant"]); p2D(allD,"IT",[BO,"Golden Square Coup",Vi,BO,"Regia Aeronautica",BO,"Somaliland",Vi,BO,"Supermarina",Vi,AP,3,BO,"BETASOM",BO,"Italy Completes Carriers Early",Pl,BO,"Pact of Steel",BN,EV,"Giuliani, Cappellini, and Torelli",EV,"Operation Herkules",EV,"Reza Shah Supports Axis",EV,"Spain",EV,"Wafdist Uprising",EW,"Operation Lobster",EW,"Operation Pike",LB,RE,"Alpini",RE,"Operation Unthinkable",ST,"Irredentismo Italiano",ST,"Spanish Troops Seize Gibraltar",ST,"Turkey Opens the Straits"]); removeCards("US",["American Volunteer Group Expands","Free French Allies"]);p2D(allD,"US",[BO,"A Great, Sleeping Giant",BO,"Eagle Squadrons",Af,BO,"Navajo Code Talkers",[ [BoDn] ],Pl,BO,"Our Philosophy of Government",[ ["discardtop"],["discardtop"] ],Dr,BO,"P-51 Mustang",BO,"Pacific Bases",Vi,BO,"Rangers",AP,6,BO,"Carpet Bombing",[ [drt,EW] ],BO,"Flying Tigers",Af,BO,"Pappy Boyington",Vi,EV,"American Public Sympathizes with Chinese People",EV,"Cash and Carry Replaces Neutrality Acts",EV,"Ledo and Burma Roads"+sub,EV,"Shoot First and Argue Afterwards",EV,"The Brazilian Expeditionary Force",EV,"The Hundred Regiments Offensive",EW,"Doolittle's Bombers",EW,"Oil Embargo",EW,"Stalemate in China",EW,"United States Submarines Patrol Japanese Shipping Lanes",ST,"American Volunteer Group Expands"+sub,ST,"Anti-Japanese Volunteer Armies",ST,"Artifical Harbors",ST,"SHAEF",ST,"USMC",ST,"Victory Gardens",ST,"War Bonds"]);} if(prelude){p2D(prelD,"DE",[AR,"Achtung - Panzer!",Vi,AR,"Amerika Bomber",Pl,AR,"Assault Gliders",AR,"Bismarck Class",Vi,AR,"Ersatz Goods",AR,"Flak 88",AR,"Freya Radar",Pl,AR,"Panzergrenadiers",AR,"Peenemünde Army Research Center",Pl,AR,"Siegfried Line",AR,"Slovakia Armed",Vi,AR,"Uranverein",Pl,HI,"Anglo-German Naval Agreement Renounced | +1",HI,"Anschluss Connects Axis Powers | +1",HI,"Condor Legion | +1",HI,"Kaiser Wilhelm Society | +1",[ ["prestt10"] ],HI,"League of Nations Referendum | +1",HI,"Partition of Czechoslovakia | +1",HI,"Remilitarization of the Rhineland | +2",[ ["preplaydraw"],["preplaydraw"] ],HI,"Truppenführung | 0"]);p2D(prelD,"UK",[AR,"British Commonwealth Air Training Plan",Vi,AR,"Dominion of Canada Mobilizes",Vi,AR,"Force Z",AR,"Free French Bases",Su,AR,"King George V & Prince of Wales",AR,"Ouvrage Hackenberg",AR,"Secret Intelligence Service",AR,"Sterling Area",[ [drt,BA] ],Vi,AR,"Viet Minh",AR,"We Shall Never Surrender",Vi,HI,"BEF Establised | +1",HI,"But It Is Not Far Distant | +1",HI,"Colonial Mediterranean Bases | +1",HI,"Imperial Africa | +1",HI,"Italian Coal Embargo | +1",[ ["prehisup"] ],HI,"Peace for Our Time | -1",HI,"Poland Mobilizes | +1",HI,"Scapa Flow Salvage Cleared | +1",HI,"That Thing is Honor | +1",HI,"Women's Voluntary Service | 0"]);p2D(prelD,"JA",[AR,"Akagi",Vi,AR,"Aleutian Island Bases",Pl,AR,"Combined Fleet",AR,"Genda Prevails",Pl,AR,"Hainan Island Operation",AR,"Imperial Japanese Navy Air Service",AR,"Japan Fortifies Micronesia",Vi,AR,"Jungle Warfare Tactics",AR,"National Mobilization Law",[ ["play"] ],Vi,HI,"Amau Doctrine | +1",HI,"Black Dragon Society | +1",[ ["play"],["draw1"] ],HI,"Gandhi Declares a Satyagraha | 0",HI,"Imperial Japanese Army Air Service | 0",HI,"League of Blood | 0",[ ["bottomdrawx"] ],HI,"Mukden | +2",HI,"Soviet-Japanese Neutrality Pact | -1",[ ["prehisup"] ],HI,"Tientsin Incident | +1",HI,"Washington Naval Treaty Renounced | +1"]);p2D(prelD,"SU",[AR,"5 Year Plan Industrialization",Vi,AR,"Battle of Lake Khasan",AR,"Katyusha Multiple Rocket Launcher",AR,"Sorge Spy Ring Warns Kremlin",AR,"Soviet Offensive Doctrine",AR,"Soviet Ships Defend Ports",AR,"T-34",AR,"Winter War",Vi,HI,"Great Purges Eliminate Dissent | -1",[ ["prediscx"] ],HI,"Invasion of Xinjiang | 0",HI,"Japanese-Soviet Nonaggression Pact | -1",[ ["prehisup"] ],HI,"Molotov-Ribbentrop Pact | -1",[ ["prehisup"] ],HI,"Occupation of the Baltic States | +1",HI,"Popular Front Confronts Fascism | +1",HI,"Socialism in"+" "+"O"+"n"+"e Country | 0",[ ["play"],["draw1"] ],HI,"Soviets Support Spanish Republicans | +1",HI,"The Long March | 0",]);p2D(prelD,"IT",[AR,"Build-up in Libya",Vi,AR,"Iraq Gains Independence",Vi,AR,"Italian Colonial Troops",Vi,AR,"Littorio",Vi,AR,"Militia",Vi,AR,"Minelayers",AR,"Romania Reacts to Bessarabia Annexation",Vi,HI,"America First Committee | -1",HI,"Anti-Comintern Pact | +1",HI,"Aviazione Legionaria | +1",HI,"Corpo Truppe Volontarie | +1",HI,"Dodecanese Bases | +1",HI,"Italy Invades Albania | +1",HI,"Second Italo-Abyssinian War | +1",HI,"Spanish Coup of July 1936 | 0",HI,"The March to the Oceans | +1"]);p2D(prelD,"US",[AR,"Assembly Lines Refit for War",[ ["bottomdrawf"] ],Pl,AR,"Einstein-Szilárd Letter",Pl,AR,"National Revolutionary Army",AR,"North Carolina Class Fast Battleships",Vi,AR,"Philippine Scouts",Vi,AR,"United States Army Air Corps",HI,"Battle of Nanking | +3",HI,"Civilian Conservation Corps | 0",[ ["preplaydisc"] ],HI,"Hot Dogs in Hyde Park | +1",HI,"Japan Sinks the U.S.S. Panay | +1",HI,"Naval Expansion Act | +1",HI,"Neutrality Acts | -1",HI,"Quarantine Speech | +1",HI,"Second United Front | 0",HI,"Tizard Mission | 0",HI,"Works Progress Administration | 0",[ ["prestt10"] ] ]);} if(treaty_variant){removeCards("DE",["12.8cm Flakzwilling 40","Jet Fighters","Superior Planning"]);p2D(allD,"DE",[BO,"Graf Zeppelin"+vn,EV,"Amerika"+vn,EV,"Fall Ikarus"+vn,ST,"12.8cm Flakzwilling 40"+vs,ST,"German-Soviet Treaty of Friendship, Cooperation, and Demarcation"+vs,ST,"Jet Fighters"+vs,ST,"Superior Planning"+vs,Pl]);p2D(allD,"UK",[BO,"Canadian Forces Mobilize"+vn,Vi,EV,"British Expeditionary Force"+vn,RE,"Auxiliary Units"+vn]);p2D(allD,"JA",[RE,"Attack"+" "+"o"+"n"+" Pearl Harbor"+vn,Pl,RE,"Pacific Coast Offensive"+vn,ST,"Imperial Pacific Sphere"+vn,ST,"Japanese-Soviet Non-aggression Pact"+vn]);removeCards("SU",["German-Soviet Treaty of Friendship, Cooperation, and Demarcation","Vasilevsky Takes Command in the Far East"+sub]);p2D(allD,"SU",[BO,"Caspian Flotilla"+vn,Pl,EV,"Attack is the Best form of Defense"+vn,EV,"RDS-1"+vn,EV,"Revolución Antiimperialista"+vn,EV,"Vasilevsky Takes Command in the Far East"+vs]);p2D(allD,"IT",[RE,"Bersaglieri"+vn,RE,"Guerrilla Colonialista"+vn,ST,"Italian-Soviet Treaty"+" "+"o"+"n"+" Friendship, Non-aggression, and Neutrality"+vn,ST,"Mundo Latino"+vn]);removeCards("US",[ "Flying Fortresses","Cash and Carry Replaces Neutrality Acts"]);p2D(allD,"US",[EV,"Cash and Carry Replaces Neutrality Acts"+vs,EW,"Little Boy and Fat Man"+vn,ST,"Flying Fortresses"+vs,ST,"Manhattan Project"+vn,Pl,ST,"Neutrality Acts"+vn,ST,"Permanent Joint Board"+" "+"o"+"n"+" Defense"+vn,Pl]);} if(qmg11_variant){removeCards("DE",["12.8cm Flakzwilling 40","Arkhangelsk Overrun","Jet Fighters","Superior Planning","Volksturm","Westwall","Wolf Packs"]);p2D(allD,"DE",[BO,"Superior Planning"+vs,[ ["drawfromtop4"],["reorder4"] ],Pl,BO,"Total War"+vn,Pl,EV,"Operation Achse"+vn,ST,"12.8cm Flakzwilling 40"+vs,ST,"Jet Fighters"+vs,ST,"Kriegsmarine"+vn,ST,"Volksturm"+vs,ST,"Wolf Packs"+vs]); removeCards("UK",["La Royale","Les Forces Navales Françaises Libres"]);p2D(allD,"UK",[BO,"Double-Cross System"+vn,Dr,BO,"Evacuation"+vn,BO,"La Royale"+vs,[ [drt,"any","any"] ],Vi,EV,"El Alamein"+vn,EV,"Les Forces Navales Françaises Libres"+vs]); removeCards("JA",[ "Absolute National Defense Sphere","Forward Bases","Truk"]);p2D(allD,"JA",[BO,"Gozen Kaigi"+vn,[ ["discrespha"],["play"] ],Vi,BO,"Night Supply"+vn,[ [drt,RE] ],RE,"Fleet Mobilization"+vn,Pl,ST,"Forward Bases"+vs,ST,"Truk"+vs]); p2D(allD,"SU",[BO,"Red Orchestra"+vn,aPl,BO,"Yakovlev Yak"+vn,[ [drt,BA] ],EV,"North-Western Front"+vn]); removeCards("IT",["German Reinforcements Counterattack","Irredentismo Italiano","Operation Pike","Operation Unthinkable","Pact of Steel","Skilled Pilots","Spanish Troops Seize Gibraltar"]);p2D(allD,"IT",[BO,"Vichy Colonies"+vn,EV,"German Reinforcements Counterattack"+vs,EV,"Pact of Steel"+vs,EW,"Arkhangelsk Falls!"+vn,RE,"German Example"+vn,RE,"Prepared Defences"+vn,RE,"Skilled Pilots"+vs,ST,"Spanish Troops Seize Gibraltar"+vs,ST,"Tripartite Pact"+vn,ST,"Vichy France"+vn]); removeCards("US",["Anti-Japanese Volunteer Armies","Flying Fortresses"]);p2D(allD,"US",[BO,"Prisoners of War"+vn,Vi,BO,"War Production Board"+vn,ST,"Anti-Japanese Volunteer Armies"+vs,ST,"Flying Fortresses"+vs,ST,"Industrial Giant"+vn,ST,"Manhattan Project"+vn,Dr]);}/*powArray.forEach(function(el){*/ /*});*/   function isInList(itemo,list){for(var ii=0;ii < list.length;ii++){if(list[ii]===itemo){return tr;}}return fa;}function takeSpecialActions(specAct,succ){var numdiscarded=0; specAct.forEach(function(elt){if(succ===1){if(elt[0]===drt){var typespecial=elt.slice(1);alert("You need to discard [ "+typespecial+" ] from your hand,press OK to continue.");var numdisc=typespecial.length; for(var i=0;i < numdisc;i++){var thisSuccess=discard(drt,typespecial[i]);succ=Math.min(succ,thisSuccess);if(thisSuccess){numdiscarded+=1;}else {break;}}}else {t.value=t.value+tTemp;tTemp="";succ=1;switch (elt[0]){case "playdrawBB": succ=pickdraw("playdraw","BB");break;case "playdrawST": succ=pickdraw("playdraw",ST);break;case "draw1": succ=draw(elt[0]);break;case "preplaydraw": if(preDeck.length > 0) pickdraw(elt[0]);break;case "prediscx": succ=discardtop(elt[0]);break;case "bottomdrawx": case "bottomdrawf": bottomdrawx(elt[0]);break;case "preplaydisc": pickdisc(elt[0]);break;case "prestt10": pickdraw(elt[0]);break;case "prehisup": succ=preHisUp();break;case "reorder4": succ=reorder(4);break;case "reorder5": succ=reorder(5);break;case "pickdraw": case "drawfromtop4": succ=pickdraw(elt[0]);break;case "playdraw": succ=pickdraw(elt[0]);break;case "playdisc": case "pickdisc": succ=pickdisc(elt[0]);break;case "discard": succ=discard(elt[0]);break;case "discstat": case "discresp": case "discrespha": succ=discstat(elt[0]);break;case "discardtop": succ=discardtop();break;case BoDn: case "play": play(elt[0]);break;case "draw2BAdisc": succ=draw2BAFromDiscards();break;default: alert("MISSING SPECIAL ACTION: "+elt[0]);succ=0;}}}}); return {succ: succ,numdiscarded: numdiscarded};}function play(c2){var handt=hand,decks=allD,discardst=discards;if(c2==="prelude"){handt=preHand;decks=prelD;discardst=preDisc;}if(c2==="prelude"&&preHand.length===0&&preDeck.length===0){alert("You have no cards in hand nor Prelude deck cards.");}else if(hand.length===0){alert("You have no cards in hand.");}else {var conti=tr,plcard=null,topcard=fa,snum="1",playtop=fa;while (conti){toptext="";prtxt="";if(c2==="prelude"){prtxt="("+preDeck.length+" left )";if(preDeck.length > 0){toptext="0: TOP DECK CARD: "+cardNameEll(preDeck[0])+"\n";topcard=tr;snum="0";}}var pTxt="Please choose a card to play ("+snum+"-"+handt.length+"). "+prtxt+"\n\n"+toptext;handt.forEach(function(elt,index){if( !(c2===BoDn&&cTyp(elt) !== BO) ){pTxt+=index+1+": "+cardNameEll(elt)+"\n";}});var prompt1=prompt(pTxt);if(prompt1===null){plcard=null;break;}var cId=-1;plcard=parseInt(prompt1,10);if(plcard===0&&topcard){cId=preDeck[0];playtop=tr;}else {cId=handt[plcard - 1];}conti=isNaN(plcard)||(!(plcard > 0)&&(c2 !== "prelude"))||(!(plcard > -1)&&c2==="prelude")&&topcard||plcard > handt.length||(cTyp(cId) !== BO&&c2===BoDn);}if(plcard !== null){var note="";var name=cNam(cId);if(cTyp(cId)===AP){note+="Using a "+AP+".\n\nNOTE: Technically "+AP+" cards are 'discarded' in the Air Force phase,not 'played',which can limit other card powers.";}else {note+="Playing "+cNam(cId,isInList(cTyp(cId),[RE,ST,AR]));}var titlePlayed=title(cId);var succ=1;tTemp="";alert(note);actions+=note+"\n"; var specAct=[];if(decks[power][cId-idn(cId)].hasOwnProperty("special")){specAct=decks[power][cId-idn(cId)].special;}var toptxt=" ";if(playtop) toptxt=" (from top) ";if(cTyp(cId)===ST){t.value=t.value+bold("Playing "+name)+"\n";status.push(cId);}else if(cTyp(cId)===AP){t.value=t.value+bold("Using a "+AP)+"\n";discards.unshift(cId);}else if(cTyp(cId)===RE){t.value=t.value+bold("Playing a "+RE+" card face down.")+"\n";prepared.push(cId);}else if(cTyp(cId)===AR){t.value=t.value+bold("Playing"+toptxt+"an "+AR+" card face down")+"\n";armaments.push(cId);}else if(cTyp(cId)===BO&&c2===BoDn){t.value=t.value+bold("Playing a Bolster card face down.")+"\n";prepared.push(cId);}else if(specAct.length > 0 ){tTemp=tTemp+bold("Playing"+toptxt+cNam(cId,tr))+"\n";discardst.unshift(cId);}else {t.value=t.value+bold("Playing"+toptxt+cNam(cId,tr))+"\n";discardst.unshift(cId);}if(playtop){preDeck.splice(0,1);}else {handt.splice(plcard - 1,1);} if(specAct.length > 0&&!(cTyp(cId)===AR||cTyp(cId)===RE||(cTyp(cId)===BO&&c2===BoDn)) ){var returnObj=takeSpecialActions(specAct,succ);succ=returnObj.succ;numdiscarded=returnObj.numdiscarded; if(succ){t.value=t.value+tTemp;}else {if(playtop){preDeck.splice(0,0,discardst.shift());}else {handt.splice(plcard - 1,0,discardst.shift());}for(var i=0;i < numdiscarded;i ++){handt.push(discardst.pop());}alert("Play of "+name+" did not succeed! Please redo your turn from the start.");}}return 1;}}return 0;}function preHisUp(){history.push(preDisc.shift());alert( "History card played to table" ) ;return 1;}function viewHand(){anote="This is your current regular hand:\n\n";hand.forEach(function(elt){anote+=cNam(elt)+"\n";});alert(anote);}function draw2BAFromDiscards(){var cardsFound=0;for(var j=0;!( j > discards.length-1 )&&!(cardsFound >= 2);j++){if(cTyp(discards[j])===BA){hand.push(discards[j]);discards.splice(j,1);j--;cardsFound++;}}var note="Asian Reserves: Moving "+cardsFound+" Build Army cards from discard to hand.";alert(note);t.value=t.value+bold(note)+"\n";return 1;}function map(password){var subs=(' '+alph).slice(1),nsubs="";for(var i=password.length-1;i > -1;i--){pch=password.charAt(i);ind=getIndexOf(pch,subs);ar=subs.split('');ar.splice(ind,1);subs=(' '+pch+ar.join('')).slice(1);}return subs;}function enc(dat,subs,alph){var out="";for(var k=0;k < dat.length;k++){out+=subs[getIndexOf(dat[k],alph)];}return out;}function getIndexOf(char,str){for(var x=0;x < str.length;x++){var c=str.charAt(x);if(char===c){return x;}}return -1;}function isPrelCard(id){return (id > 100);}function response(){var facedown=prepared.concat(armaments);if(facedown.length===0){alert("You have no face down cards.");}else {var continue2=tr,discarded=null;while (continue2){var pTxt="Please choose a face down card to use (1-"+facedown.length+"):\n\n";facedown.forEach(function(elt,index){pTxt+=index+1+": "+cardNameEll(elt)+"\n";});var p2=prompt(pTxt);if(p2===null){break;}discarded=parseInt(p2,10);continue2=isNaN(discarded)||!(discarded > 0)||discarded > facedown.length;}if(discarded !== null){var d_1=discarded - 1;var cId=facedown[d_1],succ=1,specAct=[],isPrel=fa,deck=allD;if(isPrelCard(cId)){deck=prelD;isPrel=tr;}tTemp="";if(deck[power][cId-idn(cId)].hasOwnProperty("special")){specAct=deck[power][cId-idn(cId)].special;}if(isPrel){preDisc.unshift(cId);armaments.splice(d_1-prepared.length,1);}else {discards.unshift(cId);prepared.splice(d_1,1);}var txt="Using face down card: "+cNam(facedown[d_1],tr);alert(txt);t.value=t.value+bold(txt)+"\n"; if(specAct.length > 0){var returnObj=takeSpecialActions(specAct,succ);succ=returnObj.succ;numdiscarded=returnObj.numdiscarded; if(succ){t.value=t.value+tTemp;}else {alert("Play of "+cNam(cId)+" did not succeed! Please redo your turn from scratch.");}}return 1;}}return 0;}function preDiscDraw(){if(confirm("Are you sure you want to discard your Prelude hand and draw 2?")){anote="Discarding:\n\n";for(i=preHand.length;i>0;i--){anote+=cNam(preHand[0])+"\n";t.value=t.value+bold("Discarding a card from Prelude hand.")+"\n";preDisc.push(preHand[0]);preHand.splice(0,1);}anote+="\nDrawing:\n\n";if(preDeck.length===0){anote+="You have no deck left."}else {for(i=2-preHand.length;i>0;i--){if(preDeck.length > 0){nc=preDeck.shift();preHand.push(nc);anote+=cNam(nc)+"\n";t.value=t.value+bold("Drawing a card from Prelude deck.")+"\n";}}}if(preDeck.length > 0) anote+= "TOP CARD: "+cNam(preDeck[0]);alert(anote);}}function discard(c2,dtype){dtype=dtype||0;if(hand.length===0){alert("You have no cards in hand.");}else {var continue3=tr;var discarded=null;inputError=fa;while (continue3){var pTxt="Please choose ONE card in your hand to discard:\n\n";if(c2==="multidiscard"){pTxt="Please choose ONE OR MORE cards in your hand to discard. Separate each number by a space or comma,eg.: 3 1 5 6\n\n";}var numItems=0;var itemMap={};hand.forEach(function(elt,index){if( isInList(c2,["discrevtypemenu","multidiscard","discard"])||(c2===drt&&dtype===cTyp(elt))||(c2===drt&&dtype==="any") ){numItems+=1;itemMap[numItems]=index+1;pTxt+=numItems+": "+cNam(elt,tr)+"\n";}});if(inputError){pTxt+="\nInput Error,please try again.";inputError=fa;}if(numItems===0){alert("You have no "+dtype+" cards in hand. If this discard was triggered by playing a card,that play is now cancelled.");break;}var prompt3=prompt(pTxt);if(prompt3===null){return 0;}prompt3=prompt3.replace(/^[ ,]+|[ ,]+$/g,"");var inpArr=prompt3.split(/[ ,]+/);var inpArrInt=[];var allGood=tr;inpArr.forEach(function(elt1){var nn=parseInt(elt1,10);if(!inArray(nn,inpArrInt)) inpArrInt.push(nn);});inpArrInt.forEach(function(elt){allGood=allGood&&!(isNaN(elt))&&elt > 0&&!(elt > numItems);});continue3=!allGood;if(inpArrInt.length > 1&&c2 !== "multidiscard"){continue3=tr;}inputError=continue3;}if(inpArr !== null){var alertNote="Discarding from hand:\n\n";inpArrInt.forEach(function(elt){var cId=hand[itemMap[elt] - 1];alertNote+=cNam(cId)+"\n";if(c2===drt||c2==="discrevtypemenu"){var temptext;if(dtype==="any"){temptext="";}else {temptext=cTyp(cId)+" ";}if(c2===drt){tTemp=tTemp+bold("Discarding a "+temptext+"card from hand.")+"\n";}else {t.value=t.value+bold("Discarding a "+temptext+"card from hand.")+"\n";}}else {t.value=t.value+bold("Discarding a card from hand.")+"\n";}discards.push(cId);});inpArrInt.sort(function(a,b){return b - a;});inpArrInt.forEach(function(elt){hand.splice(itemMap[elt] - 1,1);});alert(alertNote);return 1;}}return 0;}function draw(c2){var handsize=7;status.forEach(function(elt){if(title(elt)==="Industrial Giant"+vn){handsize=8;}});if(drawDeck.length===0){alert("Your draw deck is empty.");}else if(c2 !== "draw1"&&hand.length >= handsize){alert("Your hand is full.");}else {var continue7=tr;var numDraw=null;if(c2==="draw1") numDraw=1;while (continue7&&c2 !== "draw1"){var pTxt="How many cards would you like to draw? (1-"+Math.min(handsize - hand.length,drawDeck.length)+")";var p7=prompt(pTxt,Math.min(handsize - hand.length,drawDeck.length));if(p7===null||p7==="0"){break;}numDraw=parseInt(p7,10);continue7=isNaN(numDraw)||!(numDraw > 0)||numDraw > Math.min(handsize - hand.length,drawDeck.length);}if(numDraw !== null){for(var i=0;!(i >= numDraw);i++){hand.push(drawDeck.shift());}var alertText="Drew the following cards to hand:\n\n";for(var i=1;!(i > numDraw);i++){alertText+=cNam(hand[hand.length - i])+"\n";}alertText+="You now have "+hand.length+" cards in hand.";alert(alertText);t.value=t.value+bold("Drawing "+numDraw+" cards to hand")+" (now "+hand.length+" cards in hand).\n";return 1;}}return 0;}function discardtop(deck){deck=deck||"";drawd=drawDeck;exp=allD;disc=discards;deckn="";if(isInList(deck,["Prelude","prediscx"])){deckn="Prelude";drawd=preDeck;exp=prelD;disc=preDisc;}if(drawd.length===0){alert("Your draw deck is empty.");}else {val=fa;if(deck==="prediscx"){while (!val){var max=Math.min(3,preDeck.length);var pTxt="How many cards do you want to discard from the top of the Prelude deck?";var num=prompt(pTxt,max);if(isNumber(num)&&num < max+1&&num > 0) val=tr;if(num===null||num==="0"){break;}}if(num !== null){var note="You discard:\n\n";for(var i=0;i < num;i++){note+=cNam(drawd[0])+"\n";disc.push(drawd.shift());}t.value=t.value+bold("Discarding "+num+" card(s) from the top of my Prelude draw deck.\n");alert(note);return 1;}}else {if(confirm("Are you sure you want to discard the top card of your "+deckn+" draw deck?")){alert("You discard "+cNam(drawd[0])+" from your draw deck.");disc.push(drawd.shift());t.value=t.value+bold("Discarding 1 card from the top of my "+deckn+" draw deck.\n");return 1;}}}return 0;}function reallocate(){var draft=[BA,BN,LB,SB];if(totalWar){draft.push(AP);}var draftDiscards=4;if(totalWar){draftDiscards=3;}var pTxt="If this is part of your Reallocate step,remember to discard "+draftDiscards+" cards from your hand first.\n\nWhich card would you like to draft (1-"+draft.length+")?";for(var i=0;!(i >= draft.length);i++){pTxt+="\n"+(i+1)+": "+draft[i];}var continue8=tr;var builtUnit=null;while (continue8){var p8=prompt(pTxt);if(p8===null){break;}builtUnit=parseInt(p8,10);continue8=isNaN(builtUnit)||!(builtUnit > 0)||builtUnit > draft.length;}if(builtUnit !== null){var j=0;var foundCard=fa;for(var j=0;!(j >= drawDeck.length)&&!foundCard;j++){if(cNam(drawDeck[j])===draft[builtUnit - 1]){hand.push(drawDeck[j]);drawDeck.splice(j,1);var note="Reallocate Resources: drawing a "+draft[builtUnit - 1]+" card.";alert(note);t.value=t.value+bold(note)+"\n";foundCard=tr;}}if(!foundCard){alert("You have no "+draft[builtUnit - 1]+" cards in your draw deck.");}shuffleDeck();return 1;}return 0;}function private(){var report=expused+"\nScript "+version+"\n"+size(bold(pName),12)+":\n";if(prelude){report+=bold("\nPrelude Draw Deck: ")+preDeck.length;if(preDeck.length > 0){report+=bold("\nTop card of Prelude Deck:\n")+cNam(preDeck[0]);}report+=bold("\nPrelude Hand: ")+preHand.length+"\n";preHand.forEach(function(elt){report+=cNam(elt)+"\n";});report+=bold("Prelude Discards: ")+preDisc.length+"\n";preDisc.forEach(function(elt){report+=cNam(elt)+"\n";});}report+=bold("\nDraw Deck: ")+drawDeck.length+"\n"+bold("Hand: ")+hand.length+"\n";hand.forEach(function(elt){report+=cNam(elt,tr)+"\n";});report+=bold("Responses: ")+prepared.length+"\n";prepared.forEach(function(elt,tr){report+=cNam(elt,tr)+"\n";});if(prelude){report+=bold("Armaments: ")+armaments.length+"\n";armaments.forEach(function(elt){report+=cNam(elt,tr)+"\n";});}report+=bold("Discards: ")+discards.length+"\n";discards.forEach(function(elt){report+=cNam(elt)+"\n";});report+=bold("Statuses: ")+status.length+"\n";status.forEach(function(elt){report+=title(elt)+stepStr(elt)+"\n";});if(prelude){report+=bold("History: ")+history.length+"\n";history.forEach(function(elt){report+=title(elt)+"\n";});}t.value=t.value.replace(re,"")+spoiler(report)+size(invisible("New seed: "+generateSeed()),0);var qre=new RegExp('\\[q=".+"\\][\\s\\S]*\\[/q\\]',"g");t.value=t.value.replace(qre,"");inProgress=fa;}function public(){var report=size(bold(pName),12)+":";if(prelude&&preluding){report+="\nPrelude Draw Deck: "+preDeck.length+"\nPrelude Hand: "+preHand.length+"\nPrelude Discards: "+preDisc.length+" [face up: ";if(preDisc.length===0){report+="none]\n";}else {report+=cNam(preDisc[0])+"]\n";}}report+="\nDraw Deck: "+drawDeck.length+"\nHand: "+hand.length+"\nResponses: "+prepared.length;if(prelude){report+="\nArmaments: "+armaments.length}report+="\nDiscards: "+discards.length+" [face up: ";if(discards.length===0){report+="none]\n";}else {report+=title(discards[0])+"]\n";}var stattxt="Statuses:";if(prelude) stattxt="Status/History:";if(status.length+history.length===0){report+=stattxt+" none\n";}else {report+=bold(stattxt)+"\n";status.forEach(function(elt){if(prelude){report+=cNam(elt)+"\n";}else {report+=title(elt)+"\n";}});}if(prelude){if(history.length > 0){history.forEach(function(elt){report+=cNam(elt)+"\n";});}}t.value=t.value+size(invisible(version+runs+expused.replace(/\n/g,",")+"\n"),1);t.value=t.value.replace(re,"")+report+size(invisible("New seed: "+generateSeed()),0);var qre=new RegExp('\\[q=".+"\\][\\s\\S]*\\[/q\\]',"g");t.value=t.value.replace(qre,"");inProgress=fa;try {let evt=new Event('input',{bubbles: true,cancelable: true,});t.dispatchEvent(evt);}catch(err){}}function discrandresp(){if(prepared.length===0){alert("You have no face down cards.");}else {rando=Math.floor(Math.random() * prepared.length);alert("Randomly discarding from face down cards:\n\n"+cNam(prepared[rando])+".");t.value=t.value+bold("Randomly discarding a prepared Response.")+"\n";discards.push(prepared[rando]);prepared.splice(rando,1);return 1;}return 0;}function randdisctop(){if(discards.length===0){alert("You have no discards.");}else {rando=Math.floor(Math.random() * discards.length);alert("Placing random discard "+"o"+"n"+" top of draw deck:\n\n"+cNam(discards[rando])+".");t.value=t.value+bold("Placing random discard "+"o"+"n"+" top of draw deck.")+"\n";drawDeck.unshift(discards[rando]);discards.splice(rando,1);return 1;}return 0;}function randHand(){return hand[Math.floor(Math.random() * hand.length)];}function dcRandTwo(){if(hand.length===0){alert("You have no hand.");}else {card1=randHand();rcards=cNam(card1);if(hand.length > 1){card2=card1;while (card2===card1){card2=randHand();}rcards+="\n"+cNam(card2);}t.value=t.value+spoiler("Double-cross cards:\n\n"+rcards)+"\n";alert("These cards have been randomly picked from your hand:\n\n"+rcards+"\n\nMessage the names of these cards to the UK player.");return 1;}return 0;}function bottomdrawx(c2){var n=0,note="Drawn:\n\n";while(1===bottomtop("bottom")) n+=1;if(c2==="bottomdrawx"){for(i=0;i < n;i++){var crd=drawDeck.shift();note+=cNam(crd)+"\n";hand.push(crd);}alert(note);t.value=t.value+bold("Bottomed and drawn "+n+" regular cards.");}else {alert("Remember to draw back up to 7 after discarding for playing the Armament!");}return 1;}function bottomtop(c2){if(hand.length===0){alert("Your hand is empty.");}else {var conti=tr;var plcard=null;while (conti){var pTxt="Please choose a card in your hand to bottom (1-"+hand.length+"):\n\n";hand.forEach(function(elt,index){pTxt+=index+1+": "+cNam(elt,tr)+"\n";});var prompt1=prompt(pTxt);if(prompt1===null){break;}plcard=parseInt(prompt1,10);conti=isNaN(plcard)||!(plcard > 0)||plcard > hand.length;}if(plcard !== null){var word=c2+" ";if(confirm("Please confirm you wish to move "+cNam(hand[plcard - 1])+" from your hand to the "+word+"of the draw deck:\n\n"+cNam(hand[plcard - 1]))){t.value=t.value+bold("Moving a card from hand to the "+word+"of the draw deck.")+"\n";if(c2==="bottom"){drawDeck.push(hand[plcard - 1]);}else {drawDeck.unshift(hand[plcard - 1]);}hand.splice(plcard - 1,1);return 1;}}}return 0;}function discstat(c2){var list=status,disc=discards,deck=allD;if(isInList(c2,["discresp","discrespha"])) list=prepared;if(c2==="discrespha"){alert("You will be asked to discard a Response from your hand. Cancel/ESC to continue and discard a face-down Response instead.");if(discard(drt,RE)) return 1;}if(c2==="dischist"){list=history;disc=preDisc;}if(list.length===0){alert("You have no appropriate card.");}else {var continue9=tr;var dscStat=null;while (continue9){var pTxt="Please choose a card to discard (1-"+list.length+"):\n\n";list.forEach(function(elt,index){pTxt+=index+1+": "+title(elt)+"\n";});var p9=prompt(pTxt);if(p9===null){break;}dscStat=parseInt(p9,10);continue9=isNaN(dscStat)||!(dscStat > 0)||dscStat > list.length;}if(dscStat !== null){var note="Discarding";if(isInList(c2,["discresp","discrespha"])){note+=" face down card.";}else {note+=": "+cNam(list[dscStat - 1]);}actions+=note;alert("Discarding "+cNam(list[dscStat - 1]));t.value=t.value+bold(note)+"\n";if(isInList(c2,["discresp","discrespha"])){disc.push(prepared[dscStat - 1]);}else if(c2==="dischist"){disc.unshift(history[dscStat - 1]);}else {disc.unshift(status[dscStat - 1]);}list.splice(dscStat - 1,1);return 1;}}return 0;}function pickdisc(c2){var discardt=discards,decks=allD;handt=hand;if(c2==="preplaydisc"){discardt=preDisc;decks=prelD;handt=preHand;}if(discardt.length===0){alert("You have no discards.");}else {var conti=tr;var plcard=null;var tooManyCards=fa;if(discardt.length > 20) tooManyCards=tr;var showOffset=0;while (conti){var actionWord="draw";if(isInList(c2,["playdisc","preplaydisc"])){actionWord="play";}else if(isInList(c2,["movetotop","movetobottom"])){actionWord="move";}var pTxt="Please choose a card in your discards to "+actionWord+" (1-"+discardt.length+"):\n\n";var pShown=fa;var nShown=fa;if(tooManyCards&&(showOffset > 0)){pTxt+="p: PREVIOUS 20 CARDS\n";pShown=tr;}var endDiscards=Math.min(showOffset+20,discardt.length);var tempDiscards=discardt.slice(showOffset,endDiscards);tempDiscards.forEach(function(elt,index){var name="";if(c2==="playdisc"){name=cardNameEll(elt);}else {name=cNam(elt);}pTxt+=index+1+showOffset+": "+name+"\n";});if(tooManyCards&&(discardt.length > showOffset+20)){pTxt+="n: NEXT 20 CARDS\n";nShown=tr;}var prompt1=prompt(pTxt);if(prompt1===null){break;}if(nShown&&prompt1==="n"){showOffset+=20;}else if(pShown&&prompt1==="p"){showOffset -= 20;}else  if(prompt1 != "n"&&prompt1 != "p"){plcard=parseInt(prompt1,10);conti=isNaN(plcard)||!(plcard > 0)||plcard > discardt.length;}}if(plcard !== null){var cId=discardt[plcard - 1];var succ=1;tTemp=""; var specAct=[];if(decks[power][cId-idn(cId)].hasOwnProperty("special")){specAct=decks[power][cId-idn(cId)].special;}if(c2==="pickdisc"){alert("Drawing "+cNam(cId));t.value=t.value+bold("Drawing a chosen card from the discards\n");hand.push(cId);}else if(c2==="playdisc"){alert("Playing "+cNam(cId,tr));if(cTyp(cId)===RE){t.value=t.value+bold("Playing a card face down from discards.")+"\n";prepared.push(cId);}else if(cTyp(cId)===ST){t.value=t.value+bold("Playing "+cNam(cId)+" from discards.")+"\n";status.push(cId);}else if(specAct.length > 0 ){tTemp=tTemp+bold("Playing "+cNam(cId)+" from discards."+stepStr(cId))+"\n";discardt.push(cId);}else {t.value=t.value+bold("Playing "+cNam(cId)+" from discards."+stepStr(cId))+"\n";discardt.unshift(cId);}}else if(c2==="movetotop"){alert("Moving "+cNam(cId)+" to top of deck.");t.value=t.value+bold("Moving from discards to top of deck: "+cNam(cId))+"\n";drawDeck.unshift(cId);}else if(c2==="movetobottom"){alert("Moving "+cNam(cId)+" to bottom of deck.");t.value=t.value+bold("Moving from discards to bottom of deck: "+cNam(cId))+"\n";drawDeck.push(cId);}else if(c2 == "preplaydisc"){alert("Playing "+cNam(cId)+" face down.");t.value=t.value+bold("Playing Armament card from Prelude discards face down.") +"\n";armaments.push(cId);}discardt.splice(plcard - 1,1); if(specAct.length > 0&&(isInList(c2,["playdisc","preplaydisc"]))){var returnObj=takeSpecialActions(specAct,succ);succ=returnObj.succ;numdiscarded=returnObj.numdiscarded; if(succ){t.value=t.value+tTemp;}else {tempcard=discardt.shift();discardt.splice(plcard - 1,0,tempcard);for(var i=0;i < numdiscarded;i ++){handt.push(discardt.pop());}alert("Play of "+cNam(cId)+" did not succeed! Please redo your turn from the start.");}}return 1;}}return 0;}function pickdraw(c2,dtype){dtype=dtype||0;var handt=hand,decks=allD,discardst=discards,drawt=drawDeck;if(isInList(c2,["preplaydraw"])){handt=preHand;decks=prelD;discardst=preDisc;drawt=preDeck;}var actionWordArray={pickdraw: "draw",playdraw: "play",preplaydraw: "play",prestt10: "play",preparingForWarStart: "prepare face down",researchStart: "draw",drawfromtop4: "draw",constremove: "remove",constadd: "add",};var actionWord2Array={pickdraw: "Drawing ",playdraw: "Playing ", preplaydraw: "Playing ",prestt10: "Playing ",preparingForWarStart: "Preparing (face down) ",researchStart: "Drawing ",drawfromtop4: "Drawing ",constremove: "Removing ",constadd: "Adding ",};if(drawDeck.length===0){alert("You have no draw deck.");}else {var sortedDeck=[];var numdeck=0;if(c2==="researchStart"&&researchTile){discres=discard("discard");if(discres !== 1){return 0;}numdeck=10;}else if(c2==="drawfromtop4"){numdeck=5;}else {var numtext="";if(c2==="constadd"){numdeck=unused.length;}else if(c2==="preplaydraw"){numdeck=preDeck.length;}else if(c2==="prestt10"){numdeck=Math.min(drawDeck.length,10);numtext=" top "+numdeck;}else {numdeck=drawDeck.length;}}for(var i=0;i < numdeck;i++){if(preparingForWarTile&&c2==="preparingForWarStart"){if( cTyp(drawDeck[i])===ST||cTyp(drawDeck[i])===RE ){sortedDeck.push({nind:origToSortedMap[drawDeck[i]-1],ind:i});}}else if(c2==="preplaydraw"){if( cTyp(preDeck[i])===AR ){sortedDeck.push({nind:origToSortedPreMap[preDeck[i]-1],ind:i});}}else if(c2==="prestt10"||dtype===ST){if( cTyp(drawDeck[i])===ST ){sortedDeck.push({nind:origToSortedMap[drawDeck[i]-1],ind:i});}}else if(dtype==="BB"){if( isInList(cTyp(drawDeck[i]),[BA,BN,LB,SB])){sortedDeck.push({nind:origToSortedMap[drawDeck[i]-1],ind:i});}}else {if(c2==="constremove"){sortedDeck.push({nind:origToSortedMap[drawDeck[i]-1],ind: drawDeck[i]});}else {sortedDeck.push({nind:origToSortedMap[drawDeck[i]-1],ind:i});}}}sortedDeck.sort(compareNind);var conti=tr;var drawnCard=null;var tooManyCards=fa;var numshow=20;if(sortedDeck.length > numshow){tooManyCards=tr;}var showOffset=0;while (conti){var actionWord=actionWordArray[c2];var pTxt="";if(preparingForWarTile&&c2==="preparingForWarStart"){pTxt+="Preparing for War!:\n";}var decktext="draw deck";if(c2==="constadd"){decktext="unused cards";}var howmany="a card";var example=":";if(c2==="constremove"){howmany="ONE OR MORE cards";example=". Separate each number by a space or comma,eg.: 3 1 5 6";}pTxt+="Please choose "+howmany+" in your sorted "+decktext+numtext+" to "+actionWord+" (1-"+sortedDeck.length+")"+example+"\n\n";if(c2==="researchStart"&&researchTile){var pTxt="Research Promo Tile:\nPlease choose from the top 10 cards of your draw deck to "+actionWord+" (1-"+sortedDeck.length+"):\n\n";}if(c2==="drawfromtop4"){var promptText="Please choose from the top 5 cards of your draw deck to "+actionWord+" (1-"+sortedDeck.length+"):\n\n";}var pShown=fa;var nShown=fa;if(tooManyCards&&(showOffset > 0)){pTxt+="p: PREVIOUS "+numshow+" CARDS\n";pShown=tr;}var endDeck=Math.min(showOffset+numshow,sortedDeck.length),tempDeck=sortedDeck.slice(showOffset,endDeck),sourceDeck=drawDeck;if(c2==="constadd") sourceDeck=unused;if(c2==="preplaydraw") sourceDeck=preDeck;var allChoices=[];sortedDeck.forEach(function(elt,index){if(c2==="preplaydraw"){allChoices.push(origToSortedPreMap[elt.ind-1]+1);}else {allChoices.push(origToSortedMap[elt.ind-1]+1);}});tempDeck.forEach(function(elt,index){var name="";if(isInList(c2,["playdraw","prestt10"])){name=cardNameEll(sourceDeck[elt.ind]);}else if(c2==="constremove"){name=cNam(elt.ind);}else {name=cNam(sourceDeck[elt.ind]);}if(c2==="constremove"){var m=origToSortedMap[elt.ind-1]+1;pTxt+=m+": "+name+"\n";}else {pTxt+=index+1+showOffset+": "+name+"\n";}});if(tooManyCards&&(sortedDeck.length > showOffset+numshow)){pTxt+="n: NEXT "+numshow+" CARDS\n";nShown=tr;}var p8=prompt(pTxt);if(p8===null){break;}if(nShown&&p8==="n"){showOffset+=numshow;}else if(pShown&&p8==="p"){showOffset -= numshow;}else if(p8 != "n"&&p8 != "p"){if(c2==="constremove"){p8=p8.replace(/^[ ,]+|[ ,]+$/g,"");var inpArr=p8.split(/[ ,]+/);var inpArrInt=[];var inchoices=tr;conti=fa;inpArr.forEach(function(elt1){var nn=parseInt(elt1,10);if(!inArray(nn,inpArrInt)) inpArrInt.push(nn);});inpArrInt.forEach(function(elt){if(!inArray(elt,allChoices)) inchoices=fa;});conti=!inchoices;drawnCard=inpArr[0];}else {drawnCard=parseInt(p8,10);conti=isNaN(drawnCard)||!(drawnCard > 0)||drawnCard > sortedDeck.length;}}}if(drawnCard !== null){if(c2==="constremove"){var alertNote="Removing from deck:\n\n";inpArrInt.forEach(function(elti){cId=refSortedDeck[elti - 1].oind+1;alertNote+=cNam(cId)+"\n";unused.push(cId);var cardPos=-1;drawDeck.forEach(function(elt,index){if(elt===cId){cardPos=index;}});drawDeck.splice(cardPos,1);});alert(alertNote);}else {var tind=sortedDeck[drawnCard - 1].ind;var cId=drawDeck[tind];if(c2==="constadd"){cId=unused[tind];}else if(c2==="preplaydraw"){cId=preDeck[tind];}var succ=1;tTemp="";if(c2==="constadd"){alert("Adding "+cNam(cId)+" back into the deck.");}else {alert(actionWord2Array[c2]+cNam(cId)+" from the draw deck.");}var specAct=[];if(decks[power][cId-idn(cId)].hasOwnProperty("special")){specAct=decks[power][cId-idn(cId)].special;}if(isInList(c2,["playdraw","prestt10"])){if(cTyp(cId)===ST){t.value=t.value+bold("Playing "+cNam(cId)+" from the draw deck.")+"\n";status.push(cId);}else if(cTyp(cId)===RE){t.value=t.value+bold("Playing a card face down.")+"\n";prepared.push(cId);}else if(choice===BoDn&&cTyp(cId)===BO){t.value=t.value+bold("Playing a Bolster card face down.")+"\n";prepared.push(cId);}else if(specAct.length > 0 ){tTemp=tTemp+bold("Playing "+cNam(cId)+" from the draw deck."+stepStr(cId))+"\n";discardst.push(cId);}else {t.value=t.value+bold("Playing "+cNam(cId)+" from the draw deck."+stepStr(cId))+"\n";discardst.push(cId);}}else if(c2==="researchStart"){t.value=t.value+bold("Research: Drawing a chosen card from top 10 of draw deck.")+"\n";handt.push(cId);}else if(c2==="drawfromtop4"){t.value=t.value+bold("Drawing a chosen card from top 5 of draw deck.")+"\r\n";hand.push(cardId);}else if(c2==="preparingForWarStart"){t.value=t.value+bold("Prepare For War!: Placing Status or Response face down.")+"\n";prepared.push(cId);}else if(c2==="constadd"){drawDeck.push(cId);}else if(c2==="preplaydraw"){t.value=t.value+bold("Playing an Armament card face down.")+"\n";armaments.push(cId);}else {t.value=t.value+bold("Drawing a chosen card from the draw deck.")+"\n";handt.push(cId);}if(c2==="constadd"){unused.splice(tind,1);}else if(c2==="preplaydraw"){preDeck.splice(tind,1);}else {drawDeck.splice(tind,1);}if(specAct.length > 0&&c2==="playdraw"){var returnObj=takeSpecialActions(specAct,succ);succ=returnObj.succ;numdiscarded=returnObj.numdiscarded; if(succ){t.value=t.value+tTemp;}else {drawt.splice(sortedDeck[drawnCard - 1].ind,0,discardst.shift());for(var i=0;i < numdiscarded;i ++){handt.push(discardst.pop());}alert("Play of "+cNam(cId)+" did not succeed! Please redo your turn from the start.");}}}if(!isInList(c2,["constremove","constadd","drawfromtop4"])||c2==="prestt10"){shuffleDeck();}if(c2==="preplaydraw") shuffleDeck(preDeck);return 1;}}return 0;}function revealPrepareForWar(){if(prepared.length===0){alert("You have no face down cards.");}else {for(var i=0;i < prepared.length;i++){if(cTyp(prepared[i])===ST){cId=prepared[i];status.push(cId);prepared.splice(i,1);alert("Revealing "+cNam(cId));t.value=t.value+bold("Revealing "+cNam(cId))+"\n";break;}}}}function reorder(topn){if(drawDeck.length===0){alert("Your draw deck is empty.");}else {var continue7=tr;var numDraw=topn;if(drawDeck.length < topn){numDraw=drawDeck.length;}while (continue7){var pTxt="These are the top "+topn+" cards of the draw deck. Choose a card to move to the top of the draw deck,or choose DONE to continue:\n\n";for(var i=0;i < numDraw;i++){pTxt+=i+1+": "+cNam(drawDeck[i])+"\n";}pTxt+="\n"+(topn+1)+": DONE\n";var p7=prompt(pTxt);if(p7===null){break;}p7=parseInt(p7,10);if(p7===(topn+1)){continue7=fa;}if(p7 > 0&&p7 < numDraw+1){moveCard=drawDeck[p7 - 1];drawDeck.splice(p7 - 1,1);drawDeck.unshift(moveCard);}}var alertText="Current top "+topn+" draw deck order:\n\n";for(var i=0;i != numDraw;i++){alertText+=cNam(drawDeck[i])+"\n";}alertText+="\nThe top "+topn+" cards of the draw deck have been reordered.";alert(alertText);t.value=t.value+bold("The top "+topn+" cards of the draw deck have been reordered.")+"\n";return 1;}return 0;}function printCards(){var report="Full "+power+" card list:\n\n";refSortedDeck.forEach(function(elt){report+=(elt.nind+1)+". "+elt.text+"\n";});t.value=t.value+report;constructing=fa;skipInProgress=tr;}function printDeck(){var report="";var removedCards=[];unused.forEach(function(elt){removedCards.push(origToSortedMap[elt-1]+1);});removedCards.sort(compare);report+=bold("Removed:")+" "+removedCards+"\n\n"+bold("Deck ready: ")+deckReady+"\n\n"+bold("Removed Cards:")+"\n";removedCards.forEach(function(elt){report+=elt+". "+refSortedDeck[elt - 1].text+"\n";});sortedDeck=[];for(var i=0;i < drawDeck.length;i++){sortedDeck.push({text:cNam(drawDeck[i]),ind:i,nind:origToSortedMap[drawDeck[i]-1]});}sortedDeck.sort(compareNind);report+=bold("\nConstructed Deck:")+"\n";sortedDeck.forEach(function (elt){report+=(elt.nind+1)+". "+elt.text+"\n";});t.value=t.value+spoiler(report);constructing=fa;skipInProgress=tr;}function constructLoop(){constructing=tr;while (constructing){var validInput=fa;while (!validInput){deckReady=fa; var numAir=0;var numNonAir=0;drawDeck.forEach(function (elt){if(cTyp(elt)===AP||cTyp(elt)===BO){numAir+=1;}else {numNonAir+=1;}});if(totalWar){airRemain=(numAir - constructedDeckSizeAir[power]);}else {airRemain=0;}nonAirRemain=(numNonAir - constructedDeckSizeNonAir[power]);if(nonAirRemain===0&&airRemain===0){var pTxt="DECK READY!\n\n";deckReady=tr;}else {var pTxt="Deck is not yet ready. Please remove/add cards until the discards remaining is 0:\n\n";}var menu=[ ["Remove card(s) form your deck.","constremove"],["Add card(s) back into your deck.","constadd"],["Print full numbered list of ALL cards and EXIT.","printcards"],["Print your current contructed deck and EXIT. (Cancel/ESC)","printdeck"],];if(deckReady){menu.push(["Continue to initial hand draw.","continue"]);}var builtMenu=[];var menuMap={};var currItemNum=1; menu.forEach(function(elt,index){if(elt[1]==="note"){builtMenu.push(elt[0]);}else if( (elt.length > 2&&(RegExp(power).test(elt[2])))||elt.length===2 ){builtMenu.push(currItemNum+": "+elt[0]);menuMap[currItemNum]=elt[1];currItemNum+=1;}});pTxt+=builtMenu.join("\n"); pTxt+="\n\nDiscards remaining:";if(totalWar){pTxt+="\n\nAir Power/Bolster cards: "+airRemain+"\nOther cards: "+nonAirRemain;}else {pTxt+=" "+nonAirRemain;}var choice=0;var maxChoice=currItemNum - 1;var prompt0=prompt(pTxt);if(prompt0===null){choice="printdeck";skipInProgress=tr;skipPrelude=tr;constructing=fa;validInput=tr;}else {var inputnum=parseInt(prompt0,10);if(inputnum > 0&&inputnum < maxChoice+1){choice=menuMap[prompt0];validInput=tr;}}}switch (choice){case "constremove": case "constadd": preluding=fa;pickdraw(choice);break;case "printcards": preluding=fa;printCards();break;case "printdeck": preluding=fa;printDeck();break;case "continue": if(deckReady){t.value=t.value+bold("Deck construction completed.")+"\n";}else {t.value=t.value+bold("Deck construction not properly completed!")+"\n";}constructing=fa;break;default: alert("ERROR: MISSING ACTION CHOICE: "+choice);}}}function menuRun(menu){menu_choices=[];menu.push(["Private card report & exit.","private"],["Public card report & exit (Cancel/ESC).","public"]);var builtMenu=[],menuMap={},currItemNum=1;menu.forEach(function(elt){if(elt[1]==="private"){builtMenu.push(( "A: " )+elt[0]);menu_choices.push("a","A");menuMap["a"]=elt[1];menuMap["A"]=elt[1];}else if(elt[1]==="public"){builtMenu.push(( "B: " )+elt[0]);menu_choices.push("b","B");menuMap["b"]=elt[1];menuMap["B"]=elt[1];}else if( (elt.length > 2&&(RegExp(power).test(elt[2])))||elt.length===2 ){builtMenu.push(currItemNum+": "+elt[0]);menu_choices.push(String(currItemNum));menuMap[String(currItemNum)]=elt[1];currItemNum+=1;}});return {ptxt:builtMenu.join("\n"),mc:menu_choices,map:menuMap};} function preludeLoop(){cont=tr;if(!oldseedpr){t.value+=invisible(size("Old Seed: "+generateSeed(),0))+"\n";oldseedpr=tr;}while (cont&&preluding){var validInput=fa;while (!validInput){var menu=[ ["Play Prelude card from hand or top of deck.","preplay"],["Discard entire hand and draw 2 Prelude cards. ("+preDeck.length+" left )","prediscdraw"],["View regular hand.","viewhand"],["Discard from top of Prelude deck.","prediscardtop"],["Discard from top of REGULAR deck.","discardtop"],["End Prelude.","continue"] ] ;if(power==="UK"){menu.push(["(Tizard Mission) Play Armament card from discards.","preplaydisc"]);}var res=menuRun(menu);var pTxt=res.ptxt,menu_choices=res.mc,menuMap=res.map,choice=0;var prompt0=prompt(pTxt);if(prompt0===null){choice="public";validInput=tr;}else {menu_choices.forEach(function(elt){if(prompt0===elt){choice=menuMap[prompt0];validInput=tr;}});}}switch (choice){case "preplaydisc": pickdisc(choice);break;case "preplay": play("prelude");break;case "prediscdraw": preDiscDraw();break;case "viewhand": viewHand();break;case "prediscardtop": discardtop("Prelude");break;case "discardtop": discardtop();break;case "private": private();skipInProgress=tr;cont=fa;break;case "public": public();skipInProgress=tr;cont=fa;break;case "continue": var txt="Completed Prelude.";alert(txt);t.value=t.value+bold(txt)+"\n";preluding=fa;cont=fa;break;default: alert("ERROR: Prelude action choice: "+choice);}}}function bold(str){return "[b"+"]"+str+"[/"+"b]";}function spoiler(str){return "[o"+"]"+str+"[/"+"o]";}function size(str,pt){return "[size="+pt+"]"+str+"[/"+"size]";}function invisible(str){return "[color="+"#FFFFFF]"+str+"[/"+"color]";}function idn(id){if(isPrelCard(id)){return 101;}else {return 1;}}function cTyp(id){var deck=allD;if(isPrelCard(id)) deck=prelD;return deck[power][id-idn(id)].type;}function title(id){var deck=allD;if(isPrelCard(id)) deck=prelD;return deck[power][id-idn(id)].title;}function stepStr(id){var deck=allD;if(isPrelCard(id)) deck=prelD;var stp="";if(deck[power][id-idn(id)].hasOwnProperty("step")){stp=" ("+deck[power][id-idn(id)].step+" step)";}return stp;}function cNam(id,stp){var deck=allD;if(isPrelCard(id)) deck=prelD;var stp=stp||fa,type=cTyp(id),answer=type;if(isInList(type,[EV,EW,ST,RE,BO,AR,HI])){answer+=": "+deck[power][id-idn(id)].title;}if(stp) answer+=stepStr(id);return answer;}function cardNameEll(id){var deck=allD;if(isPrelCard(id)) deck=prelD;var ell="",stp=tr;if(deck[power][id-idn(id)].hasOwnProperty("special")){ell=" ...";}return cNam(id,tr)+ell;}function generateSeed(){variables=[preluding,runs,powArray.indexOf(power),constructedDeck,totalWar,prelude,researchTile,preparingForWarTile,treaty_variant,qmg11_variant];return window.btoa(drawDeck.concat(["|"]).concat(hand).concat(["|"]).concat(prepared).concat(["|"]).concat(status).concat(["|"]).concat(history).concat(["|"]).concat(discards).concat(["|"]).concat(unused).concat(["|"]).concat(armaments).concat(["|"]).concat(preHand).concat(["|"]).concat(preDeck).concat(["|"]).concat(preDisc).concat(["|"]).concat(variables).concat(["|"]).concat(password).concat(["|"]).concat(myUsername).toString());}function shuffleDeck(deck){deck=deck||drawDeck;for(var i=deck.length;i > 0;i--){var rando=Math.floor(Math.random() * i);var removed=deck.splice(rando,1)[0];deck.push(removed);}}function compare(a,b){if(a===b){return 0;}if(a > b){return 1;}return -1;}function inArray(item,arr){for(var i=0;i < arr.length;i++){if(item===arr[i]) return tr;}return fa;}var expused=exp_used_list(); var startingSetup=fa;if(seed===""){validInput=false;while (!validInput){var prompt00=prompt("Please choose a power by typing in one of the following:\nDE  UK  JA  SU  IT  US");if(prompt00===null){return 0;}else if(powArray.includes(prompt00)){power=prompt00;validInput=true;}}pName=getPName(power); deckSize=allD[power].length;preDeckSize=prelD[power].length; var refSortedDeck=[];var refSortedPreDeck=[];function refSortDeck(ref,deck){for(var i=0;i < deck[power].length;i++){ref.push({text:cNam(i+1),oind:i});}ref.sort(compareTitle);}refSortDeck(refSortedDeck,allD);refSortDeck(refSortedPreDeck,prelD); var origToSortedMap=[];var origToSortedPreMap=[];function origToSorted(map,size){for(var i=0;i < size;i++){map[i]=-1;}}origToSorted(origToSortedMap,deckSize);origToSorted(origToSortedPreMap,preDeckSize); function addNind(ref,map){for(var i=0;i < ref.length;i++){ref[i].nind=i;map[refSortedDeck[i].oind]=i;}ref.sort(compareTitleNind);}addNind(refSortedDeck,origToSortedMap);addNind(refSortedPreDeck,origToSortedPreMap); if(confirm("You've chosen "+pName+" !\n\nPress OK to begin start-of-game setup for "+pName+". To enter a seed manually,press Cancel.\n\nOptions used:"+expused)){startingSetup=tr;var cards=[];var pre_cards=[];for(var i=1;i < (deckSize+1);i++){cards.push(refSortedDeck[i-1].oind+1);}if(prelude){for(var i=101;i < (preDeckSize+101);i++){pre_cards.push(i);}}var w="|";cards.push(w,w,w,w,w,w,w,w,w);cards.push.apply(cards,pre_cards);cards.push(w,w);cards.push(preluding,runs,powArray.indexOf(power),constructedDeck,totalWar,prelude,researchTile,preparingForWarTile,treaty_variant,qmg11_variant,w,password,w,myUsername);seed=window.btoa(cards.toString());}else {seed=prompt("Enter your seed.");}}spl=window.atob(seed).split("|");drawDeck=jsonp(spl,0);hand=jsonp(spl,1);prepared=jsonp(spl,2);status=jsonp(spl,3);history=jsonp(spl,4);discards=jsonp(spl,5);unused=jsonp(spl,6);armaments=jsonp(spl,7);preHand=jsonp(spl,8);preDeck=jsonp(spl,9);preDisc=jsonp(spl,10);variables=jsonp(spl,11);preluding=variables[0];runs=variables[1]+1;power=powArray[variables[2]];constructedDeck=variables[3];totalWar=variables[4];prelude=variables[5];researchTile=variables[6];preparingForWarTile=variables[7];treaty_variant=variables[8];qmg11_variant=variables[9]; deckSize=allD[power].length;preDeckSize=prelD[power].length; var refSortedDeck=[];var refSortedPreDeck=[];refSortDeck(refSortedDeck,allD);refSortDeck(refSortedPreDeck,prelD); var origToSortedMap=[];var origToSortedPreMap=[]; origToSorted(origToSortedMap,deckSize);origToSorted(origToSortedPreMap,preDeckSize); addNind(refSortedDeck,origToSortedMap);addNind(refSortedPreDeck,origToSortedPreMap); pName=getPName(power);var pwCandidate=spl[12].replace(/(^,)|(,$)/g,"");if(password !== pwCandidate){alert("Error: incorrect password.");return 0;}var userfromseed=spl[13].replace(/(^,)|(,$)/g,"");if(userfromseed !== myUsername){alert("Error: incorrect seed[1].");return 0;}var totalCards=drawDeck.length+hand.length+prepared.length+status.length+discards.length+unused.length;var totalPreCards=preDeck.length+preHand.length+armaments.length+history.length+preDisc.length;if(totalCards !== deckSize||totalPreCards !== preDeckSize){alert("Error: Invalid Seed "+totalCards+" "+deckSize+" "+totalPreCards+" "+preDeckSize+" | "+preDeck.length+" "+preHand.length+" "+armaments.length+" "+history.length+" "+preDisc.length);return 0;}var skipInProgress=fa;var skipPrelude=fa;var removed=[];if(startingSetup){if(constructedDeck){constructLoop();}if(prelude) shuffleDeck(preDeck);shuffleDeck();}function startingStatus(status_title){for(var i=0;i < deckSize;i++){if(title(drawDeck[i])===status_title){status.push(drawDeck[i]);drawDeck.splice(i,1);break;}}} if(startingSetup&&!skipInProgress){var startingHandSize=10;if(totalWar){startingHandSize=12;}if(preparingForWarTile){pickdraw("preparingForWarStart");}if(treaty_variant){if(power==="DE"){var no_DE_treaty=tr;while (no_DE_treaty){for(var i=0;i < startingHandSize;i++){if(title(drawDeck[i])==="German-Soviet Treaty of Friendship, Cooperation, and Demarcation"+vs){no_DE_treaty=fa;}}if(no_DE_treaty){shuffleDeck();}}}st_str="Italian-Soviet Treaty "+"o"+"n "+"Friendship, Non-aggression, and Neutrality"+vn;if(power==="IT") startingStatus(st_str);if(power==="US") startingStatus("Neutrality Acts"+vn);}for(var i=0;i < startingHandSize;i++){hand.push(drawDeck.shift());}var initialHand="Your initial "+startingHandSize+"-card draw is:\n\n";for(var j=0;j < startingHandSize;j++){initialHand+=j+1+": "+cNam(hand[j])+"\n";}initialHand+="\nPress OK to continue ";if(prelude){for(var i=0;i < 2;i++){preDisc.push(preDeck.shift());preHand.push(preDeck.shift());}initialHand+="to draw your Prelude cards.";}else {initialHand+="and discard "+discardNum+" cards to complete your setup.";}alert(initialHand);if(prelude){initialHand="DISCARDED Prelude cards:\n\n";preDisc.forEach(function(elt){initialHand+=cNam(elt)+"\n";});initialHand+="\nYour initial Prelude hand:\n\n";preHand.forEach(function(elt){initialHand+=cNam(elt)+"\n";});initialHand+="TOP CARD: "+cNam(preDeck[0])+"\n\nPlease continue to start the Prelude.";alert(initialHand);}t.value=t.value.replace(re,"")+size(invisible("New seed: "+generateSeed()),0);}function banner(){switch (power){case "DE": return 3783817;case "UK": return 3783811;case "JA": return 3783812;case "SU": return 3783813;case "IT": return 3783814;case "US": return 3783815;}}function compareTitle(a,b){if(a.text < b.text) return -1;if(a.text > b.text) return 1;return 0;}function compareNind(a,b){if(a.nind < b.nind) return -1;if(a.nind > b.nind) return 1;return 0;}function compareTitleNind(a,b){if(a.text < b.text) return -1;if(a.text > b.text) return 1;if(a.text===b.text){if(a.nind < b.nind) return -1;if(a.nind > b.nind) return 1;}return 0;}function refreshBanner(){var bannerRegExp=new RegExp("\\[ima"+"geid="+banner()+" medium\\]","g");t.value="[ima"+"geid="+banner()+" medium]\n"+t.value.replace(bannerRegExp,"");return "";}var inProgress=tr;if(preluding&&!skipPrelude ){preludeLoop();}refreshBanner();if(skipInProgress){inProgress=fa;}else {if(!oldseedpr){t.value+=invisible(size("Old Seed: "+generateSeed(),0))+"\n";oldseedpr=tr;}}while (inProgress){if(!oldseedpr){t.value+=invisible(size("Old Seed: "+generateSeed(),0))+"\n";oldseedpr=tr;}var validInput=fa;while (!validInput){var menu=[ ["Play a card from hand.","play"],["Use a face down card.",RE],["Discard a card from hand.","multidiscard"],["Draw card(s) from your draw deck.","draw"],["Discard from the top of your draw deck.","discardtop"],["Reallocate resources. (shuffles)","reallocate"],["Discard a random face down card.","discrandresp",["JA","SU"] ],["Discard a status.","discstat",["DE","JA"] ],["Place a random discard "+"o"+"n"+" top of the draw deck.","randdisctop",["DE","IT","JA"] ],["Play a chosen card from discards.","playdisc",["UK"] ],["Move a discard to the top of the draw deck. (Lend Lease)","movetotop",["US"] ],];if(researchTile&&discards.length===discardNum&&hand.length===7){menu.push(["Research: Discard 1 and draw chosen card from top 10 of draw deck.","researchStart"]);}var statusInPrepared=fa;var deck=allD;prepared.forEach(function(elt){if(isPrelCard(elt)) deck=prelD;if(cTyp(elt)===ST){statusInPrepared=tr;}});if(statusInPrepared&&preparingForWarTile){menu.push(["Prepare for War!: Reveal prepared Status.","revealPreparedStatus"]);}status.forEach(function(elt){var stp=stepStr(elt);switch (title(elt)){case "Rosie the Riveter": menu.push([ "(Rosie the Riveter) Move a card from your hand to the bottom of the draw deck."+stp,"bottom"]);break;case "Rationing": menu.push([ "(Rationing) Move a discard to the bottom of the draw deck."+stp,"movetobottom"]);break;case "War Bonds": menu.push(["(War Bonds) Draw a chosen card from discards."+stp,"pickdisc"]);break;case "Bravado": case "Guards": menu.push([ "("+title(elt)+") Play a chosen card from discards."+stp,"playdisc"]);break;case "Women Conscripts": menu.push(["(Women Conscripts) Move a discard to top of draw deck."+stp,"movetotop"]);break;case "Superior Planning": menu.push(["Reorder top 4 cards of draw deck"+stp,"reorder4"]);break;case "Superior Planning"+vs: menu.push(["(Superior Planning) Reorder top 5 cards of draw deck."+stp,"reorder5"]);break;case "Quantity Has a Quality All its Own": case "People's Liberation Army": case "Tank Desant": case "Attrition": case "Permanent Joint Board "+"o"+"n"+" Defense"+vn: case "American Volunteer Group Expands"+sub: menu.push(["Discard from hand and reveal type (only).","discrevtypemenu"]);break;case "Flexible Resources": menu.push(["(Flexible Resources) Play a chosen card from discards."+stp,"playdisc"]);break;case "Japanese-Soviet Non-aggression Pact"+vn: case "Italian-Soviet Treaty "+"o"+"n"+" Friendship, Non-aggression, and Neutrality"+vn: case "Neutrality Acts"+vn: menu.push(["Discard a status.","discstat"]);break;}});history.forEach(function(elt){switch (title(elt)){case "Japanese-Soviet Nonaggression Pact | -1": case "Molotov-Ribbentrop Pact | -1": case "Italian Coal Embargo | +1": case "Soviet-Japanese Neutrality Pact | -1": menu.push(["Discard a History card.","dischist"]);break;}});if(qmg11_variant){menu.push(["(Double-Cross) Randomly pick two cards in hand.","dcrandtwo",["DE"] ]);menu.push(["(Double-Cross) Return card to top of deck.","top",["DE"] ]);}var res=menuRun(menu);var pTxt=res.ptxt,menu_choices=res.mc,menuMap=res.map,choice=0;var prompt0=prompt(pTxt);if(prompt0===null){choice="public";validInput=tr;}else {menu_choices.forEach(function(elt){if(prompt0===elt){choice=menuMap[prompt0];validInput=tr;}});}} switch (choice){case "play": case BoDn: play(choice);break;case RE: response();break;case "discard": case "multidiscard": case drt: case "discrevtypemenu": discard(choice);break;case "draw": draw(choice);break;case "discardtop": discardtop();break;case "reallocate": reallocate();break;case "private": private();break;case "public": public();break;case "discrandresp": discrandresp();break;case "randdisctop": randdisctop();break;case "bottom": case "top": bottomtop(choice);break;case "discstat": case "dischist": case "discresp": discstat(choice);break;case "pickdisc": case "playdisc": case "movetotop": case "movetobottom": pickdisc(choice);break;case "pickdraw": case "playdraw": case "researchStart": case "preparingForWarStart": pickdraw(choice);break;case "reorder4": reorder(4);break;case "reorder5": reorder(5);break;case "revealPreparedStatus": revealPrepareForWar();break;case "dcrandtwo": dcRandTwo();break;default: alert("ERROR: MISSING ACTION CHOICE: "+choice);}}})();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top