'use strict'; game.import('mode',function(lib,game,ui,get,ai,_status){ return { name:'versus', init:function(){ if(get.config('versus_mode')=='jiange'){ lib.characterPack.mode_versus=lib.jiangeboss; } else if(get.config('versus_mode')=='siguo'){ lib.characterPack.mode_versus={ tangzi:['male',['wei','wu'].randomGet(),4,['xingzhao'],[]], liuqi:['male',['shu','qun'].randomGet(),3,['wenji','tunjiang'],[]], }; for(var i in lib.characterPack.mode_versus){ lib.character[i]=lib.characterPack.mode_versus[i]; } delete lib.character.sp_liuqi; delete lib.character.xf_tangzi; lib.cardPack.mode_versus=['zong','xionghuangjiu','tongzhougongji','lizhengshangyou']; lib.translate.mode_versus_character_config='四国武将'; } if(!lib.cardPack.mode_versus){ delete lib.card.zong; delete lib.card.xionghuangjiu; delete lib.card.tongzhougongji; delete lib.card.lizhengshangyou; } }, start:function(){ "step 0" _status.mode=get.config('versus_mode'); if(_status.connectMode) _status.mode=lib.configOL.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':case 'guandu':lib.configOL.number=8;break; } }); } else if(_status.mode=='jiange'||_status.mode=='siguo'||_status.mode=='four'||_status.mode=='guandu'){ if(_status.mode=='four'&&!get.config('enable_all_cards_four')){ lib.card.list=lib.cardsFour; game.fixedPile=true; } else if(_status.mode=='siguo'){ 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(); } "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=(_status.firstAct||game.players.randomGet()); if(firstChoose.next.side==firstChoose.side){ firstChoose=firstChoose.next; } game.gameDraw(firstChoose,function(player){ if(lib.configOL.replace_handcard&&player==firstChoose.previousSeat){ return 5; } return 4; }); game.phaseLoop(firstChoose); } else if(_status.mode=='guandu'){ game.gameDraw(_status.firstAct); game.phaseLoop(_status.firstAct); } 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=='guandu'){ game.gameDraw(_status.firstAct,4); game.phaseLoop(_status.firstAct); } else if(_status.mode=='two'){ _status.first_less=true; _status.first_less_forced=true; var firstChoose=_status.firstAct; game.gameDraw(firstChoose,function(player){ if(player==_status.firstAct.previousSeat&&get.config('replace_handcard_two')){ return 5; } return 4; }); game.phaseLoop(firstChoose); } else if(_status.mode=='endless'){ _status.first_less=true; _status.first_less_forced=true; var firstChoose=_status.firstAct; game.gameDraw(firstChoose); 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=='siguo'){ _status.siguoai=[ [-7.5,-2,0,-4.5,-6,-7.5], [-7.5,-2,0,-4.5,-6,-7.5], [-6,-6,-1,-4.5,-6,-7.5], [-6,-3,0,-3,-3,-6], [-6,-3,0,-3,-3,-6], [-6,-6,-6,-6,-6,-6], ].randomGet(); var firstChoose=_status.firstAct; game.gameDraw(firstChoose); game.phaseLoop(firstChoose); } 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+'人'); } if(lib.configOL.versus_mode=='2v2'||lib.configOL.versus_mode=='3v3'){ uiintro.add('
四号位保护:'+(lib.configOL.replace_handcard?'开启':'关闭')); if(lib.configOL.versus_mode=='2v2') uiintro.add('
四号位【飞扬】:'+(lib.configOL.olfeiyang_four?'开启':'关闭')); } 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'; }, getVideoName:function(){ if(_status.mode=='three'){ var zhu=game.findPlayer2(function(current){ return current.side==game.me.side&¤t.identity=='zhu'; }); var str=(game.me.side?'暖/':'冷/')+get.translation(zhu.previousSeat.name1)+'/'+get.translation(zhu.name1)+'/'+get.translation(zhu.nextSeat.name1); return ['统率三军',str] } var str=get.translation(game.me.name1); if(game.me.name2){ str+='/'+get.translation(game.me.name2); } var str2; if(game.versusVideoName) str2=game.versusVideoName; else{ switch(_status.mode){ case 'two':str2='欢乐成双';break; case 'endless':str2='无尽模式';break; case 'three':str2='统率三军';break; case 'siguo':str2='同舟共济';break; case 'jiange':str2='守卫剑阁';break; case 'four':str2='对决 - 4v4';break; case 'guandu':str2='官渡之战';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'); 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]=[]; } } 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; lib.characterIntro.boss_kumuyuanrang=lib.characterIntro.xiahoudun; lib.characterIntro.boss_baijiwenyuan=lib.characterIntro.zhangliao; lib.characterIntro.boss_yihanyunchang=lib.characterIntro.guanyu; lib.characterIntro.boss_fuweizilong=lib.characterIntro.zhaoyun; '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].includes('jiangeboss')|| lib.characterPack.boss[i][4].includes('jiangemech')){ lib.character[i]=lib.characterPack.boss[i]; } } } } for(var i in lib.character){ if(lib.character[i][4]){ if(lib.character[i][4].includes('jiangeboss')){ list[lib.character[i][1]+'boss'].push(i);continue; } else if(lib.character[i][4].includes('jiangemech')){ list[lib.character[i][1]+'mech'].push(i);continue; } } if(lib.filter.characterDisabled(i)) continue; if(get.is.double(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当前分数:
'+(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; } event.addSetting=function(){ var cs=function(link,node){ game.swapPlayer(node._link); _status.rechoose=true; 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; case 'guandu':game.chooseCharacterOLGuandu();break; } }, chooseCharacterOLGuandu:function(){ var next=game.createEvent('chooseCharacter'); next.setContent(function(){ "step 0" var list=[ ['zhu','ezhu','ezhong','zhong','ezhong','zhong','zhong','ezhong'], ['zhu','ezhong','zhong','ezhu','ezhong','zhong','ezhong','zhong'], ['zhu','ezhong','zhong','ezhong','zhong','ezhong','zhong','ezhu'], ['zhu','ezhu','zhong','ezhong','zhong','ezhong','zhong','ezhong'], ['zhu','ezhong','zhong','ezhong','zhong','ezhu','zhong','ezhong'], ].randomGet(); var side=true; var num=Math.floor(Math.random()*8); list=list.splice(8-num).concat(list); for(var i=0;i<8;i++){ if(list[i][0]=='e'){ game.players[i].side=side; game.players[i].identity=list[i].slice(1); } else{ game.players[i].side=!side; game.players[i].identity=list[i]; } if(game.players[i].identity=='zhu'){ game[game.players[i].side+'Zhu']=game.players[i]; game.players[i].isZhu=true; } game.players[i].setIdentity(game.players[i].identity); game.players[i].node.identity.dataset.color=get.translation(game.players[i].side+'Color'); game.players[i].getId(); } var side=true; var map={}; var num=Math.floor(Math.random()*8); list=list.splice(8-num).concat(list); for(var i=0;i<8;i++){ if(list[i][0]=='e'){ game.players[i].side=side; game.players[i].identity=list[i].slice(1); } else{ game.players[i].side=!side; game.players[i].identity=list[i]; } map[game.players[i].playerid]=[game.players[i].side,game.players[i].identity]; } var evt_list=[['huoshaowuchao','chunyuqiong'],['liangcaokuifa','sp_xuyou'],['zhanyanliangzhuwenchou','jsp_guanyu'],['shishengshibai','re_guojia'],['xutuhuanjin','yj_jushou'],['liangjunxiangchi','yj_jushou'],['jianshoudaiyuan','tianfeng'],['yiruoshengqiang','re_caocao'],['shichongerjiao','sp_xuyou']].randomGet(); var evt=evt_list[0],character=evt_list[1]; game.addGlobalSkill(evt); var func=function(map,evt){ for(var i in map){ var player=lib.playerOL[i]; if(player){ player.side=map[i][0]; player.identity=map[i][1]; player.setIdentity(); player.node.identity.dataset.color=get.translation(player.side+'Color'); if(player.identity=='zhu'){ game[player.side+'Zhu']=player; player.isZhu=true; } } } game.falseZhu.init('re_caocao'); game.trueZhu.init('ol_yuanshao'); game.trueZhu.hp++; game.trueZhu.maxHp++; game.falseZhu.hp++; game.falseZhu.maxHp++; game.trueZhu.update(); game.falseZhu.update(); ui.arena.classList.add('choose-character'); if(get.is.phoneLayout()){ ui.guanduInfo=ui.create.div('.touchinfo.left',ui.window); } else{ ui.guanduInfo=ui.create.div(ui.gameinfo); } ui.guanduInfo.innerHTML='当前事件:'+get.translation(evt); if(lib.config.background_speak) game.playAudio('skill',evt); var dialog=ui.create.dialog('本局特殊事件:'+get.translation(evt)); dialog.addText(get.translation(evt+'_info'),false); dialog.add([[character],'character']); setTimeout(function(){ dialog.close(); },5000) }; game.broadcastAll(func,map,evt); _status.firstAct=game.falseZhu; game.delay(0,5000); "step 1" event.falseList=['ol_xiahouyuan','litong','zangba','manchong','xunyu','re_guojia','re_zhangliao','xuhuang','caohong','jsp_guanyu','hanhaoshihuan','caoren','yujin','liuye','chengyu','xunyou','zhangxiu','sp_jiaxu'].filter(function(name){ if(!Array.isArray(lib.character[name])) return false; lib.character[name][1]='wei'; return true; }); event.trueList=['xinping','hanmeng','gaogan','yuantanyuanshang','lvkuanglvxiang','xinpi','xunchen','sp_zhanghe','chenlin','re_liubei','yj_jushou','guotufengji','gaolan','sp_xuyou','tianfeng','chunyuqiong','sp_shenpei'].filter(function(name){ if(!Array.isArray(lib.character[name])) return false; lib.character[name][1]='qun'; return true; }); game.broadcast(function(list1,list2){ while(list1.length){ lib.character[list1.shift()][1]='wei'; } while(list2.length){ lib.character[list2.shift()][1]='qun'; } },event.falseList,event.trueList); event.map={}; var list=[]; game.countPlayer(function(current){ if(current.identity=='zhong'){ var choice=event[current.side+'List'].randomRemove(2); event.map[current.playerid]=choice; list.push([current,['请选择武将',[choice,'character']],true]); } }); game.me.chooseButtonOL(list,function(player,result){ if(game.online||player==game.me){ player.init(result.links[0]); } }); "step 2" for(var i in result){ if(result[i]=='ai'){ result[i]=event.map[i].randomGet(); } else result[i]=result[i].links[0]; } game.broadcastAll(function(result){ for(var i in result){ lib.playerOL[i].init(result[i]); } setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); },result); }); }, chooseCharacterGuandu:function(){ var next=game.createEvent('chooseCharacter'); next.setContent(function(){ 'step 0' lib.init.onfree(); ui.arena.classList.add('choose-character'); game.falseZhu.init('re_caocao'); game.trueZhu.init('ol_yuanshao'); game.trueZhu.hp++; game.trueZhu.maxHp++; game.falseZhu.hp++; game.falseZhu.maxHp++; game.trueZhu.update(); game.falseZhu.update(); var evt_list=[['huoshaowuchao','chunyuqiong'],['liangcaokuifa','sp_xuyou'],['zhanyanliangzhuwenchou','jsp_guanyu'],['shishengshibai','re_guojia'],['xutuhuanjin','yj_jushou'],['liangjunxiangchi','yj_jushou'],['jianshoudaiyuan','tianfeng'],['yiruoshengqiang','re_caocao'],['shichongerjiao','sp_xuyou']].randomGet(); var evt=evt_list[0],character=evt_list[1]; game.addGlobalSkill(evt); game.broadcastAll(function(evt){ if(get.is.phoneLayout()){ ui.guanduInfo=ui.create.div('.touchinfo.left',ui.window); } else{ ui.guanduInfo=ui.create.div(ui.gameinfo); } if(lib.config.background_speak) game.playAudio('skill',evt); ui.guanduInfo.innerHTML='当前事件:'+get.translation(evt); },evt); game.me.chooseControl('ok').set('dialog',['###本局特殊事件:'+get.translation(evt)+'###'+get.translation(evt+'_info'),[[character],'character']]); 'step 1' event.falseList=['ol_xiahouyuan','litong','zangba','manchong','xunyu','re_guojia','re_zhangliao','xuhuang','caohong','jsp_guanyu','hanhaoshihuan','caoren','yujin','liuye','chengyu','xunyou','zhangxiu','sp_jiaxu'].filter(function(name){ if(!Array.isArray(lib.character[name])) return false; lib.character[name][1]='wei'; return true; }); event.trueList=['xinping','hanmeng','gaogan','yuantanyuanshang','lvkuanglvxiang','xinpi','xunchen','sp_zhanghe','chenlin','re_liubei','yj_jushou','guotufengji','gaolan','sp_xuyou','tianfeng','chunyuqiong','sp_shenpei'].filter(function(name){ if(!Array.isArray(lib.character[name])) return false; lib.character[name][1]='qun'; return true; }); 'step 2' if(game.me.identity!='zhu'){ event.choose_me=true; game.me.chooseButton(['请选择你的武将牌',[event[game.me.side+'List'].randomRemove(2),'character']],true); } 'step 3' if(event.choose_me) game.me.init(result.links[0]); game.countPlayer(function(current){ if(current!=game.me&¤t.identity=='zhong') current.init(event[current.side+'List'].randomRemove(2)[0]); }); setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); }); }, chooseCharacterOL4:function(){ var next=game.createEvent('chooseCharacter'); 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;i0){ event.withai=true; game.pause(); } 'step 4' game.broadcastAll(function(id){ var dialog=get.idDialog(id); if(dialog){ dialog.close(); clearInterval(dialog.delay); } },event.videoId); var result=event._choiceMap; for(var i in lib.playerOL){ if(!lib.character[result[i]]){ result[i]=game._characterChoice[i].randomGet(); } _status.characterlist.remove(result[i]); if(!lib.playerOL[i].name1){ lib.playerOL[i].init(result[i]); } lib.playerOL[i].update(); } game.broadcast(function(result){ for(var i in result){ if(!lib.playerOL[i].name1){ lib.playerOL[i].init(result[i]); lib.playerOL[i].update(); } } setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500) },result); setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); if(lib.configOL.olfeiyang_four){ var target=_status.firstAct.previous; if(target.isIn()) target.addSkill('olfeiyang'); } game.addGlobalSkill('versus_viewHandcard'); }); }, chooseCharacterOL1:function(){ var next=game.createEvent('chooseCharacterOL'); next.setContent(function(){ 'step 0' game.removeCard('shengdong'); game.additionaldead=[]; var list=get.charactersOL(); list=list.randomGets(parseInt(lib.configOL.choice_num)); list.remove('huatuo'); list.remove('sunquan'); event.videoId=lib.status.videoId++; if(Math.random()<0.5){ event.choosing=game.players[0]; } else{ event.choosing=game.players[1]; } var createDialog=function(list,id,list1,list2){ var dialog=ui.create.dialog('选择角色',[list,'character']); dialog.classList.add('fullwidth'); dialog.classList.add('fullheight'); dialog.classList.add('noslide'); dialog.classList.add('fixed'); dialog.videoId=id; if(list2&&list2){ ui.arena.classList.add('playerhidden'); for(var i=0;icurrent.classList.contains('acted'))){ next._isThreeRound=true; } player.classList.add('acted'); 'step 1' if(player.identity!='zhu'){ 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',false,_status.event.getParent()); next.source=player; next.setContent('replacePlayerOL'); }, replacePlayer:function(player){ var next=game.createEvent('replacePlayer',false,_status.event.getParent()); next.source=player; next.setContent('replacePlayer'); }, replacePlayerTwo:function(player,character){ var next=game.createEvent('replacePlayerTwo',false,_status.event.getParent()); 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.addTempClass('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'); var added=false; for(var i=0;i0; }, content:function(){ if(trigger.name=='phaseDraw') trigger.num--; else player.draw(); }, }, zhanyanliangzhuwenchou:{ trigger:{player:'phaseBegin'}, silent:true, content:function(){ 'step 0' player.chooseUseTarget({ name:'juedou', isCard:true, storage:{nowuxie:true} }, '选择一名角色,视为对其使用【决斗】','或点【取消】失去1点体力'); 'step 1' if(!result.bool) player.loseHp(); }, }, xujiu2:{ charlotte:true, onremove:true, trigger:{player:'damageBegin2'}, forced:true, content:function(){ trigger.num+=player.countMark('xujiu2'); }, intro:{content:'本回合受到的伤害+#'}, ai:{threaten:(player,target)=>1+target.countMark('xujiu2')}, }, shishengshibai:{ mod:{ aiOrder:function(player,card,num){ if(_status.shishengshibai&&_status.shishengshibai%10==9){ if(['sha','tao','guohe','shunshou','tunliang','wuzhong','juedou','yuanjun'].includes(card.name)) return num+15; } }, }, trigger:{ player:'useCard1', }, silent:true, content:function(){ if(event.triggername=='useCard1'){ if(!_status.shishengshibai) _status.shishengshibai=0; _status.shishengshibai++; game.broadcastAll(function(num){ if(ui.guanduInfo) ui.guanduInfo.innerHTML='当前事件:十胜十败('+num+')'; },_status.shishengshibai); if(_status.shishengshibai%10==0&&trigger.targets&&trigger.targets.length>0&&!['delay','equip'].includes(get.type(trigger.card))){ trigger.effectCount++; } } }, ai:{ result:{ player:function(card,player,target){ if(_status.shishengshibai&&_status.shishengshibai%10==9&&card.name=='tiesuo') return 'zerotarget'; }, }, }, }, liangjunxiangchi: { mod: { maxHandcard: function(player, num) { if (game.roundNumber <= 4) return num + game.roundNumber; }, }, trigger: { source: 'damageBegin1' }, filter: function(event, player) { if (game.roundNumber <= 4) return false; var evt2 = event.getParent('phaseUse'); if (evt2.player != player) return false; return player.getHistory('useCard', function (evt) { return evt.card.name == 'sha' && evt.getParent('phaseUse') == evt2; }).indexOf(event.getParent()) == 0; }, silent: true, forced: true, content: function() { trigger.num++; }, }, xutuhuanjin: { trigger: { player: 'phaseUseEnd' }, filter: function(event, player) { if (player.getHistory('useCard', function (evt) { return evt.card && evt.card.name == 'sha' && evt.getParent('phaseUse') == event; }).length > 0) return false; if (player.getHistory('respond', function (evt) { return evt.card && evt.card.name == 'sha' && evt.getParent('phaseUse') == event; }).length > 0) return false; return true; }, forced: true, content: function() { player.addTempSkill('xutuhuanjin_yingzi', { player: 'phaseDrawAfter' }); player.addMark('xutuhuanjin_yingzi', 1, false); }, subSkill: { yingzi: { charlotte: true, onremove: true, trigger: { player: 'phaseDrawBegin2' }, filter: function(event, player) { return !event.numFixed && player.hasMark('xutuhuanjin_yingzi'); }, forced: true, content: function() { trigger.num += player.countMark('xutuhuanjin_yingzi'); }, marktext: '缓', intro: { content: '下个摸牌阶段多摸#张牌' }, }, }, }, jianshoudaiyuan: { charlotte: true, mod: { aiValue: function(player, card, num) { if (card.name != 'sha' && card.name != 'shan') return; var geti = function () { var cards = player.getCards('hs', function (card) { return card.name == 'sha' || card.name == 'shan'; }); if (cards.contains(card)) { return cards.indexOf(card); } return cards.length; }; return Math.max(num, [7, 5, 5, 3][Math.min(geti(), 3)]); }, aiUseful: function() { return lib.skill.jianshoudaiyuan.mod.aiValue.apply(this, arguments); }, }, locked: false, enable: ['chooseToUse', 'chooseToRespond'], position: 'hs', prompt: '将【杀】当作【闪】,或将【闪】当作的【杀】使用或打出,然后你的下个弃牌阶段的手牌上限-1', viewAs: function(cards, player) { var name = false; switch (get.name(cards[0], player)) { case 'sha': name = 'shan'; break; case 'shan': name = 'sha'; break; } if (name) return { name: name }; return null; }, onuse: function(links, player) { player.addTempSkill('jianshoudaiyuan_less', { player: 'phaseDiscardAfter' }); player.addMark('jianshoudaiyuan_less', 1, false); player.markSkill('jianshoudaiyuan_less'); }, onrespond: function(links, player) { player.addTempSkill('jianshoudaiyuan_less', { player: 'phaseDiscardAfter' }); player.addMark('jianshoudaiyuan_less', 1, false); player.markSkill('jianshoudaiyuan_less'); }, check: function(card) { var player = _status.event.player; if (_status.event.type == 'phase') { var max = 0; var name2; var list = ['sha']; var map = { sha: 'shan' }; for (var i = 0; i < list.length; i++) { var name = list[i]; if (player.countCards('hs', map[name]) && player.getUseValue({ name: name }) > 0) { var temp = get.order({ name: name }); if (temp > max) { max = temp; name2 = map[name]; } } } if (name2 == get.name(card, player)) return 1; return 0; } return 1; }, filterCard: function(card, player, event) { event = event || _status.event; var filter = event._backup.filterCard; var name = get.name(card, player); if (name == 'sha' && filter({ name: 'shan', cards: [card] }, player, event)) return true; if (name == 'shan' && filter({ name: 'sha', cards: [card] }, player, event)) return true; return false; }, filter: function(event, player) { var filter = event.filterCard; if (filter({ name: 'sha' }, player, event) && player.countCards('hs', 'shan')) return true; if (filter({ name: 'shan' }, player, event) && player.countCards('hs', 'sha')) return true; return false; }, ai: { respondSha: true, respondShan: true, skillTagFilter: function(player, tag) { var name; switch (tag) { case 'respondSha': name = 'shan'; break; case 'respondShan': name = 'sha'; break; } if (!player.countCards('hs', name)) return false; }, order: 0.01, }, subSkill: { less: { onremove: true, charlotte: true, market: '守', intro: { content: '手牌上限-#' }, mod: { maxHandcard: function(player, num) { return num - player.countMark('jianshoudaiyuan_less'); }, }, }, }, }, yiruoshengqiang: { trigger: { source: 'damageBegin2' }, filter: function(event, player) { return event.player.hp > player.hp; }, forced: true, silent: true, content: function() { trigger.num++; }, }, shichongerjiao: { charlotte: true, trigger: { player: 'phaseJieshu' }, filter: function(event, player) { return lib.skill.shichongerjiao.filterx(event, player) || lib.skill.shichongerjiao.filtery(event, player); }, filterx: function(event, player) { return player.isMaxHp(); }, filtery: function(event, player) { return player.isMaxHandcard(); }, forced: true, silent: true, content: function() { var bool1 = lib.skill.shichongerjiao.filterx(trigger, player); var bool2 = lib.skill.shichongerjiao.filtery(trigger, player); if (bool1) player.chooseToDiscard('he', true); if (bool2) player.loseHp(); }, }, wenji:{ trigger:{global:'phaseUseBegin'}, filter:function(event,player){ return event.player.side==player.side&&event.player!=player&&event.player.countCards('h'); }, logTarget:'player', check:function(event,player){ return event.player.needsToDiscard(1)||event.player.countCards('h')>player.countCards('h')+1||player.hp==1; }, content:function(){ 'step 0' trigger.player.chooseCard('将一张手牌交给'+get.translation(player),true).ai=function(card){ if(get.type(card)=='trick') return 8-get.value(card); return 6-get.value(card); } 'step 1' if(result.bool&&result.cards.length){ player.gain(result.cards,trigger.player,'give'); if(get.type(result.cards[0])=='trick'){ player.addTempSkill('wenji2',{player:'phaseBegin'}); } } } }, wenji2:{ mark:true, intro:{ content:'非队友角色计算与你的距离+1' }, mod:{ globalTo:function(from,to,distance){ if(from.side!=to.side){ return distance+1; } } } }, tunjiang:{ trigger:{player:'phaseEnd'}, direct:true, filter:function(event,player){ return !player.getStat('damage')&&player.countUsed()>=2; }, content:function(){ 'step 0' var target=null; for(var i=0;i=player.countCards('h')){ return 1; } return 0; }).set('prompt',get.prompt('xingzhao')).set('choiceList',[ '摸两张牌','令'+get.translation(target)+'摸两张牌' ]); } else{ player.chooseBool(get.prompt('xingzhao')); } 'step 1' if(event.target){ if(result.index==0){ player.logSkill('xingzhao'); player.draw(2); } else if(result.index==1){ player.logSkill('xingzhao',event.target); event.target.draw(2); } } else{ if(result.bool){ player.logSkill('xingzhao'); player.draw(2); } } } }, xingzhao:{ inherit:'xunxun', mark:true, intro:{ content:function(storage,player){ var num=0; for(var i=0;i=1){ str='具有技能“恂恂”'; } if(num>=2){ str+=';当你或队友使用装备牌时,其摸一张牌'; } if(num>=3){ str+=';你和队友跳过判定阶段'; } return str; } }, filter:function(event,player){ var num=0; for(var i=0;i=2; }, content:function(){ player.draw(); } }, xingzhao3:{ trigger:{player:'phaseJudgeBefore'}, forced:true, filter:function(event,player){ var num=0,bool=false; for(var i=0;i=3; }, content:function(){ trigger.cancel(); game.log(player,'跳过了判定阶段'); } }, xionghuangjiu:{ trigger:{source:'damageBegin1'}, filter:function(event,player){ return event.card&&event.card==player.storage.xionghuangjiu&&event.notLink(); }, forced:true, content:function(){ trigger.num++; }, temp:true, vanish:true, onremove:function(player){ game.addVideo('jiuNode',player,false); if(player.node.jiu){ player.node.jiu.delete(); player.node.jiu2.delete(); delete player.node.jiu; delete player.node.jiu2; } delete player.storage.xionghuangjiu; }, group:['xionghuangjiu2','xionghuangjiu3'] }, xionghuangjiu2:{ trigger:{player:'useCardAfter',global:'phaseAfter'}, priority:2, filter:function(event,player){ if(event.name=='useCard') return (event.card&&event.card==player.storage.xionghuangjiu); return true; }, forced:true, popup:false, audio:false, content:function(){ game.broadcastAll(function(player){ player.removeSkill('xionghuangjiu'); },player); }, }, xionghuangjiu3:{ trigger:{player:'useCard'}, silent:true, filter:function(event,player){ return !player.storage.xionghuangjiu; }, content:function(){ player.storage.xionghuangjiu=trigger.card; } }, longchuanzhibao:{ mark:'auto', nopop:true, init:function(player){ player.storage.longchuanzhibao=0; }, intro:{ content:function(storage,player){ var str='已有'+storage+'个龙船至宝,'+get.translation(player.side)+'势力共有'; var num=storage; for(var i=0;i0; }, content:function(){ player.gainZhibao(1,trigger.player); game.delay(); }, group:'longchuanzhibao_over', subSkill:{ over:{ trigger:{player:'roundStart'}, silent:true, filter:function(){ var map={wei:0,shu:0,wu:0,qun:0}; for(var i=0;i=4){ _status.winside=current.side; return true; } } }, content:function(){ for(var i=0;i0; }, content:function(){ if(trigger.name=='die') player.addMark('boss_huchen',1); else trigger.num+=player.countMark('boss_huchen'); }, intro:{ content:'已斩杀过$名敌将', }, }, boss_fengjian:{ trigger:{source:'damageSource'}, forced:true, filter:function(event,player){ return event.player.isAlive(); }, logTarget:'player', content:function(){ trigger.player.addTempSkill('boss_fengjian2',{player:'phaseAfter'}); trigger.player.markAuto('boss_fengjian2',[player]); }, }, boss_fengjian2:{ onremove:true, intro:{ content:'不能对$使用牌', }, mod:{ playerEnabled:function(card,player,target){ if(player.getStorage('boss_fengjian2').includes(target)) return false; }, }, }, boss_keding:{ trigger:{player:'useCard2'}, direct:true, filter:function(event,player){ if(!event.targets||event.targets.length!=1) return false; var card=event.card; if(card.name!='sha'&&get.type(card)!='trick')return false; var info=get.info(card); if(info.allowMultiple==false) return false; if(!player.countCards('h')) return false; if(!info.multitarget){ if(game.hasPlayer(function(current){ return !event.targets.includes(current)&&lib.filter.targetEnabled2(card,player,current)&&lib.filter.targetInRange(card,player,current); })){ return true; } } return false; }, content:function(){ 'step 0' var card=trigger.card; var prompt2='弃置任意张手牌,并为'+get.translation(card)+'增加等量的目标'; var targets=game.filterPlayer(function(current){ return !trigger.targets.includes(current)&&lib.filter.targetEnabled2(card,player,current)&&lib.filter.targetInRange(card,player,current); }); var max=0; if(!trigger.targets[0].hasSkill('heiguangkai_skill')) max=targets.filter(function(target){ return get.effect(target,card,player,player)>0; }).length; player.chooseCardTarget({ prompt:get.prompt('boss_keding'), prompt2:prompt2, selectCard:function(){ var player=_status.event.player; var targets=_status.event.targets; return [Math.max(1,ui.selected.targets.length),Math.min(targets.length,player.countCards('h'))]; }, selectTarget:function(){ return ui.selected.cards.length; }, position:'h', filterCard:lib.filter.cardDiscardable, filterTarget:function(card,player,target){ return _status.event.targets.includes(target); }, targets:targets, ai1:function(card){ if(ui.selected.cards.length>=_status.event.max) return 0; return 5-get.value(card); }, ai2:function(target){ if(target.hasSkill('heiguangkai_skill')) return 0; var trigger=_status.event.getTrigger(); var player=_status.event.player; return get.effect(target,trigger.card,player,player); }, max:max, }); 'step 1' if(result.bool){ player.logSkill('boss_keding',result.targets); player.discard(result.cards); trigger.targets.addArray(result.targets); } }, }, boss_bashi:{ filter:function(event,player){ return event.player!=player&&event.card&&(event.card.name=='sha'||get.type(event.card)=='trick')&&!player.isTurnedOver(); }, logTarget:'player', check:function(event,player){ if(event.getParent().excluded.includes(player)) return false; if(get.attitude(player,event.player)>0){ return false; } if(get.tag(event.card,'respondSha')){ if(player.countCards('h',{name:'sha'})==0){ return true; } } else if(get.tag(event.card,'respondShan')){ if(player.countCards('h',{name:'shan'})==0){ return true; } } else if(get.tag(event.card,'damage')){ if(event.card.name=='shuiyanqijunx') return player.countCards('e')<2; return true; //if(player.countCards('h')<2) return true; } return false; }, trigger:{target:'useCardToTargeted'}, content:function(){ player.turnOver(); trigger.getParent().excluded.add(player); }, }, boss_danjing:{ trigger:{global:'dying'}, filter:function(event,player){ return player.hp>1&&event.player.hp<1&&event.player.isFriendOf(player); }, check:function(event,player){ var target=event.player; return get.attitude(player,target)>0&&lib.filter.cardSavable({name:'tao',isCard:true},player,target); }, logTarget:'player', content:function(){ 'step 0' player.loseHp(); 'step 1' var card={name:'tao',isCard:true}; if(lib.filter.cardSavable(card,player,trigger.player)) player.useCard(card,trigger.player); }, }, boss_jiaoxie:{ enable:'phaseUse', usable:1, filter:function(event,player){ return game.hasPlayer(function(current){ return lib.skill.boss_jiaoxie.filterTarget(null,player,current); }); }, filterTarget:function(card,player,target){ return target.isEnemyOf(player)&&target.type=='mech'&&target.countCards('he')>0; }, content:function(){ 'step 0' if(!target.countCards('he')) event.finish(); else target.chooseCard('he',true,'将一张牌交给'+get.translation(player)); 'step 1' if(result.bool){ player.gain(result.cards,target,'give'); } }, ai:{ order:9, result:{ target:function(player,target){ if(target.countCards('e',function(card){ return get.value(card,target)<=0; })>0) return 1; return -1; }, }, }, }, boss_didongjg:{ trigger:{player:'phaseEnd'}, direct:true, content:function(){ "step 0" player.chooseTarget(get.prompt('boss_didongjg'),function(card,player,target){ return target.isEnemyOf(player); }).ai=function(target){ var att=get.attitude(player,target); if(target.isTurnedOver()){ if(att>0){ 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=game.filterPlayer(function(current){ return current.isEnemyOf(player); }); "step 1" if(event.players.length){ var current=event.players.shift(); 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:'damageBegin4'}, forced:true, filter:function(event,player){ if(event.num<=1) return false; return event.player.isFriendOf(player); }, 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.4?2:3,'thunder'); } }, ai:{ threaten:function(player,target){ if(_status.mode=='jiange'){ 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(); 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=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(Math.random()>0.4?2:3,'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']}, 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; } } }, card:{ tunliang:{ audio:true, fullskin:true, type:'trick', enable:true, selectTarget:[1,3], filterTarget:true, content:function(){ target.draw(); }, ai:{ basic:{ order:7.2, useful:4.5, value:9.2 }, result:{ target:1, }, tag:{ draw:1 } } }, yuanjun:{ fullskin:true, type:'trick', selectTarget:[1,2], enable:true, filterTarget:function(card,player,target){ return target!=player&&target.hp{ var cards=player.getCards('hs',card=>get.tag(card,'damage')&&player.hasValueTarget(card)); if(!cards.length) return 0; var cardx=cards.filter(card=>get.name(card)=='sha'); cardx.sort((a,b)=>player.getUseValue(b)-player.getUseValue(a)); cardx=cardx.slice(Math.min(cardx.length,player.getCardUsable('sha')),cardx.length); cards.removeArray(cardx); return get.order(cards.sort((a,b)=>get.order(b,player)-get.order(a,player))[0])+0.3; }, useful:5, value:3, }, result:{ target:(player,target)=>{ if(target.hasSkill('gangzhi')||get.attitude(player,target)>=0) return 0; var cards=player.getCards('hs',card=>get.tag(card,'damage')&&player.canUse(card,target)&&get.effect(target,card,player,player)>0); if(!cards.length) return 0; var cardx=cards.filter(card=>get.name(card)=='sha'); cardx.sort((a,b)=>get.effect(target,b,player,player)-get.effect(target,a,player,player)); cardx=cardx.slice(Math.min(cardx.length,player.getCardUsable('sha')),cardx.length); cards.removeArray(cardx); return -cards.reduce((sum,card)=>sum+get.effect(target,card,player,player),0); }, }, }, }, zong:{ fullskin:true, type:'basic', cardcolor:'red', enable:function(card,player){ return player.hp=2&&target.countCards('h','tao')<=1){ keep=true; } var mode=get.mode(); if(target.hp>=2&&keep&&target.hasFriend()){ if(target.hp>2||nd==0) return 0; if(target.hp==2){ if(game.hasPlayer(function(current){ if(target!=current&&get.attitude(target,current)>=3){ if(current.hp<=1) return true; } })){ return 0; } } } return 2; }, }, tag:{ recover:1, save:1, } } }, xionghuangjiu:{ fullskin:true, type:"basic", enable:function(event,player){ return !player.hasSkill('jiu')&&!player.hasSkill('xionghuangjiu'); }, lianheng:true, logv:false, savable:function(card,player,dying){ return dying==player; }, usable:1, selectTarget:-1, modTarget:true, filterTarget:function(card,player,target){ return target==player; }, content:function(){ if(target.isDying()){ target.recover(); if(_status.currentPhase==target){ target.getStat().card.jiu--; } } else{ if(cards&&cards.length){ card=cards[0]; } game.broadcastAll(function(target,card,gain2){ if(get.population(target.side)==1){ target.addSkill('xionghuangjiu'); } else{ if(!target.storage.jiu) target.storage.jiu=0; target.storage.jiu++; target.addSkill('jiu'); } game.addVideo('jiuNode',target,true); if(!target.node.jiu&&lib.config.jiu_effect){ target.node.jiu=ui.create.div('.playerjiu',target.node.avatar); target.node.jiu2=ui.create.div('.playerjiu',target.node.avatar2); } if(gain2&&card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ card.clone.moveDelete(target); } },target,card,target==targets[0]); if(target==targets[0]){ if(card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ game.addVideo('gain2',target,get.cardsInfo([card])); } } } }, ai:{ basic:{ useful:function(card,i){ if(_status.event.player.hp>1){ if(i==0) return 5; return 1; } if(i==0) return 7.3; return 3; }, value:function(card,player,i){ if(player.hp>1){ if(i==0) return 5; return 1; } if(i==0) return 7.3; return 3; }, }, order:function(){ return get.order({name:'sha'})+0.2; }, result:{ target:function(player,target){ if(target&&target.isDying()) return 2; if(lib.config.mode=='stone'&&!player.isMin()){ if(player.getActCount()+1>=player.actcount) return 0; } var shas=player.getCards('h','sha'); if(shas.length>1&&player.getCardUsable('sha')>1){ return 0; } var card; if(shas.length){ for(var i=0;i0); })){ return 1; } } return 0; }, }, tag:{ save:1 } } }, tongzhougongji:{ fullskin:true, cardimage:'lulitongxin', notarget:true, enable:true, type:'trick', content:function(){ 'step 0' var num=0; for(var i=0;i2){ return 0; } if(num==2&&get.population(player.side)==1){ return 0; } return 1; }).set('choiceList',[ '摸'+get.cnNumber(num)+'张牌', '你和队友各摸一张牌' ]); event.num=num; 'step 1' if(result.index==0){ if(event.num){ player.draw(event.num); } } else{ if(event.friend){ player.line(event.friend); game.asyncDraw([player,event.friend]); } else{ player.draw(); } } }, ai:{ basic:{ order:7.2, useful:4, value:9.2 }, result:{ target:2, }, tag:{ draw:1 } } }, lizhengshangyou:{ fullskin:true, cardimage:'lianjunshengyan', type:'trick', enable:true, selectTarget:-1, reverseOrder:true, filterTarget:function(card,player,target){ for(var i=0;i1&&(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 2" 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); var evt=event.getParent('dying'); if(evt&&evt.parent){ evt=evt.parent; evt.untrigger(false,source); 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(); } game.triggerEnter(source); "step 3" // if(_status.currentPhase==source){ // source.skip('phase'); // } }, replacePlayerTwo:function(){ 'step 0' var cards=source.getCards('hej'); if(cards.length){ source.$throw(cards,1000); game.cardsDiscard(cards); } 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); var evt=event.getParent('dying'); if(evt&&evt.parent){ evt=evt.parent; evt.untrigger(false,source); for(var i=0;i<100;i++){ evt=evt.parent; if(evt.player==source){ evt.finish(); } if(evt.name=='phase'){ break; } } } game.triggerEnter(source); }, replacePlayerOL:function(){ 'step 0' var cards=source.getCards('hej'); if(cards.length){ source.$throw(cards,1000); game.cardsDiscard(cards); } 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); var evt=event.getParent('dying'); if(evt&&evt.parent){ evt=evt.parent; evt.untrigger(false,source); for(var i=0;i<100;i++){ evt=evt.parent; if(evt.player==source){ evt.finish(); } if(evt.name=='phase'){ break; } } } game.addVideo('reinit',source,[name,color]); game.triggerEnter(source); }, }, player:{ gainZhibao:function(num,source){ if(source){ if(num===true||num>source.storage.longchuanzhibao){ num=source.storage.longchuanzhibao; } } else{ if(typeof num!='number'){ num=1; } } if(!num||typeof num!='number') return this; this.storage.longchuanzhibao+=num; this.updateMark('longchuanzhibao'); if(source){ source.storage.longchuanzhibao-=num; source.updateMark('longchuanzhibao'); game.log(this,'从',source,'处获得了'+get.cnNumber(num)+'个','#y龙船至宝'); } else{ game.log(this,'获得了'+get.cnNumber(num)+'个','#y龙船至宝'); } if(source&&source.side!=this.side){ this.draw(num,'nodelay'); var that=this; var friend=game.findPlayer(function(current){ return current.side==that.side&¤t!=that; }); if(friend){ friend.draw(num,'nodelay'); } } var map={wei:0,shu:0,wu:0,qun:0}; for(var i=0;i=4){ current.classList.add('current_action'); } else{ current.classList.remove('current_action'); } } return this; }, dieAfter2:function(source){ if(_status.connectMode&&_status.mode!='guandu'){ if(_status.mode=='1v1'||_status.mode=='3v3') return; else if(_status.mode=='2v2'){ var friend; for(var i=0;i2)){ return; } else if(game.friend.length==1&&this==game.friend[0]&&_status.friend.length==0){ return; } else if(game.enemy.length==1&&this==game.enemy[0]&&_status.enemy.length==0){ return; } 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(); } } } }, 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.name1); _status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true); } else{ _status.enemyDied.push(dead.name1); _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){ // later ? } var friend; for(var i=0;i=side2.length+2){ me.showGiveup(); } } } return; } else if(_status.mode=='two'){ var friend; for(var i=0;imax){ max=list[i].storage.longchuanzhibao; } } for(var i=0;i2)){ if(game.friend.includes(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{ game.replacePlayer(this); } } } } }, get:{ rawAttitude:function(from,to){ if(from.side==to.side){ if(to.identity=='zhu'){ if(_status.connectMode){ if(_status.mode=='4v4'||_status.mode=='guandu') return 7; } else{ if(lib.storage.main_zhu||_status.mode=='four'||_status.mode=='guandu') return 7; } } return 6; } else{ if(_status.mode=='siguo'){ var list=['wei','shu','wu','qun']; var map={wei:0,shu:0,wu:0,qun:0}; var map2={wei:0,shu:0,wu:0,qun:0}; for(var i=0;i=4){ allin=i; break; } else if(map2[i]==3){ map[i]+=10; } else if(map2[i]==2){ map[i]++; } } if(allin) return to.side==allin?-20:0; list.sort(function(a,b){ return map[b]-map[a]; }); var id1=list.indexOf(from.side); var id2=list.indexOf(to.side); var att=-1; switch(id1){ case 0:att=_status.siguoai[id2+2];break; case 1: switch(id2){ case 0:att=_status.siguoai[0];break; case 2:att=_status.siguoai[1];break; case 3:att=_status.siguoai[2];break; } break; case 2: switch(id2){ case 0:att=_status.siguoai[0];break; case 1:att=_status.siguoai[1];break; case 3:att=_status.siguoai[2];break; } break; case 3:{ if(id2==0){ att=_status.siguoai[1];break; } else{ att=_status.siguoai[2];break; } } } if(map2[to.side]>=4){ att-=10; } else if(map2[to.side]==3){ att-=3; } else if(map2[to.side]==2){ att-=0.5; } if(to.storage.longchuanzhibao){ return att*1.2; } return att; } else{ if(to.identity=='zhu'){ if(_status.connectMode){ if(_status.mode=='4v4'||_status.mode=='guandu') return -10; } else{ if(lib.storage.main_zhu||_status.mode=='four'||_status.mode=='guandu') return -10; } } return -6; } } }, }, help:{ '对决模式': '
同舟共济(四国)
  • 游戏开始时,每个势力的随机一名角色得到一个龙船至宝,1号位角色所在的势力额外获得一个龙船至宝,场上共5枚龙船至宝。龙船至宝是一个特殊标记。'+ '
  • 争夺龙船至宝的方式:当敌人受到了你造成的伤害后,若其有龙船至宝,则你获得其一个龙船至宝。若你杀死了该敌人,则你获得其所有的龙船至宝。'+ '
  • 获得龙船至宝时的摸牌:除游戏开始时外,若你从非队友处获得了龙船至宝,则你和队友各摸X张牌。(X为该次获得的龙船至宝数;获得队友的龙船至宝不摸牌)'+ '
  • 无来源死亡时:当一名角色死亡时,若没有伤害来源,则其持有的所有龙船至宝交给场上龙船至宝数唯一最多的角色,若没有则随机分配,获得龙船至宝的角色和其队友各摸X张牌。'+ '
  • 杀死队友时:当你杀死队友时,则将你和队友持有的所有龙船至宝交给场上龙船至宝数唯一最多的敌人,若没有则随机分配,获得龙船至宝的角色和其队友各摸X张牌。'+ '
  • 胜利条件:满足一下任意条件游戏结束:(1)在新的一轮开始时,若你的势力获得的龙船至宝至少为4个,则你和队友获胜;(2)消灭所有敌人。'+ '
'+ '
2v2 替补模式
  • 选将时额外选择一名替补武将,阵亡时使用自己的替补武将上场,无替补时改为用队友的替补武将,两人均无替补时游戏结束'+ '
  • 杀死敌方武将摸三张牌,杀死友方武将弃置所有牌
'+ '
4v4
  • 双方各有一名主公和三名忠臣,杀死对方主公获胜
  • '+ '8号位游戏开始时额外摸一张牌,7、8号位可在游戏开始时置换一次手牌
  • '+ '杀死对方忠臣摸2+x张牌,x为对方(含刚被杀的忠臣)与己方的存活人数之差;主公杀死己方忠臣须弃置所有牌', } }; });