Merge pull request #798 from PZ157/PR-Branch

bug修复,AI优化
This commit is contained in:
Spmario233 2024-01-15 20:56:48 +08:00 committed by GitHub
commit 8408da8d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 10 deletions

View File

@ -1095,7 +1095,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
forced:true,
filter:(event,player)=>{
if(event.getParent('phaseDraw',true)) return false;
const evt=player.getHistory('gain')[0];
const evt=player.getHistory('gain',i=>!i.getParent('phaseDraw',true))[0];
if(!evt) return false;
if(event.name=='gain'){
if(evt!=event||event.getlx===false) return false;

View File

@ -886,25 +886,39 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
pshengwu:{
audio:'hengwu',
mod:{
aiOrder:(player,card,num)=>{
if(num>0&&get.tag(card,'draw')&&ui.cardPile.childNodes.length+ui.discardPile.childNodes.length<20) return 0;
},
aiValue:(player,card,num)=>{
if(num>0&&card.name==='zhuge') return 20;
},
aiUseful:(player,card,num)=>{
if(num>0&&card.name==='zhuge') return 10;
}
},
trigger:{player:['useCard','respond']},
direct:true,
locked:false,
filter:function(event,player){
return game.hasPlayer(i=>i.countCards('ej',cardx=>get.type(cardx)=='equip'&&get.suit(event.card)==get.suit(cardx)));
},
content:function(){
'step 0'
var suit=get.suit(trigger.card);
var prompt2='弃置任意张'+get.translation(suit)+'手牌然后摸X张牌X为你弃置的牌数+'+game.filterPlayer().map(i=>i.countCards('ej',cardx=>get.type(cardx)=='equip'&&get.suit(trigger.card)==get.suit(cardx))).reduce((p,c)=>p+c)+'';
var suit=get.suit(trigger.card),extra=game.filterPlayer().map(i=>i.countCards('ej',cardx=>{
return get.type(cardx)=='equip'&&get.suit(trigger.card)==get.suit(cardx);
})).reduce((p,c)=>p+c);
var prompt2='弃置任意张'+get.translation(suit)+'手牌然后摸X张牌X为你弃置的牌数+'+extra+'';
player.chooseToDiscard('h',[1,player.countCards('h',{suit:suit})],{suit:suit}).set('prompt',get.prompt('pshengwu')).set('prompt2',prompt2).set('ai',card=>{
var player=_status.event.player;
if(_status.event.tie) return 0;
let player=_status.event.player;
if(_status.event.goon) return 12-get.value(card);
if(player.countCards('h')>50) return 0;
if(player==_status.currentPhase){
if(['shan','caochuan','tao','wuxie'].includes(card.name)) return 8-get.value(card);
return 6-get.value(card);
}
return 5.5-get.value(card);
}).set('goon',player.countCards('h',{suit:suit})==1).set('logSkill','pshengwu');
}).set('goon',player.countCards('h',{suit:suit})==1).set('tie',extra>ui.cardPile.childNodes.length+ui.discardPile.childNodes.length).set('logSkill','pshengwu');
'step 1'
if(result.bool){
var num=result.cards.length;

View File

@ -145,10 +145,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return (dis?6:1)-get.useful(card);
}
if(_status.event.hvt.includes(card)){
if(_status.event.suits.length>=4){
if(cards.length>8) return 0;
return 4.5-get.value(card);
}
if(!_status.event.suits.includes(suit)) return 6-get.value(card);
if(card.name==='sha') return 3-get.value(card);
return 1-get.value(card);
@ -1306,6 +1302,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
dczhangcai:{
audio:2,
mod:{
aiOrder:(player,card,num)=>{
if(num>0&&get.tag(card,'draw')&&ui.cardPile.childNodes.length+ui.discardPile.childNodes.length<20) return 0;
},
aiValue:(player,card,num)=>{
if(num>0&&card.name==='zhuge') return 20;
},
aiUseful:(player,card,num)=>{
if(num>0&&card.name==='zhuge') return 10;
}
},
trigger:{
player:['useCard','respond'],
},
@ -1319,6 +1326,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(typeof num=='number') count=Math.max(1,player.countCards('h',card=>get.number(card)==num))
return '你可以摸'+get.cnNumber(count)+'张牌。';
},
check:(event,player)=>{
const num=player.hasSkill('dczhangcai_all')?get.number(event.card):8;
let count=1;
if(typeof num=='number') count=Math.max(1,player.countCards('h',card=>get.number(card)==num));
return ui.cardPile.childNodes.length+ui.discardPile.childNodes.length>=count;
},
frequent:true,
content:function(){
var num=player.hasSkill('dczhangcai_all')?get.number(trigger.card):8;