优化【决讨】【屯田】【剑合】【悲歌】【狂斧】【落宠】ai

This commit is contained in:
157 2023-12-26 00:03:08 +08:00
parent f45dfd3126
commit cfad17964c
5 changed files with 69 additions and 21 deletions

View File

@ -10824,10 +10824,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(val<min) min=val;
});
if(att>0&&min<=0) return target.hasSkillTag('noe')?3:1;
if(att<0&&max>0){
if(att<=0&&max>0){
if(target.hasSkillTag('noe')) return max>6?(-max/3):0;
return -max;
}
if(player===target&&!player.hasSha()){
let ph=player.countCards('h');
if(game.hasPlayer(i=>{
if(!player.canUse('sha',i,true,true)||get.effect(i,{name:'sha'},player,player)<=0) return false;
return !ph||!i.mayHaveShan(player,'use');
})) return 1;
}
return 0;
},
},

View File

@ -3453,8 +3453,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return event.card&&event.card.name=='sha'&&event.player.isIn()&&player.countCards('he')>0;
},
check:function(event,player){
if(event.player.hasSkill('xinleiji')) return get.attitude(player,event.player)>0;
return true;
let att=get.attitude(player,event.player);
if(event.player.hasSkill('xinleiji')) return att>0;
if(att>0||event.player.isHealthy()) return true;
if(!event.source) return true;
att=get.attitude(player,event.source);
return att<=0||event.source.isTurnedOver();
},
prompt2:'令其进行判定,然后你可根据判定结果,弃置一张牌并令其执行对应效果。',
content:function(){
@ -13309,21 +13313,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
ai:{
effect:function(card,player,target){
if(!target.hasFriend()) return;
if(player==target) return;
if(player==target||!target.hasFriend()) return;
var type=get.type(card);
var nh=target.countCards();
var nh=Math.min(target.countCards(),game.countPlayer(i=>get.attitude(target,i)>0));
if(type=='trick'){
if(!get.tag(card,'multitarget')||get.info(card).singleCard){
if(get.tag(card,'damage')){
if(nh<3||target.hp<=2) return 0.8;
}
if(get.tag(card,'damage')) return [1.5,nh-1];
return [1,nh];
}
}
else if(type=='delay'){
return [0.5,0.5];
}
else if(type=='delay') return [0.5,0.5];
},
}
},

View File

@ -3663,6 +3663,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
effect:{
target:function(card,player,target,current){
if(typeof card==='object'&&get.name(card)==='sha'&&target.mayHaveShan(player,'use')) return [0.6,0.75];
if(!target.hasFriend()&&!player.hasUnknown()) return;
if(_status.currentPhase==target) return;
if(card.name!='shuiyanqijunx'&&get.tag(card,'loseCard')&&target.countCards('he')){

View File

@ -5427,7 +5427,41 @@ game.import('character',function(lib,game,ui,get,ai,_status){
effect:{
player:function(card,player,target){
if((!card.isCard||!card.cards)&&get.itemtype(card)!='card') return;
if(target&&player!=target&&player.countCards('h')>player.getHandcardLimit()) return [0,0,0,0.5];
let cs=0;
if(target&&player!=target&&player.countCards('h',i=>{
if(card===i||card.cards&&card.cards.includes(i)){
cs++;
return false;
}
return true;
})>player.getHandcardLimit()){
let targets=[],evt=_status.event.getParent('useCard');
targets.addArray(ui.selected.targets);
if(evt&&evt.card==card) targets.addArray(evt.targets);
if(targets.length){
if(targets.length>1||!targets.includes(target)) return 'zeroplayertarget';
return;
}
let info=get.info(card);
if(!info||info.notarget||!info.filterTarget) return;
let range,select=get.copy(info.selectTarget),filter;
if(select===undefined) range=[1,1];
else if(typeof select==='number') range=[select,select];
else if(get.itemtype(select)==='select') range=select;
else if(typeof select==='function') range=select(card,player);
if(info.singleCard) range=[1,1];
game.checkMod(card,player,range,'selectTarget',player);
if(range[1]<-1) range=[1, 1];
else if(range[0]<0){
if(info.filterTarget===true) filter=game.players.length;
else filter=game.countPlayer(current=>{
return info.filterTarget(card,player,current);
});
range=[filter,filter];
}
if(range&&range[0]>1&&range[1]>1) return 'zeroplayertarget';
return [0,0,0,1];
}
},
},
},

View File

@ -4725,16 +4725,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.chooseButton([1,num]).set('createDialog',dialog).set('filterButton',button=>{
return lib.filter.canBeDiscarded(button.link,_status.event.player,get.owner(button.link));
}).set('ai',button=>{
var card=button.link;
var player=_status.event.player,target=get.owner(card);
if(target==player&&ui.cardPile.childNodes.length>80){
if(ui.selected.buttons.some(i=>get.owner(i.link)==player)) return 0;
if(get.value(card,player)<6) return 60-get.value(card,player);
var player=_status.event.player,
target=get.owner(button.link),
num=ui.selected.buttons.filter(i=>get.owner(i.link)==target).length;
if(num>1&&player.hp+player.hujia>2) return 0;
if(target==player){
if(num) return -get.value(button.link,target);
if(ui.cardPile.childNodes.length>80) return 6-get.value(card,player);
return 0;
}
var num=ui.selected.buttons.filter(i=>get.owner(i.link)==target).length;
var val=get.buttonValue(button);
if(num>2) val/=Math.sqrt(num);
if(num===2) val/=4;
if(get.attitude(player,target)>0) return -val;
return val;
//return -(get.position(card)!='h'?get.value(card,target):(4.5+Math.random()-0.2*(num>2?1:0)))*get.attitude(player,target);
@ -9184,7 +9185,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
'step 0'
player.chooseTarget(get.prompt2('juetao'),lib.filter.notMe).set('ai',function(target){
return -get.attitude(_status.event.player,target);
let att=-get.attitude(_status.event.player,target);
if(att<=0) return -att;
if(target.hasSkillTag('nodamage')) return 0.01*att;
if(target.getEquip('tengjia')||target.getEquip('renwang')) return 0.2*att;
if(target.getEquip('bugua')) return 0.3*att;
if(target.getEquip(2)) return att/2;
return 1.2*att;
});
'step 1'
if(result.bool){