From 288da4677329f16b8d37329c0df8c52634f21df2 Mon Sep 17 00:00:00 2001 From: libccy Date: Sun, 12 Feb 2017 08:08:13 +0800 Subject: [PATCH] 2 --- character/hearth.js | 146 +++++++++++++++++++------------------------- 1 file changed, 63 insertions(+), 83 deletions(-) diff --git a/character/hearth.js b/character/hearth.js index 4300d27a9..b95c14fd7 100644 --- a/character/hearth.js +++ b/character/hearth.js @@ -214,23 +214,14 @@ character.hearth={ trigger:{player:'phaseBegin'}, direct:true, filter:function(event,player){ - var nh=player.num('h'); - for(var i=0;inh){ - return true; - } - } - return false; + return !player.isMostHandcard(); }, content:function(){ 'step 0' var nh=player.num('h'); - var num=0; - for(var i=0;inh){ - num++; - } - } + var num=game.countPlayer(function(current){ + return current.num('h')>nh; + }); player.chooseTarget(get.prompt('xingluo'),[1,num],function(card,player,target){ return target.num('h')>nh; }).ai=function(target){ @@ -645,12 +636,9 @@ character.hearth={ var info=lib.card[name]; var targets=[]; if(get.select(info.selectTarget)[0]==-1&&!info.modTarget){ - var targets=[]; - for(var i=0;i0){ - if(game.players[i].hp<2){ - lose--; - recover+=0.5; - } + var players=game.filterPlayer(); + for(var i=0;i0){ + if(players[i].hp<2){ lose--; - recover++; - } - else if(ai.get.attitude(player,game.players[i])<0){ - if(game.players[i].hp<2){ - lose++; - recover-=0.5; - } - lose++; - recover--; + recover+=0.5; } + lose--; + recover++; } - else{ - if(ai.get.attitude(player,game.players[i])>0){ - lose--; - } - else if(ai.get.attitude(player,game.players[i])<0){ + else if(ai.get.attitude(player,players[i])<0){ + if(players[i].hp<2){ lose++; + recover-=0.5; } + lose++; + recover--; + } + } + else{ + if(ai.get.attitude(player,players[i])>0){ + lose--; + } + else if(ai.get.attitude(player,players[i])<0){ + lose++; } } } @@ -1182,33 +1169,32 @@ character.hearth={ check:function(button){ var player=_status.event.player; var recover=0,lose=1; - for(var i=0;i0){ - if(game.players[i].hp<2){ - lose--; - recover+=0.5; - } + var players=game.filterPlayer(); + for(var i=0;i0){ + if(players[i].hp<2){ lose--; - recover++; - } - else if(ai.get.attitude(player,game.players[i])<0){ - if(game.players[i].hp<2){ - lose++; - recover-=0.5; - } - lose++; - recover--; + recover+=0.5; } + lose--; + recover++; } - else{ - if(ai.get.attitude(player,game.players[i])>0){ - lose--; - } - else if(ai.get.attitude(player,game.players[i])<0){ + else if(ai.get.attitude(player,players[i])<0){ + if(players[i].hp<2){ lose++; + recover-=0.5; } + lose++; + recover--; + } + } + else{ + if(ai.get.attitude(player,players[i])>0){ + lose--; + } + else if(ai.get.attitude(player,players[i])<0){ + lose++; } } } @@ -1339,12 +1325,9 @@ character.hearth={ while(list.length){ var card={name:list.randomRemove()}; var info=get.info(card); - var targets=[]; - for(var i=0;i1){