修复【轻袭】ai

This commit is contained in:
PZ157 2023-11-27 17:50:27 +08:00
parent 3f6cf09add
commit a50a49e300
1 changed files with 16 additions and 7 deletions

View File

@ -2247,14 +2247,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{ ai:{
order:8, order:8,
result:{ result:{
target:function(player,target){ target:(player,target)=>{
var num=target.countCards('h')-player.countCards('h'); let num=player.countCards('h')-target.countCards('h'),
var cnt=player.countCards('h',card=>{ eff=get.effect(target,{name:'sha',nature:'stab'},player,target),
return get.value(card)<5; val=0,
ph=_status.event.getTempCache('jsrgqingxi_result','ph');
if(!ph){
ph=player.getCards('h').sort((a,b)=>{
return get.value(a)-get.value(b);
}); });
if(cnt<num) return 0; _status.event.putTempCache('jsrgqingxi_result','ph',ph);
var eff=get.effect(target,{name:'sha',nature:'stab'},player,target); }
return Math.sign(eff)/Math.sqrt(num); ph.slice(0,num).forEach(i=>{
val+=get.value(i,player);
});
eff=Math.sign(eff)*Math.sqrt(Math.abs(eff));
if(val>2*Math.abs(eff)) return 0;
return eff/num;
} }
} }
}, },