'use strict'; mode.versus={ init:function(){ if(get.config('versus_mode')=='jiange'){ lib.characterPack.mode_versus={ boss_liedixuande:['male','shu',5,['boss_lingfeng','boss_jizhen'],['jiangeboss','hiddenboss','bossallowed'],'shu'], boss_gongshenyueying:['female','shu',4,['boss_gongshenjg','boss_jingmiao','boss_zhinang'],['jiangeboss','hiddenboss','bossallowed'],'shu'], boss_tianhoukongming:['male','shu',4,['boss_biantian','bazhen'],['jiangeboss','hiddenboss','bossallowed'],'shu'], boss_yuhuoshiyuan:['male','shu',4,['boss_yuhuojg','boss_qiwu','boss_tianyujg'],['jiangeboss','hiddenboss','bossallowed'],'shu'], boss_qiaokuijunyi:['male','wei',4,['boss_huodi','boss_jueji'],['jiangeboss','hiddenboss','bossallowed'],'wei'], boss_jiarenzidan:['male','wei',5,['boss_chiying','boss_jingfan'],['jiangeboss','hiddenboss','bossallowed'],'wei'], boss_duanyuzhongda:['male','wei',5,['boss_fanshi','boss_xuanlei','boss_skonghun'],['jiangeboss','hiddenboss','bossallowed'],'wei'], boss_juechenmiaocai:['male','wei',4,['boss_chuanyun','boss_leili','boss_fengxing'],['jiangeboss','hiddenboss','bossallowed'],'wei'], boss_jileibaihu:['male','shu',4,['boss_jiguan','boss_zhenwei','boss_benlei'],['jiangemech','hiddenboss','bossallowed'],'shu'], boss_yunpingqinglong:['male','shu',4,['boss_jiguan','boss_mojianjg'],['jiangemech','hiddenboss','bossallowed'],'shu'], boss_lingjiaxuanwu:['male','shu',5,['boss_jiguan','yizhong','boss_lingyu'],['jiangemech','hiddenboss','bossallowed'],'shu'], boss_chiyuzhuque:['male','shu',5,['boss_jiguan','boss_yuhuojg','boss_tianyun'],['jiangemech','hiddenboss','bossallowed'],'shu'], boss_fudibian:['male','wei',4,['boss_jiguan','boss_didongjg'],['jiangemech','hiddenboss','bossallowed'],'wei'], boss_tuntianchiwen:['male','wei',5,['boss_jiguan','boss_tanshi','boss_tunshi'],['jiangemech','hiddenboss','bossallowed'],'wei'], boss_shihuosuanni:['male','wei',3,['boss_jiguan','boss_lianyujg'],['jiangemech','hiddenboss','bossallowed'],'wei'], boss_lieshiyazi:['male','wei',4,['boss_jiguan','boss_nailuo'],['jiangemech','hiddenboss','bossallowed'],'wei'], }; lib.characterIntro.boss_liedixuande=lib.characterIntro.liubei; lib.characterIntro.boss_gongshenyueying=lib.characterIntro.huangyueying; lib.characterIntro.boss_tianhoukongming=lib.characterIntro.shen_zhugeliang; lib.characterIntro.boss_yuhuoshiyuan=lib.characterIntro.pangtong; lib.characterIntro.boss_qiaokuijunyi=lib.characterIntro.zhenghe; lib.characterIntro.boss_jiarenzidan=lib.characterIntro.caozhen; lib.characterIntro.boss_duanyuzhongda=lib.characterIntro.simayi; lib.characterIntro.boss_juechenmiaocai=lib.characterIntro.xiahouyuan; } }, start:function(){ "step 0" _status.mode=get.config('versus_mode'); if(_status.brawl&&_status.brawl.submode){ _status.mode=_status.brawl.submode; } if(lib.config.test_game){ _status.mode='standard'; } "step 1" var playback=localStorage.getItem(lib.configprefix+'playback'); if(playback){ 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(); return; } if(_status.connectMode){ game.waitForPlayer(function(){ switch(lib.configOL.versus_mode){ case '1v1':lib.configOL.number=2;break; case '2v2':lib.configOL.number=4;break; case '3v3':lib.configOL.number=6;break; case '4v4':lib.configOL.number=8;break; } }); } else if(_status.mode=='jiange'||_status.mode=='four'){ if(_status.mode=='four'&&!get.config('enable_all_cards_four')){ lib.card.list=lib.cardsFour; } game.prepareArena(8); } else if(_status.mode=='two'){ game.prepareArena(4); } else if(_status.mode=='three'){ if(!get.config('enable_all_cards')){ lib.translate.wuzhong_info+='若对方存活角色多于己方,则额外摸一张牌'; lib.translate.zhuge_info='锁定技,出牌阶段,你使用杀的次数上限+3'; lib.card.list=lib.cardsThree; } ui.create.cardsAsync(); game.finishCards(); } else{ if(lib.storage.choice==undefined) game.save('choice',20); if(lib.storage.zhu==undefined) game.save('zhu',true); if(lib.storage.noreplace_end==undefined) game.save('noreplace_end',true); if(get.config('first_less')==undefined) game.saveConfig('first_less',true,true); if(lib.storage.autoreplaceinnerhtml==undefined) game.save('autoreplaceinnerhtml',true); if(lib.storage.single_control==undefined) game.save('single_control',true); if(lib.storage.number==undefined) game.save('number',3); if(lib.storage.versus_reward==undefined) game.save('versus_reward',3); if(lib.storage.versus_punish==undefined) game.save('versus_punish','弃牌'); if(lib.storage.replace_number==undefined) game.save('replace_number',3); switch(lib.storage.seat_order){ case '交叉':lib.storage.cross_seat=true;lib.storage.random_seat=false;break; case '随机':lib.storage.cross_seat=false;lib.storage.random_seat=true;break; default:lib.storage.cross_seat=false;lib.storage.random_seat=false; } game.save('only_zhu',true); ui.wuxie.hide(); ui.create.cardsAsync(); game.finishCards(); } // game.delay(); "step 2" if(_status.connectMode){ if(lib.configOL.versus_mode=='1v1'){ game.randomMapOL('hidden'); } else{ game.randomMapOL(); } } else if(_status.mode=='four'){ var list=[ ['zhong','ezhong','ezhong','zhong','zhong','ezhong','ezhong','zhong'], ['zhong','ezhong','zhong','ezhong','ezhong','zhong','ezhong','zhong'], ['zhong','ezhong','ezhong','zhong','ezhong','zhong','zhong','ezhong'], ['zhong','ezhong','zhong','ezhong','zhong','ezhong','zhong','ezhong'], ['zhong','ezhong','ezhong','zhong','ezhong','zhong','ezhong','zhong'], ].randomGet(); var rand1=Math.floor(Math.random()*4); var rand2=Math.floor(Math.random()*4); for(var i=0;i=8){ j-=8; } if(list[i][0]=='w'){ game.players[j].side=true; game.players[j].setIdentity('wei'); game.players[j].identity='wei'; } else{ game.players[j].side=false; game.players[j].setIdentity('shu'); game.players[j].identity='shu'; } if(list[i].indexOf('mech')!=-1){ game.players[j].type='mech'; } else if(list[i].indexOf('boss')!=-1){ game.players[j].type='boss'; } else{ game.players[j].type='human'; } game.players[i].getId(); } game.chooseCharacterJiange(); } else if(_status.mode=='three'){ game.chooseCharacterThree(); } else{ game.chooseCharacter(); } if(!_status.connectMode&&_status.brawl&&_status.brawl.chooseCharacterBefore){ _status.brawl.chooseCharacterBefore(); } "step 3" var players=get.players(lib.sort.position); var info=[]; for(var i=0;i=4); } game.addVideo('init',null,info); event.trigger('gameStart'); if(_status.connectMode){ if(_status.mode=='1v1'){ _status.first_less=true; game.gameDraw(_status.firstChoose.next); game.phaseLoop(_status.firstChoose.next); } else if(_status.mode=='2v2'||_status.mode=='3v3'){ _status.first_less=true; var firstChoose=game.players.randomGet(); if(firstChoose.next.side==firstChoose.side){ firstChoose=firstChoose.next; } game.gameDraw(firstChoose); if(lib.configOL.replace_handcard){ game.replaceHandcards(firstChoose.previous); } game.phaseLoop(firstChoose); } else if(_status.mode=='4v4'){ game.gameDraw(_status.firstAct,function(player){ if(player==_status.firstAct.previousSeat){ return 5; } return 4; }); game.replaceHandcards(_status.firstAct.previous,_status.firstAct.previous.previous); game.phaseLoop(_status.firstAct); } event.finish(); } else{ if(_status.mode=='two'){ _status.first_less=true; _status.first_less_forced=true; var firstChoose=_status.firstAct; game.gameDraw(firstChoose); if(get.config('replace_handcard_two')){ game.replaceHandcards(firstChoose.previous); } game.phaseLoop(firstChoose); } else if(_status.mode=='four'){ game.gameDraw(_status.firstAct,function(player){ if(player==_status.firstAct.previousSeat){ return 5; } return 4; }); if(game.me==_status.firstAct.previous||game.me==_status.firstAct.previous.previous){ game.me.chooseBool('是否置换手牌?'); event.replaceCard=true; } } else if(_status.mode=='jiange'){ var firstAct; for(var i=0;i1){ for(var i=0;i=lib.storage.number){ actcount=i-lib.storage.number; } else{ actcount=i+lib.storage.number; } } if(actcount>0){ actcount--; } else{ actcount=game.players.length-1; } firstAct=game.players[actcount]; break; } } } else{ firstAct=game.players[Math.floor(Math.random()*game.players.length)]; } } game.gameDraw(firstAct,4); _status.first_less=true; _status.round=0; if(lib.storage.single_control){ game.addGlobalSkill('autoswap'); if(game.players.length>2&&lib.config.show_handcardbutton){ ui.versushs=ui.create.system('手牌',null,true); lib.setPopped(ui.versushs,game.versusHoverHandcards,220); } } _status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true); _status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true); lib.setPopped(_status.friendCount,game.versusHoverFriend); lib.setPopped(_status.enemyCount,game.versusHoverEnemy); if(lib.storage.zhu){ game.versusPhaseLoop(firstAct); } else{ game.versusPhaseLoop(firstAct); } } if(_status.mode!='four'){ event.finish(); } } "step 4" if(event.replaceCard&&result.bool){ var hs=game.me.getCards('h'); for(var i=0;i侯选人数:'+lib.configOL.choice_num+'人'); uiintro.add('
替补人数:'+lib.configOL.replace_number+'人'); } else if(lib.configOL.versus_mode=='2v2'||lib.configOL.versus_mode=='3v3'){ uiintro.add('
四号位换牌:'+(lib.configOL.replace_handcard?'开启':'关闭')); } 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'; }, getVideoName:function(){ var str=get.translation(game.me.name); if(game.me.name2){ str+='/'+get.translation(game.me.name2); } var str2; switch(_status.mode){ case 'two':str2='欢乐成双';break; case 'three':str2='统率三军';break; case 'four':str2='对决 - 4v4';break; default:str2='对决 - '+lib.storage.number+'v'+lib.storage.number } return [str,str2]; }, addRecord:function(bool){ if(typeof bool=='boolean'){ var data=lib.config.gameRecord.versus.data; var identity=get.cnNumber(lib.storage.number)+'人'; if(!data[identity]){ data[identity]=[0,0]; } if(bool){ data[identity][0]++; } else{ data[identity][1]++; } var list=['一人','两人','三人']; var str=''; for(var i=0;i'; } } lib.config.gameRecord.versus.str=str; game.saveConfig('gameRecord',lib.config.gameRecord); } }, chooseCharacterJiange:function(){ var next=game.createEvent('chooseCharacter',false); next.showConfig=true; next.setContent(function(){ 'step 0' ui.arena.classList.add('choose-character'); for(var i in lib.characterPack.mode_versus){ lib.character[i]=lib.characterPack.mode_versus[i]; if(!lib.character[i][4]){ lib.character[i][4]=[]; } } 'step 1' for(var i in lib.skill){ if(lib.skill[i].changeSeat){ lib.skill[i]={}; if(lib.translate[i+'_info']){ lib.translate[i+'_info']='此模式下不可用'; } } } var list={ weilist:[],shulist:[], weimech:[],shumech:[], weiboss:[],shuboss:[], } event.list=list; if(lib.characterPack.boss){ for(var i in lib.characterPack.boss){ if(!lib.character[i]&&lib.characterPack.boss[i][4]){ if(lib.characterPack.boss[i][4].contains('jiangeboss')|| lib.characterPack.boss[i][4].contains('jiangemech')){ lib.character[i]=lib.characterPack.boss[i]; } } } } for(var i in lib.character){ if(lib.character[i][4]){ if(lib.character[i][4].contains('jiangeboss')){ list[lib.character[i][1]+'boss'].push(i);continue; } else if(lib.character[i][4].contains('jiangemech')){ list[lib.character[i][1]+'mech'].push(i);continue; } } if(lib.filter.characterDisabled(i)) continue; if(lib.character[i][1]=='wei'){ list.weilist.push(i); } else if(lib.character[i][1]=='shu'){ list.shulist.push(i); } } var dialog; switch(game.me.type){ case 'human': for(var i=0;i'; td.link=i-1; if(get.distance(_status.firstAct,game.me,'absolute')===i-1){ td.classList.add('thundertext'); } td.addEventListener(lib.config.touchscreen?'touchend':'click',function(){ if(_status.dragged) return; if(_status.justdragged) return; if(get.distance(_status.firstAct,game.me,'absolute')==this.link) return; var current=this.parentNode.querySelector('.thundertext'); if(current){ current.classList.remove('thundertext'); } this.classList.add('thundertext'); _status.firstAct=game.me; for(var i=0;i当前分数:
'+(lib.storage.ladder.current+(_status.ladder_tmp?40:0))+'
'); uiintro.add('
历史最高:
'+lib.storage.ladder.top+'
'); uiintro.content.lastChild.style.paddingBottom='8px'; return uiintro; },180); _status.ladder=true; _status.ladder_mmr=0; } if(get.config('four_phaseswap')){ game.addGlobalSkill('autoswap'); if(lib.config.show_handcardbutton){ ui.versushs=ui.create.system('手牌',null,true); lib.setPopped(ui.versushs,game.versusHoverHandcards,220); } } "step 1" if(event.current==game.me||(event.four_assign&&event.current.side==game.me.side)){ var dialog=event.xdialog; if(!dialog){ if(get.config('expand_dialog')){ dialog=event.xdialog||ui.create.characterDialog(event.filterChoice,'expandall'); } else{ dialog=event.xdialog||ui.create.characterDialog(event.filterChoice); } } var names=[]; for(var i=0;ib?1:-1; } if(lib.storage.choice=='∞'){ list.sort(sortByGroup); } else{ list.randomSort(); } _status.list=list; var choice=(lib.storage.choice=='∞')?list.length:lib.storage.choice; event.dialog=ui.create.dialog('选择角色',[list.slice(0,choice),'character']); event.dialog.classList.add('fixed'); // for(var i=0;i=dialog.versus_number.link+dialog.replace_number.link){ event.fill.firstChild.innerHTML='开始'; _status.choosefinished=true; if(ui.cheat){ ui.cheat.close(); delete ui.cheat; } } game.save('zhu',dialog.versus_zhu.link); if(lib.storage.zhu){ // dialog.versus_only_zhu.parentNode.classList.remove('disabled'); dialog.versus_main_zhu.parentNode.classList.remove('disabled'); } else{ // dialog.versus_only_zhu.parentNode.classList.add('disabled'); dialog.versus_main_zhu.parentNode.classList.add('disabled'); } // game.save('only_zhu',dialog.versus_only_zhu.link); game.save('main_zhu',dialog.versus_main_zhu.link); game.save('assign_enemy',dialog.versus_assign_enemy.link); game.save('seat_order',dialog.versus_seat_order.link); // game.save('cross_seat',dialog.versus_cross_seat.link); game.save('noreplace_end',dialog.versus_noreplace_end.link); game.save('single_control',dialog.versus_single_control.link); switch(lib.storage.seat_order){ case '交叉':lib.storage.cross_seat=true;lib.storage.random_seat=false;break; case '随机':lib.storage.cross_seat=false;lib.storage.random_seat=true;break; default:lib.storage.cross_seat=false;lib.storage.random_seat=false; } game.saveConfig('first_less',dialog.versus_first_less.link,true); game.save('number',dialog.versus_number.link); game.save('versus_reward',dialog.versus_reward.link); game.save('versus_punish',dialog.versus_punish.link); game.save('replace_number',dialog.replace_number.link); game.save('choice',dialog.choice.link); var count,i; if(dialog.buttons.length>lib.storage.choice){ count=dialog.buttons.length-lib.storage.choice; var removed=[]; for(i=dialog.buttons.length-1;i>=0&&count>0;i--){ if(dialog.buttons[i].classList.contains('target')==false&& dialog.buttons[i].classList.contains('glow')==false){ dialog.buttons[i].remove(); _status.list.remove(dialog.buttons[i].link); removed.push(dialog.buttons[i].link) dialog.buttons.splice(i,1); count--; } } for(i=0;i=4){ ui.arena.setNumber(parseInt(ui.arena.dataset.number)+1); for(var i=0;i=4){ // ui.fakemebg.show(); game.onSwapControl(); } }); }, chooseCharacterOL:function(){ switch(lib.configOL.versus_mode){ case '1v1':game.chooseCharacterOL1();break; case '2v2':game.chooseCharacterOL2();break; case '3v3':game.chooseCharacterOL3();break; case '4v4':game.chooseCharacterOL4();break; } }, chooseCharacterOL4:function(){ var next=game.createEvent('chooseCharacter',false); next.setContent(function(){ "step 0" var list=[ ['zhong','ezhong','ezhong','zhong','zhong','ezhong','ezhong','zhong'], ['zhong','ezhong','zhong','ezhong','ezhong','zhong','ezhong','zhong'], ['zhong','ezhong','ezhong','zhong','ezhong','zhong','zhong','ezhong'], ['zhong','ezhong','zhong','ezhong','zhong','ezhong','zhong','ezhong'], ['zhong','ezhong','ezhong','zhong','ezhong','zhong','ezhong','zhong'], ].randomGet(); var rand1=Math.floor(Math.random()*4); var rand2=Math.floor(Math.random()*4); for(var i=0;i0.4){ return (rank>=6)?Math.random():-Math.random(); } else if(seed>0.1){ return (rank>=4&&rank<6)?Math.random():-Math.random(); } else{ return (rank<4)?Math.random():-Math.random(); } }).set('selected',_status.event.selected).set('dialog',event.videoId).set('seed',Math.random()); "step 2" event.selected.push(result.links[0]); game.broadcastAll(function(player,name,zhu){ player.classList.remove('selectedx'); player.init(name); if(player.node.name_seat){ player.node.name_seat.remove(); } },event.current,result.links[0]); if(event.current.identity=='zhu'){ event.current.hp++; event.current.maxHp++; event.current.update(); } event.current.classList.remove('selectedx'); for(var i=0;i=2*Math.max(game.friend.length,game.enemy.length)){ _status.round=0; for(var i=0;ib.countCards('j')) return 1; return a.hp-b.hp; }) event.player=list[0]; event.goto(0); } else{ game.me.chooseTarget('选择要行动的角色',true,function(card,player,target){ return (target.classList.contains('acted')==false&&target.side==game.me.side); }).includeOut=true; } } else{ event.player=event.player.next; event.goto(0); } "step 2" event.player=result.targets[0]; event.goto(0); }); }, phaseLoopJiange:function(){ var next=game.createEvent('phaseLoop'); next.num=0; next.setContent(function(){ if(event.num>=8){ event.num-=8; } var player=_status.actlist[event.num]; if(player.isAlive()){ player.phase(); } event.num++; event.redo(); }); }, replacePlayerOL:function(player){ var next=game.createEvent('replacePlayer'); next.source=player; next.setContent('replacePlayerOL'); }, replacePlayer:function(player){ var next=game.createEvent('replacePlayer'); next.source=player; next.setContent('replacePlayer'); }, replacePlayerTwo:function(player,character){ var next=game.createEvent('replacePlayerTwo'); next.source=player; next.character=character; next.setContent('replacePlayerTwo'); }, versusClickToSwap:function(e){ if(_status.dragged) return; if(this.link==game.me){ if(!this.classList.contains('buttonclick')){ this.animate('buttonclick'); } } else if(_status.event.player==game.me&&!_status.auto){ game.me.popup('请稍后再换人'); e.stopPropagation(); } else{ game.modeSwapPlayer(this.link); } }, versusHoverEnemy:function(){ var uiintro=ui.create.dialog('hidden'); if(_status.enemyDied.length){ uiintro.add('已阵亡'); uiintro.add([_status.enemyDied,'character']); } uiintro.add('未上场'); if(_status.enemy.length){ uiintro.add([_status.enemy,'character']); } else{ uiintro.add('(无)') } return uiintro; }, versusHoverFriend:function(){ var uiintro=ui.create.dialog('hidden'); if(_status.friendDied.length){ uiintro.add('已阵亡'); uiintro.add([_status.friendDied,'character']); } uiintro.add('未上场'); if(_status.friend.length){ uiintro.add([_status.friend,'character']); } else{ uiintro.add('(无)') } return uiintro; }, versusHoverHandcards:function(){ var uiintro=ui.create.dialog('hidden'); for(var i=0;i0){ return att+5; } return -1; } if(player.isTurnedOver()){ return 5-att; } return -att; }; "step 1" if(result.bool){ player.logSkill('boss_didongjg',result.targets); result.targets[0].turnOver(); } }, ai:{ threaten:1.7 } }, boss_lianyujg:{ trigger:{player:'phaseEnd'}, unique:true, content:function(){ "step 0" event.players=get.players(player); "step 1" if(event.players.length){ var current=event.players.shift(); if(current.isEnemyOf(player)){ player.line(current,'fire'); current.damage('fire'); } event.redo(); } }, ai:{ threaten:2 } }, boss_mojianjg:{ trigger:{player:'phaseUseBegin'}, content:function(){ var list=game.filterPlayer(function(current){ return player.canUse('wanjian',current)&¤t.isEnemyOf(player); }); list.sort(lib.sort.seat); player.useCard({name:'wanjian'},list); }, ai:{ threaten:1.8 } }, boss_qiwu:{ audio:true, trigger:{player:'useCard'}, direct:true, filter:function(event,player){ if(get.suit(event.card)=='club'){ return game.hasPlayer(function(current){ return current.isFriendOf(player)&¤t.isDamaged(); }); } return false; }, content:function(){ "step 0" var noneed=(trigger.card.name=='tao'&&trigger.targets[0]==player&&player.hp==player.maxHp-1); player.chooseTarget(get.prompt('boss_qiwu'),function(card,player,target){ return target.hp0){ if(noneed&&player==target){ num=0.5; } else if(target.hp==1){ num+=3; } else if(target.hp==2){ num+=1; } } return num; } "step 1" if(result.bool){ player.logSkill('qiwu',result.targets); result.targets[0].recover(); } }, ai:{ expose:0.3, threaten:1.5 } }, boss_tianyujg:{ audio:true, trigger:{player:'phaseEnd'}, forced:true, filter:function(event,player){ return game.hasPlayer(function(current){ return current.isEnemyOf(player)&&!current.isLinked(); }); }, content:function(){ "step 0" event.targets=game.filterPlayer(); event.targets.sort(lib.sort.seat); "step 1" if(event.targets.length){ var target=event.targets.shift(); if(!target.isLinked()&&target.isEnemyOf(player)){ player.line(target,'green'); target.link(); } event.redo(); } } }, boss_jueji:{ audio:2, trigger:{global:'phaseDrawBegin'}, filter:function(event,player){ if(event.player.isFriendOf(player)){ return false; } return event.num>0&&event.player!=player&&event.player.hp=0; }, forced:true, content:function(){ 'step 0' var targets=game.filterPlayer(function(current){ return current.isEnemyOf(player); }); targets.sort(lib.sort.seat); event.targets=targets; player.line(targets,'thunder'); event.num=targets.length; 'step 1' if(event.targets.length){ event.targets.shift().damage('thunder'); event.redo(); } 'step 2' player.recover(event.num); }, ai:{ threaten:function(player,target){ if(target.hp==1) return 2; if(target.hp==2&&game.players.length<8) return 1.5; return 0.5; }, } }, boss_chiying:{ audio:2, trigger:{global:'damageBegin'}, forced:true, filter:function(event,player){ if(event.num<=1) return false; return event.player.isFriendOf(player); }, priority:-11, content:function(){ trigger.num=1; } }, boss_jingfan:{ global:'boss_jingfan2', }, boss_jingfan2:{ mod:{ globalFrom:function(from,to,distance){ if(to.isEnemyOf(from)) return; var players=game.filterPlayer(); for(var i=0;i0){ if(players[i].hp==1){ return true; } num++; if(num>=2) return true; } } return false; }, content:function(){ 'step 0' player.turnOver(); 'step 1' var list=game.filterPlayer(function(current){ return current.isDamaged()&¤t.isFriendOf(player); }); player.line(list,'green'); event.targets=list; 'step 2' if(event.targets.length){ event.targets.shift().recover(); event.redo(); } }, ai:{ threaten:1.5, effect:{ target:function(card,player,target){ if(card.name=='guiyoujie') return [0,1]; } } }, }, boss_zhenwei:{ global:'boss_zhenwei2', ai:{ threaten:1.5 } }, boss_zhenwei2:{ mod:{ globalTo:function(from,to,distance){ if(to.isFriendOf(from)) return; var players=game.filterPlayer(); for(var i=0;i0; } } } return num>=4; }, filter:function(event,player){ var players=game.filterPlayer(); for(var i=0;i0; }, content:function(){ player.chooseToDiscard('h',true); } }, boss_tunshi:{ trigger:{player:'phaseBegin'}, forced:true, filter:function(event,player){ var nh=player.countCards('h'); return game.hasPlayer(function(current){ return current.isEnemyOf(player)&¤t.countCards('h')>nh; }); }, content:function(){ 'step 0' var nh=player.countCards('h'); var targets=game.filterPlayer(function(current){ return current.isEnemyOf(player)&¤t.countCards('h')>nh; }); targets.sort(lib.sort.seat); event.targets=targets; 'step 1' if(event.targets.length){ var current=event.targets.shift(); current.damage('thunder'); player.line(current,'thunder'); event.redo(); } } }, boss_jiguan:{ mod:{ targetEnabled:function(card,player,target){ if(card.name=='lebu'){ return false; } } } }, boss_gongshenjg:{ audio:2, trigger:{player:'phaseEnd'}, mode:['versus'], filter:function(event,player){ if(_status.mode!='jiange') return false; var players=game.filterPlayer(); for(var i=0;i0&&target.hasJudge('lebu')){ return 0.1; } if(player.countCards('h')>player.hp){ if(target==player) return Math.max(1,att-2); } if(target==player) return att+5; return att; } } "step 2" if(result&&result.targets&&result.targets.length){ event.target=result.targets[0]; } if(event.cards2.length){ player.line(event.target,'green'); event.target.gain(event.cards2,'gain2','log'); } }, ai:{ threaten:1.3 } }, boss_biantian4:{ trigger:{player:'dieBegin'}, forced:true, popup:false, content:function(){ for(var i=0;i-3) return 0; var eff=ai.get.damageEffect(target,player,player,'fire'); if(eff>0){ return eff+target.countCards('e')/2; } return 0; } "step 1" if(result.bool){ player.logSkill('boss_tianyun',result.targets,'fire'); player.loseHp(); event.target=result.targets[0]; } else{ event.finish(); } "step 2" if(event.target){ event.target.damage(2,'fire'); } "step 3" if(event.target){ var es=event.target.getCards('e'); if(es.length){ event.target.discard(es); } } }, ai:{ threaten:2 } }, versus_ladder:{ trigger:{global:['damageEnd','recoverEnd','dieEnd','gainEnd','phaseDiscardEnd']}, forced:true, popup:false, silent:true, filter:function(event,player){ if(!_status.ladder) return false; if(event._ladder_mmr_counted) return false; if(!event.source) return false; return event.source==game.me||event.player==game.me; }, content:function(){ switch(event.triggername){ case 'damageEnd':{ if(trigger.source.side!=trigger.player.side){ if(trigger.source==game.me){ _status.ladder_mmr+=0.5*Math.max(1,trigger.num); } else{ _status.ladder_mmr+=0.2*Math.max(1,trigger.num); } } break; } case 'recoverEnd':{ if(trigger.source!=trigger.player){ if(trigger.source==game.me){ if(trigger.player.side==game.me.side){ _status.ladder_mmr+=0.5*trigger.num; } else{ _status.ladder_mmr-=0.3*trigger.num; } } } else{ _status.ladder_mmr+=0.3*trigger.num; } break; } case 'dieEnd':{ if(trigger.source==game.me&&trigger.player.side!=game.me.side){ _status.ladder_mmr+=2; } break; } case 'gainEnd':{ if(trigger.cards&&trigger.cards.length){ if(trigger.source==game.me&&trigger.player!=game.me){ if(trigger.player.side==game.me.side){ _status.ladder_mmr+=0.3*trigger.cards.length; } else{ _status.ladder_mmr-=0.1*trigger.cards.length; } } else{ if(trigger.source){ if(trigger.source.side!=game.me.side){ _status.ladder_mmr+=0.3*trigger.cards.length; } } else{ _status.ladder_mmr+=0.1*trigger.cards.length; } } } break; } case 'phaseDiscardEnd':{ if(trigger.player==player){ if(trigger.cards&&trigger.cards.length){ _status.ladder_mmr-=0.2*trigger.cards.length; } } break; } } trigger._ladder_mmr_counted=true; } } }, element:{ content:{ replacePlayer:function(){ "step 0" var list=(source.side==game.me.side)?_status.friend:_status.enemy; if(list.length==0){ // if(game.friend.contains(source)){ // game.over(false); // } // else{ // game.over(true); // } game.friend.remove(source); game.enemy.remove(source); if(game.friend.length==0) game.over(false); else if(game.enemy.length==0) game.over(true); if(game.friendZhu&&game.friendZhu.classList.contains('dead')&&game.friend.length){ game.friendZhu=game.friend[0]; game.friendZhu.setIdentity(_status.color+'Zhu'); } if(game.enemyZhu&&game.enemyZhu.classList.contains('dead')&&game.enemy.length){ game.enemyZhu=game.enemy[0]; game.enemyZhu.setIdentity(!_status.color+'Zhu'); } event.finish(); return; } if(source.side==game.me.side&&list.length>1&&(game.me==game.friendZhu||(lib.storage.zhu&&lib.storage.single_control))&& !_status.auto){ event.dialog=ui.create.dialog('选择替补角色',[list,'character']); event.filterButton=function(){return true;}; event.player=game.me; event.forced=true; event.custom.replace.confirm=function(){ event.character=ui.selected.buttons[0].link; event.dialog.close(); if(ui.confirm) ui.confirm.close(); delete event.player; game.resume(); } game.check(); game.pause(); } else{ event.character=list[Math.floor(Math.random()*list.length)]; } "step 1" game.uncheck(); _status.friend.remove(event.character); _status.enemy.remove(event.character); source.revive(null,false); game.additionaldead.push({ name:source.name, stat:source.stat }); game.addVideo('reinit',source,[event.character,get.translation(source.side+'Color')]); source.uninit(); source.init(event.character); game.log(source,'出场'); source.node.identity.dataset.color=get.translation(source.side+'Color'); source.draw(4); _status.event.parent.parent.parent.untrigger(false,source); var evt=_status.event.parent.parent.parent; for(var i=0;i<100;i++){ evt=evt.parent; if(evt.player==source){ evt.finish(); } if(evt.name=='phase'){ break; } } if(lib.storage.single_control){ game.onSwapControl(); } "step 2" // if(_status.currentPhase==source){ // source.skip('phase'); // } }, replacePlayerTwo:function(){ 'step 0' game.delay(); 'step 1' source.revive(null,false); game.additionaldead.push({ name:source.name, stat:source.stat }); game.addVideo('reinit',source,[event.character,get.translation(source.side+'Color')]); source.uninit(); source.init(event.character); game.log(source,'出场'); // source.node.identity.dataset.color=source.side+'zhu'; source.draw(4); _status.event.parent.parent.parent.untrigger(false,source); var evt=_status.event.parent.parent.parent; for(var i=0;i<100;i++){ evt=evt.parent; if(evt.player==source){ evt.finish(); } if(evt.name=='phase'){ break; } } }, replacePlayerOL:function(){ 'step 0' game.delay(); 'step 1' if(event.source.side==game.me.side){ if(_status.friend.length==1){ event.directresult=_status.friend[0]; } else if(event.source==game.me){ if(_status.auto){ event.directresult=_status.friend.randomGet(); } } else{ if(!event.source.isOnline()){ event.directresult=_status.friend.randomGet(); } } } else{ if(_status.enemy.length==1){ event.directresult=_status.enemy[0]; } else{ if(!event.source.isOnline()){ event.directresult=_status.enemy.randomGet(); } } } if(!event.directresult){ if(event.source==game.me){ event.dialog=ui.create.dialog('选择替补角色',[_status.friend,'character']); event.filterButton=function(){return true}; event.player=game.me; event.forced=true; event.custom.replace.confirm=function(){ event.directresult=ui.selected.buttons[0].link; event.dialog.close(); if(ui.confirm) ui.confirm.close(); delete event.player; game.resume(); } event.switchToAuto=function(){ event.directresult=_status.friend.randomGet(); event.dialog.close(); if(ui.confirm) ui.confirm.close(); delete event.player; }; game.check(); game.pause(); } else{ event.source.send(function(player){ if(_status.auto){ _status.event._result=_status.friend.randomGet(); } else{ var next=game.createEvent('replacePlayer'); next.source=player; next.setContent(function(){ event.dialog=ui.create.dialog('选择替补角色',[_status.friend,'character']); event.filterButton=function(){return true}; event.player=event.source; event.forced=true; event.custom.replace.confirm=function(){ event.result=ui.selected.buttons[0].link; event.dialog.close(); if(ui.confirm) ui.confirm.close(); delete event.player; game.resume(); game.uncheck(); } event.switchToAuto=function(){ event.result=_status.friend.randomGet(); event.dialog.close(); if(ui.confirm) ui.confirm.close(); delete event.player; game.uncheck(); }; game.check(); game.pause(); }); } game.resume(); },event.source); event.source.wait(); game.pause(); } } 'step 2' game.uncheck(); if(!event.directresult){ if(event.resultOL){ event.directresult=event.resultOL[source.playerid]; } if(!event.directresult||event.directresult=='ai'){ if(source.side==game.me.side){ event.directresult=_status.friend.randomGet(); } else{ event.directresult=_status.enemy.randomGet(); } } } var name=event.directresult; var color=source.node.identity.dataset.color; game.additionaldead.push({ name:source.name, stat:source.stat }); game.broadcastAll(function(source,name,color){ _status.friend.remove(name); _status.enemy.remove(name); source.revive(null,false); source.uninit(); source.init(name); source.node.identity.dataset.color=color; if(source==game.me){ ui.arena.classList.remove('selecting'); } },source,name,color); game.log(source,'出场'); source.draw(4); _status.event.parent.parent.parent.untrigger(false,source); game.addVideo('reinit',source,[name,color]); }, }, player:{ dieAfter:function(source){ if(_status.connectMode){ if(_status.mode=='1v1'||_status.mode=='3v3'){ game.broadcastAll(function(dead){ if(dead.side==game.me.side){ _status.friendDied.push(dead.name); _status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true); } else{ _status.enemyDied.push(dead.name); _status.enemyCount.innerHTML='杀敌: '+get.cnNumber(_status.enemyDied.length,true); } },this); if(this.side==game.me.side){ if(_status.friend.length==0){ game.over(false); return; } } else{ if(_status.enemy.length==0){ game.over(true); return; } } game.replacePlayerOL(this); } else if(_status.mode=='2v2'){ if(_status.replacetwo){ } var friend; for(var i=0;i=side2.length+2){ game.me.showGiveup(); } } } return; } else if(_status.mode=='two'){ var friend; for(var i=0;i2)){ if(game.friend.contains(this)){ game.over(false); } else{ game.over(true); } } else if(game.friend.length==1&&this==game.friend[0]&&_status.friend.length==0){ game.over(false); } else if(game.enemy.length==1&&this==game.enemy[0]&&_status.enemy.length==0){ game.over(true); } else{ if(source){ if(source.side!=this.side){ if(lib.storage.versus_reward){ source.draw(lib.storage.versus_reward); } } else{ if(lib.storage.versus_punish=='弃牌'){ source.discard(source.getCards('he')); } else if(lib.storage.versus_punish=='摸牌'&&lib.storage.versus_reward){ source.draw(lib.storage.versus_reward); } } } else{ game.delay(); } game.replacePlayer(this); } } } } }, ai:{ get:{ rawAttitude:function(from,to){ if(from.side==to.side){ if(to.identity=='zhu'){ if(_status.connectMode){ if(_status.mode=='4v4') return 10; } else{ if(lib.storage.main_zhu||_status.mode=='four') return 10; } } return 6; } else{ if(to.identity=='zhu'){ if(_status.connectMode){ if(_status.mode=='4v4') return -10; } else{ if(lib.storage.main_zhu||_status.mode=='four') return -10; } } return -6; } }, } }, help:{ '对决模式': '
2v2 替补模式
  • 选将时额外选择一名替补武将,阵亡时使用自己的替补武将上场,无替补时改为用队友的替补武将,两人均无替补时游戏结束'+ '
  • 杀死敌方武将摸3张牌,杀死友方武将弃置所有牌
'+ '
4v4
  • 双方各有一名主公和三名忠臣,杀死对方主公获胜
  • '+ '8号位游戏开始时额外摸一张牌,7、8号位可在游戏开始时置换一次手牌
  • '+ '杀死对方忠臣摸2+x张牌,x为对方(含刚被杀的忠臣)与己方的存活人数之差;主公杀死己方忠臣须弃置所有牌', } }