'use strict'; game.import('mode',function(lib,game,ui,get,ai,_status){ return { name:'identity', start:function(){ "step 0" if(!lib.config.new_tutorial){ ui.arena.classList.add('only_dialog'); } _status.mode=get.config('identity_mode'); if(_status.brawl&&_status.brawl.submode){ _status.mode=_status.brawl.submode; } event.replacePile=function(){ var list=['shengdong','qijia','caomu','jinchan','zengbin','fulei','qibaodao','zhungangshuo','lanyinjia']; var map={ shunshou:'shengdong', jiedao:'qijia', bingliang:'caomu', wuxie:'jinchan', wuzhong:'zengbin', wugu:'zengbin', shandian:'fulei', qinggang:'qibaodao', qinglong:'zhungangshuo', bagua:'lanyinjia' }; for(var i=0;i跳过后,你可以在选项-其它中重置新手向导'); ui.auto.hide(); ui.create.control('跳过向导',function(){ clear(); clear2(); game.resume(); // lib.cheat.cfg(); // owidgets }); ui.create.control('继续',step2); } var step2=function(){ if(!lib.config.phonelayout){ clear(); ui.create.dialog('如果你在使用手机,可能会觉得按钮有点小'+ ',将布局改成移动可以使按钮变大'); ui.dialog.add('
你可以在选项-外观-布局中更改此设置'); var lcontrol=ui.create.control('使用移动布局',function(){ if(lib.config.phonelayout){ ui.control.firstChild.firstChild.innerHTML='使用移动布局'; game.saveConfig('phonelayout',false); lib.init.layout('mobile'); } else{ ui.control.firstChild.firstChild.innerHTML='使用默认布局'; game.saveConfig('phonelayout',true); lib.init.layout('mobile'); } }); ui.create.control('继续',step3); } else{ step3(); } }; var step3=function(){ if(lib.config.touchscreen){ clear(); ui.create.dialog('触屏模式中,下划可以显示菜单,上划可以切换托管,双指单击可以暂停'); ui.dialog.add('
你可以在选项-通用-中更改手势设置'); ui.create.control('继续',step4); } else{ step4(); } }; var step4=lib.genAsync(function*(){ clear(); ui.window.classList.add('noclick_important'); ui.click.configMenu(); ui.control.classList.add('noclick_click_important'); ui.control.style.top='calc(100% - 105px)'; yield new Promise(resolve => ui.create.control('在菜单中,可以进行各项设置',resolve)); ui.click.menuTab('选项'); yield new Promise(resolve => ui.controls[0].replace('如果你感到游戏较卡,可以开启流畅模式',resolve)); yield new Promise(resolve => ui.controls[0].replace('在技能一栏中,可以设置自动发动或双将禁配的技能',resolve)); ui.click.menuTab('武将'); yield new Promise(resolve => ui.controls[0].replace('在武将或卡牌一栏中,单击武将/卡牌可以将其禁用',resolve)); ui.click.menuTab('战局'); yield new Promise(resolve => ui.controls[0].replace('在战局中可以输入游戏命令,或者管理录像',resolve)); ui.click.menuTab('帮助'); yield new Promise(resolve => ui.controls[0].replace('在帮助中,可以检查更新和下载素材',resolve)); ui.click.configMenu(); ui.window.classList.remove('noclick_important'); ui.control.classList.remove('noclick_click_important'); ui.control.style.top=''; step5(); }); var step5=function(){ clear(); ui.create.dialog('如果还有其它问题,欢迎来到百度无名杀吧进行交流'); ui.create.control('完成',function(){ clear(); clear2(); game.resume(); }) }; game.pause(); step1(); } else{ if(!_status.connectMode){ game.showChangeLog(); } } "step 3" if(typeof _status.new_tutorial=='function'){ _status.new_tutorial(); } delete _status.new_tutorial; if(_status.connectMode){ game.waitForPlayer(function(){ if(lib.configOL.identity_mode=='zhong'||lib.configOL.identity_mode=='purple'){ lib.configOL.number=8; } }); } "step 4" var yearLimitCheck=()=>{ var next=game.createEvent('year_limit_pop',false); next.setContent(function(){ 'step 0' var str=get.cnNumber(game.shuffleNumber+1,true); game.me.$fullscreenpop(`第${str}年`,'thunder'); game.log('游戏进入了',`#y第${str}年`); if(game.shuffleNumber+1i=='nei').length>=2) toReplace='nei'; else if(list.filter(i=>i=='zhong').length>list.filter(i=>i=='fan').length/2) toReplace='zhong'; else toReplace='fan'; list.remove(toReplace); list.push(identity); } game.broadcast(identityList=>lib.config.mode_config.identity.identity=identityList,lib.config.mode_config.identity.identity); } } if(lib.configOL.number<2){ lib.configOL.number=2; } if(_status.mode!='purple'&&lib.configOL.enable_year_limit){ lib.onwash.push(yearLimitCheck); } game.randomMapOL(); } else{ if(_status.mode=='normal'&&(get.config('enable_commoner')||get.config('double_nei'))){ var identity=get.config('enable_commoner')?'commoner':'nei'; for(var i=1;ii=='nei').length>=2) toReplace='nei'; else if(list.filter(i=>i=='zhong').length>list.filter(i=>i=='fan').length/2) toReplace='zhong'; else toReplace='fan'; list.remove(toReplace); list.push(identity); } } if(_status.mode!='purple'&&get.config('enable_year_limit')){ lib.onwash.push(yearLimitCheck); } for(var i=0;i{ _status.stratagemFuryMax=3; ui.css.stratagemCardStyle=lib.init.sheet([ '.card.stratagem-fury-glow:before{', 'opacity:0.2;', 'box-shadow:rgba(0,0,0,0.2) 0 0 0 1px,rgb(255,109,12) 0 0 5px,rgb(255,0,0) 0 0 10px;', 'background-color:yellow;', '-webkit-filter:blur(5px);', 'filter:blur(5px);', '}' ].join('')); }; game.broadcastAll(stratagemBroadcast); if(_status.connectMode&&!_status.postReconnect.stratagemReinit) _status.postReconnect.stratagemReinit=[stratagemBroadcast,{}]; for(var current of game.players){ if(current.identity=='zhu') current.addSkill('stratagem_monarchy'); if(current.identity=='fan') current.addSkill('stratagem_revitalization'); } } if(game.zhu==game.me&&game.zhu.identity!='zhu'&&_status.brawl&&_status.brawl.identityShown){ delete game.zhu; } else{ if(!stratagemMode) game.zhu.ai.shown=1; if(game.zhu2){ game.zhong=game.zhu; game.zhu=game.zhu2; delete game.zhu2; if(game.zhong.sex=='male'&&game.zhong.maxHp<=4){ game.zhong.addSkill('dongcha'); } else{ game.zhong.addSkill('sheshen'); } } var enhance_zhu=false; if(_status.connectMode){ enhance_zhu=(!['zhong','stratagem','purple'].includes(_status.mode)&&lib.configOL.enhance_zhu&&get.population('fan')>=3); } else{ enhance_zhu=(!['zhong','stratagem','purple'].includes(_status.mode)&&get.config('enhance_zhu')&&get.population('fan')>=3); } if(enhance_zhu){ var skill; switch(game.zhu.name){ case 'key_yuri':skill='buqu';break; case 'liubei':skill='jizhen';break; case 'dongzhuo':skill='hengzheng';break; case 'sunquan':skill='batu';break; case 'sp_zhangjiao':skill='tiangong';break; case 'liushan':skill='shengxi';break; case 'sunce':skill='ciqiu';break; case 're_sunben':skill='ciqiu';break; case 'yuanshao':skill='geju';break; case 're_caocao':skill='dangping';break; case 'caopi':skill='junxing';break; case 'liuxie':skill='moukui';break; default:skill='tianming';break; } game.broadcastAll(function(player,skill){ player.addSkill(skill); player.storage.enhance_zhu=skill; },game.zhu,skill); } } game.syncState(); event.trigger('gameStart'); var players=get.players(lib.sort.position); var info=[]; for(var i=0;i5) return 5; return 4; }); if(_status.connectMode&&lib.configOL.change_card) game.replaceHandcards(game.players.slice(0)); "step 7" game.phaseLoop(event.beginner); }, game:{ canReplaceViewpoint:()=>true, getState:function(){ var state={}; for(var i in lib.playerOL){ var player=lib.playerOL[i]; state[i]={identity:player.identity}; if(player==game.zhu){ state[i].zhu=true; } if(player==game.zhong){ state[i].zhong=true; } if(player.isZhu){ state[i].isZhu=true; } if(player.special_identity){ state[i].special_identity=player.special_identity; } state[i].shown=player.ai.shown; //state[i].group=player.group; } return state; }, updateState:function(state){ for(var i in state){ var player=lib.playerOL[i]; if(player){ player.identity=state[i].identity; if(state[i].identity=='rZhu'||state[i].identity=='bZhu') game[state[i].identity]=player; if(state[i].special_identity){ player.special_identity=state[i].special_identity; if(player.node.dieidentity){ player.node.dieidentity.innerHTML=get.translation(state[i].special_identity); player.node.identity.firstChild.innerHTML=get.translation(state[i].special_identity+'_bg'); } } if(state[i].zhu){ game.zhu=player; } if(state[i].isZhu){ player.isZhu=true; } if(state[i].zhong){ game.zhong=player; } player.ai.shown=state[i].shown; //player.group=state[i].group; //player.node.name.dataset.nature=get.groupnature(player.group); } } }, getRoomInfo:function(uiintro){ uiintro.add('
游戏模式:'+(lib.configOL.identity_mode=='zhong'?'明忠':'标准')); uiintro.add('
双将模式:'+(lib.configOL.double_character?'开启':'关闭')); if(lib.configOL.identity_mode!='zhong'){ if(lib.configOL.identity_mode=='stratagem'){ uiintro.add('
首轮强化:'+(lib.configOL.round_one_use_fury?'开启':'关闭')); } else if(lib.configOL.identity_mode!='purple'){ uiintro.add('
双内奸:'+(lib.configOL.double_nei?'开启':'关闭')); if(lib.configOL.identity_mode!='stratagem'){ uiintro.add('
加强主公:'+(lib.configOL.enhance_zhu?'开启':'关闭')); uiintro.add('
平民身份:'+(lib.configOL.enable_commoner?'开启':'关闭')); } uiintro.add('
年机制:'+(lib.configOL.enable_year_limit?'开启':'关闭')); } } else{ uiintro.add('
卡牌替换:'+(lib.configOL.zhong_card?'开启':'关闭')); } var last=uiintro.add('
出牌时限:'+lib.configOL.choose_timeout+'秒'); // uiintro.add('
屏蔽弱将:'+(lib.configOL.ban_weak?'开启':'关闭')); // var last=uiintro.add('
屏蔽强将:'+(lib.configOL.ban_strong?'开启':'关闭')); if(lib.configOL.banned.length){ last=uiintro.add('
禁用武将:'+get.translation(lib.configOL.banned)); } if(lib.configOL.bannedcards.length){ last=uiintro.add('
禁用卡牌:'+get.translation(lib.configOL.bannedcards)); } last.style.paddingBottom='8px'; }, getIdentityList:function(player){ if(player.identityShown) return; if(player==game.me) return; if(_status.mode=='purple'){ if(_status.yeconfirm&&['rNei','bNei'].includes(game.me.identity)&&['rNei','bNei'].includes(player.identity)) return; if(player.identity.slice(0,1)=='r') return { cai2:'猜', rZhong:'忠', rNei:'内', rYe:'野', } return { cai:'猜', bZhong:'忠', bNei:'内', bYe:'野', } } else if(_status.mode=='zhong'){ if(player.fanfixed) return; if(game.zhu&&game.zhu.isZhu){ return { fan:'反', zhong:'忠', nei:'内', cai:'猜', } } else{ return { fan:'反', zhong:'忠', nei:'内', zhu:'主', cai:'猜', } } } else if(_status.mode=='stratagem'){ if(game.zhu&&game.zhu.isZhu&&game.zhu.identityShown||game.me.identity=='zhu'){ return { fan:'反', zhong:'忠', nei:'内', enemy:'敌', friend:'友', cai:'猜', } } else{ return { fan:'反', zhong:'忠', nei:'内', zhu:'主', enemy:'敌', friend:'友', cai:'猜', } } } else{ if(get.config('enable_commoner')){ return { fan:'反', zhong:'忠', nei:'内', commoner:'民', cai:'猜', } } else{ return { fan:'反', zhong:'忠', nei:'内', cai:'猜', } } } }, getIdentityList2:function(list){ for(var i in list){ switch(i){ case 'fan':list[i]='反贼';break; case 'zhong':list[i]='忠臣';break; case 'nei':list[i]='内奸';break; case 'commoner':list[i]='平民'; break; case 'zhu':list[i]='主公';break; case 'enemy':list[i]='敌方';break; case 'friend':list[i]='友方';break; case 'cai':case 'cai2':list[i]='未知';break; case 'rZhong':case 'bZhong':list[i]='前锋';break; case 'rNei':case 'bNei':list[i]='细作';break; case 'rYe':case 'bYe':list[i]='野心家';break; } } }, getVideoName:function(){ var str=get.translation(game.me.name); if(game.me.name2){ str+='/'+get.translation(game.me.name2); } var str2; if(game.identityVideoName) str2=game.identityVideoName; else{ switch(_status.mode){ case 'purple':str2='3v3v2 - '+(game.me.identity.indexOf('r')==0?'暖色':'冷色')+lib.translate[game.me.identity+'2'];break; case 'zhong':str2='忠胆英杰 - '+lib.translate[game.me.identity+'2'];break; case 'stratagem':str2=get.cnNumber(get.playerNumber())+'人谋攻'+'-'+lib.translate[game.me.identity+'2'];break; default:str2=get.cnNumber(get.playerNumber())+'人'+get.translation(lib.config.mode)+' - '+lib.translate[game.me.identity+'2'] } } var name=[ str, str2, ]; return name; }, addRecord:function(bool){ if(typeof bool=='boolean'){ var data=lib.config.gameRecord.identity.data; var identity=game.me.identity; if(identity=='mingzhong'){ identity='zhong'; } if(!data[identity]){ data[identity]=[0,0]; } if(bool){ data[identity][0]++; } else{ data[identity][1]++; } var list=['zhu','zhong','nei','fan','commoner']; var str=''; for(var i=0;i'; } } lib.config.gameRecord.identity.str=str; game.saveConfig('gameRecord',lib.config.gameRecord); } }, showIdentity:function(me){ for(var i=0;i0||loser.length==game.players.length){ game.broadcastAll(function(winner,loser){ _status.winner=winner; _status.loser=loser; },winner,loser); if(loser.length==game.players.length){ game.showIdentity(); game.over('游戏平局'); } else if(winner2.includes(me)){ game.showIdentity(); if(loser2.includes(me)) game.over(false); else game.over(true); } else{ game.showIdentity(); game.over(false); } } return; } if(!game.zhu){ if(get.population('fan')==0){ switch(me.identity){ case 'fan':game.over(false);break; case 'zhong':game.over(true);break; case 'commoner':game.over(true); break; default:game.over();break; } } else if(get.population('zhong')==0){ switch(me.identity){ case 'fan':game.over(true);break; case 'zhong':game.over(false);break; case 'commoner':game.over(true); break; default:game.over();break; } } return; } if(game.zhu.isAlive()&&get.population('fan')+get.population('nei')>0) return; if(game.zhong){ game.zhong.identity='zhong'; } game.showIdentity(); if(me.identity=='zhu'||me.identity=='zhong'||me.identity=='mingzhong'){ if(game.zhu.classList.contains('dead')){ game.over(false); } else{ game.over(true); } } else if(me.identity=='nei'){ if(game.players.length==(1+game.players.filter(i=>i.identity=='commoner').length)&&me.isAlive()){ game.over(true); } else{ game.over(false); } } else if(me.identity=='fan'){ if((get.population('fan')+get.population('zhong')>0||get.population('nei')>1)&& game.zhu.classList.contains('dead')){ game.over(true); } else{ game.over(false); } } else if(me.identity=='commoner'){ game.over(true); } }, checkOnlineResult:function(player){ if(_status.winner&&_status.loser){ if(_status.loser.length==game.players.length) return null; if(_status.loser.includes(player)) return false; if(_status.winner.includes(player)) return true; } if(game.zhu.isAlive()){ return (player.identity=='zhu'||player.identity=='zhong'||player.identity=='mingzhong'||player.identity=='commoner'&&player.isAlive()); } else if(game.players.length==(1+game.players.filter(i=>i.identity=='commoner').length)&&game.players[0].identity=='nei'||game.players[0].identity=='commoner'){ return player.isAlive(); } else{ return player.identity=='fan'||player.identity=='commoner'&&player.isAlive(); } }, chooseCharacterPurpleOL:function(){ var next=game.createEvent('chooseCharacter'); next.setContent(function(){ "step 0" ui.arena.classList.add('choose-character'); "step 1" var list=['rZhu','rZhong','rNei','rYe']; var list2=['bZhu','bZhong','bNei','bYe']; list.randomSort(); list2.randomSort(); var identityList=list.concat(list2); var num=get.rand(0,7); var players=game.players.slice(0); for(var i=0;i15?5:3; } list.sort(function(a,b){ return lib.group.indexOf(a)-lib.group.indexOf(b); }); event.list=list; event.map=map; event.map_zhu=map_zhu; game.bZhu.chooseControl(list).set('prompt','请选择冷方武将势力').set('ai',function(){ return _status.event.choice; }).set('choice',event.list.randomGet()); "step 3" event.bZhu=result.control; event.list.remove(event.bZhu); game.rZhu.chooseControl(event.list).set('prompt','请选择暖方武将的势力').set('ai',function(){ return _status.event.choice; }).set('choice',event.list.randomGet()); "step 4" event.rZhu=result.control; var players=[game.rZhu,game.bZhu]; var list=[]; for(var i=0;i5){ num=5; } num2=event.list.length-num*(game.players.length-1); if(lib.configOL.double_nei){ num2=Math.floor(num2/2); } if(num2>2){ num2=2; } for(var i=0;igame.addGlobalSkill(globalSkill)); game.players.forEach(current=>{ current.storage.zhibi=[]; current.storage.stratagem_expose=[]; current.markSkill('stratagem_fury'); }); setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); }); }, chooseCharacter:function(){ if(_status.mode=='purple'){ game.chooseCharacterPurple(); return; } var next=game.createEvent('chooseCharacter'); next.showConfig=true; next.addPlayer=function(player){ var list=get.identityList(game.players.length-1); var list2=get.identityList(game.players.length); for(var i=0;i4){ if(!player.isInitFilter('noZhuHp')){ player.hp++; player.maxHp++; player.$update(); } } } else if(player.identity=='zhong'&&(Math.random()<0.5||['sunliang','key_akane'].includes(game.zhu.name))&&!stratagemMode){ var listc=list.slice(0); for(var i=0;i'; td.addEventListener(lib.config.touchscreen?'touchend':'click',function(){ if(_status.dragged) return; if(_status.justdragged) return; _status.tempNoButton=true; setTimeout(function(){ _status.tempNoButton=false; },500); var link=this.link; if(game.zhu){ if(link!='random'){ _status.event.parent.fixedseat=get.distance(game.me,game.zhu,'absolute'); } if(game.zhu.name) game.zhu.uninit(); delete game.zhu.isZhu; delete game.zhu.identityShown; } var current=this.parentNode.querySelector('.bluebg'); if(current){ current.classList.remove('bluebg'); } current=_status.cheat_seat||seats.querySelector('.bluebg'); if(current){ current.classList.remove('bluebg'); } if(link=='random'){ if(event.zhongmode){ link=['zhu','zhong','nei','fan','mingzhong'].randomGet(); } else{ var listi=['zhu','zhong','nei','fan']; if(get.config('enable_commoner')&&!event.stratagemMode) listi.push('commoner'); link=listi.randomGet(); } for(var i=0;i=1){ fans.randomRemove().special_identity='identity_zeishou'; event.special_identity.push('identity_zeishou'); } if(zhongs.length>1){ zhongs.randomRemove().special_identity='identity_dajiang'; zhongs.randomRemove().special_identity='identity_junshi'; event.special_identity.push('identity_dajiang'); event.special_identity.push('identity_junshi'); } else if(zhongs.length==1){ if(Math.random()<0.5){ zhongs.randomRemove().special_identity='identity_dajiang'; event.special_identity.push('identity_dajiang'); } else{ zhongs.randomRemove().special_identity='identity_junshi'; event.special_identity.push('identity_junshi'); } } } if(!game.zhu) game.zhu=game.me; else{ if(!stratagemMode){ game.zhu.setIdentity(); game.zhu.identityShown=true; game.zhu.node.identity.classList.remove('guessing'); } game.zhu.isZhu=(game.zhu.identity=='zhu'); game.me.setIdentity(); game.me.node.identity.classList.remove('guessing'); } //选将框分配 for(i in lib.characterReplace){ var ix=lib.characterReplace[i]; for(var j=0;j4){ if(!game.me.isInitFilter('noZhuHp')){ game.me.hp++; game.me.maxHp++; game.me.$update(); } } for(var i=0;igame.addGlobalSkill(globalSkill)); game.players.forEach(i=>{ i.storage.zhibi=[]; i.storage.stratagem_expose=[]; i.markSkill('stratagem_fury'); }); } setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); if(event.special_identity){ for(var i=0;i=1){ map.identity_zeishou=fans.randomRemove(); } if(zhongs.length>1){ map.identity_dajiang=zhongs.randomRemove(); map.identity_junshi=zhongs.randomRemove(); } else if(zhongs.length==1){ if(Math.random()<0.5){ map.identity_dajiang=zhongs.randomRemove(); } else{ map.identity_junshi=zhongs.randomRemove(); } } game.broadcastAll(function(zhu,map){ for(var i in map){ map[i].special_identity=i; } },game.zhu,map); event.special_identity=map; } game.zhu.setIdentity(); game.zhu.identityShown=true; game.zhu.isZhu=(game.zhu.identity=='zhu'); game.zhu.node.identity.classList.remove('guessing'); game.me.setIdentity(); game.me.node.identity.classList.remove('guessing'); if(game.me.special_identity){ game.me.node.identity.firstChild.innerHTML=get.translation(game.me.special_identity+'_bg'); } for(var i=0;i4){ if(!game.zhu.isInitFilter('noZhuHp')){ game.zhu.maxHp++; game.zhu.hp++; game.zhu.update(); } } game.broadcast(function(zhu,name,name2,addMaxHp){ if(!zhu.name){ zhu.init(name,name2); } if(addMaxHp){ if(!zhu.isInitFilter('noZhuHp')){ zhu.maxHp++; zhu.hp++; zhu.update(); } } },game.zhu,result.links[0],result.links[1],game.players.length>4); if(game.zhu.group=='shen'&&!game.zhu.isUnseen(0)){ var list=['wei','shu','wu','qun','jin','key']; for(var i=0;i5){ num=5; } num2=event.list.length-num*(game.players.length-1); if(lib.configOL.double_nei){ num2=Math.floor(num2/2); } if(num2>2){ num2=2; } } for(var i=0;i0.95){ this.ai.shown=0.95; } } return this; }, yexinbilu:function(){ game.broadcastAll(function(player){ player.showIdentity(); },this); this.gainMaxHp(); this.recover(); }, $dieAfter:function(){ if(_status.video) return; if(!this.node.dieidentity){ var str; if(this.special_identity){ str=get.translation(this.special_identity); } else{ str=get.translation(this.identity+'2'); } var node=ui.create.div('.damage.dieidentity',str,this); if(str=='野心家'){ node.style.fontSize='40px'; } ui.refresh(node); node.style.opacity=1; this.node.dieidentity=node; } var trans=this.style.transform; if(trans){ if(trans.indexOf('rotateY')!=-1){ this.node.dieidentity.style.transform='rotateY(180deg)'; } else if(trans.indexOf('rotateX')!=-1){ this.node.dieidentity.style.transform='rotateX(180deg)'; } else{ this.node.dieidentity.style.transform=''; } } else{ this.node.dieidentity.style.transform=''; } }, dieAfter2:function(source){ if(_status.mode=='stratagem') return; if(_status.mode=='purple'){ if(source){ if(this.identity=='rZhu'||this.identity=='bZhu'){ if(this.identity.slice(0,1)!=source.identity.slice(0,1)) source.recover(); } else if(this.identity=='rZhong'||this.identity=='bZhong'){ if(this.identity.slice(0,1)!=source.identity.slice(0,1)) source.draw(2); else if(source.identity.indexOf('Zhu')==1) source.discard(source.getCards('h')); } else if(this.identity=='rNei'||this.identity=='bNei'){ if(this.identity.slice(0,1)==source.identity.slice(0,1)) source.draw(3); } } if(!_status.yeconfirm){ _status.yeconfirm=true; game.addGlobalSkill('yexinbilu'); game.broadcastAll(function(){ if(game.me.identity=='rYe'||game.me.identity=='bYe'){ var player=game.findPlayer(function(current){ return current!=game.me&&(current.identity=='bYe'||current.identity=='rYe'); }); if(player){ player.showIdentity(); } } }); } } if(this.identity=='fan'&&source) source.draw(3); else if(this.identity=='commoner'&&source) source.draw(2); else if(this.identity=='mingzhong'&&source){ if(source.identity=='zhu'){ source.discard(source.getCards('he')); } else{ source.draw(3); } } else if(this.identity=='zhong'&&source&&source.identity=='zhu'&&source.isZhu){ source.discard(source.getCards('he')); } }, dieAfter:function(source){ if(!this.identityShown){ game.broadcastAll(function(player,identity,identity2){ player.setIdentity(player.identity); player.identityShown=true; player.node.identity.classList.remove('guessing'); if(identity){ player.node.identity.firstChild.innerHTML=get.translation(identity+'_bg'); game.log(player,'的身份是','#g'+get.translation(identity)); } else{ game.log(player,'的身份是','#g'+get.translation(identity2+'2')); } },this,this.special_identity,this.identity); } if(this.special_identity){ game.broadcastAll(function(zhu,identity){ zhu.removeSkill(identity); },game.zhu,this.special_identity); } game.checkResult(); if(_status.mode=='purple'){ var red=[]; var blue=[]; game.countPlayer(function(current){ var identity=current.identity.slice(1); if(identity!='Zhu'){ if(current.identity.indexOf('r')==0) red.push(current); else blue.push(current); } }); if(red.length<=1&&blue.length<=1) game.broadcastAll(game.showIdentity); return; } if(game.zhu&&game.zhu.isZhu){ if((get.population('zhong')+get.population('nei')==0|| get.population('zhong')+get.population('fan')==0)&&get.population('commoner')==0){ game.broadcastAll(function(){ if(game.showIdentity) game.showIdentity(); if(game.zhu&&game.zhu.isAlive()&&get.population('nei')==1&&get.config('nei_fullscreenpop')) game.me.$fullscreenpop('主公 vs 内奸',null,null,false); }); } } if(game.zhu&&game.zhu.storage.enhance_zhu&&get.population('fan')<3){ game.zhu.removeSkill(game.zhu.storage.enhance_zhu); delete game.zhu.storage.enhance_zhu; } if(this==game.zhong){ game.broadcastAll(function(player){ game.zhu=player; game.zhu.identityShown=true; game.zhu.ai.shown=1; game.zhu.setIdentity(); game.zhu.isZhu=true; var skills=player.getStockSkills(true,true).filter(skill=>{ if(player.hasSkill(skill)) return false; var info=get.info(skill); return info&&info.zhuSkill; }); if(skills.length){ for(var i of skills) player.addSkillLog(i); } game.zhu.node.identity.classList.remove('guessing'); if(lib.config.animation&&!lib.config.low_performance) game.zhu.$legend(); delete game.zhong; if(_status.clickingidentity&&_status.clickingidentity[0]==game.zhu){ for(var i=0;i<_status.clickingidentity[1].length;i++){ _status.clickingidentity[1][i].delete(); _status.clickingidentity[1][i].style.transform=''; } delete _status.clickingidentity; } },game.zhu); game.delay(2); game.zhu.playerfocus(1000); _status.event.trigger('zhuUpdate'); } if(!_status.over){ var giveup; if(get.population('fan')+get.population('nei')==1){ for(var i=0;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; } else if(effect<0&&this==game.me&&['nei','commoner','rYe','bYe'].includes(game.me.identity)){ if(targets.length==1&&targets[0]==this); else if(targets.length==1) this.ai.shown-=0.2; else this.ai.shown-=0.1; } } if(!stratagemMode&&this!=game.me) this.ai.shown*=2; if(this.ai.shown>0.95) this.ai.shown=0.95; if(this.ai.shown<-0.5) this.ai.shown=-0.5; if(_status.mode=='purple') return; if(stratagemMode) return; var marknow=(!_status.connectMode&&this!=game.me&&get.config('auto_mark_identity')&&this.ai.identity_mark!='finished'); // if(true){ if(marknow&&_status.clickingidentity&&_status.clickingidentity[0]==this){ for(var i=0;i<_status.clickingidentity[1].length;i++){ _status.clickingidentity[1][i].delete(); _status.clickingidentity[1][i].style.transform=''; } delete _status.clickingidentity; } if(!Array.isArray(targets)){ targets=[]; } var effect=0,c,shown; var zhu=game.zhu; if(_status.mode=='zhong'&&!game.zhu.isZhu){ zhu=game.zhong; } if(targets.length==1&&targets[0]==this){ effect=0; } else if(this.identity!='nei'&&this.identity!='commoner'){ if(this.ai.shown>0){ if(this.identity=='fan'){ effect=-1; } else{ effect=1; } } } else if(targets.length>0){ for(var i=0;i0){ if(this.ai.identity_mark=='fan'){ if(marknow) this.setIdentity(); this.ai.identity_mark='finished'; } else{ if(marknow) this.setIdentity('zhong'); this.ai.identity_mark='zhong'; } } else if(effect<0&&get.population('fan')>0){ if(this.ai.identity_mark=='zhong'){ if(marknow) this.setIdentity(); this.ai.identity_mark='finished'; } else{ if(marknow) this.setIdentity('fan'); this.ai.identity_mark='fan'; } } } else if(marknow){ if(effect>0&&this.identity!='fan'){ this.setIdentity('zhong'); this.ai.identity_mark='finished'; } else if(effect<0&&this.identity=='fan'){ this.setIdentity('fan'); this.ai.identity_mark='finished'; } } // } }, showIdentity:function(){ this.node.identity.classList.remove('guessing'); this.identityShown=true; this.ai.shown=1; this.setIdentity(); if(this.special_identity){ this.node.identity.firstChild.innerHTML=get.translation(this.special_identity+'_bg'); } if(this.identity=='zhu'){ this.isZhu=true; } else{ delete this.isZhu; } if(_status.clickingidentity){ for(var i=0;i<_status.clickingidentity[1].length;i++){ _status.clickingidentity[1][i].delete(); _status.clickingidentity[1][i].style.transform=''; } delete _status.clickingidentity; } } }, content:{ stratagemInsight:event=>{ 'step 0' game.log(player,'洞察了',target,'与其的阵营关系'); 'step 1' var storage=player.storage; if(!storage.zhibi) storage.zhibi=[]; var zhibi=storage.zhibi; if(!zhibi.includes(target)) zhibi.push(target); var insightResult=event.insightResult=get.insightResult(player,target); event.videoId=lib.status.videoId++; var send=(clientTarget,clientInsightResult,id)=>{ var classList=clientTarget.classList,nonStratagemInsightFlashing=classList.contains('flash-animation-iteration-count-infinite'); if(nonStratagemInsightFlashing) clientTarget.nonStratagemInsightFlashing=true; else classList.add('flash-animation-iteration-count-infinite'); var identity=get.translation(`${clientInsightResult}2`); clientTarget.prompt(identity,clientInsightResult); var dialog=ui.create.dialog(`${get.translation(clientTarget)}是${identity}
`,'forcebutton'); ui.create.spinningIdentityCard(clientInsightResult,dialog); var control=ui.create.control('ok',()=>{ dialog.close(); control.close(); _status.imchoosing=false; _status.event._result={ bool:true }; game.resume(); }); dialog.videoId=id; game.pause(); game.countChoose(); }; game.broadcastAll((clientPlayer,clientTarget,id)=>{ if(clientPlayer!=game.me) ui.create.dialog(`${get.translation(clientPlayer)}正在洞察${get.translation(clientTarget)}的阵营...
`).videoId=id; },player,target,event.videoId); if(event.isMine()) send(target,insightResult,event.videoId); else if(event.isOnline()){ player.send(send,target,insightResult,event.videoId); player.wait(); game.pause(); } 'step 2' game.broadcastAll('closeDialog',event.videoId); if(!_status.connectMode&&get.config('auto_mark_identity')&&!target.node.identity.firstChild.innerHTML.length) game.broadcastAll((clientPlayer,clientTarget,insightResult)=>{ if(clientPlayer.isUnderControl(true)) clientTarget.setIdentity(insightResult); },player,target,event.insightResult); var afterInsight=clientTarget=>{ clientTarget.unprompt(); if(clientTarget.nonStratagemInsightFlashing){ delete clientTarget.nonStratagemInsightFlashing; return; } var classList=clientTarget.classList; if(classList.contains('flash-animation-iteration-count-infinite')) classList.remove('flash-animation-iteration-count-infinite'); }; if(event.isMine()) afterInsight(target); else if(event.isOnline()) player.send(afterInsight,target); }, stratagemCamouflage:()=>{ 'step 0' var camouflaged=event.targets=game.players.filter(current=>current.identity=='fan'&&!current.ai.stratagemCamouflage).randomGets(Math.max(Math.round(get.population()/6),1)); camouflaged.forEach(current=>current.ai.stratagemCamouflage=true); var me=game.me; if(event.players.includes(me)&&me.identity=='nei'){ event.videoId=lib.status.videoId++; var rebel=get.translation('fan2'),dialog=ui.create.dialog(`${get.translation(camouflaged)}是${rebel}
`,'forcebutton'); ui.create.spinningIdentityCard('fan',dialog); dialog.videoId=event.videoId; camouflaged.forEach(victim=>{ var classList=victim.classList,nonCamouflageFlashing=classList.contains('flash-animation-iteration-count-infinite'); if(nonCamouflageFlashing) victim.nonCamouflageFlashing=true; else classList.add('flash-animation-iteration-count-infinite'); victim.prompt(rebel,'fan'); }); me.chooseControl('ok').set('dialog',dialog); } game.filterPlayer(current=>{ if(current.identity!='nei') return; var storage=current.storage; if(!storage.zhibi) storage.zhibi=[]; storage.zhibi.addArray(camouflaged); }); 'step 1' targets.forEach(current=>{ if(game.me.identity=='nei'&&get.config('nei_auto_mark_camouflage')) current.setIdentity(); current.unprompt(); if(current.nonCamouflageFlashing){ delete current.nonCamouflageFlashing; return; } var classList=current.classList; if(classList.contains('flash-animation-iteration-count-infinite')) classList.remove('flash-animation-iteration-count-infinite'); }); }, stratagemCamouflageOL:()=>{ 'step 0' var send=(clientCamouflaged,id,online)=>{ var me=game.me; if(me.identity=='nei'){ var storage=me.storage; if(!storage.zhibi) storage.zhibi=[]; storage.zhibi.addArray(clientCamouflaged); var rebel=get.translation('fan2'),dialog=ui.create.dialog(`${get.translation(clientCamouflaged)}是${rebel}
`,'forcebutton'); ui.create.spinningIdentityCard('fan',dialog); dialog.videoId=id; clientCamouflaged.forEach(victim=>{ var classList=victim.classList,nonCamouflageFlashing=classList.contains('flash-animation-iteration-count-infinite'); if(nonCamouflageFlashing) victim.nonCamouflageFlashing=true; else classList.add('flash-animation-iteration-count-infinite'); victim.prompt(rebel,'fan'); }); me.chooseControl('ok').set('dialog',dialog); } else ui.create.dialog('请等待内奸身份确认...').videoId=id; if(online) game.resume(); }; var camouflaged=event.targets=game.players.filter(current=>current.identity=='fan'&&!current.ai.stratagemCamouflage).randomGets(Math.max(Math.round(get.population()/6),1)); camouflaged.forEach(current=>current.ai.stratagemCamouflage=true); event.videoId=lib.status.videoId++; var time=10000; if(lib.configOL&&lib.configOL.choose_timeout) time=parseInt(lib.configOL.choose_timeout)*1000; var aiTargets=event.aiTargets=[]; event.players.forEach(current=>{ current.showTimer(time); if(current.isOnline()){ current.send(send,camouflaged,event.videoId,true); current.wait(); if(current.identity=='nei') event.withOL=true; return; } var me=game.me; if(current==me){ event.withMe=true; send(camouflaged,event.videoId); if(me.identity=='nei') me.wait(); else event._result={ bool:true }; return; } if(current.identity=='nei') aiTargets.push(current); }); if(!aiTargets.length) return; aiTargets.randomSort(); new Promise(resolve=>setTimeout(resolve,Math.ceil(5000+5000*Math.random()))).then(()=>{ var interval=setInterval(()=>{ aiTargets.shift(); if(aiTargets.length) return; clearInterval(interval); if(event.withAI) game.resume(); },Math.ceil(500+500*Math.random())) }); 'step 1' if(event.withMe) game.me.unwait(result); 'step 2' if(event.withOL&&!event.resultOL) game.pause(); 'step 3' if(!event.aiTargets.length) return; event.withAI=true; game.pause(); 'step 4' game.broadcastAll('closeDialog',event.videoId); event.players.forEach(current=>current.hideTimer()); var afterCamouflage=clientCamouflaged=>clientCamouflaged.forEach(victim=>{ victim.unprompt(); if(victim.nonCamouflageFlashing){ delete victim.nonCamouflageFlashing; return; } var classList=victim.classList; if(classList.contains('flash-animation-iteration-count-infinite')) classList.remove('flash-animation-iteration-count-infinite'); }); event.players.forEach(current=>{ if(current.isOnline()){ current.send(afterCamouflage,targets); return; } var me=game.me; if(current==me&&me.identity=='nei') afterCamouflage(targets); }); } } }, get:{ rawAttitude:function(from,to){ var x=0,num=0,temp,i; if(_status.ai.customAttitude){ for(i=0;i<_status.ai.customAttitude.length;i++){ temp=_status.ai.customAttitude[i](from,to); if(temp!=undefined){ x+=temp; num++; } } } if(num){ return x/num; } if(_status.mode=='purple'){ var real=get.realAttitude(from,to); if(from==to||to.identityShown||from.storage.zhibi&&from.storage.zhibi.includes(to)||(_status.yeconfirm&&['rYe','bYe'].includes(to.identity)&&['rYe','bYe'].includes(to.identity))) return real*1.1; return ((to.ai.shown+0.1)*real+(from.identity.slice(0,1)==to.identity.slice(0,1)?3:-3)*(1-to.ai.shown)) } else if(_status.mode=='stratagem'){ var x=0,num=0,temp,i; if(_status.ai.customAttitude){ for(i=0;i<_status.ai.customAttitude.length;i++){ temp=_status.ai.customAttitude[i](from,to); if(temp!=undefined){ x+=temp; num++; } } } if(num){ return x/num; } var real=get.realAttitude(from,to),zhibi=from.storage.zhibi,stratagem_expose=from.storage.stratagem_expose,followCamouflage=true; if(to.ai.shown) return to.ai.shown*(real+(from.identity==to.identity||from.identity=='zhu'&&to.identity=='zhong'||from.identity=='zhong'&&to.identity=='zhu'||from.identity=='nei'&&to.identity=='zhu'&&get.situation()<=1||(to.identity=='nei'&&get.situation()<=0&&['zhu','zhong'].includes(from.identity)||get.situation()>=3&&from.identity=='fan')?2.9:-2.9)) if(from==to||to.identityShown||((stratagem_expose&&stratagem_expose.includes(to))||(zhibi&&zhibi.includes(to)))&&!to.ai.stratagemCamouflage) return real*1.1; if(from.identity=='nei'&&to.ai.stratagemCamouflage) return real*1.1; if(to.identity=='nei'){ if(from.identity=='fan'){ if(get.population('zhong')==0){ if(zhibi){ var dead=game.dead.slice(); for(var current of dead){ if(from.storage.zhibi.includes(current)&¤t.ai.stratagemCamouflage){ if(from.storage.stratagem_expose&&from.storage.stratagem_expose.includes(to)) return -7; } } if(zhibi.includes(to)) return 3; } } } } if(to.identity=='fan'&&from.identity=='nei'&&zhibi.includes(game.zhu)&&game.players.filter(i=>i!=from&&!zhibi.includes(i)).map(i=>i.identity).reduce((p,c)=>(!p.includes(c)?(p.push(c)&&p):p),[]).length==1) return real; for(var fan of game.dead){ if(fan.identity!='fan'||!fan.storage.stratagem_revitalization) continue; for(var current of fan.storage.stratagem_expose){ if(to==current){ return real; } } } if(from.identity=='fan'&&to.identity=='fan'){ if(from.ai.stratagemCamouflage){ var zhu=game.zhu&&game.zhu.isZhu&&game.zhu.identityShown?game.zhu:undefined; if(zhu){ if(zhu.storage.stratagem_expose&&zhu.storage.stratagem_expose.includes(to)) return 0; } if(zhibi&&zhibi.includes(to)) return -7; } if(to.ai.stratagemCamouflage){ var zhu=game.zhu&&game.zhu.isZhu&&game.zhu.identityShown?game.zhu:undefined; if(zhu){ if(zhu.storage.stratagem_expose&&zhu.storage.stratagem_expose.includes(to)) return 0; } if(zhibi&&zhibi.includes(to)) return -7; } } if(from.identity!='nei'&&zhibi&&zhibi.includes(to)&&!to.identityShown&&(followCamouflage&&to.ai.stratagemCamouflage)) return -5; if(from.identity!='nei'&&stratagem_expose&&stratagem_expose.includes(to)&&!to.identityShown) return -5; if(zhibi){ for(var to2 of zhibi){ if(to2.storage.stratagem_expose){ if(to2.ai.stratagemCamouflage){ for(var to3 of to2.storage.stratagem_expose){ if(zhibi.slice().addArray(stratagem_expose).includes(to3)){ if(to==to2){ return real; } } else if(to==to3){ return Math.abs(real+10)/10; } } }else{ for(var to3 of to2.storage.stratagem_expose){ if(!zhibi.slice().addArray(stratagem_expose).includes(to3)&&to==to3){ return get.rawAttitude(to3,to)*Math.sign(real); } } } } } } return Math.max(-1,Math.min(-0.1,(-Math.min(5,to.countCards('hes')/2+1)/5-Math.max(0,5-to.hp)/4)/2)); } //正常身份模式态度 var difficulty=0; if(to==game.me) difficulty=2-get.difficulty(); if(from==to||to.identityShown||(from.storage.dongcha==to)||to.identityShown||from.storage.zhibi&&from.storage.zhibi.includes(to)){ return get.realAttitude(from,to)+difficulty*1.5; } else{ if(from.identity=='zhong'&&to.ai.shown==0&&from.ai.tempIgnore&& !from.ai.tempIgnore.includes(to)){ for(var i=0;i1&&to.hp>fan.hp&&to.countCards('he')>fan.countCards('he')){ return -3; } } return 0; } if(situation>1) return Math.max((situation-8)/3,-2); return Math.min(3,get.population('fan')); case 'fan': if(get.population('fan')==1&&get.population('nei')==1&&game.players.length==3){ var nei; for(var i=0;i1&&nei.hp>to.hp&&nei.countCards('he')>to.countCards('he')){ return 0; } } return -3; } return -4; } break; case 'zhong': switch (identity2){ case 'zhu':return 10; case 'zhong': if(from==to) return 5; if(get.population('zhong')>1) return 3; return 4; case 'nei': if(get.population('fan')==0&&get.population('zhong')==1) return -2; if(get.population('zhong')>=1) return Math.min(3,-situation); return 3; case 'fan':return -8; } break; case 'nei': if(identity2=='zhu'&&game.players.length==2) return -10; if(from!=to&&identity2!='zhu'&&game.players.length==3) return -8; var strategy=get.aiStrategy(); if(strategy==4){ if(from==to) return 10; return 0; } var num; switch (identity2){ case 'zhu': if(strategy==6) return -1; if(strategy==5) return 10; if(to.hp<=0) return 10; if(get.population('fan')==1){ var fan; for(var i=0;i1&&to.hp>fan.hp&&to.countCards('he')>fan.countCards('he')){ return -3; } } return 0; } else{ if(situation>1||get.population('fan')==0) num=0; else num=get.population('fan')+Math.max(0,3-game.zhu.hp); } if(strategy==2) num--; if(strategy==3) num++; return num; case 'zhong': if(strategy==5) return Math.min(0,-situation); if(strategy==6) return Math.max(-1,-situation); if(get.population('fan')==0) num=-5; else if(situation<=0) num=0; else if(game.zhu&&game.zhu.hp<2) num=0; else if(game.zhu&&game.zhu.hp==2) num=-1; else if(game.zhu&&game.zhu.hp<=2&&situation>1) num=-1; else num=-2; if(strategy==2) num--; if(strategy==3) num++; return num; case 'nei': if(from==to) return 10; if(from.ai.friend.includes(to)) return 5; if(get.population('fan')+get.population('zhong')>0) return 0; return -5; case 'fan': if(strategy==5) return Math.max(-1,situation); if(strategy==6) return Math.min(0,situation); if((game.zhu&&game.zhu.hp<=2&&situation<0)||situation<-1) num=-3; else if(situation<0||get.population('zhong')==0) num=-2; else if((game.zhu&&game.zhu.hp>=4&&situation>0)||situation>1) num=1; else num=0; if(strategy==2) num++; if(strategy==3) num--; return num; } break; case 'fan': switch (identity2){ case 'zhu': if(get.population('nei')>0){ if(situation==1) return -6; if(situation>1) return -5; } return -8; case 'zhong': if(game.zhu.hp>=3&&to.hp==1){ return -10; } return -7; case 'nei': if(get.population('fan')==1) return 0; if(get.population('zhong')==0) return -2; if(game.zhu&&game.zhu.hp<=2&&game.zhu.identityShown) return -1; return 3; case 'fan': return 5; } } } //正常身份模式态度 if(!game.zhu){ if(from.identity=='nei'||to.identity=='nei'||from.identity=='commoner'||to.identity=='commoner') return -1; if(from.identity==to.identity) return 6; return -6; } var situation=get.situation(); var identity=from.identity; var identity2=to.identity; if(identity2=='zhu'&&!to.isZhu){ identity2='zhong'; if(from==to) return 10; } if(from!=to&&to.identity=='nei'&&to.ai.shown<1&&(to.ai.identity_mark=='fan'||to.ai.identity_mark=='zhong')){ identity2=to.ai.identity_mark; } if(from.identity!='nei'&&from.identity!='commoner'&&from!=to&&get.population('fan')==0&&identity2=='zhong'){ for(var i=0;i1&&to.hp>fan.hp&&to.countCards('he')>fan.countCards('he')){ return -3; } } return 0; } if(situation>1) return 0; return Math.min(3,get.population('fan')); case 'fan': if(get.population('fan')==1&&get.population('nei')==1&&game.players.length==3){ var nei; for(var i=0;i1&&nei.hp>to.hp&&nei.countCards('he')>to.countCards('he')){ return 0; } } return -3; } return -4; case 'commoner': if(to.identity=='zhong') return 0; if(get.population('fan')==0){ if(to.ai.identity_mark=='zhong'&&to.ai.shown<1) return 0; return -0.5; } if(zhongmode&&to.ai.sizhong&&to.ai.shown<1) return 6; if(game.players.length==3){ var fan; for(var i=0; i1&&to.hp>fan.hp&&to.countCards('he')>fan.countCards('he')){ return -3; } } return 3; } if(situation<0&&game.zhu&&game.zhu.hp<=2) return -3.8; return Math.max(-4,2-get.population('fan')); } break; case 'zhong':case 'mingzhong': switch(identity2){ case 'zhu': return 10; case 'zhong':case 'mingzhong': return 4; case 'nei': if(get.population('fan')==0) return -2; if(zhongmode&&to.ai.sizhong&&to.ai.shown<1) return 6; return Math.min(3,-situation); case 'fan': return -8; case 'commoner': return Math.min(3,Math.max(-3,situation-0.2)); } break; case 'nei': if(identity2=='zhu'&&game.players.length==2) return -10; if(from!=to&&identity2!='zhu'&&identity2!='commoner'&&game.players.length==3) return -8; var strategy=get.aiStrategy(); if(strategy==4){ if(from==to) return 10; return 0; } var num; switch(identity2){ case 'zhu': if(strategy==6) return -1; if(strategy==5) return 10; if(to.hp<=0) return 10; if(get.population('fan')==1){ var fan; for(var i=0;i1&&to.hp>fan.hp&&to.countCards('he')>fan.countCards('he')){ return -3; } } return 0; } else{ if(situation>1||get.population('fan')==0) num=0; else num=get.population('fan')+Math.max(0,3-game.zhu.hp); } if(strategy==2) num--; if(strategy==3) num++; return num; case 'zhong': if(strategy==5) return Math.min(0,-situation); if(strategy==6) return Math.max(-1,-situation); if(get.population('fan')==0) num=-5; else if(situation<=0) num=0; else if(game.zhu&&game.zhu.hp<2) num=0; else if(game.zhu&&game.zhu.hp==2) num=-1; else if(game.zhu&&game.zhu.hp<=2&&situation>1) num=-1; else num=-2; if(zhongmode&&situation<2){ num=4; } if(strategy==2) num--; if(strategy==3) num++; return num; case 'mingzhong': if(zhongmode){ if(from.ai.sizhong==undefined){ from.ai.sizhong=(Math.random()<0.5); } if(from.ai.sizhong) return 6; } if(strategy==5) return Math.min(0,-situation); if(strategy==6) return Math.max(-1,-situation); if(get.population('fan')==0) num=-5; else if(situation<=0) num=0; else num=-3; if(strategy==2) num--; if(strategy==3) num++; return num; case 'nei': if(from==to) return 10; if(from.ai.friend.includes(to)) return 5; if(get.population('fan')+get.population('zhong')>0) return 0; return -5; case 'fan': if(strategy==5) return Math.max(-1,situation); if(strategy==6) return Math.min(0,situation); if((game.zhu&&game.zhu.hp<=2&&situation<0)||situation<-1) num=-3; else if(situation<0||get.population('zhong')+get.population('mingzhong')==0) num=-2; else if((game.zhu&&game.zhu.hp>=4&&situation>0)||situation>1) num=1; else num=0; if(strategy==2) num++; if(strategy==3) num--; return num; case 'commoner': if(game.players.length<=4) return 5; return Math.min(Math.max(-situation,-2),2); } break; case 'fan': switch(identity2){ case 'zhu': if(get.population('nei')>0){ if(situation==1) return -6; if(situation>1) return -5; } return -8; case 'zhong': if(!zhongmode&&game.zhu.hp>=3&&to.hp==1){ return -10; } return -7; case 'mingzhong':return -5; case 'nei': if(zhongmode&&to.ai.sizhong) return -7; if(get.population('fan')==1) return 0; if(get.population('zhong')+get.population('mingzhong')==0) return -7; if(game.zhu&&game.zhu.hp<=2) return -1; return Math.min(3,situation); case 'fan': return 5; case 'commoner': return 2*get.population('fan')-3; } break; case 'commoner': switch(identity2){ case 'zhu': if(situation>0) return 2*Math.min(4,(to.hp+to.countCards('h')/4-2)); if(situation>=-3&&game.zhu) return (to.hp-2)+to.countCards('h')/4; //return Math.min(-0.1,5-game.zhu.hp); return to.hp+to.countCards('h')/3-4; case 'zhong': if(situation>0){ if(to.hp>=2) return Math.min(3,Math.max(1,to.hp+to.countCards('h')/4-4)); else return 0; } return -2; case 'nei': if(game.players.length==3&&get.population('nei')==1) return Math.min(3.5,(to.hp-1.5)+to.countCards('h')/3)-(to.hp<(game.zhu?game.zhu.hp:0)?4:0); if(game.players.length<=4&&get.population('nei')==1) return Math.min(5,(to.hp-1.5)+to.countCards('h')/3); if(situation>0) return -3; return 0; case 'fan': if(situation<0) return to.hp+to.countCards('h')/4-1.7*get.population('fan')+2; else if(situation==0) return 0; return 0.55*get.population('fan')-2.1; case 'commoner': return from==to?10:(to.hp<=2?-2:0); } break; } }, situation:function(absolute){ var i,j,player; var zhuzhong=0,total=0,zhu,fan=0; for(i=0;i4){ php=4; } else if(php>6){ php=6; } j=player.countCards('h')+player.countCards('e')*1.5+php*2; if(player.identity=='zhu'){ zhuzhong+=j*1.2+5; total+=j*1.2+5; zhu=j; } else if(player.identity=='zhong'||player.identity=='mingzhong'){ zhuzhong+=j*0.8+3; total+=j*0.8+3; } else if(player.identity=='fan'){ zhuzhong-=j+4; total+=j+4; fan+=j+4; } } if(absolute) return zhuzhong; var result=parseInt(10*Math.abs(zhuzhong/total)); if(zhuzhong<0) result=-result; if(!game.zhong){ if(zhu<12&&fan>30) result--; if(zhu<6&&fan>15) result--; if(zhu<4) result--; } return result; }, insightResult:function(from,to){ var friend='friend',enemy='enemy'; if(from.identity=='nei') return to.identity; if(to.identity=='nei') return friend; if(from.ai.stratagemCamouflage||to.ai.stratagemCamouflage) return enemy; if(from.identity==to.identity||from.identity=='zhu'&&to.identity=='zhong'||from.identity=='zhong'&&to.identity=='zhu') return friend; return enemy; } }, skill:{ stratagem_gain:{ silent:true, charlotte:true, ruleSkill:true, trigger:{ player:['phaseBegin','damageEnd'] }, content:()=>{ player.changeFury(trigger.name=='damage'?trigger.num:1,true); } }, stratagem_insight:{ trigger:{ source:'damageSource', global:'loseHpEnd' }, filter:(event,player)=>{ if(!player.storage.stratagem_fury) return false; const target=event.player; if(target==player||!target.isIn()||target.identityShown) return false; let source=event.source; if(event.name=='loseHp'){ const trigger=event.getParent()._trigger; if(trigger) source=trigger.source; } return player==source; }, logTarget:'player', prompt2:event=>`消耗1点怒气,洞察${get.translation(event.player)}的身份`, check:(event,player)=>{ const storage=player.storage,zhibi=storage.zhibi; if(zhibi&&zhibi.includes(event.player)) return false; const stratagemExpose=storage.stratagem_expose; if(stratagemExpose&&stratagemExpose.includes(event.player)) return false; if(get.population('zhong')==0&&player.identity=='fan') return false; return Math.abs(get.attitude(player,event.player))<=1; }, content:()=>{ player.changeFury(-1,true); player.insightInto(trigger.player); } }, stratagem_monarchy:{ trigger:{ player:['dying','phaseZhunbeiBegin'], global:'dieAfter', }, forced:true, priority:100, popup:false, unique:true, firstDo:true, silent:true, charlotte:true, ruleSkill:true, filter:(event,player,name)=>{ if(player.storage.stratagem_monarchy||player.identity!='zhu') return false; if(name=='dieAfter') return game.dead.length>=Math.max(Math.round(get.population()/3),2); return name=='dying'||game.roundNumber>=Math.max(Math.round(get.population()/2),3); }, content:()=>{ 'step 0' if(event.triggername=='dying') game.delayx(); 'step 1' player.storage.stratagem_monarchy=true; game.broadcastAll(clientPlayer=>{ if(!game.zhu) game.zhu=clientPlayer; clientPlayer.identityShown=true; clientPlayer.ai.shown=1; clientPlayer.setIdentity(); clientPlayer.isZhu=true; clientPlayer.node.identity.classList.remove('guessing'); var config=lib.config; if(config.animation&&!config.low_performance) clientPlayer.$legend(); var clickingIdentity=_status.clickingidentity; if(!clickingIdentity||clickingIdentity[0]!=clientPlayer) return; clickingIdentity[1].forEach(element=>{ element.delete(); element.style.transform=''; }); delete _status.clickingidentity; },player); game.addVideo('showIdentity',player,'zhu'); game.delay(2); player.playerfocus(1000); event.trigger('zhuUpdate'); 'step 2' player.recover(); player.draw(); player.getStockSkills(true,true).forEach(stockSkill=>{ if(player.hasSkill(stockSkill)) return; var info=get.info(stockSkill); if(!info||!info.zhuSkill) return; player.addSkillLog(stockSkill); }); } }, stratagem_revitalization:{ trigger:{ player:'dying', }, forced:true, unique:true, silent:true, charlotte:true, ruleSkill:true, filter:(event,player)=>{ const storage=player.storage; return !storage.stratagem_revitalization&&player.ai.stratagemCamouflage&&game.dead.length=2; }, content:()=>{ 'step 0' game.delayx(); 'step 1' player.storage.stratagem_revitalization=true; game.broadcastAll(clientPlayer=>{ clientPlayer.identityShown=true; clientPlayer.ai.shown=1; clientPlayer.setIdentity(); clientPlayer.node.identity.classList.remove('guessing'); if(lib.config.animation&&!lib.config.low_performance) clientPlayer.$thunder(); },player); game.addVideo('showIdentity',player,'fan'); game.delay(2); player.playerfocus(800); 'step 2' player.changeFury(-player.storage.stratagem_fury,true); player.discard(player.getCards('hej')); player.link(false); player.turnOver(false); player.recover(2-player.hp); player.draw(3); } }, stratagem_expose:{ trigger:{player:'useCard'}, forced:true, silent:true, popup:false, filter:(event,player)=>{ const targets=event.targets; if(targets.length!=1) return false; const target=targets[0]; return target==player&&(target.identityShown||player.storage.zhibi.includes(target)||game.hasPlayer2(current=>{ if(!current.identityShown) return false; const storage=current.storage; return (storage.stratagem_revitalization||storage.stratagem_monarchy)&&storage.stratagem_expose.includes(target); })); }, content:()=>{ var storage=trigger.targets[0].storage; if(!storage.stratagem_expose) storage.stratagem_expose=[]; storage.stratagem_expose.add(player); } }, yexinbilu:{ enable:'phaseUse', filter:function(event,player){ return player.identity=='rYe'||player.identity=='bYe'; }, skillAnimation:'legend', animationColor:'thunder', content:function(){ game.removeGlobalSkill('yexinbilu'); player.yexinbilu(); }, ai:{ order:10, result:{ player:function(player){ return 1-game.countPlayer(function(current){ return current!=player&&(current.identity=='rYe'||current.identity=='bYe')&&(current==game.me||current.isOnline()); }) }, }, }, }, identity_junshi:{ name:'军师', mark:true, intro:{ content:'准备阶段开始时,可以观看牌堆顶的三张牌,然后将这些牌以任意顺序置于牌堆顶或牌堆底' }, trigger:{player:'phaseZhunbeiBegin'}, silent:true, content:function(){ "step 0" var cards=get.cards(3); game.cardsGotoOrdering(cards); var next=player.chooseToMove(); next.set('list',[ ['牌堆顶',cards], ['牌堆底'], ]); next.set('prompt','观星:点击将牌移动到牌堆顶或牌堆底'); next.processAI=function(list){ var cards=list[0][1],player=_status.event.player; var top=[]; var judges=player.getCards('j'); var stopped=false; if(!player.hasWuxie()){ for(var i=0;i0; }).set('ai',function(target){ var player=_status.event.player; var att=get.attitude(player,target); if(att>0){ var js=target.getCards('j'); if(js.length){ var jj=js[0].viewAs?{name:js[0].viewAs}:js[0]; if(jj.name=='guohe'||js.length>1||get.effect(target,jj,target,player)<0){ return 2*att; } } if(target.getEquip('baiyin')&&target.isDamaged()&& get.recoverEffect(target,player,player)>0){ if(target.hp==1&&!target.hujia) return 1.6*att; if(target.hp==2) return 0.01*att; return 0; } } var es=target.getCards('e'); var noe=target.hasSkillTag('noe'); var noe2=(es.length==1&&es[0].name=='baiyin'&&target.isDamaged()); if(noe||noe2) return 0; if(att<=0&&!es.length) return 1.5*att; return -1.5*att; }); 'step 1' if(result.bool){ event.target=result.targets[0]; event.target.addExpose(0.1); player.logSkill('dongcha',event.target); game.delayx(); } else{ event.finish(); } 'step 2' if(event.target){ player.discardPlayerCard('ej',true,event.target); } }, group:['dongcha_begin','dongcha_log'], subSkill:{ begin:{ trigger:{global:'gameStart'}, forced:true, popup:false, content:function(){ var list=[]; for(var i=0;i0; }, logTarget:'player', content:function(){ 'step 0' trigger.player.gainMaxHp(); 'step 1' var dh=player.hp-trigger.player.hp; if(dh>0){ trigger.player.recover(dh); } 'step 2' var cards=player.getCards('he'); if(cards.length){ trigger.player.gain(cards,player); player.$giveAuto(cards,trigger.player); } 'step 3' trigger.cancel(); player.die(); } } }, help:{ '身份模式':'
选项
  • 加强主公
    反贼人数多于2时主公会额外增加一个技能(每个主公的额外技能固定,非常备主公增加天命)'+ '
  • 特殊身份
    • 军师:忠臣身份。只要军师存活,主公在准备阶段开始时,可以观看牌堆顶的三张牌,然后将这些牌以任意顺序置于牌堆顶或牌堆底
    • 大将:忠臣身份。只要大将存活,主公手牌上限+1
    • 贼首:反贼身份,只要贼首存活,主公手牌上限-1
'+ '
  • 平民身份
    英盗版三国杀于2017标准版中提出的新概念。平民的获胜条件为:当其他身份的角色达成了其获胜条件,且你存活,你也获胜;同时内奸的获胜条件改为:主公死亡时,场上所有忠臣和反贼均已死亡。即内奸可以和与平民共同胜利。杀死平民的角色的奖惩为:摸两张牌。'+ '
  • 年机制
    英盗版三国杀于2019标准版中提出的新概念。“年”是一个全局概念,游戏开始时为第一年,当牌堆洗牌时,年数+1。一局游戏的限定年数为本局游戏开始时玩家总数。当年数增加后,若当前年数已超过限定年数,则主忠方直接获胜,若平民存活则平民也获胜。', '明忠模式':'
    明忠模式(忠胆英杰)
    • 本模式需要8名玩家进行游戏,使用的身份牌为:1主公、2忠臣、4反贼和1内奸。游戏开始时,每名玩家随机获得一个身份,由系统随机选择一名忠臣身份的玩家亮出身份(将忠臣牌正面朝上放在面前),其他身份(包括主公)的玩家不亮出身份。
    • '+ '首先由亮出身份的忠臣玩家随机获得六张武将牌,挑选一名角色,并将选好的武将牌展示给其他玩家。之后其余每名玩家随机获得三张武将牌,各自从其中挑选一张同时亮出
    • '+ '亮出身份牌的忠臣增加1点体力上限。角色濒死和死亡的结算及胜利条件与普通身份局相同。', '谋攻模式':'
      模式命名由来
      • 《谋攻篇》一词出自《孙子兵法·谋攻篇》,是春秋时期兵法家孙武创作的一篇散文。《谋攻篇》故知胜有五:知可以战与不可以战者胜,识众寡之用者胜,上下同欲者胜,以虞待不虞者胜,将能而君不御者胜。
      '+ '
      游戏规则
      • 谋攻篇模式为六名玩家参与的全暗身份模式,引入新机制“怒气”,玩家可以消耗怒气探查其他角色的身份是敌人或者队友,或使用怒气强化手牌,以达到识别出队友并击杀敌人的目标。'+ '
      • 各身份玩家的胜利条件与身份局中对应身份的胜利条件一致,且该模式下没有奖惩。'+ '
      • 当主公进入濒死、场上有两名角色阵亡、第三轮的主公准备阶段,主公将会翻开身份牌,回复1点体力并摸一张牌,并获得武将牌上的主公技。'+ '
      • 内奸在游戏开始时将会得知一名反贼的身份,并令该反贼被“伪装”。本局游戏内,被“伪装”的反贼在被任何人探查身份时,结果都提示为“敌人”。作为补偿,其第一次进入濒死时,若场上没有角色死亡且其怒气值不小于2,其弃置区域内所有牌,重置武将牌,将体力回复至2点并摸三张牌。'+ '
      • 特殊地,内奸在被所有角色探查时,都提示为“队友”;内奸在进行探查时,直接得知目标的身份。
      '+ '
      新机制“怒气”
      • 一名角色在回合开始时或受到1点伤害后,将获得1点怒气;怒气上限为3。
      • 一名角色令其他角色扣减体力后,该角色可以消耗1点怒气,查探扣减体力的角色是敌或友。
      '+ '
      强化卡牌规则
      • 在第二轮游戏开始后,当你需要使用一张“强化表”内的牌时,你可以通过消耗怒气将此牌强化。'+ '
      • 可强化卡牌
          '+ '
        • 【杀】:消耗1点怒气进行强化,你令响应此杀所需使用的【闪】数+1'+ '
        • 【闪】:消耗1点怒气进行强化,使用时视为两张【闪】的效果'+ '
        • 【决斗】:消耗2点怒气进行强化,对此牌的目标造成伤害时,伤害+1'+ '
        • 【火攻】:消耗2点怒气进行强化,造成的伤害+1'+ '
        • 【桃】:消耗3点怒气进行强化,回复的体力+1
      ', '3v3v2':'
      3v3v2模式
      • 游戏准备
        本模式需要8名玩家进行游戏。游戏开始前,所有玩家随机分成两组,每组四人,分别称为「冷色阵营」和「暖色阵营」,然后分发身份牌,抽取到「主帅」身份的玩家亮出身份牌。'+ '
      • 身份牌
        每组的身份分为四种。
        主帅(主)和前锋(忠):联合对方阵营的细作,击杀己方细作,对方阵营的主帅和前锋以及所有的野心家。
        细作(内):帮助对方阵营的主帅和前锋,击杀对方细作,己方阵营的主帅和前锋以及所有的野心家。
        野心家(野):联合对方阵营中的野心家,击杀所有其他角色,成为最后的生还者。
        '+ '
      • 胜负判定
        冷色主帅,先锋和暖色细作在所有野心家和对方主帅全部阵亡后视为胜利,在冷色主帅阵亡后视为游戏失败。
        暖色主帅,先锋和冷色细作在所有野心家和对方主帅阵亡后视为胜利,在暖色主帅阵亡后视为失败。
        野心家在所有不为野心家的角色阵亡后视为胜利,在双方主帅全部阵亡而有非野心家角色存活时失败。
        当有角色阵亡后,若有角色满足胜利条件,游戏结束。若所有角色均满足失败条件,则游戏平局。若一名角色满足失败条件,即使其满足胜利条件,也视为游戏失败。
        '+ '
      • 游戏流程
        在「游戏准备」中的工作完成后,冷色主帅选择一个势力,然后暖色主帅选择一个其他势力,作为双方各自的势力将池。
        双方主帅从各自的势力将池中获得两张常备主公武将牌和四张非常备主公武将牌,然后选择一张作为武将牌,将其他的武将牌放回势力将池并洗混。然后双方的其他玩家从各自的势力将池中随机获得五张武将牌,选择一张作为自己的武将牌。
        暖色主帅成为游戏的一号位,双方主帅各加1点体力和体力上限。七号位和八号位的起始手牌+1。
        当场上第一次有玩家死亡时,野心家确认彼此的身份牌,然后获得技能〖野心毕露〗:出牌阶段,你可以明置身份牌,加1点体力上限和体力值。若如此做,所有的野心家失去技能〖野心毕露〗
        '+'
      • 击杀奖惩
        杀死颜色不同的主帅的角色回复1点体力,杀死颜色不同的先锋的角色摸两张牌,杀死颜色相同的细作的角色摸三张牌,杀死颜色相同的先锋的主帅弃置所有手牌。
        '+ '
      • 制作团队
        游戏出品:紫星居
        游戏设计:食茸貳拾肆
        游戏开发:食茸貳拾肆、紫髯的小乔、聆星Mine、空城琴音依旧弥漫、丽景原同志、雪之彩翼、拉普拉斯、明月照沟渠
        程序化:无名杀
        鸣谢:荆哲、魔风、萨巴鲁酱、这就是秋夜
    ', } }; });