'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; 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; } 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&&lib.configOL.versus_mode=='guandu') _status.mode='guandu'; 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+'人'); } else if(lib.configOL.versus_mode=='2v2'||lib.configOL.versus_mode=='3v3'){ uiintro.add('
四号位换牌:'+(lib.configOL.replace_handcard?'开启':'关闭')); } 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.name)+'/'+get.translation(zhu.name)+'/'+get.translation(zhu.nextSeat.name); return ['统率三军',str] } var str=get.translation(game.me.name); 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',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当前分数:
'+(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',false); 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=['huoshaowuchao','liangcaokuifa','zhanyanliangzhuwenchou','shishengshibai'].randomGet(); 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); var dialog=ui.create.dialog('本局特殊事件:'+get.translation(evt)); dialog.addText(get.translation(evt+'_info'),false); setTimeout(function(){ dialog.close(); },5000) }; game.broadcastAll(func,map,evt); _status.firstAct=game.falseZhu; game.delay(0,5000); "step 1" event.falseList=['xunyu','xunyou','re_guojia','re_zhangliao','re_xuhuang','yujin_yujin','caohong','jsp_guanyu','liuye','litong','zangba','re_manchong','re_hanhaoshihuan','chengyu','caoren'].filter(function(name){ if(!Array.isArray(lib.character[name])) return false; lib.character[name][1]='wei'; return true; }); event.trueList=['xunchen','gaolan','sp_zhanghe','sp_xuyou','chenlin','re_liubei','yj_jushou','sp_shenpei','tianfeng','yuantanyuanshang','lvkuanglvxiang','xinpi','guotufengji','chunyuqiong'].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(3); 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',false); 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=['huoshaowuchao','liangcaokuifa','zhanyanliangzhuwenchou','shishengshibai'].randomGet(); 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); } ui.guanduInfo.innerHTML='当前事件:'+get.translation(evt); },evt); game.me.chooseControl('ok').set('prompt','###本局特殊事件:'+get.translation(evt)+'###'+get.translation(evt+'_info')); 'step 1' event.falseList=['xunyu','xunyou','re_guojia','re_zhangliao','re_xuhuang','yujin_yujin','caohong','jsp_guanyu','liuye','litong','zangba','re_manchong','re_hanhaoshihuan','chengyu','caoren'].filter(function(name){ if(!Array.isArray(lib.character[name])) return false; lib.character[name][1]='wei'; return true; }); event.trueList=['xunchen','gaolan','sp_zhanghe','sp_xuyou','chenlin','re_liubei','yj_jushou','sp_shenpei','tianfeng','yuantanyuanshang','lvkuanglvxiang','xinpi','guotufengji','chunyuqiong'].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(3),'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',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',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.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'); 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(); }, }, shishengshibai:{ mod:{ aiOrder:function(player,card,num){ if(_status.shishengshibai&&_status.shishengshibai%10==9){ if(['sha','tao','guohe','shunshou','tunliang','wuzhong','juedou','yuanjun'].contains(card.name)) return num+15; } }, }, trigger:{ player:['useCard1','useCardToTargeted'], }, silent:true, filter:function(event,player,name){ if(name=='useCard1') return true; if(!event.parent.shishengshibai||event.targets.length!=event.parent.triggeredTargets4.length) return false; if(!event.targets||!event.targets.length||['delay','equip'].contains(get.type(event.card))) return false; return 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.shishengshibai=true; } else{ trigger.getParent().targets=trigger.getParent().targets.concat(trigger.targets); trigger.getParent().triggeredTargets4=trigger.getParent().triggeredTargets4.concat(trigger.targets); } }, ai:{ result:{ player:function(card,player,target){ if(_status.shishengshibai&&_status.shishengshibai%10==9&&card.name=='tiesuo') return 'zerotarget'; }, }, }, }, 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:'damageBegin'}, 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){ 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:'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(); 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(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']}, 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=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); _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(); } 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); _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; } } 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); _status.event.parent.parent.parent.untrigger(false,source); 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.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){ // 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.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{ 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 替补模式
  • 选将时额外选择一名替补武将,阵亡时使用自己的替补武将上场,无替补时改为用队友的替补武将,两人均无替补时游戏结束'+ '
  • 杀死敌方武将摸3张牌,杀死友方武将弃置所有牌
'+ '
4v4
  • 双方各有一名主公和三名忠臣,杀死对方主公获胜
  • '+ '8号位游戏开始时额外摸一张牌,7、8号位可在游戏开始时置换一次手牌
  • '+ '杀死对方忠臣摸2+x张牌,x为对方(含刚被杀的忠臣)与己方的存活人数之差;主公杀死己方忠臣须弃置所有牌', } }; });