From 2cce257e7df5684e413ebe92b5cdb545eb94f508 Mon Sep 17 00:00:00 2001 From: libccy Date: Sat, 11 Feb 2017 22:16:35 +0800 Subject: [PATCH] 4 --- card/hearth.js | 4 +- card/sp.js | 2 +- card/standard.js | 104 +++++++++++++++++++++-------------------------- card/swd.js | 2 +- game/game.js | 16 +++++++- 5 files changed, 65 insertions(+), 63 deletions(-) diff --git a/card/hearth.js b/card/hearth.js index 4916bb033..6aae8e1eb 100644 --- a/card/hearth.js +++ b/card/hearth.js @@ -423,7 +423,7 @@ card.hearth={ content:function(){ 'step 0' event.current=target; - event.num=game.countPlayer(lib.filter.all); + event.num=game.countPlayer(); if(event.num%2==0){ event.num--; } @@ -619,7 +619,7 @@ card.hearth={ result:{ target:function(player,target){ if(target.hasSkillTag('nothunder')) return 0; - if(player.hasUnknown()) return 0; + if(player.hasUnknown(2)) return 0; var nh=target.num('he'); if(target==player) nh--; if(nh==2) return -2.5; diff --git a/card/sp.js b/card/sp.js index b93faeda4..5d12641d7 100644 --- a/card/sp.js +++ b/card/sp.js @@ -68,7 +68,7 @@ card.sp={ fullskin:true, enable:true, chongzhu:function(){ - return game.countPlayer(lib.filter.all)<=2; + return game.countPlayer()<=2; }, singleCard:true, type:'trick', diff --git a/card/standard.js b/card/standard.js index b17531f88..ec46c8b57 100644 --- a/card/standard.js +++ b/card/standard.js @@ -224,23 +224,25 @@ card.standard={ result:{ target:function(player,target){ // if(player==target&&player.hp<=0) return 2; - var nh=target.num('h'); + var nd=player.needsToDiscard(); var keep=false; - if(nh<=target.hp){ + if(nd<=0){ keep=true; } - else if(nh==target.hp+1&&target.hp>=2&&target.num('h','tao')<=1){ + else if(nd==1&&target.hp>=2&&target.num('h','tao')<=1){ keep=true; } var mode=get.mode(); if(target.hp>=2&&keep&&target.hasFriend()){ - if(target.hp>2) return 0; + if(target.hp>2||nd==0) return 0; if(target.hp==2){ - for(var i=0;i=3){ - if(game.players[i].hp<=1) return 0; - if(mode=='identity'&&game.players[i].isZhu&&game.players[i].hp<=2) return 0; + if(game.hasPlayer(function(current){ + if(target!=current&&ai.get.attitude(target,current)>=3){ + if(current.hp<=1) return true; + if((mode=='identity'||mode=='versus'||mode=='chess')&¤t.identity=='zhu'&¤t.hp<=2) return true; } + })){ + return 0; } } } @@ -250,13 +252,11 @@ card.standard={ var tri=_status.event.getTrigger(); if(mode=='identity'&&player.identity=='fan'&&target.identity=='fan'){ if(tri&&tri.name=='dying'&&tri.source&&tri.source.identity=='fan'&&tri.source!=target){ - var num=0; - for(var i=0;i2) return 2; + var num=game.countPlayer(function(current){ + if(current.identity=='fan'){ + return current.num('h','tao'); } - } + }); if(num>1&&player==target) return 2; return 0; } @@ -334,17 +334,14 @@ card.standard={ ai:{ basic:{ equipValue:function(card,player){ - var num=1,i,no_target=true; - for(i=0;i1) return 4+num; + return 2+num; } } }, @@ -474,7 +471,7 @@ card.standard={ } "step 3" ui.clear(); - var cards=get.cards(game.players.length); + var cards=get.cards(game.countPlayer()); var dialog=ui.create.dialog('五谷丰登',cards,true); _status.dieClose.push(dialog); dialog.videoId=lib.status.videoId++; @@ -589,12 +586,10 @@ card.standard={ if(target==player) return 1.5; return 1; } - var num=0; - for(var i=0;i1) return 0; - return 2-2*get.distance(player,target,'absolute')/game.players.length; + return 2-2*get.distance(player,target,'absolute')/game.countPlayer(); } }, tag:{ @@ -672,11 +667,7 @@ card.standard={ }, result:{ target:function(player,target){ - var num=0; - for(var i=0;i1) return 0; + if(player.hasUnknown(2)) return 0; var nh=target.num('h'); if(get.mode()=='identity'){ if(target.isZhu&&nh<=2&&target.hp<=1) return -100; @@ -734,11 +725,7 @@ card.standard={ }, result:{ target:function(player,target){ - var num=0; - for(var i=0;i1) return 0; + if(player.hasUnknown(2)) return 0; var nh=target.num('h'); if(get.mode()=='identity'){ if(target.isZhu&&nh<=2&&target.hp<=1) return -100; @@ -1233,17 +1220,21 @@ card.standard={ }, result:{ target:function(player,target){ - var rejudge,num=0; - for(var i=0;i0&& - ai.get.attitude(game.players[i],target)>0) num+=rejudge; - else num-=rejudge; + if(ai.get.attitude(target,current)>0&& + ai.get.attitude(current,target)>0){ + return rejudge; + } + else{ + return -rejudge; + } } } - } + }); if(num>0) return num; if(num==0){ var mode=get.mode(); @@ -1259,12 +1250,14 @@ card.standard={ } else if(mode=='guozhan'){ if(target.identity=='ye') return 1; - for(var i=0;i2&&target.hp<2) return 1; - if(game.players.length<3) return -1; + if(game.countPlayer()<3) return -1; if(target.hp<=2&&target.num('he')<=3) return 1; } } @@ -1701,14 +1694,11 @@ card.standard={ } }; 'step 1' - var list=[]; + var list=game.filterPlayer(function(current){ + return current.hasWuxie(); + }); event.list=list; event.id=get.id(); - for(var i=0;i