优化铁索ai

This commit is contained in:
PZ157 2023-11-10 15:14:54 +08:00
parent 9fe8508423
commit 62aa20d6d2
1 changed files with 44 additions and 24 deletions

View File

@ -289,35 +289,55 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
recastable:true,
ai:{
wuxie:function(target,card,player,viewer){
if(_status.event.getRand()<0.5) return 0;
if(player==game.me&&get.attitude(viewer,player)>0){
return 0;
}
wuxie:(target,card,player,viewer, status)=>{
if(status*get.attitude(viewer,player)>0&&!player.isMad() || target.hasSkillTag('nodamage') || target.hasSkillTag('nofire') || target.hasSkillTag('nothunder') || get.attitude(viewer,player)>0 || (1+target.countCards('hs'))*_status.event.getRand()>1.57) return 0;
},
basic:{
useful:4,
value:4,
order:7
order:(item,player)=>{
if(player.hasCard(card=>{
return get.tag(card,'damage')&&game.hasNature(card)&&player.hasValueTarget(card);
},'hs')) return 7.3;
return 4.1;
},
useful:1.2,
value:4
},
result:{
target:function(player,target){
if(target.isLinked()){
if(target.hasSkillTag('link')) return 0;
var f=target.hasSkillTag('nofire');
var t=target.hasSkillTag('nothunder');
if(f&&t) return 0;
if(f||t) return 0.5;
return 2;
target:(player,target)=>{
if(target.hasSkillTag('link')) return 0;
let curs = game.filterPlayer(current=>{
if(current.hasSkillTag('nodamage')) return false;
return !current.hasSkillTag('nofire') || !current.hasSkillTag('nothunder');
});
if(curs.length<2) return 0;
let f = target.hasSkillTag('nofire'),
t = target.hasSkillTag('nothunder'),
res = 0.9;
if(f&&t || target.hasSkillTag('nodamage')) return 0;
if(f || t) res = 0.45;
if(target.getEquip('tengjia')) res *= 2;
if(!target.isLinked()) res = -res;
if(ui.selected.targets.length) return res;
let fs = 0,
es = 0,
att = get.attitude(player,target),
linkf = false,
alink = true;
curs.forEach(i=>{
let atti = get.attitude(player,i);
if(atti>0){
fs++;
if(i.isLinked()) linkf = true;
}
else if(atti<0){
es++;
if(!i.isLinked()) alink = false;
}
});
if(es<2&&!alink) {
if(att<=0 || att>0 && linkf && fs<2) return 0;
}
if(get.attitude(player,target)>=0) return -0.9;
if(ui.selected.targets.length) return -0.9;
if(game.hasPlayer(function(current){
return get.attitude(player,current)<=-1&&current!=target&&!current.isLinked();
})){
return -0.9;
}
return 0;
return res;
}
},
tag:{