diff --git a/card/yunchou.js b/card/yunchou.js index ee51bd406..fef5e2d3d 100644 --- a/card/yunchou.js +++ b/card/yunchou.js @@ -1,963 +1,963 @@ -'use strict'; -game.import('card',function(lib,game,ui,get,ai,_status){ - return { - name:'yunchou', - card:{ - diaobingqianjiang:{ - fullskin:true, - type:'trick', - enable:true, - selectTarget:-1, - filterTarget:function(card,player,target){ - return player==target||target.countCards('h'); - }, - contentBefore:function(){ - "step 0" - game.delay(); - player.draw(); - "step 1" - if(get.is.versus()){ - player.chooseControl('顺时针','逆时针',function(event,player){ - if(player.next.side==player.side) return '逆时针'; - return '顺时针'; - }).set('prompt','选择'+get.translation(card)+'的结算方向'); - } - else{ - event.goto(3); - } - "step 2" - if(result&&result.control=='顺时针'){ - var evt=event.getParent(); - evt.fixedSeat=true; - evt.targets.sortBySeat(); - evt.targets.reverse(); - if(evt.targets[evt.targets.length-1]==player){ - evt.targets.unshift(evt.targets.pop()); - } - } - "step 3" - ui.clear(); - var cards=get.cards(Math.ceil(game.countPlayer()/2)); - var dialog=ui.create.dialog('调兵遣将',cards,true); - _status.dieClose.push(dialog); - dialog.videoId=lib.status.videoId++; - game.addVideo('cardDialog',null,['调兵遣将',get.cardsInfo(cards),dialog.videoId]); - event.getParent().preResult=dialog.videoId; - }, - content:function(){ - "step 0" - for(var i=0;i0){ - return get.value(button.link,nextSeat)-5; - } - else{ - return 5-get.value(button.link,nextSeat); - } - } - next.set('closeDialog',false); - next.set('dialogdisplay',true); - 'step 1' - if(result&&result.bool&&result.links&&result.links.length){ - for(var i=0;i0&&target!=player; - }, - content:function(){ - 'step 0' - if(target.countCards('h','sha')){ - var name=get.translation(player.name); - target.chooseControl().set('prompt',get.translation('caochuanjiejian')).set('choiceList',[ - '将手牌中的所有杀交给'+name+',并视为对'+name+'使用一张杀','展示手牌并令'+name+'弃置任意一张' - ],function(){ - if(get.effect(player,{name:'sha'},target,target)<0) return 1; - if(target.countCards('h','sha')>=3) return 1; - return 0; - }); - } - else{ - event.directfalse=true; - } - 'step 1' - if(event.directfalse||result.control=='选项二'){ - if(target.countCards('h')){ - if(!player.isUnderControl(true)){ - target.showHandcards(); - } - else{ - game.log(target,'展示了',target.getCards('h')); - } - player.discardPlayerCard(target,'h',true,'visible'); - } - event.finish(); - } - else{ - var hs=target.getCards('h','sha'); - player.gain(hs,target); - target.$give(hs,player); - } - 'step 2' - target.useCard({name:'sha'},player); - }, - ai:{ - order:4, - value:[5,1], - result:{ - target:function(player,target){ - if(player.hasShan()) return -1; - return 0; - } - } - } - }, - // xiaolicangdao:{ - // fullskin:true, - // type:'trick', - // enable:true, - // filterTarget:function(card,player,target){ - // return target!=player; - // }, - // multitarget:true, - // content:function(){ - // 'step 0' - // if(cards&&cards.length){ - // target.gain(cards,player); - // target.$gain2(cards); - // if(cards.length==1){ - // event.card1=cards[0]; - // } - // } - // 'step 1' - // event.card2=target.getCards('h').randomGet(); - // if(event.card2){ - // target.discard(event.card2); - // } - // else{ - // event.finish(); - // } - // 'step 2' - // if(event.card1&&event.card1.name==event.card2.name){ - // target.damage(); - // } - // }, - // ai:{ - // order:6, - // value:[3,1], - // result:{ - // target:function(player,target){ - // return -2/Math.sqrt(1+target.countCards('h')); - // }, - // }, - // tag:{ - // damage:1, - // discard:1, - // loseCard:1, - // } - // } - // }, - geanguanhuo:{ - fullskin:true, - type:'trick', - filterTarget:function(card,player,target){ - return target!=player&&target.countCards('h')>0; - }, - enable:function(){ - return game.countPlayer()>2; - }, - chongzhu:function(){ - return game.countPlayer()<=2; - }, - multicheck:function(card,player){ - return game.countPlayer(function(current){ - return current!=player&¤t.countCards('h'); - })>1; - }, - multitarget:true, - multiline:true, - singleCard:true, - content:function(){ - 'step 0' - target.chooseToCompare(event.addedTarget); - 'step 1' - if(!result.tie){ - if(result.bool){ - if(event.addedTarget.countCards('he')){ - target.line(event.addedTarget); - target.gainPlayerCard(event.addedTarget,true); - } - } - else{ - if(target.countCards('he')){ - event.addedTarget.line(target); - event.addedTarget.gainPlayerCard(target,true); - } - } - event.finish(); - } - 'step 2' - target.discardPlayerCard(player); - target.line(player); - }, - selectTarget:2, - ai:{ - order:5, - value:[7,1], - useful:[4,1], - result:{ - target:-1, - } - } - }, - shezhanqunru:{ - fullskin:true, - type:'trick', - enable:true, - toself:true, - filterTarget:function(card,player,target){ - return target==player; - }, - selectTarget:-1, - modTarget:true, - content:function(){ - 'step 0' - var list=game.filterPlayer(function(current){ - return current!=target&¤t.countCards('h'); - }); - if(!list.length){ - target.draw(3); - event.finish(); - } - else{ - list.sortBySeat(target); - event.list=list; - event.torespond=[]; - } - 'step 1' - if(event.list.length){ - event.current=event.list.shift(); - event.current.chooseBool('是否响应'+get.translation(target)+'的舌战群儒?',function(event,player){ - if(get.attitude(player,_status.event.source)>=0) return false; - var hs=player.getCards('h'); - var dutag=player.hasSkillTag('nodu'); - for(var i=0;i=8&&value<=7) return true; - if(value<=3) return true; - } - else if(_status.event.hasTarget%2==1){ - if(hs[i].number>=11&&value<=6) return true; - } - } - return false; - }).set('source',target).set('hasTarget',event.torespond.length); - } - else{ - event.goto(3); - } - 'step 2' - if(result.bool){ - event.torespond.push(event.current); - event.current.line(target,'green'); - event.current.popup('响应'); - game.log(event.current,'响应了舌战群儒'); - game.delayx(0.5); - } - event.goto(1); - 'step 3' - if(event.torespond.length==0){ - event.num=1; - } - else{ - event.num=0; - target.chooseToCompare(event.torespond).callback=lib.card.shezhanqunru.callback; - } - 'step 4' - if(event.num>0){ - target.draw(3); - } - }, - callback:function(){ - if(event.card1.number>event.card2.number){ - event.parent.parent.num++; - } - else{ - event.parent.parent.num--; - } - }, - ai:{ - order:8.5, - value:[6,1], - useful:[3,1], - tag:{ - draw:1 - }, - result:{ - target:function(player,target){ - var hs=target.getCards('h'); - for(var i=0;i=7&&value<=6) return 1; - if(value<=3) return 1; - } - return 0; - } - } - } - }, - youdishenru:{ - fullskin:true, - type:'trick', - notarget:true, - wuxieable:true, - global:'g_youdishenru', - content:function(){ - 'step 0' - var info=event.getParent(2).youdiinfo||event.getParent(3).youdiinfo; - if(!info){ - event.finish(); - return; - } - info.evt.cancel(); - event.source=info.source; - event.source.storage.youdishenru=player; - event.source.addSkill('youdishenru'); - 'step 1' - var next=event.source.chooseToUse({name:'sha'},player,-1,'对'+get.translation(player)+'使用一张杀,或受到一点伤害'); - next.ai2=function(){ - return 1; - }; - 'step 2' - if(result.bool){ - if(event.source.storage.youdishenru){ - event.goto(1); - } - else{ - event.source.removeSkill('youdishenru'); - } - } - else{ - event.source.damage(player); - event.source.removeSkill('youdishenru'); - } - }, - ai:{ - value:[5,1], - useful:[5,1], - order:1, - wuxie:function(target,card,player,current,state){ - return -state*get.attitude(player,current); - }, - result:{ - player:function(player){ - if(_status.event.parent.youdiinfo&& - get.attitude(player,_status.event.parent.youdiinfo.source)<=0){ - return 1; - } - return 0; - } - } - } - }, - wangmeizhike:{ - fullskin:true, - type:'trick', - enable:true, - filterTarget:function(card,player,target){ - return (target.isMinHp()&&target.isDamaged())||target.isMinHandcard(); - }, - content:function(){ - 'step 0' - if(target.isMinHp()&&target.isDamaged()){ - target.recover(); - event.rec=true; - } - 'step 1' - if(target.isMinHandcard()){ - target.draw(event.rec?1:2); - } - }, - ai:{ - order:2.5, - value:7, - result:{ - target:function(player,target){ - var num=0; - if(target.isMinHp()&&get.recoverEffect(target)>0){ - if(target.hp==1){ - num+=3; - } - else{ - num+=2; - } - } - if(target.isMinHandcard()){ - num+=2; - } - return num; - } - } - } - }, - suolianjia:{ - fullskin:true, - type:"equip", - subtype:"equip2", - skills:['suolianjia'], - onEquip:function(){ - if(player.isLinked()==false) player.link(); - }, - onLose:function(){ - if(player.isLinked()) player.link(); - }, - ai:{ - basic:{ - equipValue:5 - }, - }, - }, - chenhuodajie:{ - fullskin:true, - type:'trick', - filterTarget:true, - global:'g_chenhuodajie', - content:function(){ - if(target.countCards('he')){ - player.gainPlayerCard('he',target,true); - } - }, - ai:{ - order:1, - useful:6, - value:6, - result:{ - target:-1 - }, - tag:{ - loseCard:1 - } - } - }, - fudichouxin:{ - fullskin:true, - type:'trick', - enable:true, - filterTarget:function(card,player,target){ - return player!=target&&target.countCards('h'); - }, - content:function(){ - "step 0" - player.chooseToCompare(target).set('preserve','win').clear=false; - "step 1" - if(result.bool){ - player.gain([result.player,result.target]); - result.player.clone.moveDelete(player); - result.target.clone.moveDelete(player); - game.addVideo('gain2',player,get.cardsInfo([result.player,result.target])); - } - else if(!result.cancelled){ - result.player.clone.delete(); - result.target.clone.delete(); - game.addVideo('deletenode',player,get.cardsInfo([result.player,result.target])); - } - }, - ai:{ - order:4, - value:[4,1], - result:{ - target:function(player){ - if(player.countCards('h')<=1) return 0; - return -1; - }, - player:function(player){ - if(player.countCards('h')<=1) return 0; - return 0.5; - } - }, - tag:{ - loseCard:1 - } - } - }, - shuiyanqijun:{ - fullskin:true, - type:'trick', - enable:true, - filterTarget:function(card,player,target){ - return target.countCards('e'); - }, - selectTarget:-1, - content:function(){ - if(target.countCards('e')) target.chooseToDiscard('e',true); - }, - reverseOrder:true, - ai:{ - order:9, - result:{ - target:function(player,target){ - if(target.countCards('e')) return -1; - return 0; - } - }, - tag:{ - multitarget:1, - multineg:1 - } - } - }, - toulianghuanzhu:{ - fullskin:true, - type:'trick', - enable:true, - filterTarget:function(card,player,target){ - return target.countCards('h')>0; - }, - content:function(){ - 'step 0' - if(!target.countCards('h')){ - event.finish(); - return; - } - var hs=player.getCards('h'); - if(hs.length){ - var minval=get.value(hs[0]); - var colors=[get.color(hs[0])]; - for(var i=1;i=0){ - if(colors.contains(get.color(button.link))){ - val+=3; - } - } - return val; - } - } - else{ - player.viewHandcards(target); - event.finish(); - } - 'step 1' - if(result.bool){ - event.card=result.links[[0]]; - player.chooseCard('h',true,'用一张手牌替换'+get.translation(event.card)).ai=function(card){ - return -get.value(card); - }; - } - else{ - event.finish(); - } - 'step 2' - if(result.bool){ - player.gain(event.card,target); - target.gain(result.cards,player); - player.$giveAuto(result.cards,target); - target.$giveAuto(event.card,player); - game.log(player,'与',target,'交换了一张手牌'); - if(get.color(event.card)==get.color(result.cards[0])){ - player.draw(); - } - target.addTempSkill('toulianghuanzhu_ai1'); - } - else{ - target.addTempSkill('toulianghuanzhu_ai2'); - } - }, - ai:{ - order:8, - tag:{ - loseCard:1, - norepeat:1, - }, - result:{ - target:function(player,target){ - if(player.countCards('h')<=1) return 0; - if(target.hasSkill('toulianghuanzhu_ai2')) return 0; - if(target.hasSkill('toulianghuanzhu_ai1')) return 0.5; - return -1; - } - }, - useful:[4,1], - value:[6,1] - } - }, - huoshan:{ - fullskin:true, - type:'delay', - cardcolor:'red', - cardnature:'fire', - modTarget:function(card,player,target){ - return lib.filter.judge(card,player,target); - }, - enable:function(card,player){ - return player.canAddJudge(card); - }, - filterTarget:function(card,player,target){ - return (lib.filter.judge(card,player,target)&&player==target); - }, - selectTarget:[-1,-1], - judge:function(card){ - if(get.suit(card)=='heart'&&get.number(card)>1&&get.number(card)<10) return -6; - return 0; - }, - effect:function(){ - if(result.bool==false){ - player.damage(2,'fire','nosource'); - var players=game.filterPlayer(function(current){ - return get.distance(player,current)<=1&&player!=current; - }); - players.sort(lib.sort.seat); - for(var i=0;i1&&get.number(card)<10) return -3; - return 0; - }, - fullskin:true, - effect:function(){ - if(result.bool==false){ - if(player.countCards('he')==0) player.loseHp(); - else{ - player.discard(player.getCards('he').randomGets(3)); - } - var players=get.players(); - for(var i=0;i0){ + return get.value(button.link,nextSeat)-5; + } + else{ + return 5-get.value(button.link,nextSeat); + } + } + next.set('closeDialog',false); + next.set('dialogdisplay',true); + 'step 1' + if(result&&result.bool&&result.links&&result.links.length){ + for(var i=0;i0&&target!=player; + }, + content:function(){ + 'step 0' + if(target.countCards('h','sha')){ + var name=get.translation(player.name); + target.chooseControl().set('prompt',get.translation('caochuanjiejian')).set('choiceList',[ + '将手牌中的所有杀交给'+name+',并视为对'+name+'使用一张杀','展示手牌并令'+name+'弃置任意一张' + ],function(){ + if(get.effect(player,{name:'sha'},target,target)<0) return 1; + if(target.countCards('h','sha')>=3) return 1; + return 0; + }); + } + else{ + event.directfalse=true; + } + 'step 1' + if(event.directfalse||result.control=='选项二'){ + if(target.countCards('h')){ + if(!player.isUnderControl(true)){ + target.showHandcards(); + } + else{ + game.log(target,'展示了',target.getCards('h')); + } + player.discardPlayerCard(target,'h',true,'visible'); + } + event.finish(); + } + else{ + var hs=target.getCards('h','sha'); + player.gain(hs,target); + target.$give(hs,player); + } + 'step 2' + target.useCard({name:'sha'},player); + }, + ai:{ + order:4, + value:[5,1], + result:{ + target:function(player,target){ + if(player.hasShan()) return -1; + return 0; + } + } + } + }, + // xiaolicangdao:{ + // fullskin:true, + // type:'trick', + // enable:true, + // filterTarget:function(card,player,target){ + // return target!=player; + // }, + // multitarget:true, + // content:function(){ + // 'step 0' + // if(cards&&cards.length){ + // target.gain(cards,player); + // target.$gain2(cards); + // if(cards.length==1){ + // event.card1=cards[0]; + // } + // } + // 'step 1' + // event.card2=target.getCards('h').randomGet(); + // if(event.card2){ + // target.discard(event.card2); + // } + // else{ + // event.finish(); + // } + // 'step 2' + // if(event.card1&&event.card1.name==event.card2.name){ + // target.damage(); + // } + // }, + // ai:{ + // order:6, + // value:[3,1], + // result:{ + // target:function(player,target){ + // return -2/Math.sqrt(1+target.countCards('h')); + // }, + // }, + // tag:{ + // damage:1, + // discard:1, + // loseCard:1, + // } + // } + // }, + geanguanhuo:{ + fullskin:true, + type:'trick', + filterTarget:function(card,player,target){ + return target!=player&&target.countCards('h')>0; + }, + enable:function(){ + return game.countPlayer()>2; + }, + chongzhu:function(){ + return game.countPlayer()<=2; + }, + multicheck:function(card,player){ + return game.countPlayer(function(current){ + return current!=player&¤t.countCards('h'); + })>1; + }, + multitarget:true, + multiline:true, + singleCard:true, + content:function(){ + 'step 0' + target.chooseToCompare(event.addedTarget); + 'step 1' + if(!result.tie){ + if(result.bool){ + if(event.addedTarget.countCards('he')){ + target.line(event.addedTarget); + target.gainPlayerCard(event.addedTarget,true); + } + } + else{ + if(target.countCards('he')){ + event.addedTarget.line(target); + event.addedTarget.gainPlayerCard(target,true); + } + } + event.finish(); + } + 'step 2' + target.discardPlayerCard(player); + target.line(player); + }, + selectTarget:2, + ai:{ + order:5, + value:[7,1], + useful:[4,1], + result:{ + target:-1, + } + } + }, + shezhanqunru:{ + fullskin:true, + type:'trick', + enable:true, + toself:true, + filterTarget:function(card,player,target){ + return target==player; + }, + selectTarget:-1, + modTarget:true, + content:function(){ + 'step 0' + var list=game.filterPlayer(function(current){ + return current!=target&¤t.countCards('h'); + }); + if(!list.length){ + target.draw(3); + event.finish(); + } + else{ + list.sortBySeat(target); + event.list=list; + event.torespond=[]; + } + 'step 1' + if(event.list.length){ + event.current=event.list.shift(); + event.current.chooseBool('是否响应'+get.translation(target)+'的舌战群儒?',function(event,player){ + if(get.attitude(player,_status.event.source)>=0) return false; + var hs=player.getCards('h'); + var dutag=player.hasSkillTag('nodu'); + for(var i=0;i=8&&value<=7) return true; + if(value<=3) return true; + } + else if(_status.event.hasTarget%2==1){ + if(hs[i].number>=11&&value<=6) return true; + } + } + return false; + }).set('source',target).set('hasTarget',event.torespond.length); + } + else{ + event.goto(3); + } + 'step 2' + if(result.bool){ + event.torespond.push(event.current); + event.current.line(target,'green'); + event.current.popup('响应'); + game.log(event.current,'响应了舌战群儒'); + game.delayx(0.5); + } + event.goto(1); + 'step 3' + if(event.torespond.length==0){ + event.num=1; + } + else{ + event.num=0; + target.chooseToCompare(event.torespond).callback=lib.card.shezhanqunru.callback; + } + 'step 4' + if(event.num>0){ + target.draw(3); + } + }, + callback:function(){ + if(event.card1.number>event.card2.number){ + event.parent.parent.num++; + } + else{ + event.parent.parent.num--; + } + }, + ai:{ + order:8.5, + value:[6,1], + useful:[3,1], + tag:{ + draw:1 + }, + result:{ + target:function(player,target){ + var hs=target.getCards('h'); + for(var i=0;i=7&&value<=6) return 1; + if(value<=3) return 1; + } + return 0; + } + } + } + }, + youdishenru:{ + fullskin:true, + type:'trick', + notarget:true, + wuxieable:true, + global:'g_youdishenru', + content:function(){ + 'step 0' + var info=event.getParent(2).youdiinfo||event.getParent(3).youdiinfo; + if(!info){ + event.finish(); + return; + } + info.evt.cancel(); + event.source=info.source; + event.source.storage.youdishenru=player; + event.source.addSkill('youdishenru'); + 'step 1' + var next=event.source.chooseToUse({name:'sha'},player,-1,'对'+get.translation(player)+'使用一张杀,或受到一点伤害').set('addCount',false); + next.ai2=function(){ + return 1; + }; + 'step 2' + if(result.bool){ + if(event.source.storage.youdishenru){ + event.goto(1); + } + else{ + event.source.removeSkill('youdishenru'); + } + } + else{ + event.source.damage(player); + event.source.removeSkill('youdishenru'); + } + }, + ai:{ + value:[5,1], + useful:[5,1], + order:1, + wuxie:function(target,card,player,current,state){ + return -state*get.attitude(player,current); + }, + result:{ + player:function(player){ + if(_status.event.parent.youdiinfo&& + get.attitude(player,_status.event.parent.youdiinfo.source)<=0){ + return 1; + } + return 0; + } + } + } + }, + wangmeizhike:{ + fullskin:true, + type:'trick', + enable:true, + filterTarget:function(card,player,target){ + return (target.isMinHp()&&target.isDamaged())||target.isMinHandcard(); + }, + content:function(){ + 'step 0' + if(target.isMinHp()&&target.isDamaged()){ + target.recover(); + event.rec=true; + } + 'step 1' + if(target.isMinHandcard()){ + target.draw(event.rec?1:2); + } + }, + ai:{ + order:2.5, + value:7, + result:{ + target:function(player,target){ + var num=0; + if(target.isMinHp()&&get.recoverEffect(target)>0){ + if(target.hp==1){ + num+=3; + } + else{ + num+=2; + } + } + if(target.isMinHandcard()){ + num+=2; + } + return num; + } + } + } + }, + suolianjia:{ + fullskin:true, + type:"equip", + subtype:"equip2", + skills:['suolianjia'], + onEquip:function(){ + if(player.isLinked()==false) player.link(); + }, + onLose:function(){ + if(player.isLinked()) player.link(); + }, + ai:{ + basic:{ + equipValue:5 + }, + }, + }, + chenhuodajie:{ + fullskin:true, + type:'trick', + filterTarget:true, + global:'g_chenhuodajie', + content:function(){ + if(target.countCards('he')){ + player.gainPlayerCard('he',target,true); + } + }, + ai:{ + order:1, + useful:6, + value:6, + result:{ + target:-1 + }, + tag:{ + loseCard:1 + } + } + }, + fudichouxin:{ + fullskin:true, + type:'trick', + enable:true, + filterTarget:function(card,player,target){ + return player!=target&&target.countCards('h'); + }, + content:function(){ + "step 0" + player.chooseToCompare(target).set('preserve','win').clear=false; + "step 1" + if(result.bool){ + player.gain([result.player,result.target]); + result.player.clone.moveDelete(player); + result.target.clone.moveDelete(player); + game.addVideo('gain2',player,get.cardsInfo([result.player,result.target])); + } + else if(!result.cancelled){ + result.player.clone.delete(); + result.target.clone.delete(); + game.addVideo('deletenode',player,get.cardsInfo([result.player,result.target])); + } + }, + ai:{ + order:4, + value:[4,1], + result:{ + target:function(player){ + if(player.countCards('h')<=1) return 0; + return -1; + }, + player:function(player){ + if(player.countCards('h')<=1) return 0; + return 0.5; + } + }, + tag:{ + loseCard:1 + } + } + }, + shuiyanqijun:{ + fullskin:true, + type:'trick', + enable:true, + filterTarget:function(card,player,target){ + return target.countCards('e'); + }, + selectTarget:-1, + content:function(){ + if(target.countCards('e')) target.chooseToDiscard('e',true); + }, + reverseOrder:true, + ai:{ + order:9, + result:{ + target:function(player,target){ + if(target.countCards('e')) return -1; + return 0; + } + }, + tag:{ + multitarget:1, + multineg:1 + } + } + }, + toulianghuanzhu:{ + fullskin:true, + type:'trick', + enable:true, + filterTarget:function(card,player,target){ + return target.countCards('h')>0; + }, + content:function(){ + 'step 0' + if(!target.countCards('h')){ + event.finish(); + return; + } + var hs=player.getCards('h'); + if(hs.length){ + var minval=get.value(hs[0]); + var colors=[get.color(hs[0])]; + for(var i=1;i=0){ + if(colors.contains(get.color(button.link))){ + val+=3; + } + } + return val; + } + } + else{ + player.viewHandcards(target); + event.finish(); + } + 'step 1' + if(result.bool){ + event.card=result.links[[0]]; + player.chooseCard('h',true,'用一张手牌替换'+get.translation(event.card)).ai=function(card){ + return -get.value(card); + }; + } + else{ + event.finish(); + } + 'step 2' + if(result.bool){ + player.gain(event.card,target); + target.gain(result.cards,player); + player.$giveAuto(result.cards,target); + target.$giveAuto(event.card,player); + game.log(player,'与',target,'交换了一张手牌'); + if(get.color(event.card)==get.color(result.cards[0])){ + player.draw(); + } + target.addTempSkill('toulianghuanzhu_ai1'); + } + else{ + target.addTempSkill('toulianghuanzhu_ai2'); + } + }, + ai:{ + order:8, + tag:{ + loseCard:1, + norepeat:1, + }, + result:{ + target:function(player,target){ + if(player.countCards('h')<=1) return 0; + if(target.hasSkill('toulianghuanzhu_ai2')) return 0; + if(target.hasSkill('toulianghuanzhu_ai1')) return 0.5; + return -1; + } + }, + useful:[4,1], + value:[6,1] + } + }, + huoshan:{ + fullskin:true, + type:'delay', + cardcolor:'red', + cardnature:'fire', + modTarget:function(card,player,target){ + return lib.filter.judge(card,player,target); + }, + enable:function(card,player){ + return player.canAddJudge(card); + }, + filterTarget:function(card,player,target){ + return (lib.filter.judge(card,player,target)&&player==target); + }, + selectTarget:[-1,-1], + judge:function(card){ + if(get.suit(card)=='heart'&&get.number(card)>1&&get.number(card)<10) return -6; + return 0; + }, + effect:function(){ + if(result.bool==false){ + player.damage(2,'fire','nosource'); + var players=game.filterPlayer(function(current){ + return get.distance(player,current)<=1&&player!=current; + }); + players.sort(lib.sort.seat); + for(var i=0;i1&&get.number(card)<10) return -3; + return 0; + }, + fullskin:true, + effect:function(){ + if(result.bool==false){ + if(player.countCards('he')==0) player.loseHp(); + else{ + player.discard(player.getCards('he').randomGets(3)); + } + var players=get.players(); + for(var i=0;i0){ player.stat[player.stat.length-1].card.sha--; } @@ -12087,13 +12141,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'useCard1'}, filter:function(event,player){ if(_status.currentPhase==player&&event.card.name=='sha'&& - event.card.number>player.storage.qiangwu) return true; + event.card.number>player.storage.qiangwu&&event.addCount!==false) return true; return false; }, forced:true, popup:false, firstDo:true, content:function(){ + trigger.addCount=false; if(player.stat[player.stat.length-1].card.sha>0){ player.stat[player.stat.length-1].card.sha--; } @@ -15471,11 +15526,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ marktext:"龙", intro:{ name:"龙印", - content:"
  • 出牌阶段限三次,你可以将你的任意一张♥或♦手牌当【火攻】使用。
  • 若你同时拥有「凤印」,则你视为拥有技能〖业炎〗。(发动〖业炎〗后,弃置龙印和凤印)", + content:"
  • 出牌阶段限三次,你可以将一张红色牌当【火攻】使用。
  • 若你同时拥有「凤印」,则你视为拥有技能〖业炎〗。(发动〖业炎〗后,弃置龙印和凤印)", }, usable:3, audio:2, enable:"chooseToUse", + position:"he", filterCard:function (card){ return get.color(card)=='red'; }, @@ -15488,7 +15544,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!game.hasPlayer(function(current){ return current.hasSkill('xinfu_jianjie'); })) return false; - if(!player.countCards('h',{color:'red'})) return false; + if(!player.countCards('he',{color:'red'})) return false; }, prompt:"将一张红色牌当火攻使用", check:function (card){ @@ -16415,7 +16471,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ "smh_yeyan":"业炎", "smh_yeyan_info":"", "xinfu_yinshi":"隐士", - "xinfu_yinshi_info":"锁定技,若你没有龙印、凤印且装备区的防具栏为空,则当你受到的属性伤害火锦囊牌造成的伤害时,防止此伤害。", + "xinfu_yinshi_info":"锁定技,若你没有龙印、凤印且防具栏为空,则当你受到属性伤害或锦囊牌造成的伤害时,防止此伤害。", "xinfu_chenghao":"称好", "xinfu_chenghao_info":"当一名角色受到属性伤害后,若其存活且其武将牌横置且是伤害传导的起点,则你可以观看牌堆顶的X张牌并分配给任意角色。(X为横置的角色数量且包含该角色)", "jianjie_faq":"关于龙凤印", @@ -17277,6 +17333,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ spmingjian_info:'一名角色的回合开始时,你可以选择一项:①弃置一张牌,然后其跳过本回合的判定阶段。②将一张手牌置于其武将牌上,然后其本回合内进行判定时不触发「判定结果生效前」的时机,且其回合结束时将此牌置入弃牌堆。', spyinzhi:'隐智', spyinzhi_info:'当你受到1点伤害后,你可以展示牌堆顶的两张牌。若其中有黑桃牌,则你可以进行至多X次「令一名角色获得伤害来源的一张手牌」的步骤,然后获得其余的牌。(X为其中黑桃牌的数量)', + wangshuang:'王双', + spzhuilie:'追猎', + spzhuilie2:'追猎', + spzhuilie_info:'锁定技,你使用【杀】无距离限制;当你使用【杀】指定目标后,若其不在你的攻击范围内,此【杀】不计入使用次数限制且你判定。若判定结果为:装备牌,此【杀】的伤害基数改为X(X为其体力值);锦囊牌,你失去1点体力。', sp_default:"常规", sp_whlw:"文和乱武", diff --git a/character/yijiang.js b/character/yijiang.js index d4aff7ec4..02f86caba 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -4194,7 +4194,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ selectCard:-1, popname:true, filterTarget:function(card,player,target){ - if(player==target) return false; + var info=get.info(player.storage.jiaozhao_card); + if((!info.singleCard||!ui.selected.targets.length)&&player==target) return false; return lib.filter.filterTarget(player.storage.jiaozhao_card,player,target); }, check:function(card){ @@ -5548,7 +5549,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } "step 2" player.chooseToUse('是否对'+get.translation(trigger.target)+'再使用一张杀?', - {name:'sha'},trigger.target,-1); + {name:'sha'},trigger.target,-1).set('addCount',false); } }, xinzhongyong:{ @@ -5608,7 +5609,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(event.useSha){ event.target.chooseToUse('是否使用一张杀?',{name:'sha'}).set('filterTarget',function(card,player,target){ return target!=_status.event.sourcex&&_status.event.sourcex.inRange(target)&&lib.filter.targetEnabled.apply(this,arguments); - }).set('sourcex',player); + }).set('sourcex',player).set('addCount',false); } } }, @@ -5964,13 +5965,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, zhaofu2:{ mod:{ - attackTo:function(from,to,distance){ + inRangeOf:function(from,to){ if(from.group!='wu') return; var players=game.filterPlayer(); for(var i=0;i1&&player.canUse('sha',current,true,true); + return current.storage.xiansi.length>1; } return false; }); @@ -10595,7 +10596,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return _status.event.list.contains(target); }).set('list',targets).set('ai',function(target){ var player=_status.event.player; - return get.effect(target,{name:'sha'},player,player); + return get.attitude(player,target); }); } else{ diff --git a/game/game.js b/game/game.js index 3f498f1ce..dc4561a25 100644 --- a/game/game.js +++ b/game/game.js @@ -13579,7 +13579,7 @@ event.customArgs={default:{}}; event.baseDamage=get.info(card,false).baseDamage||1; player.actionHistory[player.actionHistory.length-1].useCard.push(event); - if(event.addCount!=false){ + if(event.addCount!==false){ if(player.stat[player.stat.length-1].card[card.name]==undefined){ player.stat[player.stat.length-1].card[card.name]=1; } @@ -15433,12 +15433,77 @@ } } }, - inRange:function(target){ - var player=this; - if(player==target||player.hasSkill('undist')||target.hasSkill('undist')) return false; - var range2=player.getAttackRange(); - var distance=get.distance(player,target); - return distance<=range2; + inRange:function(to){ + var from=this; + if(from==to||from.hasSkill('undist')||to.hasSkill('undist')) return false; + if(!game.players.contains(from)&&!game.dead.contains(from)) return false; + if(!game.players.contains(to)&&!game.dead.contains(to)) return false; + var mod1=game.checkMod(from,to,'unchanged','inRange',from); + if(mod1!='unchanged') return mod1; + var mod2=game.checkMod(from,to,'unchanged','inRangeOf',to); + if(mod2!='unchanged') return mod2; + if(from.getAttackRange()<1) return false; + var player=from,m,n=1,i; + var fxy,txy; + if(game.chess){ + fxy=from.getXY(); + txy=to.getXY(); + n=Math.abs(fxy[0]-txy[0])+Math.abs(fxy[1]-txy[1]); + } + else if(to.isMin(true)||from.isMin(true)){} + else{ + var length=game.players.length; + var totalPopulation=game.players.length+game.dead.length+1; + for(var iwhile=0;iwhile=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=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=='4v4'){ - game.gameDraw(_status.firstAct,function(player){ - if(player==_status.firstAct.previousSeat){ - return 5; - } - return 4; - }); - game.replaceHandcards(_status.firstAct.previous,_status.firstAct.previous.previous); - game.phaseLoop(_status.firstAct); - } - event.finish(); - } - else{ - if(_status.mode=='two'){ - _status.first_less=true; - _status.first_less_forced=true; - var firstChoose=_status.firstAct; - game.gameDraw(firstChoose,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.findPlayer(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; - 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; - 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; - } - }, - 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;iplayer.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:{ - 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); - _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){ - 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){ - game.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') return 7; - } - else{ - if(lib.storage.main_zhu||_status.mode=='four') 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') return -10; - } - else{ - if(lib.storage.main_zhu||_status.mode=='four') return -10; - } - } - return -6; - } - } - }, - }, - help:{ - '对决模式': - '
    同舟共济(四国)
    • 游戏开始时,每个势力的随机一名角色得到一个龙船至宝,1号位角色所在的势力额外获得一个龙船至宝,场上共5枚龙船至宝。龙船至宝是一个特殊标记。'+ - '
    • 争夺龙船至宝的方式:当敌人受到了你造成的伤害后,若其有龙船至宝,则你获得其一个龙船至宝。若你杀死了该敌人,则你获得其所有的龙船至宝。'+ - '
    • 获得龙船至宝时的摸牌:除游戏开始时外,若你从非队友处获得了龙船至宝,则你和队友各摸X张牌。(X为该次获得的龙船至宝数;获得队友的龙船至宝不摸牌)'+ - '
    • 无来源死亡时:当一名角色死亡时,若没有伤害来源,则其持有的所有龙船至宝交给场上龙船至宝数唯一最多的角色,若没有则随机分配,获得龙船至宝的角色和其队友各摸X张牌。'+ - '
    • 杀死队友时:当你杀死队友时,则将你和队友持有的所有龙船至宝交给场上龙船至宝数唯一最多的敌人,若没有则随机分配,获得龙船至宝的角色和其队友各摸X张牌。'+ - '
    • 胜利条件:满足一下任意条件游戏结束:(1)在新的一轮开始时,若你的势力获得的龙船至宝至少为4个,则你和队友获胜;(2)消灭所有敌人。'+ - '
    '+ - '
    2v2 替补模式
    • 选将时额外选择一名替补武将,阵亡时使用自己的替补武将上场,无替补时改为用队友的替补武将,两人均无替补时游戏结束'+ - '
    • 杀死敌方武将摸3张牌,杀死友方武将弃置所有牌
    '+ - '
    4v4
    • 双方各有一名主公和三名忠臣,杀死对方主公获胜
    • '+ - '8号位游戏开始时额外摸一张牌,7、8号位可在游戏开始时置换一次手牌
    • '+ - '杀死对方忠臣摸2+x张牌,x为对方(含刚被杀的忠臣)与己方的存活人数之差;主公杀死己方忠臣须弃置所有牌', - } - }; -}); +'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.brawl&&_status.brawl.submode){ + _status.mode=_status.brawl.submode; + } + if(lib.config.test_game){ + _status.mode='standard'; + } + "step 1" + var playback=localStorage.getItem(lib.configprefix+'playback'); + if(playback){ + ui.create.me(); + ui.arena.style.display='none'; + ui.system.style.display='none'; + _status.playback=playback; + localStorage.removeItem(lib.configprefix+'playback'); + var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); + store.get(parseInt(playback)).onsuccess=function(e){ + if(e.target.result){ + game.playVideoContent(e.target.result.video); + } + else{ + alert('播放失败:找不到录像'); + game.reload(); + } + } + event.finish(); + return; + } + if(_status.connectMode){ + game.waitForPlayer(function(){ + switch(lib.configOL.versus_mode){ + case '1v1':lib.configOL.number=2;break; + case '2v2':lib.configOL.number=4;break; + case '3v3':lib.configOL.number=6;break; + case '4v4':lib.configOL.number=8;break; + } + }); + } + else if(_status.mode=='jiange'||_status.mode=='siguo'||_status.mode=='four'){ + 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=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=='4v4'){ + game.gameDraw(_status.firstAct,function(player){ + if(player==_status.firstAct.previousSeat){ + return 5; + } + return 4; + }); + game.replaceHandcards(_status.firstAct.previous,_status.firstAct.previous.previous); + game.phaseLoop(_status.firstAct); + } + event.finish(); + } + else{ + if(_status.mode=='two'){ + _status.first_less=true; + _status.first_less_forced=true; + var firstChoose=_status.firstAct; + game.gameDraw(firstChoose,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.findPlayer(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; + 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; + } + }, + 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;iplayer.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:{ + 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); + _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){ + 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){ + game.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') return 7; + } + else{ + if(lib.storage.main_zhu||_status.mode=='four') 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') return -10; + } + else{ + if(lib.storage.main_zhu||_status.mode=='four') return -10; + } + } + return -6; + } + } + }, + }, + help:{ + '对决模式': + '
      同舟共济(四国)
      • 游戏开始时,每个势力的随机一名角色得到一个龙船至宝,1号位角色所在的势力额外获得一个龙船至宝,场上共5枚龙船至宝。龙船至宝是一个特殊标记。'+ + '
      • 争夺龙船至宝的方式:当敌人受到了你造成的伤害后,若其有龙船至宝,则你获得其一个龙船至宝。若你杀死了该敌人,则你获得其所有的龙船至宝。'+ + '
      • 获得龙船至宝时的摸牌:除游戏开始时外,若你从非队友处获得了龙船至宝,则你和队友各摸X张牌。(X为该次获得的龙船至宝数;获得队友的龙船至宝不摸牌)'+ + '
      • 无来源死亡时:当一名角色死亡时,若没有伤害来源,则其持有的所有龙船至宝交给场上龙船至宝数唯一最多的角色,若没有则随机分配,获得龙船至宝的角色和其队友各摸X张牌。'+ + '
      • 杀死队友时:当你杀死队友时,则将你和队友持有的所有龙船至宝交给场上龙船至宝数唯一最多的敌人,若没有则随机分配,获得龙船至宝的角色和其队友各摸X张牌。'+ + '
      • 胜利条件:满足一下任意条件游戏结束:(1)在新的一轮开始时,若你的势力获得的龙船至宝至少为4个,则你和队友获胜;(2)消灭所有敌人。'+ + '
      '+ + '
      2v2 替补模式
      • 选将时额外选择一名替补武将,阵亡时使用自己的替补武将上场,无替补时改为用队友的替补武将,两人均无替补时游戏结束'+ + '
      • 杀死敌方武将摸3张牌,杀死友方武将弃置所有牌
      '+ + '
      4v4
      • 双方各有一名主公和三名忠臣,杀死对方主公获胜
      • '+ + '8号位游戏开始时额外摸一张牌,7、8号位可在游戏开始时置换一次手牌
      • '+ + '杀死对方忠臣摸2+x张牌,x为对方(含刚被杀的忠臣)与己方的存活人数之差;主公杀死己方忠臣须弃置所有牌', + } + }; +});