- - Game Over - - - - - Araldia - - © 2021 - Mattia Mascarello - Diego Scanavino - Giacomo Roggero - - Musica: RoleMusic -- Riavvia - `); - -} + var i = 0, childrenEl = null, tHtml = "",chart=null,tick=0,chart=null; parser = new DOMParser(); xmlDoc = parser.parseFromString(text, "text/xml"); @@ -2145,7 +2073,7 @@ function gameOver(){ var data = google.visualization.arrayToDataTable([ ['Categoria', 'Persone'], - ['Sani', 6000000], + ['Sani', 60000000], ['Infetti', 0], ['Immuni', 0], ['Morti', 0] @@ -2175,14 +2103,12 @@ function gameOver(){ var randMap={}; function randEl(category) { - if(!randMap[category]) randMap[category]=[0]; - if(randMap[category].length==cats.getElementsByTagName(category)[0].childElementCount) randMap[category]=[0]; - if(tick%5==0) return cats.getElementsByTagName(category)[0].children[0]; - var imx=imx=randomInteger(0, cats.getElementsByTagName(category)[0].childElementCount - 1); + if(!randMap[category]) randMap[category]=[]; + if(randMap[category].length==cats.getElementsByTagName(category)[0].childElementCount) randMap[category]=[]; + var imx=0; while(randMap[category].indexOf(imx)>-1){ - imx=randomInteger(0, cats.getElementsByTagName(category)[0].childElementCount - 1); + imx=randomInteger(0, cats.getElementsByTagName(category)[0].childElementCount - 1) } - randMap[category].push(imx); return cats.getElementsByTagName(category)[0].children[imx]; } function getEl(category, name) { @@ -2205,27 +2131,8 @@ function gameOver(){ gameVars.player.actionN++; } function Q() { - lastVircb=null; var h = randEl("questions"); - if(tick%5==0 && tick!=0){ - $("#gameField").hide(); - gameVars["virus"]["infoboxLastI"] ++; - $("#virusBeginOhNo").show(); - var infoId=gameVars["virus"]["infoboxLastI"] ; - var el=cats.getElementsByTagName("viruses")[virusIndex]; - try{ - var text = el.getElementsByTagName("infoboxes")[0].children[infoId].textContent; - if(tet==undefined) throw "un"; - } - catch(e){ - $("gameField").show(); - $("virusBeginOhNo").hide(); - } - $("#virusBeginOhNo").html("
Bollettino
" + text + "
"); - } - setField(h); - /*if(tick%5==0 && tick!=0) */ calcvir(); tick++; } @@ -2431,7 +2338,7 @@ function gameOver(){ upGrData(); } - var lastVircb=null,virusIndex=0; + var lastVircb=null; function initRandVirus(cb) { lastVircb=cb; setTimeout(function(){ @@ -2439,9 +2346,8 @@ function gameOver(){ audio.volume=1; audio.play() },5000); - var li = window.cats.getElementsByTagName("viruses")[0].children; + var li = cats.getElementsByTagName("viruses")[0].children; var Iindex = randomInteger(0, li.length - 1); - virusIndex=Iindex; var el = li[Iindex]; var title = el.getElementsByTagName("title")[0].textContent; var text = el.getElementsByTagName("infoboxes")[0].children[0].textContent; @@ -2451,11 +2357,11 @@ function gameOver(){ gameVars["virus"]["people"]["dead"]=0; gameVars["virus"]["people"]["immune"]=0; gameVars["virus"]["people"]["infected"]=randomInteger(30,200); - gameVars["virus"]["people"]["healthy"]=6000000; + gameVars["virus"]["people"]["healthy"]=60000; gameVars["virus"]["title"] = title; gameVars["virus"]["infoboxLastI"] = 0; - // deprecated gameVars["virus"]["stepsBeforeShowDashboard"] = randomInteger(3, 10); + gameVars["virus"]["stepsBeforeShowDashboard"] = randomInteger(3, 10); gameVars["virus"]["dashboardShown"] = false; gameVars["virus"]["Iindex"] = Iindex; gameVars["virus"]["lethality"] = parseFloat(el.getElementsByTagName("levels")[0].getElementsByTagName("lethality")[0].textContent); @@ -2468,4 +2374,4 @@ function gameOver(){ if(lastVircb) lastVircb(); }); - \ No newline at end of file +