diff --git a/card/extra.js b/card/extra.js index 46764ed07..1945ad8e7 100644 --- a/card/extra.js +++ b/card/extra.js @@ -88,7 +88,7 @@ card.extra={ } } else if(player.hasSha()&&player.needsToDiscard()){ - if(player.num('h','hufu')!=1){ + if(player.countCards('h','hufu')!=1){ card={name:'sha'}; } } @@ -353,7 +353,7 @@ card.extra={ basic:{ equipValue:function(card,player){ if(player.hp==player.maxHp) return 5; - if(player.num('h','baiyin')) return 6; + if(player.countCards('h','baiyin')) return 6; return 0; } } diff --git a/card/hearth.js b/card/hearth.js index 54f677833..dadaca374 100644 --- a/card/hearth.js +++ b/card/hearth.js @@ -285,7 +285,7 @@ card.hearth={ selectTarget:-1, content:function(){ player.addTempSkill('shihuawuqi','phaseAfter'); - if(!player.num('h','sha')){ + if(!player.countCards('h','sha')){ var card=get.cardPile('sha'); if(card){ player.gain(card,'gain2'); @@ -298,7 +298,7 @@ card.hearth={ order:8, result:{ target:function(player,target){ - return target.num('h','sha')?0:1; + return target.countCards('h','sha')?0:1; } } } @@ -486,7 +486,7 @@ card.hearth={ order:1, result:{ target:function(player,target){ - if(target.num('h','tao')) return 0; + if(target.countCards('h','tao')) return 0; var nh=target.countCards('h'); if(nh<=2) return 1; if(target.hp==1&&target.maxHp>2) return 1; diff --git a/card/standard.js b/card/standard.js index ea6619577..d929c5cef 100644 --- a/card/standard.js +++ b/card/standard.js @@ -232,7 +232,7 @@ card.standard={ if(nd<=0){ keep=true; } - else if(nd==1&&target.hp>=2&&target.num('h','tao')<=1){ + else if(nd==1&&target.hp>=2&&target.countCards('h','tao')<=1){ keep=true; } var mode=get.mode(); @@ -257,7 +257,7 @@ card.standard={ if(tri&&tri.name=='dying'&&tri.source&&tri.source.identity=='fan'&&tri.source!=target){ var num=game.countPlayer(function(current){ if(current.identity=='fan'){ - return current.num('h','tao'); + return current.countCards('h','tao'); } }); if(num>1&&player==target) return 2; @@ -342,7 +342,7 @@ card.standard={ })){ return 1; } - var num=player.num('h','sha'); + var num=player.countCards('h','sha'); if(num>1) return 4+num; return 2+num; } @@ -382,7 +382,7 @@ card.standard={ ai:{ basic:{ equipValue:function(card,player){ - return Math.min(2.5+player.num('h','sha'),4); + return Math.min(2.5+player.countCards('h','sha'),4); } } }, @@ -659,7 +659,7 @@ card.standard={ }, ai:{ wuxie:function(target,card,player,viewer){ - if(ai.get.attitude(viewer,target)>0&&target.num('h','sha')){ + if(ai.get.attitude(viewer,target)>0&&target.countCards('h','sha')){ if(!target.countCards('h')||target.hp==1||Math.random()<0.7) return 0; } }, @@ -717,7 +717,7 @@ card.standard={ }, ai:{ wuxie:function(target,card,player,viewer){ - if(ai.get.attitude(viewer,target)>0&&target.num('h','shan')){ + if(ai.get.attitude(viewer,target)>0&&target.countCards('h','shan')){ if(!target.countCards('h')||target.hp==1||Math.random()<0.7) return 0; } }, diff --git a/card/swd.js b/card/swd.js index d1668f66f..6d580cd93 100644 --- a/card/swd.js +++ b/card/swd.js @@ -93,7 +93,7 @@ card.swd={ content:function(){ 'step 0' var choice; - if(target.num('h','shan')==0||target.num('h','sha')==0||target.hp<=1){ + if(target.countCards('h','shan')==0||target.countCards('h','sha')==0||target.hp<=1){ choice='basic'; } else{ @@ -1788,7 +1788,7 @@ card.swd={ }, ai:{ wuxie:function(target,card,player,viewer){ - if(ai.get.attitude(viewer,target)>0&&target.num('h','sha')){ + if(ai.get.attitude(viewer,target)>0&&target.countCards('h','sha')){ if(!target.countCards('h')||target.hp==1||Math.random()<0.7) return 0; } }, @@ -1847,7 +1847,7 @@ card.swd={ }, ai:{ wuxie:function(target,card,player,viewer){ - if(ai.get.attitude(viewer,target)>0&&target.num('h','shan')){ + if(ai.get.attitude(viewer,target)>0&&target.countCards('h','shan')){ if(!target.countCards('h')||target.hp==1||Math.random()<0.7) return 0; } }, @@ -2257,7 +2257,7 @@ card.swd={ return player.canUse('sha',target); }, filter:function(event,player){ - return player.num('h','sha')>0&&lib.filter.cardUsable({name:'sha'},player); + return player.countCards('h','sha')>0&&lib.filter.cardUsable({name:'sha'},player); }, content:function(){ 'step 0' @@ -2403,7 +2403,7 @@ card.swd={ trigger:{player:'phaseBegin'}, forced:true, filter:function(event,player){ - return player.num('h','qinglongzhigui')>0; + return player.countCards('h','qinglongzhigui')>0; }, content:function(){ 'step 0' @@ -2417,7 +2417,7 @@ card.swd={ trigger:{player:'discardEnd'}, direct:true, filter:function(event,player){ - return player.num('h','baishouzhihu')>0; + return player.countCards('h','baishouzhihu')>0; }, content:function(){ "step 0" @@ -2442,7 +2442,7 @@ card.swd={ trigger:{player:'damageEnd'}, forced:true, filter:function(event,player){ - return event.source&&event.source!=player&&event.source.isAlive()&&player.num('h','zhuquezhizhang')>0; + return event.source&&event.source!=player&&event.source.isAlive()&&player.countCards('h','zhuquezhizhang')>0; }, logTarget:'source', check:function(event,player){ @@ -2460,7 +2460,7 @@ card.swd={ trigger:{source:'damageEnd'}, forced:true, filter:function(event,player){ - return player.num('h','xuanwuzhihuang')>0&&event.num>0&&player.hp0&&event.num>0&&player.hp0; + return !player.hujia&&player.countCards('h','huanglinzhicong')>0; }, content:function(){ player.showCards(get.translation(player)+'发动了【黄麟之琮】',player.getCards('h','huanglinzhicong')); @@ -2483,7 +2483,7 @@ card.swd={ trigger:{player:'phaseBegin'}, direct:true, filter:function(event,player){ - return player.num('h','cangchizhibi')>0; + return player.countCards('h','cangchizhibi')>0; }, content:function(){ 'step 0' diff --git a/card/yunchou.js b/card/yunchou.js index 24f0bdaa4..af2cb4207 100644 --- a/card/yunchou.js +++ b/card/yunchou.js @@ -165,13 +165,13 @@ card.yunchou={ }, content:function(){ 'step 0' - if(target.num('h','sha')){ + if(target.countCards('h','sha')){ var name=get.translation(player.name); target.chooseControl().set('prompt',get.translation('caochuanjiejian')).set('choiceList',[ '将手牌中的所有杀交给'+name+',并视为对'+name+'使用一张杀','展示手牌并令'+name+'弃置任意一张' ],function(){ if(ai.get.effect(player,{name:'sha'},target,target)<0) return 1; - if(target.num('h','sha')>=3) return 1; + if(target.countCards('h','sha')>=3) return 1; return 0; }); } @@ -981,7 +981,7 @@ card.yunchou={ order:9.5, basic:{ equipValue:function(card,player){ - if(player.num('h','qiankundai')) return 6; + if(player.countCards('h','qiankundai')) return 6; return 1; } } @@ -1070,7 +1070,7 @@ card.yunchou={ _hufu_sha:{ enable:['chooseToRespond','chooseToUse'], filter:function(event,player){ - return player.num('h','hufu')>0; + return player.countCards('h','hufu')>0; }, filterCard:{name:'hufu'}, viewAs:{name:'sha'}, @@ -1085,7 +1085,7 @@ card.yunchou={ _hufu_shan:{ enable:['chooseToRespond','chooseToUse'], filter:function(event,player){ - return player.num('h','hufu')>0; + return player.countCards('h','hufu')>0; }, filterCard:{name:'hufu'}, viewAs:{name:'shan'}, @@ -1100,7 +1100,7 @@ card.yunchou={ _hufu_jiu:{ enable:['chooseToRespond','chooseToUse'], filter:function(event,player){ - return player.num('h','hufu')>0; + return player.countCards('h','hufu')>0; }, filterCard:{name:'hufu'}, viewAs:{name:'jiu'}, diff --git a/character/gujian.js b/character/gujian.js index 8a117659f..1425af814 100644 --- a/character/gujian.js +++ b/character/gujian.js @@ -649,7 +649,7 @@ character.gujian={ }, check:function(event,player){ return ai.get.attitude(player,event.player)<0&& - ((player.countCards('h')>player.hp&&player.num('h','lebu')==0)||get.distance(player,event.player)>1); + ((player.countCards('h')>player.hp&&player.countCards('h','lebu')==0)||get.distance(player,event.player)>1); }, logTarget:'player', content:function(){ diff --git a/character/gwent.js b/character/gwent.js index 3899b5a47..c42713927 100644 --- a/character/gwent.js +++ b/character/gwent.js @@ -180,7 +180,7 @@ character.gwent={ if(player.hp>=3&&target.hp==1) return -1; return 0; } - var num=player.num('h','shan'); + var num=player.countCards('h','shan'); if(num<1){ num=1; } diff --git a/character/hearth.js b/character/hearth.js index 5beb854fa..f23c45267 100644 --- a/character/hearth.js +++ b/character/hearth.js @@ -213,7 +213,7 @@ character.hearth={ return !target.hasSkill('moxie')&&!target.storage.fuhua_failed; }, filter:function(event,player){ - return player.num('h','du'); + return player.countCards('h','du'); }, discard:false, prepare:'give', @@ -1385,7 +1385,7 @@ character.hearth={ } player.gain(event.cards); 'step 1' - if(player.num('h','sha')){ + if(player.countCards('h','sha')){ player.chooseToUse('战意:使用一张杀').filterCard=function(card){ return card.name=='sha'&&get.itemtype(card)=='card'; } @@ -3061,7 +3061,7 @@ character.hearth={ filter:function(event,player){ return event.card.name=='sha'&&event.player!=player&& get.distance(player,event.targets[0])<=1&& - player.num('h','shan')>0&& + player.countCards('h','shan')>0&& event.targets.contains(player)==false&&event.targets.length==1; }, direct:true, @@ -3793,10 +3793,10 @@ character.hearth={ var nh=player.countCards('h'); var nm=1; var check=true; - if(player.num('h','tao')){ + if(player.countCards('h','tao')){ check=false; } - else if(player.num('h','shan')&&player.num('h','wuxie')){ + else if(player.countCards('h','shan')&&player.countCards('h','wuxie')){ check=false; } player.chooseTarget(get.prompt('kuixin'),function(card,player,target){ @@ -4849,7 +4849,7 @@ character.hearth={ var hastarget=game.hasPlayer(function(current){ return ai.get.attitude(player,current)<0; }); - var ns=target.num('h','shan'); + var ns=target.countCards('h','shan'); var nh=target.countCards('h'); if(ns>1){ return [0,hastarget?1:0]; diff --git a/character/ow.js b/character/ow.js index a022ce62a..f5ebea4be 100644 --- a/character/ow.js +++ b/character/ow.js @@ -235,7 +235,7 @@ character.ow={ var bs=player.getCards('h',{type:'basic'}); if(bs.length<2) return 0; if(player.hasSkill('jiu')||player.hasSkill('tianxianjiu')) return; - if(bs.length<=3&&player.num('h','sha')<=1){ + if(bs.length<=3&&player.countCards('h','sha')<=1){ for(var i=0;i0&&player.storage.paotai<3; + return player.countCards('h','sha')>0&&player.storage.paotai<3; }, filterCard:{name:'sha'}, content:function(){ @@ -1216,7 +1216,7 @@ character.ow={ target:function(player,target){ var nh=target.countCards('h'); if(ai.get.attitude(player,target)<0&&nh>=3&& - player.canUse('sha',target)&&player.num('h','sha')&& + player.canUse('sha',target)&&player.countCards('h','sha')&& ai.get.effect(target,{name:'sha'},player,player)>0){ return -nh-5; } @@ -1485,7 +1485,7 @@ character.ow={ order:4, result:{ target:function(player,target){ - if(!player.num('h','sha')) return 0; + if(!player.countCards('h','sha')) return 0; if(target.countCards('h')<=1&&get.distance(player,target,'attack')<=1) return 0; var min=[]; var num=0; @@ -2164,7 +2164,7 @@ character.ow={ direct:true, content:function(){ "step 0" - var dis=trigger.target.num('h','shan')||trigger.target.num('e','bagua')||trigger.target.countCards('h')>2; + var dis=trigger.target.countCards('h','shan')||trigger.target.num('e','bagua')||trigger.target.countCards('h')>2; var next=player.chooseToDiscard(get.prompt('xiandan')); next.ai=function(card){ if(dis) return 7-ai.get.value(card); @@ -3071,7 +3071,7 @@ character.ow={ switch(get.suit(ui.selected.cards[0])){ case 'heart':if(target.hp==1) return 1;return 0.1; case 'diamond':return 1+Math.sqrt(target.countCards('h')); - case 'club':return -target.countCards('h')-Math.sqrt(target.num('h','sha')); + case 'club':return -target.countCards('h')-Math.sqrt(target.countCards('h','sha')); case 'spade':return ai.get.damageEffect(target,player,target,'thunder'); default:return 0; } @@ -3153,7 +3153,7 @@ character.ow={ }, enable:'phaseUse', filter:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, filterTarget:function(card,player,target){ return target.hpplayer.hp&&player.num('h','lebu')==0)||get.distance(player,event.player)>1); + ((player.countCards('h')>player.hp&&player.countCards('h','lebu')==0)||get.distance(player,event.player)>1); }, alter:true, intro:{ diff --git a/character/refresh.js b/character/refresh.js index b9c9a9cc7..9a67ce102 100644 --- a/character/refresh.js +++ b/character/refresh.js @@ -388,7 +388,7 @@ character.refresh={ audio:2, trigger:{player:'phaseDrawBegin'}, check:function(event,player){ - if(player.num('h','sha')) return true; + if(player.countCards('h','sha')) return true; return Math.random()<0.5; }, content:function(){ @@ -610,7 +610,7 @@ character.refresh={ order:9, result:{ target:function(player,target){ - return -target.countCards('he')-(player.num('h','du')?1:0); + return -target.countCards('he')-(player.countCards('h','du')?1:0); } }, threaten:2, @@ -1037,7 +1037,7 @@ character.refresh={ if(target.countCards('h')>target.hp+1&&ai.get.recoverEffect(target)>0){ return 1; } - if(player.canUse('sha',target)&&(player.num('h','sha')||player.num('he',{color:'red'}))){ + if(player.canUse('sha',target)&&(player.countCards('h','sha')||player.num('he',{color:'red'}))){ return -2; } return -0.5; @@ -1082,7 +1082,7 @@ character.refresh={ "step 1" var suit=get.suit(result.card); var target=trigger.target; - var num=target.num('h','shan'); + var num=target.countCards('h','shan'); target.chooseToDiscard('请弃置一张'+get.translation(suit)+'牌,否则不能使用闪抵消此杀','he',function(card){ return get.suit(card)==_status.event.suit; }).set('ai',function(card){ diff --git a/character/shenhua.js b/character/shenhua.js index 497b47084..957a5db37 100644 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -584,7 +584,7 @@ character.shenhua={ if(target.countCards('h')==0) return 0; if(target.countCards('h')==1) return -0.1; if(player.hp<=2) return -2; - if(player.num('h','shan')==0) return -1; + if(player.countCards('h','shan')==0) return -1; return -0.5; } }, @@ -658,7 +658,7 @@ character.shenhua={ var bs=player.getCards('h',{type:'basic'}); if(bs.length<2) return 0; if(player.hasSkill('jiu')||player.hasSkill('tianxianjiu')) return; - if(bs.length<=3&&player.num('h','sha')<=1){ + if(bs.length<=3&&player.countCards('h','sha')<=1){ for(var i=0;i1){ + if(trigger.target.countCards('h','shan')>1){ return ai.get.unuseful2(card); } return -1; @@ -3068,7 +3068,7 @@ character.shenhua={ ai:{ order:function(name,player){ var cards=player.getCards('h'); - if(player.num('h','sha')==0){ + if(player.countCards('h','sha')==0){ return 1; } for(var i=0;i0) return 0.6; + if(player.countCards('h','sha')>0) return 0.6; var num=player.countCards('h'); if(num>player.hp) return 0; if(num==1) return -2; @@ -3311,11 +3311,11 @@ character.shenhua={ return ai.get.attitude(target,current)<0; }); var be=target.num('e',{color:'black'}); - if(target.num('h','shan')&&be){ + if(target.countCards('h','shan')&&be){ if(!target.hasSkill('guidao')) return 0; return [0,hastarget?target.countCards('he')/2:0]; } - if(target.num('h','shan')&&target.countCards('h')>2){ + if(target.countCards('h','shan')&&target.countCards('h')>2){ if(!target.hasSkill('guidao')) return 0; return [0,hastarget?target.countCards('h')/4:0]; } @@ -3952,10 +3952,10 @@ character.shenhua={ var hastarget=game.hasPlayer(function(current){ return ai.get.attitude(target,current)<0; }); - if(target.num('h','shan')&&target.num('e',{suit:'spade'})){ + if(target.countCards('h','shan')&&target.num('e',{suit:'spade'})){ return [0,hastarget?target.countCards('he')/2:0]; } - if(target.num('h','shan')){ + if(target.countCards('h','shan')){ return [1,hastarget?target.countCards('he')/2:0]; } return [1,target.countCards('h')/4]; @@ -4042,14 +4042,14 @@ character.shenhua={ }, check:function(button){ var player=_status.event.player; - if(player.num('h','wuzhong')){ + if(player.countCards('h','wuzhong')){ if(player.hp==1&&player.num('tao')){ return button.link=='tao'?1:0; } return button.link=='wuzhong'?1:0; } if(player.hp1&& - player.num('h','shan')>1&&player.countCards('h')>event.target.countCards('h')){ + player.countCards('h','shan')>1&&player.countCards('h')>event.target.countCards('h')){ next.set('shan',true); } if(ai.get.attitude(player,event.target)>0&&player.needsToDiscard()){ @@ -751,7 +751,7 @@ character.sp={ return !target.hasSkill('fuman2')&&target!=player; }, filter:function(event,player){ - return player.num('h','sha'); + return player.countCards('h','sha'); }, discard:false, prepare:'give', @@ -894,7 +894,7 @@ character.sp={ player.addTempSkill('fenxun2','phaseAfter'); }, check:function(card){ - if(card.name=='sha'&&_status.event.player.num('h','sha')<=1) return 0; + if(card.name=='sha'&&_status.event.player.countCards('h','sha')<=1) return 0; return 6-ai.get.value(card); }, filterCard:true, @@ -1092,7 +1092,7 @@ character.sp={ viewAs:{name:'sha'}, viewAsFilter:function(player){ if(!player.storage.fanghun) return false; - if(!player.num('h','shan')) return false; + if(!player.countCards('h','shan')) return false; }, prompt:'将一张闪当杀使用或打出', onuse:function(result,player){ @@ -1114,7 +1114,7 @@ character.sp={ respondSha:true, skillTagFilter:function(player){ if(!player.storage.fanghun) return false; - if(!player.num('h','shan')) return false; + if(!player.countCards('h','shan')) return false; }, order:function(){ return ai.get.order({name:'sha'})+0.1; @@ -1130,7 +1130,7 @@ character.sp={ prompt:'将一张杀当闪打出', viewAsFilter:function(player){ if(!player.storage.fanghun) return false; - if(!player.num('h','sha')) return false; + if(!player.countCards('h','sha')) return false; }, onrespond:function(result,player){ player.storage.fanghun--; @@ -1146,7 +1146,7 @@ character.sp={ respondShan:true, skillTagFilter:function(player){ if(!player.storage.fanghun) return false; - if(!player.num('h','sha')) return false; + if(!player.countCards('h','sha')) return false; }, effect:{ target:function(card,player,target,current){ @@ -2332,7 +2332,7 @@ character.sp={ juesi:{ enable:'phaseUse', filter:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, filterTarget:function(card,player,target){ return target!=player&&target.countCards('he')>0; @@ -2503,7 +2503,7 @@ character.sp={ if(trigger.card.name=='sha'){ var target=trigger.targets[0]; if(target==player){ - return !player.num('h','shan'); + return !player.countCards('h','shan'); } else{ return target.hp==1||(target.countCards('h')<=2&&target.hp<=2); @@ -3137,9 +3137,9 @@ character.sp={ var save=false; if(ai.get.attitude(player,trigger.target)>2){ if(trigger.card.name=='sha'){ - if(player.num('h','shan')||player.getEquip(2)|| + if(player.countCards('h','shan')||player.getEquip(2)|| trigger.target.hp==1||player.hp>trigger.target.hp+1){ - if(!trigger.target.num('h','shan')||trigger.target.countCards('h')0; + return player.countCards('h','shan')>0; }, content:function(){ var target=trigger.player; @@ -4676,7 +4676,7 @@ character.sp={ var target=event.target; var tosave=trigger.player; var att=ai.get.attitude(target,tosave); - var hastao=target.num('h','tao'); + var hastao=target.countCards('h','tao'); target.chooseToDiscard(4,true,'he').set('ai',function(card){ var hastao=_status.event.hastao; var att=_status.event.att; @@ -5293,7 +5293,7 @@ character.sp={ trigger:{player:'phaseUseBegin'}, direct:true, filter:function(event,player){ - return player.num('h','sha')==0; + return player.countCards('h','sha')==0; }, content:function(){ "step 0" @@ -5620,7 +5620,7 @@ character.sp={ if(get.color(event.card)!='black') return false; if(!event.player) return false; if(event.player==player) return false; - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, direct:true, content:function(){ @@ -6318,7 +6318,7 @@ character.sp={ else if(trigger.player.hp>1&&player.countCards('h')<3){ nono=true; } - else if(trigger.player.canUse('sha',player)&&!player.num('h','shan')&&trigger.player.countCards('h')>=3){ + else if(trigger.player.canUse('sha',player)&&!player.countCards('h','shan')&&trigger.player.countCards('h')>=3){ nono=true; } var next=player.chooseToDiscard(get.prompt('zhendu',trigger.player)); @@ -7104,7 +7104,7 @@ character.sp={ player.storage.huxiao++; }, check:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, mod:{ cardUsable:function(card,player,num){ @@ -7987,7 +7987,7 @@ character.sp={ forced:true, popup:false, check:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, filter:function(event,player){ return _status.currentPhase==player; diff --git a/character/standard.js b/character/standard.js index ac67736dd..98d1acbab 100644 --- a/character/standard.js +++ b/character/standard.js @@ -794,7 +794,7 @@ character.standard={ var top=[]; var judges=player.node.judges.childNodes; var stopped=false; - if(!player.num('h','wuxie')){ + if(!player.countCards('h','wuxie')){ for(var i=0;i1){ + if(_status.event.player.countCards('h','shan')>1){ return ai.get.unuseful2(card); } return -1; @@ -1566,7 +1566,7 @@ character.standard={ var next=trigger.turn.chooseToRespond({name:'sha'}); next.autochoose=lib.filter.autoRespondSha; next.ai=function(card){ - if(ai.get.attitude(trigger.turn,player)<0&&trigger.turn.num('h','sha')>1){ + if(ai.get.attitude(trigger.turn,player)<0&&trigger.turn.countCards('h','sha')>1){ return ai.get.unuseful2(card); } return -1; diff --git a/character/swd.js b/character/swd.js index 2974a1de7..bb3846b9a 100644 --- a/character/swd.js +++ b/character/swd.js @@ -505,7 +505,7 @@ character.swd={ } if(get.tag(card,'respondSha')||get.tag(card,'respondShan')){ if(ai.get.attitude(player,target)>0&&card.name=='juedou') return; - return [0.5,target.num('h','sha')+target.num('h','shan')]; + return [0.5,target.countCards('h','sha')+target.countCards('h','shan')]; } } } @@ -827,7 +827,7 @@ character.swd={ effect:{ target:function(card,player,target){ if(get.tag(card,'respondShan')){ - var shans=target.num('h','shan'); + var shans=target.countCards('h','shan'); var hs=target.countCards('h'); if(shans>1) return [1,1]; if(shans&&hs>2) return [1,1]; @@ -877,7 +877,7 @@ character.swd={ effect:{ target:function(card,player,target){ if(get.tag(card,'respondShan')){ - var shans=target.num('h','shan'); + var shans=target.countCards('h','shan'); var hs=target.countCards('h'); if(shans>1) return [0,1]; if(shans&&hs>2) return [0,1]; @@ -1572,8 +1572,8 @@ character.swd={ order:10, result:{ player:function(player){ - if(player.num('h','juedou')) return 1; - if(player.num('h','sha')==0) return 0; + if(player.countCards('h','juedou')) return 1; + if(player.countCards('h','sha')==0) return 0; var players=game.filterPlayer(); for(var i=0;i2){ - if(player.num('h','shan')||player.getEquip(2)|| + if(player.countCards('h','shan')||player.getEquip(2)|| trigger.target.hp==1||player.hp>trigger.target.hp+1){ - if(!trigger.target.num('h','shan')||trigger.target.countCards('h')1) return [0,1]; if(shans&&hs>2) return [0,1]; if(shans) return [0,0]; @@ -2220,7 +2220,7 @@ character.swd={ return [1.5,0]; } if(get.tag(card,'respondSha')){ - var shas=target.num('h','sha'); + var shas=target.countCards('h','sha'); if(shas>1) return [0,1]; if(shas&&hs>2) return [0,1]; if(shas) return [0,0]; @@ -2342,7 +2342,7 @@ character.swd={ var next=trigger.target.chooseToRespond({name:'shan'}); next.autochoose=lib.filter.autoRespondShan; next.ai=function(card){ - if(trigger.target.num('h','shan')>1){ + if(trigger.target.countCards('h','shan')>1){ return ai.get.unuseful2(card); } return -1; @@ -3294,7 +3294,7 @@ character.swd={ if((nme=='juedou')&&(player==trigger.targets[0]||trigger.targets[0].hp==1)) return val; if(nme=='chenhuodajie') return val; if(nme=='lebu'&&trigger.targets[0].countCards('h')>trigger.targets[0].hp) return val; - if(nme=='sha'&&trigger.targets[0].hp==1&&!trigger.targets[0].num('h','shan')) return val; + if(nme=='sha'&&trigger.targets[0].hp==1&&!trigger.targets[0].countCards('h','shan')) return val; if(nme=='jiedao'&&trigger.targets[0]==player) return val; if(nme=='yihuajiemu'&&trigger.targets[0]==player) return val; if(nme=='shuiyanqijun'&&trigger.targets.contains(player)) return val; @@ -3332,7 +3332,7 @@ character.swd={ priority:15, filter:function(event,player){ return event.card.name=='sha'&&event.player!=player&& - player.num('h','sha')>0&&event.targets.contains(player)==false; + player.countCards('h','sha')>0&&event.targets.contains(player)==false; }, direct:true, content:function(){ @@ -7404,7 +7404,7 @@ character.swd={ usable:1, alter:true, filter:function(event,player){ - return player.num('h','sha')>1; + return player.countCards('h','sha')>1; }, filterCard:{name:'sha'}, selectCard:2, @@ -8589,7 +8589,7 @@ character.swd={ direct:true, content:function(){ "step 0" - var dis=trigger.target.num('h','shan')||trigger.target.num('e','bagua')||trigger.target.countCards('h')>2; + var dis=trigger.target.countCards('h','shan')||trigger.target.num('e','bagua')||trigger.target.countCards('h')>2; var next=player.chooseToDiscard(get.prompt('shoulie',trigger.target)); next.ai=function(card){ if(dis) return 7-ai.get.value(card); diff --git a/character/xianjian.js b/character/xianjian.js index 9ab3940ad..e99c5a890 100644 --- a/character/xianjian.js +++ b/character/xianjian.js @@ -265,7 +265,7 @@ character.xianjian={ viewAs:{name:'wanjian'}, filterCard:{name:'sha'}, filter:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, alter:true, usable:1, @@ -706,7 +706,7 @@ character.xianjian={ filter:function(event,player){ if(event.responded) return false; if(!event.filterCard({name:'shan'})) return false; - return player.num('h','shan')>0; + return player.countCards('h','shan')>0; }, direct:true, check:function(event,player){ @@ -750,7 +750,7 @@ character.xianjian={ popup:false, silent:true, filter:function(event,player){ - return player.num('h','shan')==0; + return player.countCards('h','shan')==0; }, content:function(){ player.removeSkill('zhangmu_ai'); @@ -1006,7 +1006,7 @@ character.xianjian={ diewu:{ enable:'phaseUse', filter:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, filterCard:{name:'sha'}, filterTarget:function(card,player,target){ @@ -1247,7 +1247,7 @@ character.xianjian={ effect:{ player:function(card,player){ if(_status.currentPhase!=player) return; - if(card.name=='sha'&&player.num('h','sha')<2&&!player.needsToDiscard()){ + if(card.name=='sha'&&player.countCards('h','sha')<2&&!player.needsToDiscard()){ var num=0; var player=_status.event.player; var players=game.filterPlayer(); @@ -1278,7 +1278,7 @@ character.xianjian={ ctianfu:{ enable:'phaseUse', filter:function(event,player){ - return player.num('h','shan')>0; + return player.countCards('h','shan')>0; }, usable:1, filterCard:{name:'shan'}, diff --git a/character/yijiang.js b/character/yijiang.js index c0faae0f4..aa3c7c5ac 100644 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -229,7 +229,7 @@ character.yijiang={ var goon=true; if(ai.get.attitude(player,trigger.player)>=-0.8) goon=false; else if(trigger.player.countCards('h')<=3) goon=false; - else if(player.num('h','shan')==0) goon=false; + else if(player.countCards('h','shan')==0) goon=false; var es=player.getCards('e'); var color=[]; for(var i=0;i0; + return player.countCards('h','jiu')>0; }, filterCard:{name:'jiu'}, viewAs:{name:'sha'}, viewAsFilter:function(player){ - if(!player.num('h','jiu')) return false; + if(!player.countCards('h','jiu')) return false; }, check:function(){return 1}, ai:{ skillTagFilter:function(player){ - if(!player.num('h','jiu')) return false; + if(!player.countCards('h','jiu')) return false; }, respondSha:true, order:4, @@ -1725,7 +1725,7 @@ character.yijiang={ ai:{ order:function(name,player){ var cards=player.getCards('h'); - if(player.num('h','sha')==0){ + if(player.countCards('h','sha')==0){ return 1; } for(var i=0;i0) return 0; + if(player.countCards('h','sha')>0) return 0; var num=player.countCards('h'); if(num>player.hp) return 0; if(num==1) return -2; @@ -1779,7 +1779,7 @@ character.yijiang={ return card.name=='sha'&&!card.nature; }, filter:function(event,player){ - return player.num('h','sha')>0 + return player.countCards('h','sha')>0 }, viewAs:{name:'sha',nature:'fire'}, mod:{ @@ -1821,7 +1821,7 @@ character.yijiang={ direct:true, audio:2, filter:function(event,player){ - return player.num('h','sha')>0&&!player.storage.chunlao.length; + return player.countCards('h','sha')>0&&!player.storage.chunlao.length; }, init:function(player){ player.storage.chunlao=[]; @@ -1831,7 +1831,7 @@ character.yijiang={ }, content:function(){ 'step 0' - player.chooseCard([1,player.num('h','sha')],get.prompt('chunlao'),{name:'sha'}).set('ai',function(){ + player.chooseCard([1,player.countCards('h','sha')],get.prompt('chunlao'),{name:'sha'}).set('ai',function(){ return 1; }); 'step 1' @@ -1980,7 +1980,7 @@ character.yijiang={ var trigger=_status.event.getTrigger(); if(att>0&&eff>=0) return 1; if(att>=0&&eff>0) return 1; - if(att>0&&(trigger.player.hp>=3||trigger.player.num('e','bagua')||trigger.player.num('h','shan'))){ + if(att>0&&(trigger.player.hp>=3||trigger.player.num('e','bagua')||trigger.player.countCards('h','shan'))){ if(name=='lebu'&&nh>trigger.player.hp) return 1; if(name=='bingliang'&&nh=2){ + if(target.countCards('h','shan')&&target.countCards('h')>=2){ att/=1.5; } return att; @@ -2281,12 +2281,12 @@ character.yijiang={ !trigger.player.num('e','zhuge')){ var nh=trigger.player.countCards('h'); if(player==trigger.player){ - go=(player.num('h','sha')>0); + go=(player.countCards('h','sha')>0); } else if(nh>=4){ go=true; } - else if(player.num('h','sha')){ + else if(player.countCards('h','sha')){ if(nh==3){ go=Math.random()<0.8; } @@ -2332,7 +2332,7 @@ character.yijiang={ check:function(event,player){ var nh=player.countCards('h')-player.num('h',{type:'equip'}); if(nh<=1) return true; - if(player.num('h','tao')) return false; + if(player.countCards('h','tao')) return false; if(nh<=2) return Math.random()<0.7; if(nh<=3) return Math.random()<0.4; return false; @@ -2723,13 +2723,13 @@ character.yijiang={ filterCard:{name:'shan'}, viewAs:{name:'sha'}, viewAsFilter:function(player){ - if(!player.num('h','shan')) return false; + if(!player.countCards('h','shan')) return false; if(player.hp!=1) return false; }, check:function(){return 1}, ai:{ skillTagFilter:function(player){ - if(!player.num('h','shan')) return false; + if(!player.countCards('h','shan')) return false; if(player.hp!=1) return false; }, respondSha:true, @@ -2919,8 +2919,8 @@ character.yijiang={ result:{ target:function(player,target){ if(player.countCards('h')>=3||target.countCards('h')>=3) return 0; - if(player.num('h','tao')) return 0; - if(target.num('h','sha')>1) return 0; + if(player.countCards('h','tao')) return 0; + if(target.countCards('h','sha')>1) return 0; return -1.5; } } @@ -3002,7 +3002,7 @@ character.yijiang={ var players=game.filterPlayer(); for(var i=0;i1&&(nh>=4||(nh>=3&&players[i].num('h','sha')))){ + if(players[i].group=='shu'&&ai.get.attitude(players[i],player)>1&&(nh>=4||(nh>=3&&players[i].countCards('h','sha')))){ yep=true;break; } } @@ -3073,7 +3073,7 @@ character.yijiang={ var player=_status.event.player,players=game.filterPlayer(); for(var i=0;i1&&(nh>=4||(nh>=3&&players[i].num('h','sha')))){ + if(players[i].group=='shu'&&ai.get.attitude(players[i],player)>1&&(nh>=4||(nh>=3&&players[i].countCards('h','sha')))){ return 5-ai.get.value(card); } } @@ -3204,7 +3204,7 @@ character.yijiang={ player.chooseCard(get.prompt('huomo'),'he',function(card){ return get.type(card)!='basic'&&get.color(card)=='black'; }).set('ai',function(card){ - if(!_status.event.player.num('h','shan')){ + if(!_status.event.player.countCards('h','shan')){ return 8-ai.get.value(card); } return 6-ai.get.value(card); @@ -3545,8 +3545,8 @@ character.yijiang={ order:1, result:{ target:function(player,target){ - if(player.countCards('h')==1&&player.num('h','du')) return -1; - if(player.hp<=2&&player.num('h','shan')) return 0; + if(player.countCards('h')==1&&player.countCards('h','du')) return -1; + if(player.hp<=2&&player.countCards('h','shan')) return 0; if(target.countCards('h')+player.countCards('h')>target.hp+2) return 0; if(ai.get.attitude(player,target)>3) return 1; return 0; @@ -3788,7 +3788,7 @@ character.yijiang={ audio:2, enable:'phaseUse', filter:function(event,player){ - return player.num('h','sha')>0; + return player.countCards('h','sha')>0; }, filterCard:{name:'sha'}, prepare:function(cards,player){ @@ -3842,7 +3842,7 @@ character.yijiang={ return player.countCards('he')>0; }, check:function(event,player){ - return player.num('h','sha')<=player.countCards('h')/3; + return player.countCards('h','sha')<=player.countCards('h')/3; }, content:function(){ "step 0" @@ -5239,7 +5239,7 @@ character.yijiang={ return card.name=='sha'||get.type(card)=='equip'; }, filter:function(event,player){ - return player.num('h','sha')>0||player.num('he',{type:'equip'})>0; + return player.countCards('h','sha')>0||player.num('he',{type:'equip'})>0; }, check:function(card){return 8-ai.get.value(card)}, selectTarget:2, @@ -5897,9 +5897,9 @@ character.yijiang={ result:{ player:function(player){ if(_status.event.parent.name=='phaseUse'){ - if(player.num('h','jiu')>0) return 0; - if(player.num('e','zhuge')&&player.num('h','sha')>1) return 0; - if(!player.num('h','sha')) return 0; + if(player.countCards('h','jiu')>0) return 0; + if(player.num('e','zhuge')&&player.countCards('h','sha')>1) return 0; + if(!player.countCards('h','sha')) return 0; var targets=[]; var target; var players=game.filterPlayer(); @@ -6305,10 +6305,10 @@ character.yijiang={ "step 0" player.chooseControl('jiangchi_less','jiangchi_more','cancel2',function(){ var player=_status.event.player; - if(player.countCards('h')>3&&player.num('h','sha')>1){ + if(player.countCards('h')>3&&player.countCards('h','sha')>1){ return 'jiangchi_less'; } - if(player.num('h','sha')>2){ + if(player.countCards('h','sha')>2){ return 'jiangchi_less'; } if(player.hp-player.countCards('h')>1){ diff --git a/character/yxs.js b/character/yxs.js index 9b635f44f..f78ae67aa 100644 --- a/character/yxs.js +++ b/character/yxs.js @@ -203,7 +203,7 @@ character.yxs={ if(n1-n2==1){ num=1; } - if(player.num('h','du')){ + if(player.countCards('h','du')){ if(n1==n2) num=0.5; else num=0.1; } @@ -1551,7 +1551,7 @@ character.yxs={ trigger:{global:'dying'}, priority:11, filter:function(event,player){ - return event.player.hp<=0&&(player.num('h','jiu')>0||player.num('h',{color:'black'})>=2)&&player!=event.player; + return event.player.hp<=0&&(player.countCards('h','jiu')>0||player.num('h',{color:'black'})>=2)&&player!=event.player; }, check:function(event,player){ return ai.get.attitude(player,event.player)<0; @@ -1736,7 +1736,7 @@ character.yxs={ result:{ target:function(player,target){ if(player==target){ - if(player.hp<=2&&!player.num('h','shan')){ + if(player.hp<=2&&!player.countCards('h','shan')){ return 2; } return 0; @@ -2227,7 +2227,7 @@ character.yxs={ var next=trigger.target.chooseToRespond({name:'shan'}); next.autochoose=lib.filter.autoRespondShan; next.ai=function(card){ - if(trigger.target.num('h','shan')>1){ + if(trigger.target.countCards('h','shan')>1){ return ai.get.unuseful2(card); } return -1; @@ -2250,7 +2250,7 @@ character.yxs={ var next=trigger.turn.chooseToRespond({name:'sha'}); next.autochoose=lib.filter.autoRespondSha; next.ai=function(card){ - if(ai.get.attitude(trigger.turn,player)<0&&trigger.turn.num('h','sha')>1){ + if(ai.get.attitude(trigger.turn,player)<0&&trigger.turn.countCards('h','sha')>1){ return ai.get.unuseful2(card); } return -1; @@ -2282,7 +2282,7 @@ character.yxs={ priority:15, filter:function(event,player){ return event.card.name=='sha'&&event.player!=player&& - player.num('h','sha')>0&&event.targets.contains(player)==false; + player.countCards('h','sha')>0&&event.targets.contains(player)==false; }, direct:true, content:function(){ diff --git a/game/game.js b/game/game.js index 7224f1f99..b75e4a3d5 100644 --- a/game/game.js +++ b/game/game.js @@ -15680,7 +15680,7 @@ return false; }, hasWuxie:function(){ - if(this.num('h','wuxie')) return true; + if(this.countCards('h','wuxie')) return true; var skills=this.get('s',true).concat(lib.skill.global); game.expandSkills(skills); for(var i=0;i1) return [1,1]; if(shans&&hs>2) return [1,1]; @@ -1636,7 +1636,7 @@ mode.boss={ effect:{ target:function(card,player,target){ if(get.tag(card,'respondShan')){ - var shans=target.num('h','shan'); + var shans=target.countCards('h','shan'); var hs=target.countCards('h'); if(shans>1) return [0,1]; if(shans&&hs>2) return [0,1]; @@ -2528,11 +2528,11 @@ mode.boss={ } } var be=target.num('e',{color:'black'}); - if(target.num('h','shan')&&be){ + if(target.countCards('h','shan')&&be){ if(!target.hasSkill('guidao')) return 0; return [0,hastarget?target.countCards('he')/2:0]; } - if(target.num('h','shan')&&target.countCards('h')>2){ + if(target.countCards('h','shan')&&target.countCards('h')>2){ if(!target.hasSkill('guidao')) return 0; return [0,hastarget?target.countCards('h')/4:0]; } @@ -2704,7 +2704,7 @@ mode.boss={ order:1, result:{ player:function(player){ - if(player.num('h','shan')) return 1; + if(player.countCards('h','shan')) return 1; var num=0,players=game.filterPlayer(); for(var i=0;i1){ @@ -3473,7 +3473,7 @@ mode.boss={ trigger:{player:'damageAfter'}, direct:true, filter:function(event,player){ - return player.num('h','tao')>0; + return player.countCards('h','tao')>0; }, content:function(){ player.chooseToUse({name:'tao'},'神躯:是否使用一张桃?').logSkill='shenqu'; diff --git a/mode/chess.js b/mode/chess.js index 90bbf87ab..1de519e4a 100644 --- a/mode/chess.js +++ b/mode/chess.js @@ -4751,7 +4751,7 @@ mode.chess={ sanjiansheji:{ enable:'phaseUse', filter:function(event,player){ - return player.num('h','sha')>1&&lib.filter.filterCard({name:'sha'},player); + return player.countCards('h','sha')>1&&lib.filter.filterCard({name:'sha'},player); }, filterCard:{name:'sha'}, selectCard:2, @@ -4791,7 +4791,7 @@ mode.chess={ effect:{ player:function(card,player){ if(_status.currentPhase!=player) return; - if(card.name=='sha'&&player.num('h','sha')<2&&player.countCards('h')<=player.hp){ + if(card.name=='sha'&&player.countCards('h','sha')<2&&player.countCards('h')<=player.hp){ var num=0; var player=_status.event.player; for(var i=0;i1){ + if(_status.event.player.countCards('h','shan')>1){ return ai.get.unuseful2(card); } return -1; diff --git a/mode/stone.js b/mode/stone.js index 3426d801e..6c15623f4 100644 --- a/mode/stone.js +++ b/mode/stone.js @@ -8413,7 +8413,7 @@ mode.stone={ ai:{ order:function(skill,player){ if(!player.getEquip(1)&&player.countCards('e')<2){ - if(player.num('h','sha')&&player.getActCount()+3<=player.actcount){ + if(player.countCards('h','sha')&&player.getActCount()+3<=player.actcount){ return 4; } return 0.1;