族王浑一技能ai大调

This commit is contained in:
mengxinzxz 2023-10-07 18:14:49 +08:00 committed by GitHub
parent dd3f1db366
commit 0876ac7b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 61 additions and 3 deletions

View File

@ -188,6 +188,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
//族王浑
clanfuxun:{
mod:{
aiOrder:function(player,card,num){
if(player.isPhaseUsing()&&get.type(card)=='equip'&&get.equipValue(card,player)>0) return num+3;
},
},
locked:false,
audio:2,
enable:'phaseUse',
usable:1,
@ -206,6 +212,27 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!ui.selected.cards.length) return target.countGainableCards(player,'h')>0;
return true;
},
check:function(card){
var player=_status.event.player;
var evtx=_status.event.getParent('phaseUse');
var targets=game.filterPlayer(target=>target!=player&&lib.skill.clanfuxun.ai.result.target(player,target)!=0);
targets.sort((a,b)=>Math.abs(lib.skill.clanfuxun.ai.result.target(player,b))-Math.abs(lib.skill.clanfuxun.ai.result.target(player,a)));
if(evtx&&targets.length){
var target=targets[0];
if(!target.hasHistory('lose',evt=>{
return evt.getParent(3).name!='clanfuxun'&&evt.getParent('phaseUse')==evtx&&evt.cards2.length;
})&&!target.hasHistory('gain',evt=>{
return evt.getParent().name!='clanfuxun'&&evt.getParent('phaseUse')==evtx&&evt.cards.length;
})&&Math.abs(player.countCards('h')-target.countCards('h'))==2){
if(player.countCards('h')>target.countCards('h')) return 1/(get.value(card)||0.5);
return -1;
}
if(card.name=='du') return 20;
return -1;
}
if(card.name=='du') return 20;
return -1;
},
content:function(){
'step 0'
if(cards.length){
@ -261,9 +288,36 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},
ai:{
order:2,
order:function(item,player){
var evtx=_status.event.getParent('phaseUse');
if(game.hasPlayer(current=>{
if(current==player||!evtx||get.attitude(player,current)==0) return false;
return !current.hasHistory('lose',evt=>{
return evt.getParent(3).name!='clanfuxun'&&evt.getParent('phaseUse')==evtx&&evt.cards2.length;
})&&!current.hasHistory('gain',evt=>{
return evt.getParent().name!='clanfuxun'&&evt.getParent('phaseUse')==evtx&&evt.cards.length;
})&&Math.abs(player.countCards('h')-current.countCards('h'))==2;
})) return 10;
return 2;
},
result:{
target:-1,
target:function(player,target){
var evtx=_status.event.getParent('phaseUse');
var num=get.sgn(get.attitude(player,target));
var targets=game.filterPlayer(current=>{
if(current==player||!evtx||get.attitude(player,current)==0) return false;
return !current.hasHistory('lose',evt=>{
return evt.getParent(3).name!='clanfuxun'&&evt.getParent('phaseUse')==evtx&&evt.cards2.length;
})&&!current.hasHistory('gain',evt=>{
return evt.getParent().name!='clanfuxun'&&evt.getParent('phaseUse')==evtx&&evt.cards.length;
})&&Math.abs(player.countCards('h')-current.countCards('h'))==2;
});
if(targets.contains(target)){
if(player.countCards('h')<target.countCards('h')) return get.sgn(num+0.5)*Math.sqrt(2-num);
else return num*(2+num);
}
return get.sgn(num+0.5)*(1-num)*0.25;
},
},
},
subSkill:{
@ -274,7 +328,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
position:'hes',
filterTarget:lib.filter.targetEnabled,
selectCard:1,
check:(card)=>6-get.value(card),
check:function(card){
var player=_status.event.player;
if(player.hasSkill('clanzhongliu')&&get.position(card)!='h') return 10-get.value(card);
return 5-get.value(card);
},
log:false,
precontent:function(){
delete event.result.skill;