From c129a6e3fe84d6463da43f1bade59024ea807ae6 Mon Sep 17 00:00:00 2001 From: libccy Date: Wed, 1 Mar 2017 12:48:42 +0800 Subject: [PATCH] h --- character/hearth.js | 2 ++ character/old.js | 57 ++++---------------------------------------- character/shenhua.js | 11 +-------- character/yxs.js | 25 +++++++++++++------ game/game.js | 40 ++++++++++++++++++++++++++++++- 5 files changed, 64 insertions(+), 71 deletions(-) diff --git a/character/hearth.js b/character/hearth.js index 608beb9a2..41b5bc8ea 100644 --- a/character/hearth.js +++ b/character/hearth.js @@ -175,6 +175,7 @@ character.hearth={ direct:true, filter:function(event,player){ return game.hasPlayer(function(current){ + if(current==player) return false; var nh=current.num('h'); return nh&&nh>=player.num('h'); }); @@ -182,6 +183,7 @@ character.hearth={ content:function(){ 'step 0' player.chooseTarget(get.prompt('kuixin'),function(card,player,target){ + if(target==player) return false; var nh=target.num('h'); return nh&&nh>=player.num('h'); }).ai=function(target){ diff --git a/character/old.js b/character/old.js index 88048e990..bcd923c81 100644 --- a/character/old.js +++ b/character/old.js @@ -52,21 +52,8 @@ character.old={ } player.logSkill('zhenshan',result.targets); player.addTempSkill('zhenshan2','phaseAfter'); - event.target=result.targets[0]; - event.cards0=player.get('h'); - event.cards1=event.target.get('h'); - player.lose(event.cards0,ui.special); - event.target.lose(event.cards1,ui.special); + player.swapHandcards(result.targets[0]); } - else{ - event.finish(); - } - "step 2" - player.gain(event.cards1,event.target); - event.target.gain(event.cards0,player); - player.$give(event.cards0.length,event.target); - event.target.$give(event.cards1.length,player); - game.delay(); }, group:['zhenshan_sha','zhenshan_tao','zhenshan_jiu'] }, @@ -93,20 +80,8 @@ character.old={ 'step 1' if(result.bool){ player.logSkill('zhenshan_sha',result.targets); - event.target=result.targets[0]; - event.cards0=player.get('h'); - event.cards1=event.target.get('h'); - player.lose(event.cards0,ui.special); - event.target.lose(event.cards1,ui.special); + player.swapHandcards(result.targets[0]); } - else{ - event.finish(); - } - 'step 2' - player.gain(event.cards1,event.target); - event.target.gain(event.cards0,player); - player.$give(event.cards0.length,event.target); - event.target.$give(event.cards1.length,player); }, filterCard:function(card){ return false; @@ -155,20 +130,8 @@ character.old={ 'step 1' if(result.bool){ player.logSkill('zhenshan_tao',result.targets); - event.target=result.targets[0]; - event.cards0=player.get('h'); - event.cards1=event.target.get('h'); - player.lose(event.cards0,ui.special); - event.target.lose(event.cards1,ui.special); + player.swapHandcards(result.targets[0]); } - else{ - event.finish(); - } - 'step 2' - player.gain(event.cards1,event.target); - event.target.gain(event.cards0,player); - player.$give(event.cards0.length,event.target); - event.target.$give(event.cards1.length,player); }, filterCard:function(card){ return false; @@ -217,20 +180,8 @@ character.old={ 'step 1' if(result.bool){ player.logSkill('zhenshan_jiu',result.targets); - event.target=result.targets[0]; - event.cards0=player.get('h'); - event.cards1=event.target.get('h'); - player.lose(event.cards0,ui.special); - event.target.lose(event.cards1,ui.special); + player.swapHandcards(result.targets[0]); } - else{ - event.finish(); - } - 'step 2' - player.gain(event.cards1,event.target); - event.target.gain(event.cards0,player); - player.$give(event.cards0.length,event.target); - event.target.$give(event.cards1.length,player); }, filterCard:function(card){ return false; diff --git a/character/shenhua.js b/character/shenhua.js index 951465d5f..f1ba29b40 100644 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -2146,16 +2146,7 @@ character.shenhua={ multitarget:true, multiline:true, content:function(){ - 'step 0' - event.cards0=targets[0].get('h'); - event.cards1=targets[1].get('h'); - targets[0].lose(event.cards0,ui.special); - targets[1].lose(event.cards1,ui.special); - 'step 1' - targets[0].gain(event.cards1,targets[1]); - targets[1].gain(event.cards0,targets[0]); - targets[0].$give(event.cards0.length,targets[1]); - targets[1].$give(event.cards1.length,targets[0]); + targets[0].swapHandcards(targets[1]); }, check:function(card){ var list=[],player=_status.event.player; diff --git a/character/yxs.js b/character/yxs.js index 338b10904..8d4b50123 100644 --- a/character/yxs.js +++ b/character/yxs.js @@ -41,7 +41,7 @@ character.yxs={ yxs_zhangsanfeng:['male','wei',4,['zbudao','taiji']], yxs_nandinggeer:['female','shu',3,['huli','xianqu','yixin']], yxs_weizhongxian:['male','qun',3,['zhuxin','wlianhuan']], - // yxs_meixi:['female','shu',3,['liebo','yaoji']], + yxs_meixi:['female','shu',3,['liebo','yaoji']], // yxs_lanlinwang:['male','shu',4,['guimian','yuxue']], }, characterIntro:{ @@ -89,6 +89,22 @@ character.yxs={ yxs_lanlinwang:'高长恭(541年―573年),又名高孝瓘、高肃,祖籍渤海调蓨(今河北省景县),神武帝高欢之孙,文襄帝高澄第四子,生母不详,南北朝时期北齐宗室、将领,封爵兰陵郡王。高长恭貌柔心壮,音容兼美。为将躬勤细事,每得甘美,虽一瓜数果,必与将士分享。累次升任至并州刺史。突厥攻入晋阳,高长恭奋力将其击退。邙山之战,高长恭为中军,率领五百骑兵再入周军包围圈,直至金墉城下,因高长恭戴着头盔,城中的人不确定是敌军或是我军,直到高长恭把头盔脱下来城上的人才知道是高长恭,派弓箭手开始放箭保护他,之后高长恭成功替金墉解围,高长恭在此次战中威名大振,士兵们为此战而讴歌他,即后来知名的《兰陵王入阵曲》。', }, skill:{ + yaoji:{ + trigger:{player:'damageEnd'}, + filter:function(event,player){ + return event.source&&event.source.isIn()&&event.source!=player&&!event.source.hasJudge('lebu'); + }, + check:function(event,player){ + return ai.get.attitude(player,event.source)<=0; + }, + logTarget:'source', + content:function(){ + var card=game.createCard('lebu'); + trigger.source.addJudge(card); + trigger.source.$draw(card); + game.delay(); + } + }, liebo:{ enable:'phaseUse', usable:1, @@ -96,12 +112,7 @@ character.yxs={ return Math.abs(target.num('h')-player.num('h'))<=1; }, content:function(){ - var cards0=target.get('h'); - var cards1=player.get('h'); - target.gain(cards1,player); - player.gain(cards0,target); - target.$giveAuto(cards0,player); - player.$giveAuto(cards1,target); + player.swapHandcards(target); }, ai:{ order:function(){ diff --git a/game/game.js b/game/game.js index 85160cffa..23957e710 100644 --- a/game/game.js +++ b/game/game.js @@ -9272,6 +9272,36 @@ event.trigger('respond'); game.delayx(0.5); }, + swapHandcards:function(){ + 'step 0' + event.cards1=player.get('h'); + event.cards2=target.get('h'); + target.$giveAuto(event.cards1,player); + player.$giveAuto(event.cards2,target); + 'step 1' + event.cards=event.cards1; + var next=player.lose(event.cards,ui.special).set('type','gain'); + if(player==game.me){ + event.delayed=true; + } + else{ + next.delay=false; + } + 'step 1' + event.cards=event.cards2; + var next=target.lose(event.cards,ui.special).set('type','gain'); + if(target==game.me){ + event.delayed=true; + } + else{ + next.delay=false; + } + 'step 2' + if(!event.delayed) game.delay(); + 'step 3' + player.gain(event.cards2,target); + target.gain(event.cards1,player); + }, gain:function(){ "step 0" if(cards){ @@ -11970,6 +12000,14 @@ } } next.setContent('respond'); + return next; + }, + swapHandcards:function(target){ + var next=game.createEvent('swapHandcards',false); + next.player=this; + next.target=target; + next.setContent('swapHandcards'); + return next; }, directgain:function(cards){ var hs=this.get('h'); @@ -12007,7 +12045,7 @@ var current=targets[i]; var card=current.get(position||'h').randomGet(); if(!card) continue; - if(current==game.me){ + if(current==game.me||current.isOnline()){ this.gain(card,current); delayed=true; }