'use strict'; mode.guozhan={ game:{ getIdentityList:function(player){ if(!player.isUnseen()) return; if(player==game.me) return; var list={ wei:'魏', shu:'蜀', wu:'吴', qun:'群', ye:'野', unknown:'猜' } var num=Math.floor((game.players.length+game.dead.length)/2); var noye=true; if(get.population('wei')>=num){ delete list.wei; noye=false; } if(get.population('shu')>=num){ delete list.shu; noye=false; } if(get.population('wu')>=num){ delete list.wu; noye=false; } if(get.population('qun')>=num){ delete list.qun; noye=false; } if(noye){ delete list.ye; } return list; }, getVideoName:function(){ var str=get.translation(game.me.name1)+'/'+get.translation(game.me.name2); var str2=get.cnNumber(parseInt(get.config('player_number')))+'人'+ get.translation(lib.config.mode); if(game.me.identity=='ye'){ str2+=' - 野心家'; } var name=[str,str2]; return name; }, start:function(){ var next=game.createEvent('game',false); next.content=function(){ "step 0" var playback=localStorage.getItem(lib.configprefix+'playback'); if(playback){ ui.create.arena(); ui.create.me(); ui.arena.style.display='none'; ui.system.style.display='none'; _status.playback=playback; localStorage.removeItem(lib.configprefix+'playback'); var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); store.get(parseInt(playback)).onsuccess=function(e){ if(e.target.result){ game.playVideoContent(e.target.result.video); } else{ alert('播放失败:找不到录像'); game.reload(); } } event.finish(); } else{ game.prepareArena(); game.delay(); game.showChangeLog(); } "step 1" if(lib.storage.test){ lib.config.game_speed='vfast'; _status.auto=true; ui.auto.classList.add('glow'); } for(var i=0;iget.population()/2) this.identity='ye'; else this.identity=this.group; // this.node.identity.dataset.color=this.identity; this.setIdentity(this.identity); this.ai.shown=1; } var skills; switch(num){ case 0: if(log!==false) game.log(get.translation(this)+'展示了主将'+get.translation(this.name1)); this.name=this.name1; skills=lib.character[this.name][3]; this.sex=lib.character[this.name][0]; this.classList.remove('unseen'); break; case 1: if(log!==false) game.log(get.translation(this)+'展示了副将'+get.translation(this.name2)); skills=lib.character[this.name2][3]; if(this.sex=='unknown') this.sex=lib.character[this.name2][0]; if(this.name.indexOf('unknown')==0) this.name=this.name2; this.classList.remove('unseen2'); break; case 2: if(log!==false) game.log(get.translation(this)+'展示了主将'+get.translation(this.name1)+'、副将'+get.translation(this.name2)); this.name=this.name1; skills=lib.character[this.name][3].concat(lib.character[this.name2][3]); this.sex=lib.character[this.name][0]; this.classList.remove('unseen'); this.classList.remove('unseen2'); break; } var initdraw=parseInt(get.config('initshow_draw')); if(!_status.initshown&&initdraw&&this.isAlive()&&get.config('guozhan_mode')!='mingjiang'){ this.popup('首亮'); game.log(get.translation(this)+'首先明置武将,得到奖励'); game.log(get.translation(this)+'摸了'+get.cnNumber(initdraw)+'张牌'); this.draw(initdraw).log=false; _status.initshown=true; } for(var i=0;i=2||player.hp>=player.maxHp-1) return 'draw_card'; if(player.hp==2&&player.num('h')==0) return 'draw_card'; return 'recover_hp'; },ui.create.dialog('hidden','珠联璧合:选择一项奖励')); } "step 1" if(result.control=='draw_card'){ player.draw(2); } else{ player.recover(); } } } } if(game.players[0].identity!='ye'){ for(var i=1;i0){ for(var i=0;i0){ if(effect<1) c=0.5; else c=1; if(targets.length==1&&targets[0]==this); else if(targets.length==1) this.ai.shown+=0.2*c; else this.ai.shown+=0.1*c; } } if(this.ai.shown>0.95) this.ai.shown=0.95; if(this.ai.shown<-0.5) this.ai.shown=-0.5; }, } }, skill:{ _mingzhi1:{ trigger:{player:'phaseBegin'}, priority:19, forced:true, popup:false, content:function(){ "step 0" var choice=1; for(var i=0;i=2||(popu==1&&game.players.length<=4)){ return Math.random()<0.5?3:(Math.random()<0.5?2:1); } if(choice==0) return 0; if(get.population(group)>0&&get.totalPopulation(group)+1<=get.population()/2){ return Math.random()<0.2?(Math.random()<0.5?3:(Math.random()<0.5?2:1)):0; } var nming=0; for(var i=0;i=game.players.length/2){ if(to_p<=from_p){ return 0.5; } return 0; } if(to_p=get.population()-2){ toidentity='ye'; } } var att=ai.get.realAttitude(from,toidentity,difficulty); if(from.storage.zhibi&&from.storage.zhibi.contains(to)){ return att; } if(to.ai.shown>=0.5) return att*to.ai.shown; var nshown=0; for(var i=0;i=game.players.length/2&&att>=0){ return 0; } return Math.min(0,Math.random()-0.5)+difficulty; } if(to.ai.shown>=0.2){ if(att>2){ return Math.max(0,Math.random()-0.5)+difficulty; } if(att>=0){ return 0; } return Math.min(0,Math.random()-0.7)+difficulty; } if(att>2){ return Math.max(0,Math.random()-0.7)+difficulty; } if(att>=0){ return Math.min(0,Math.random()-0.3)+difficulty; } return Math.min(0,Math.random()-0.5)+difficulty; }, } }, config:['player_number','initshow_draw', 'free_choose','change_identity','change_choice','change_card', 'swap','dierestart','revive','double_hp','difficulty'] }