diff --git a/card/standard.js b/card/standard.js index 58d6e2585..c53170162 100755 --- a/card/standard.js +++ b/card/standard.js @@ -1391,7 +1391,7 @@ card.standard={ if(mod!='unchanged') return mod; return true; }; - event.send=function(player,state,isJudge,card,source,target,targets,id){ + event.send=function(player,state,isJudge,card,source,target,targets,id,id2,tempnowuxie){ state=state?1:-1; var str=''; if(isJudge){ @@ -1402,6 +1402,11 @@ card.standard={ str+='对'+get.translation(targets||target); } str+='将'+(state>0?'生效':'失效')+',是否无懈?'; + + if(player.isUnderControl(true)&&!_status.auto&&!ui.tempnowuxie&&tempnowuxie){ + ui.tempnowuxie=ui.create.control('不无懈'+get.translation(card.name),ui.click.tempnowuxie); + ui.tempnowuxie._origin=id2; + } var next=player.chooseToUse({ filterCard:function(card,player){ if(card.name!='wuxie') return false; @@ -1523,6 +1528,7 @@ card.standard={ } } }; + var tempnowuxie=(trigger.targets&&trigger.targets.length>1&&!trigger.multitarget); var withme=false; var withol=false; @@ -1531,12 +1537,14 @@ card.standard={ if(list[i].isOnline()){ withol=true; list[i].wait(sendback); - list[i].send(event.send,list[i],event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id); + list[i].send(event.send,list[i],event.state,event.triggername=='phaseJudge', + event.card,event.source,event.target,event.targets,event.id,trigger.parent.id,tempnowuxie); list.splice(i--,1); } else if(list[i]==game.me){ withme=true; - event.send(list[i],event.state,event.triggername=='phaseJudge',event.card,event.source,event.target,event.targets,event.id); + event.send(list[i],event.state,event.triggername=='phaseJudge', + event.card,event.source,event.target,event.targets,event.id,trigger.parent.id,tempnowuxie); list.splice(i--,1); } } @@ -1595,227 +1603,6 @@ card.standard={ delete event.wuxieresult2; } }, - wuxie1_old:{ - trigger:{player:'useCardToBefore'}, - priority:5, - filter:function(event,player){ - if(!event.target) return false; - if(get.type(event.card)!='trick') return false; - return true; - }, - popup:false, - forced:true, - content:function(){ - "step 0" - if(trigger.multitarget){ - event.source2=trigger.targets; - } - event.source=trigger.target; - event.current=trigger.player; - event.end=trigger.player; - event.state=true; - event.card=trigger.card; - "step 1" - if((ui.wuxie.classList.contains('glow')|| - (ui.tempnowuxie&&ui.tempnowuxie.classList.contains('glow')&& - event.state))&&!_status.auto){ - if(event.current==game.me||event.current.isUnderControl()){ - event._result={bool:false}; - return; - } - } - if(lib.config.wuxie_self&&event.state){ - if((event.current==game.me||event.current.isUnderControl())&& - (trigger.player==game.me||trigger.player.isUnderControl())){ - if(trigger.targets&&trigger.targets.length==1){ - event._result={bool:false}; - return; - } - } - } - if(event.current.num('h','wuxie')==0){ - var noask=true; - var skills=event.current.get('s',true).concat(lib.skill.global); - game.expandSkills(skills); - for(var i=0;i1&&!ui.tempnowuxie){ - ui.tempnowuxie=ui.create.control('不无懈'+get.translation(trigger.card.name),ui.click.tempnowuxie); - ui.tempnowuxie._origin=trigger.parent; - } - } - "step 2" - if(result.bool){ - event.end=event.current; - if(event.state) event.state=false; - else event.state=true; - event.goto(1); - } - else if(event.current.next==event.end||event.end.isDead()){ - if(event.state==false){ - trigger.untrigger(); - trigger.finish(); - } - } - else{ - event.current=event.current.next; - event.goto(1); - } - } - }, - wuxie2_old:{ - trigger:{player:'phaseJudge'}, - priority:5, - popup:false, - forced:true, - content:function(){ - "step 0" - event.current=trigger.player; - event.end=trigger.player; - event.state=true; - event.card=trigger.card; - "step 1" - if(ui.wuxie.classList.contains('glow')&&!_status.auto){ - if(event.current==game.me||event.current.isUnderControl()){ - event._result={bool:false}; - return; - } - } - if(event.current.get('h','wuxie')==0){ - var noask=true; - var skills=event.current.get('s',true).concat(lib.skill.global); - game.expandSkills(skills); - for(var i=0;i=0) return 0; - return state*ai.get.attitude(_status.event.player,trigger.player); - }, - source:trigger.player - }); - "step 2" - if(result.bool){ - event.end=event.current; - if(event.state) event.state=false; - else event.state=true; - event.goto(1); - } - else if(event.current.next==event.end||event.end.isDead()){ - if(event.state==false){ - trigger.untrigger(); - trigger.cancelled=true; - } - } - else{ - event.current=event.current.next; - event.goto(1); - } - } - }, }, translate:{ sha:'杀', diff --git a/character/shenhua.js b/character/shenhua.js index 9bad36fed..5617b2b1a 100644 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -1519,13 +1519,13 @@ character.shenhua={ player.chooseCardTarget({ selectCard:Math.floor(player.num('h')/2), filterTarget:function(card,player,target){ - return target.num('h')==temp; + return target.num('h')==_status.event.temp; }, forced:true, ai2:function(target){ - return ai.get.attitude(player,target); + return ai.get.attitude(_status.event.player,target); } - }); + }).set('temp',temp); "step 1" if(result.targets&&result.targets[0]){ result.targets[0].gain(result.cards); @@ -1643,7 +1643,8 @@ character.shenhua={ "step 0" player.chooseTarget('是否发动【英魂】?',function(card,player,target){ return player!=target; - }).ai=function(target){ + }).set('ai',function(target){ + var player=_status.event.player; if(player.maxHp-player.hp==1&&target.num('he')==0){ return 0; } @@ -1654,7 +1655,7 @@ character.shenhua={ return -1; } return 1; - } + }); "step 1" if(result.bool){ player.logSkill('yinghun',result.targets); @@ -1845,7 +1846,7 @@ character.shenhua={ event.current=player.next; "step 1" event.current.animate('target'); - event.current.chooseToUse({name:'sha'},function(card,player,target){ + event.current.chooseToUse('乱舞:使用一张杀或流失一点体力',{name:'sha'},function(card,player,target){ if(player==target) return false; if(get.distance(player,target)<=1) return true; for(var i=0;i2){ return Math.min(5,target.maxHp)-target.num('h'); } return att/3; - } + }); "step 1" if(result.bool){ player.logSkill('jieming',result.targets); diff --git a/game/game.js b/game/game.js index 49c042157..4560745d9 100755 --- a/game/game.js +++ b/game/game.js @@ -4094,10 +4094,12 @@ "step 2" player.phaseUse(); "step 3" - if(ui.tempnowuxie){ - ui.tempnowuxie.close(); - delete ui.tempnowuxie; - } + game.broadcastAll(function(){ + if(ui.tempnowuxie){ + ui.tempnowuxie.close(); + delete ui.tempnowuxie; + } + }); player.phaseDiscard() if(!player.noPhaseDelay) game.delayx(); delete player.using; @@ -4156,10 +4158,12 @@ if(result.bool){ event.goto(0); } - if(ui.tempnowuxie){ - ui.tempnowuxie.close(); - delete ui.tempnowuxie; - } + game.broadcastAll(function(){ + if(ui.tempnowuxie){ + ui.tempnowuxie.close(); + delete ui.tempnowuxie; + } + }); delete player.using; }, phaseDiscard:function(){ @@ -4188,6 +4192,21 @@ } return; } + if(ui.tempnowuxie&&ui.tempnowuxie.classList.contains('glow')){ + event.result={ + bool:false + } + return; + } + if(!_status.connectMode&&lib.config.wuxie_self){ + var tw=event.parent._trigger.parent; + if(tw.player==player&&tw.targets&&tw.targets.length==1){ + event.result={ + bool:false + } + return; + } + } } var ok=game.check(); if(!ok||!lib.config.auto_confirm){ @@ -4258,7 +4277,7 @@ event.aiexclude.add(skill); var info=get.info(skill); if(info.sourceSkill){ - event.sourceSkill.add(info.aiexclude); + event.aiexclude.add(info.sourceSkill); } } else{ @@ -4477,25 +4496,32 @@ } game.log(player,'对',target,'发起拼点'); "step 1" + var sendback=function(){ + if(_status.event!=event){ + return function(){ + event.resultOL=_status.event.resultOL; + }; + } + }; if(player.isOnline()){ - player.wait(); + player.wait(sendback); event.ol=true; - player.send(function(){ + player.send(function(ai){ game.me.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=ai; game.resume(); - },ai); + },event.ai); } else{ event.localPlayer=true; player.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=event.ai; } if(target.isOnline()){ - target.wait(); + target.wait(sendback); event.ol=true; - target.send(function(){ + target.send(function(ai){ game.me.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=ai; game.resume(); - },ai); + },event.ai); } else{ event.localTarget=true; @@ -5353,7 +5379,16 @@ }); } } + event.id=get.id(); event.trigger('useCard'); + event._oncancel=function(){ + game.broadcastAll(function(id){ + if(ui.tempnowuxie&&ui.tempnowuxie._origin==id){ + ui.tempnowuxie.close(); + delete ui.tempnowuxie; + } + },event.id); + }; if(get.type(card)!='equip'){ var str=''; if(targets.length){ @@ -5491,10 +5526,7 @@ if(event.card.name!='wuxie'){ game.broadcastAll(ui.clear); } - if(ui.tempnowuxie&&ui.tempnowuxie._origin==event){ - ui.tempnowuxie.close(); - delete ui.tempnowuxie; - } + event._oncancel(); }, useSkill:function(){ "step 0" @@ -6316,10 +6348,6 @@ _status.coin+=10; } } - if(ui.tempnowuxie&&ui.tempnowuxie._origin&&ui.tempnowuxie._origin.player==player){ - ui.tempnowuxie.close(); - delete ui.tempnowuxie; - } }, equip:function(){ "step 0" @@ -9717,7 +9745,7 @@ this.playerfocus(1500); var that=this; setTimeout(function(){ - game.broadcastAll(function(that,type,name){ + game.broadcastAll(function(that,type,name,color){ if(lib.config.animation&&!lib.config.low_performance){ if(lib.config.mode=='chess'){ that['$'+type+'2'](1200); @@ -9729,7 +9757,7 @@ if(name){ that.$fullscreenpop(name,color); } - },that,type,name); + },that,type,name,color); },300); }, $fire:function(){ @@ -14195,6 +14223,10 @@ game.reload(); }); } + if(ui.tempnowuxie){ + ui.tempnowuxie.close(); + delete ui.tempnowuxie; + } return; } if(lib.config.background_audio){ @@ -14690,6 +14722,9 @@ _status.dieClose.shift().close(); } }); + if(event._oncancel){ + event._oncancel(); + } event.finish(); } else if(player&&player.removed&&event.name!='phaseLoop'){ @@ -22103,6 +22138,7 @@ custom.replace.button(this); return; } + if(!_status.event.isMine()) return; if(this.classList.contains('selectable')==false) return; if(this.classList.contains('selected')){ ui.selected.buttons.remove(this); @@ -22545,18 +22581,16 @@ wuxie:function(){ if(this.classList.contains('hidden')) return; this.classList.toggle('glow'); - if(this.classList.contains('glow')&& - (_status.event.getParent().name=='_wuxie1'||_status.event.getParent().name=='_wuxie2')&& - _status.event.isMine()&&ui.confirm){ + if(this.classList.contains('glow')&&_status.event.type=='wuxie'&& + _status.event.isMine()&&ui.confirm&&_status.imchoosing){ ui.click.cancel(ui.confirm.lastChild); } }, tempnowuxie:function(){ if(this.classList.contains('hidden')) return; this.classList.toggle('glow'); - if(this.classList.contains('glow')&& - (_status.event.getParent().name=='_wuxie1'||_status.event.getParent().name=='_wuxie2')&& - _status.event.isMine()&&ui.confirm){ + if(this.classList.contains('glow')&&_status.event.type=='wuxie'&& + _status.event.isMine()&&ui.confirm&&_status.imchoosing){ ui.click.cancel(ui.confirm.lastChild); } }, diff --git a/mode/identity.js b/mode/identity.js index 0f9c3cd3e..13b491ead 100755 --- a/mode/identity.js +++ b/mode/identity.js @@ -19,7 +19,7 @@ mode.identity={ else{ lib.configOL.number=lib.configOL.player_number; } - lib.configOL.characterPack=['standard']; + lib.configOL.characterPack=['standard','shenhua']; lib.configOL.cardPack=['standard','ex','extra','refresh','mingzhong']; lib.configOL.mode='identity'; var cardPackList=[];