mode.infinity={ game:{ start:function(){ var next=game.createEvent('load',false); next.content=function(){ "step 0" game.import('identity'); if(!lib.storage.version||lib.storage.version<0.833){ localStorage.setItem(lib.config.mode,"{}"); } "step 1" ui.create.arena(); ui.auto.hide(); ui.create.cards(); game.finishCards(); game.delay(); "step 2" if(get.config('save_progress')&&lib.storage.saved) game.loadGame(); else game.prepareGame(); "step 3" event.trigger('gameStart'); if(get.config('save_progress')&&lib.storage.saved){ var card; for(var i=0;i0) game.players[i].node.handcards1.appendChild(card); else game.players[i].node.handcards2.appendChild(card); } } for(var j=0;j20) {alert('!!!');break;} } while(player!=game.me); game.save('player',current.dataset.position); game.save('players',players); game.save('jpa',game.me.jpa); game.save('jpe',game.me.jpe); game.save('jp',game.me.jp); game.save('learned',game.me.learned); game.save('learned1',game.me.learned1); game.save('learned2',game.me.learned2); game.save('learned3',game.me.learned3); game.save('learned4',game.me.learned4); game.save('learned5',game.me.learned5); game.save('learned6',game.me.learned6); game.save('learned7',game.me.learned7); game.save('saved',true); }, clearProgress:function(){ localStorage.setItem(lib.config.mode,"{}"); lib.storage={}; }, onOver:function(){ ui.create.control('继续',function(){ while(ui.dialogs.length) ui.dialogs[0].close(); while(ui.controls.length) ui.controls[0].close(); _status.over=false; if(game.me.isDead()){ game.me.revive(game.me.maxHp); game.me.draw(4); } else{ var player=game.addPlayer(); player.init(_status.list.randomGet()); _status.list.remove(player.name); if(Math.random()2&&get.population('fan')>0){ game.removePlayer(this); } else if(game.players.length+game.dead.length>2&&this.identity!='fan'&&get.population('fan')>0){ game.removePlayer(this); } else{ var player=game.replacePlayer(this,_status.list.randomGet()); player.draw(get.difficulty()); player.identity='fan'; player.identityShown=true; player.setIdentity(); _status.list.remove(player.name); } } if(this.identity=='zhong'&&source==game.me) game.me.discard(game.me.get('h')); if(source&&this.identity=='fan'){ if(source.identity=='fan') source.draw(get.difficulty()); else source.draw(4-get.difficulty()); } game.checkResult(); } } }, skill:{ infinity_learn:{ trigger:{player:'phaseBefore'}, forced:true, popup:false, priority:20, filter:function(){ return !_status.auto; }, content:function(){ "step 0" if(_status.auto) return; var dialog=ui.create.dialog(),i,j; var addJpe=function(){ game.me.jpe=0; var link,skills=[]; for(var i=0;i<10;i++){ if(i==2||i==5||i==8) continue; link=dialog.content.childNodes[i].querySelector('.toggle').link; if(link!='无') skills.push(link); } var skills2={}; for(var i in lib.player){ for(var j in lib.player[i]){ skills2[j]=lib.player[i][j]; } } for(var i=0;igame.me.jp){ if(that.node2) return; that.node2=ui.create.div('.toggle',that).animate('start'); that.node2.innerHTML='点数不足'; that.node2.style.right='56px'; setTimeout(function(){ that.node2.delete(); delete that.node2; },1000); return; } toggle.innerHTML='已学习'; game.me.jp-=num; game.me.learned[j].push(toggle.skill); ui.jp.innerHTML=game.me.jp; } }); node.childNodes[1].skill=i; ui.learned[i]=node; dialog.add(node); } }(j)) dialog.add(ui.create.div('.placeholder')); } dialog.add(ui.create.line('摸两张牌',100,function(){ var node=this.parentNode; if(node.clicked) return; if(game.me.jp<100){ if(node.node2) return; node.node2=ui.create.div('.toggle',node).animate('start'); node.node2.innerHTML='点数不足'; node.node2.style.right='56px'; setTimeout(function(){ node.node2.delete(); delete node.node2; },1000); return; } node.clicked=true; node.querySelector('.toggle').innerHTML='已选择' game.me.jpa-=100; game.me.jp-=100; ui.jp.innerHTML=game.me.jp; ui.jpa.innerHTML=game.me.jpa; game.me.draw(2); })); dialog.add(ui.create.line('回复体力',100,function(){ var node=this.parentNode; if(node.clicked) return; if(game.me.jp<100){ if(node.node2) return; node.node2=ui.create.div('.toggle',node).animate('start'); node.node2.innerHTML='点数不足'; node.node2.style.right='56px'; setTimeout(function(){ node.node2.delete(); delete node.node2; },1000); return; } node.clicked=true; node.querySelector('.toggle').innerHTML='已选择' game.me.jpa-=100; game.me.jp-=100; ui.jp.innerHTML=game.me.jp; ui.jpa.innerHTML=game.me.jpa; game.me.recover(); })); if(game.me.maxHp<5){ dialog.add(ui.create.line('体力上限',1000,function(){ var node=this.parentNode; if(node.clicked) return; if(game.me.jp<1000){ if(node.node2) return; node.node2=ui.create.div('.toggle',node).animate('start'); node.node2.innerHTML='点数不足'; node.node2.style.right='56px'; setTimeout(function(){ node.node2.delete(); delete node.node2; },1000); return; } node.clicked=true; node.querySelector('.toggle').innerHTML='已选择' game.me.jpa-=1000; game.me.jp-=1000; ui.jp.innerHTML=game.me.jp; ui.jpa.innerHTML=game.me.jpa; game.me.maxHp++; game.me.update(); })); } dialog.add(ui.create.div('.placeholder')); dialog.add(ui.create.line('重置技能',function(){ var i,j; for(i in lib.player){ while(game.me.learned[i].length>1){ j=game.me.learned[i].pop(); ui.learned[j].childNodes[1].innerHTML=lib.player[i][j]; } } game.me.jpa=Math.ceil(0.9*game.me.jpa); game.me.jp=game.me.jpa; game.me.jpe=0; for(i=0;i<10;i++){ if(i==2||i==5||i==8) continue; dialog.content.childNodes[i].querySelector('.toggle').innerHTML='无'; dialog.content.childNodes[i].querySelector('.toggle').link='无'; } ui.jp.innerHTML=game.me.jp; ui.jpa.innerHTML=game.me.jpa; ui.jpe.innerHTML=0; })); var jp=ui.create.line('剩余点数',game.me.jp); ui.jp=jp.childNodes[1]; dialog.add(jp); var jpe=ui.create.line('装备技能',game.me.jpe); ui.jpe=jpe.childNodes[1]; dialog.add(jpe); var jpa=ui.create.line('技能点数',game.me.jpa); ui.jpa=jpa.childNodes[1]; dialog.add(jpa); var control=ui.create.control('完成',function(){ game.me.clearSkills(); var link; for(var i=0;i<10;i++){ if(i==2||i==5||i==8) continue; link=dialog.content.childNodes[i].querySelector('.toggle').link; switch(dialog.content.childNodes[i].firstChild.innerHTML){ case '主动技能一':game.me.learned1=link;break; case '主动技能二':game.me.learned2=link;break; case '被动技能一':game.me.learned3=link;break; case '被动技能二':game.me.learned4=link;break; case '锁定技能一':game.me.learned5=link;break; case '锁定技能二':game.me.learned6=link;break; case '限定技':game.me.learned7=link;break; } if(link!='无') game.me.addSkill(link); } control.close(); dialog.close(); event.finish(); game.resume(); }) game.pause(); "step 1" while(ui.dialogs.length){ ui.dialogs[0].close(); } while(ui.controls.length){ ui.controls[0].close(); } } }, infinity_jp:{ init:function(){ game.me.storage.infinity_jp=true; }, group:['jp_damage','jp_kill','jp_use','jp_skill'], intro:{ content:function(intro,player){ return '技能点数:'+player.jp+'/'+player.jpa; } } }, infinity_add:{ trigger:{player:'phaseAfter'}, forced:true, popup:false, filter:function(){ return game.players.length<8; }, content:function(){ var position,player; var num=get.population('zhong')+1+Math.min(3,Math.floor(game.me.jpa/1000))-get.population('fan'); if(get.population('zhong')>1) num--; if(num>0&&Math.random()