周处【义烈】bugfix+ai优化+写法简化

This commit is contained in:
mengxinzxz 2023-12-01 23:54:11 +08:00
parent c0b1fd8745
commit 0a0018e08f
1 changed files with 38 additions and 25 deletions

View File

@ -8092,7 +8092,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2, audio:2,
enable:'chooseToUse', enable:'chooseToUse',
hiddenCard:function(player,name){ hiddenCard:function(player,name){
if(get.type(name)=='basic'&&lib.inpile.contains(name)&&!player.getStorage('yilie_count').contains(name)){ if(get.type(name)=='basic'&&lib.inpile.contains(name)&&!player.getStorage('yilie_count').includes(name)){
var hs=player.getCards('hs'); var hs=player.getCards('hs');
if(hs.length<2) return false; if(hs.length<2) return false;
var bool=false,map={}; var bool=false,map={};
@ -8123,7 +8123,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
if(!bool) return false; if(!bool) return false;
for(var name of lib.inpile){ for(var name of lib.inpile){
if(get.type(name)!='basic'||list.contains(name)) continue; if(get.type(name)!='basic'||list.includes(name)) continue;
var card={name:name}; var card={name:name};
if(event.filterCard(card,player,event)) return true; if(event.filterCard(card,player,event)) return true;
if(name=='sha'){ if(name=='sha'){
@ -8138,10 +8138,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
chooseButton:{ chooseButton:{
dialog:function(event,player){ dialog:function(event,player){
var list=[]; var list=[];
var storage=player.storage.yilie_count; var storage=player.getStorage('yilie_count');
for(var i of lib.inpile){ for(var i of lib.inpile){
if(get.type(i)!='basic') continue; if(get.type(i)!='basic'||storage.includes(i)) continue;
if(storage&&storage.contains(i)) continue;
var card={name:i,isCard:true}; var card={name:i,isCard:true};
if(event.filterCard(card,player,event)) list.push(['基本','',i]); if(event.filterCard(card,player,event)) list.push(['基本','',i]);
if(i=='sha'){ if(i=='sha'){
@ -8154,25 +8153,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return ui.create.dialog('义烈',[list,'vcard'],'hidden') return ui.create.dialog('义烈',[list,'vcard'],'hidden')
}, },
check:function(button){ check:function(button){
let player=_status.event.player,hs=player.getCards('h',card=>{ var player=_status.event.player;
return get.name(card)!==button.link[2]&&(!button.link[3]||get.hasNature(card,button.link[3])); var evt=_status.event.getParent();
}),bool=false,map={}; var name=button.link[2],card={name:name,nature:button.link[3]};
for(let i of hs){ if(name=='shan') return 2;
let color=get.color(i); if(evt.type=='dying'){
if(!map[color]) map[color]=true; if(get.attitude(player,evt.dying)<2) return 0;
else{ if(name=='jiu') return 2.1;
bool=true; return 1.9;
break;
} }
} if(evt.type=='phase'){
if(!bool) return 0;
if(button.link[2]=='shan') return 3;
if(button.link[2]=='jiu'){ if(button.link[2]=='jiu'){
if(player.getUseValue({name:'jiu'})<=0) return 0; if(player.getUseValue({name:'jiu'})<=0) return 0;
if(player.countCards('h','sha')) return player.getUseValue({name:'jiu'}); if(player.countCards('hs',name=>get.name(card)=='sha')) return player.getUseValue({name:'jiu'});
return 0; return 0;
} }
return player.getUseValue({name:button.link[2],nature:button.link[3]})/4; return player.getUseValue(card)/4;
}
return 1;
}, },
backup:function(links,player){ backup:function(links,player){
return { return {
@ -8188,7 +8186,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
position:'hs', position:'hs',
complexCard:true, complexCard:true,
check:(card)=>{ check:(card)=>{
if(get.name(card)===lib.skill.yilie_backup.viewAs.name&&(!lib.skill.yilie_backup.viewAs.nature||game.hasNature(card,lib.skill.yilie_backup.viewAs.nature))) return -1;
return 8-get.value(card); return 8-get.value(card);
}, },
popname:true, popname:true,
@ -8211,12 +8208,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
ai:{ ai:{
order:function(item,player){ order:function(item,player){
return 2.6; if(player&&_status.event.type=='phase'){
var add=false,max=0;
var names=lib.inpile.filter(name=>get.type(name)=='basic'&&!player.getStorage('yilie_count').includes(name));
if(names.includes('sha')) add=true;
names=names.map(namex=>{return {name:namex}});
if(add) lib.inpile_nature.forEach(nature=>names.push({name:'sha',nature:nature}));
names.forEach(card=>{
if(player.getUseValue(card)>0){
var temp=get.order(card);
if(temp>max) max=temp;
}
});
if(max>0) max-=0.001;
return max;
}
return 0.5;
}, },
respondShan:true, respondShan:true,
respondSha:true, respondSha:true,
fireAttack:true, fireAttack:true,
skillTagFilter:function(player,tag){ skillTagFilter:function(player,tag,arg){
if(arg=='respond') return false;
var hs=player.getCards('hs'); var hs=player.getCards('hs');
if(hs.length<2) return false; if(hs.length<2) return false;
var bool=false,map={}; var bool=false,map={};