'use strict'; game.import('mode',function(lib,game,ui,get,ai,_status){ return { name:'single', changbanCharacter:[ "key_kyousuke", "xf_yiji","caozhang","sunquan", "re_caocao","re_guojia","re_xuzhu","re_zhangliao","re_xiahoudun","re_simayi","re_lidian", "re_zhangfei","re_zhaoyun","re_zhouyu","re_ganning","re_lvbu","re_gongsunzan","re_diaochan", "re_xiahouyuan","re_huangzhong","re_weiyan","re_dianwei","re_pangde","re_yanwen","pangtong", "re_zhurong","sunjian","jiaxu","dengai","jiangwei","sunce", "wangji","kuailiangkuaiyue","wangping","yl_luzhi","chendao","lukang", "xin_masu","lingtong","xusheng","wangyi","xunyou","madai","handang", "guohuai","caochong","guanping","liufeng","zhuran","xin_liru", "hanhaoshihuan","wuyi","guyong","caoxiu","liuchen","sunxiu","gongsunyuan", "guohuanghou","xinxianying","qinmi","xushi","xuezong","ol_yujin", "lvdai","wangcan","zhoufang","guosi","zhangji","fanchou", "zhanggong","shamoke","mangyachang","huangfusong","xf_huangquan","xf_tangzi","xf_sufei","liuqi", "lifeng","lingcao","sunru","re_jikang","zhuling", "sp_caiwenji","caoang","sp_caoren","fuwan","guanyinping","jsp_guanyu","huangjinleishi", "sp_jiangwei","litong","mayunlu","sp_pangde","wanglang","xiahouba", "yuanshu","yuejin","sp_zhangfei","zhugejin","panfeng","chenlin", "jiling","mateng","tw_dingfeng","kaisa", ], singlePile:[ ['spade',5,'sha'], ['spade',7,'sha'], ['spade',8,'sha'], ['spade',10,'sha'], ['heart',10,'sha'], ['heart',11,'sha'], ['club',4,'sha'], ['club',5,'sha'], ['club',6,'sha'], ['club',8,'sha'], ['club',9,'sha'], ['club',10,'sha'], ['club',11,'sha'], ['diamond',6,'sha'], ['diamond',9,'sha'], ['diamond',11,'sha'], ['heart',2,'shan'], ['heart',5,'shan'], ['diamond',2,'shan'], ['diamond',3,'shan'], ['diamond',7,'shan'], ['diamond',8,'shan'], ['diamond',10,'shan'], ['diamond',11,'shan'], ['heart',3,'tao'], ['heart',4,'tao'], ['heart',9,'tao'], ['diamond',12,'tao'], ['club',12,'bingliang'], ['spade',3,'guohe'], ['diamond',12,'guohe'], ['club',3,'guohe'], ['club',1,'juedou'], ['spade',1,'juedou'], ['heart',6,'lebu'], ['spade',1,'nanman'], ['club',7,'shuiyanqijunx'], ['spade',4,'shunshou'], ['spade',11,'shunshou'], ['diamond',4,'shunshou'], ['heart',1,'wanjian'], ['heart',5,'wuxie'], ['club',5,'wuxie'], ['heart',7,'wuzhong'], ['heart',8,'wuzhong'], ['diamond',5,'guanshi'], ['spade',9,'hanbing'], ['spade',6,'qinggang'], ['spade',12,'zhangba'], ['diamond',1,'zhuge'], ['spade',2,'bagua'], ['club',2,'renwang'], ], characterSingle:{ caocao:['male','wei',4,['jianxiong'],['zhu']], simayi:['male','wei',3,['fankui','guicai']], xiahoudun:['male','wei',4,['ganglie']], zhangliao:['male','wei',4,['retuxi']], xuzhu:['male','wei',4,['luoyi','xiechan']], guojia:['male','wei',3,['tiandu','yiji']], zhenji:['female','wei',3,['luoshen','sgqingguo']], liubei:['male','shu',4,['sgrenwang'],['zhu']], guanyu:['male','shu',4,['wusheng','huwei']], zhangfei:['male','shu',4,['paoxiao']], zhugeliang:['male','shu',3,['guanxing','kongcheng']], zhaoyun:['male','shu',4,['longdan']], machao:['male','shu',4,['xiaoxi','tieji']], huangyueying:['female','shu',3,['jizhi','cangji']], sunquan:['male','wu',4,['sgzhiheng'],['zhu']], ganning:['male','wu',4,['qixi']], lvmeng:['male','wu',4,['shenju','botu']], huanggai:['male','wu',4,['kurou']], zhouyu:['male','wu',3,['yingzi','fanjian']], daqiao:['female','wu',3,['guose','wanrong']], luxun:['male','wu',3,['qianxun','lianying']], sunshangxiang:['female','wu',3,['xiaoji','yinli']], //huatuo:['male','qun',3,['qingnang','jijiu']], lvbu:['male','qun',4,['wushuang']], diaochan:['female','qun',3,['pianyi','biyue']], xiahouyuan:['male','wei',4,['shensu','suzi']], old_caoren:['male','wei',4,['jushou']], huangzhong:['male','shu',4,['liegong']], weiyan:['male','shu',4,['sgkuanggu']], xiaoqiao:['female','wu',3,['tianxiang','hongyan']], old_zhoutai:['male','wu',4,['gzbuqu']], zhangjiao:['male','qun',3,['leiji','guidao'],['zhu']], dianwei:['male','wei',4,['qiangxi']], yanwen:['male','qun',4,['shuangxiong']], pangde:['male','qun',4,['xiaoxi','mengjin']], menghuo:['male','shu',4,['manyi','zaiqi']], zhurong:['female','shu',4,['manyi','lieren']], xuhuang:['male','wei',4,['sgduanliang']], sunjian:['male','wu',4,['gzyinghun']], jiangwei:['male','shu',4,['tiaoxin']], hejin:['male','qun',4,['mouzhu','yanhuo']], hansui:['male','qun',4,['xiaoxi','niluan']], niujin:['male','wei',4,['cuorui','liewei']], }, startBefore:function(){ }, onreinit:function(){ _status.mode=_status.connectMode?lib.configOL.single_mode:get.config('single_mode'); if(_status.mode!='normal') return; for(var i in lib.characterSingle){ lib.character[i]=lib.characterSingle[i]; if(!lib.character[i][4]){ lib.character[i][4]=[]; } } for(var j in lib.singleTranslate) lib.translate[j]=lib.singleTranslate[j]; }, start:function(){ "step 0" 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(); } else if(!_status.connectMode){ game.prepareArena(2); } "step 1" if(_status.connectMode){ game.waitForPlayer(function(){ lib.configOL.number=2; }); } "step 2" _status.mode=_status.connectMode?lib.configOL.single_mode:get.config('single_mode'); if(_status.mode=='normal'){ lib.card.list=lib.singlePile.slice(0); game.fixedPile=true; game.broadcastAll(function(singleTranslate,characterSingle){ _status.mode='normal'; for(var j in singleTranslate) lib.translate[j]=singleTranslate[j]; _status.characterList=[]; for(var i in characterSingle){ lib.character[i]=characterSingle[i]; if(!lib.character[i][4]){ lib.character[i][4]=[]; } _status.characterList.push(i); } },lib.singleTranslate,lib.characterSingle); } else if(_status.mode=='changban'){ _status.characterList=[]; for(var i=0;i'; for(var i=0;i'; } } } lib.config.gameRecord.single.str=str; game.saveConfig('gameRecord',lib.config.gameRecord); } }, getState:function(){ var state={}; for(var i in lib.playerOL){ var player=lib.playerOL[i]; state[i]={identity:player.identity}; } return state; }, updateState:function(state){ for(var i in state){ var player=lib.playerOL[i]; if(player){ player.identity=state[i].identity; } } }, getRoomInfo:function(uiintro){ if(lib.configOL.bannedcards.length){ uiintro.add('
禁用卡牌:'+get.translation(lib.configOL.bannedcards)); } uiintro.style.paddingBottom='8px'; }, getVideoName:function(){ var str=get.translation(game.me.name); if(game.me.name2){ str+='/'+get.translation(game.me.name2); } var name=[ str, get.translation(_status.mode+2)+' - '+lib.translate[game.me.identity+'2'] ]; return name; }, showIdentity:function(){}, checkResult:function(){ game.over(game.me.isAlive()); }, checkOnlineResult:function(player){ return player.isAlive(); }, chooseCharacterDianjiang:function(){ var next=game.createEvent('chooseCharacter',false); next.showConfig=true; next.setContent(function(){ "step 0" ui.arena.classList.add('choose-character'); lib.init.onfree(); "step 1" game.me.chooseControl('先手','后手').prompt='请选择自己的行动顺序'; "step 2" var map=result.control=='先手'?['zhu','fan']:['fan','zhu']; game.me.identity=map[0]; game.me.next.identity=map[1]; game.me.showIdentity(); game.me.next.showIdentity(); "step 3" event.flipassign=true; event.videoId=lib.status.videoId++; var list=[]; for(var i in lib.character){ if(lib.filter.characterDisabled(i)) continue; list.push(i); } _status.characterList=list; var filter=function(name){ return !_status.characterList.contains(name); }; var dialog=ui.create.characterDialog('heightset',filter,'expandall').open(); dialog.videoId=event.videoId; game.me.chooseButton(true).set('ai',function(button){ return Math.random(); }).set('dialog',event.videoId); "step 4" game.me.init(result.links[0]); game.me.chooseButton(true).set('ai',function(button){ return Math.random(); }).set('dialog',event.videoId); "step 5" game.me.next.init(result.links[0]); setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); }); }, chooseCharacter:function(){ if(_status.mode=='dianjiang'){ game.chooseCharacterDianjiang(); return; } var next=game.createEvent('chooseCharacter',false); next.showConfig=true; next.setContent(function(){ "step 0" ui.arena.classList.add('choose-character'); var num=[0,1].randomGet(); game.players[num].identity='zhu'; game.players[1-num].identity='fan'; game.broadcastAll(function(p,t){ p.enemy=t;t.enemy=p; },game.players[0],game.players[1]); for(var i=0;i=12; })&&get.effect(target,{name:'juedou'},player,player)>0) return -1; return 0; }, }, }, }, huwei:{ audio:2, trigger:{ player:'enterGame', global:'gameDrawAfter', }, direct:true, content:function(){ player.chooseUseTarget('shuiyanqijunx',get.prompt('huwei'),'视为使用一张【水淹七军】').logSkill='huwei'; }, }, sgkuanggu:{ audio:'kuanggu', trigger:{source:'damageSource'}, frequent:true, filter:function(event,player){ return player.isDamaged(); }, content:function(){ 'step 0' player.judge(function(result){ return get.color(result)=='black'?2:-2; }); 'step 1' if(result.bool==true) player.recover(); }, }, suzi:{ audio:2, trigger:{global:'loseAfter'}, filter:function(event,player){ if(event.getParent().name!='die') return false; for(var i=0;i0; }, forceDie:true, skillAnimation:true, animationColor:'orange', content:function(){ var cards=player.getCards('e'); player.cangji_yozuru=cards; player.lose(cards,ui.special); player.addSkill('cangji_yozuru'); }, subSkill:{ yozuru:{ sub:true, charlotte:true, superCharlotte:true, trigger:{player:'enterGame'}, forced:true, popup:false, //onremove:true, content:function(){ var cards=player.cangji_yozuru.slice(0); for(var i=0;i=4; }, content:function(){ player.insertPhase(); }, subSkill:{ kanade:{ trigger:{player:['useCard','phaseBefore']}, silent:true, content:function(){ if(trigger.name=='phase') player.storage.botu=[]; else{ var suit=get.suit(trigger.card); if(suit) player.storage.botu.add(suit); } }, }, }, }, _changeHandcard:{ trigger:{global:'gameDrawAfter'}, silent:true, popup:false, filter:function(event,player){ return _status.mode=='changban'&&player.maxHp<=3; }, content:function(){ 'step 0' player.chooseBool('是否更换手牌?').ai=function(){ var hs=player.getCards('h'); return get.value(hs,'raw')<6*hs; }; 'step 1' if(result.bool){ var hs=player.getCards('h'); player.lose(hs,ui.special); event.hs=hs; } else event.finish(); 'step 2' var hs=event.hs; player.draw(hs.length,'nodelay'); for(var i=0;i游戏规则
', } }; });