diff --git a/character/refresh.js b/character/refresh.js index 84de5c643..2998b3e37 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -2538,6 +2538,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ targets[event.num].chooseBool("是否押杀?").ai=function(event,player){ var evt=_status.event.getParent(); if(get.attitude(targets[event.num],evt.player)>0) return evt.player.countCards('h','sha')?false:true; + if(evt.player.hasKnownCards(targets[event.num],c=>{return c.name == 'sha';})){ + return true; + } return Math.random()<0.5; }; "step 2" diff --git a/character/yijiang.js b/character/yijiang.js index 8b589aee2..d135fe7f5 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -466,8 +466,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return _status.event.choice; }).set('choice',function(){ var num=trigger.player.countCards('h',card=>get.type2(card)==type); + var knownNum = trigger.player.countKnownCards(_status.event.player,card=>get.type2(card)==type); + if(trigger.player.isAllCardsKnown(_status.event.player)){ + return knownNum; + } + var restNum = num - knownNum; var numx; - if(type=='basic') numx=num+(Math.random()<0.2?(Math.random()>0.5?1:-1):0); + if(type=='basic') numx=num+Math.floor(Math.random()*restNum+1); else if(type=='trick'){ if(num>2) numx=2; else numx=1; @@ -478,7 +483,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else{ numx=[0,1].randomGet(); } - if(numx<0) numx=0; + if(numx=choices.length) numx=choices.length-1; return numx; }()); diff --git a/game/game.js b/game/game.js index 51cc74daa..326fd076c 100644 --- a/game/game.js +++ b/game/game.js @@ -19317,9 +19317,15 @@ for(var num=0;num 0; } + //数此角色被知道的牌。 + countKnownCards(other,filter){ + return this.getKnownCards(other,filter).length; + } //Execute the delay card effect //执行延时锦囊牌效果 executeDelayCardEffect(card,target,judge,judge2){ @@ -30591,6 +30601,21 @@ } } } + removeKnower(player){ + if(!this._knowers){ + return; + } + if(typeof player == 'string'){ + this._knowers.remove(player); + }else{ + let type = get.itemtype(player); + if(type == 'player'){ + this._knowers.remove(player.playerid); + }else if(type == 'players'){ + player.forEach(p=>this._knowers.remove(p.playerid)); + } + } + } //清除此牌的知情者。 clearKnowers(){ if(this._knowers)delete this._knowers; @@ -35843,6 +35868,7 @@ for(let i=0;i