From a55fb8c5e7fff1eaf0485a26206e6f654fc1ed8f Mon Sep 17 00:00:00 2001 From: libccy Date: Sat, 11 Feb 2017 23:40:08 +0800 Subject: [PATCH] 6 --- character/diy.js | 55 ++++++++++----------- character/extra.js | 116 +++++++++++++++++++-------------------------- character/ow.js | 2 +- 3 files changed, 77 insertions(+), 96 deletions(-) diff --git a/character/diy.js b/character/diy.js index 07f8f5005..611a41058 100644 --- a/character/diy.js +++ b/character/diy.js @@ -176,7 +176,7 @@ character.diy={ }, content:function(){ // if(player!=target) player.draw(); - var list=game.players.slice(0); + var list=game.filterPlayer(); get.sortSeat(list,target); target.useCard({name:'diaobingqianjiang'},list); }, @@ -185,12 +185,9 @@ character.diy={ result:{ player:function(player,target){ if(ai.get.attitude(player,target)<=1) return 0; - var num=0; - for(var i=0;i0){ - if(game.players[i].hp<2){ - lose--; - recover+=0.5; - } + var recover=0,lose=0,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++; } } } @@ -177,14 +175,11 @@ character.extra={ order:10, result:{ player:function(player){ - var num=0; - for(var i=0;i0?1:-1; + return game.countPlayer(function(current){ + if(current!=player){ + return get.sgn(ai.get.damageEffect(current,player,player)); } - } - return num; + }); } } } @@ -206,12 +201,11 @@ character.extra={ if(!player.storage.shenfen) return 0; var cards=player.get('h','sha'); if(cards.length){ - for(var i=0;i0&& - game.players[i].num('h','shan')){ - return 1; - } + if(game.hasPlayer(function(current){ + return (player.canUse('sha',current)&& + ai.get.effect(current,cards[0],player,player)>0&¤t.hasShan()); + })){ + return 1; } } return 0; @@ -522,19 +516,15 @@ character.extra={ trigger:{player:'damageEnd'}, check:function(event,player){ if(player.isTurnedOver()) return true; - var num=0; - for(var i=0;i0){ - num++; + if(current.num('j')&¤t!=player&&ai.get.attitude(player,current)>0){ + return true; } - if(num>=2) return true; - } - return false; + }); + return num>=2; }, content:function(){ "step 0" @@ -572,21 +562,18 @@ character.extra={ target:function(card,player,target){ if(get.tag(card,'damage')){ if(player.hasSkill('jueqing')) return [1,-2]; - if(target.hp==1) return; + if(target.hp==1) return 0.8; if(target.isTurnedOver()) return [0,3]; - var num=0; - for(var i=0;i0){ - num++; + if(current.num('j')&¤t!=player&&ai.get.attitude(player,current)>0){ + return true; } - if(num>2) return [0,1]; - if(num==2) return [0.5,1]; - } + }); + if(num>2) return [0,1]; + if(num==2) return [0.5,1]; } } } @@ -696,7 +683,7 @@ character.extra={ content:function(){ "step 0" player.chooseTarget('选择角色获得大雾标记', - [1,Math.min(game.players.length,player.storage.qixing.length)]).ai=function(target){ + [1,Math.min(game.countPlayer(),player.storage.qixing.length)]).ai=function(target){ if(target.isMin()) return 0; if(target.hasSkill('biantian2')) return 0; var att=ai.get.attitude(player,target); @@ -886,14 +873,7 @@ character.extra={ target:function(player,target){ if(target.hasSkillTag('nofire')) return 0; if(lib.config.mode=='versus') return -1; - for(var i=0;i