神华佗滤心添加AI

This commit is contained in:
copcap 2024-04-14 20:02:35 +08:00
parent 2183af6fc2
commit fa9ca51be2
No known key found for this signature in database
GPG Key ID: 30E7AB6699451AEE
1 changed files with 29 additions and 1 deletions

View File

@ -142,6 +142,17 @@ game.import('character', function () {
usable:1,
filterCard:true,
filterTarget:lib.filter.notMe,
check(card){
const round=game.roundNumber,player=get.player();
let valueFix = 0;
if(['sha','shan'].includes(get.name(card,false))) valueFix += 3;
if(round<=2&&player.hasCard(card=>{
return ['sha','shan'].includes(get.name(card))&&get.value(card)<=3;
})||game.hasPlayer(current=>{
return current!==player&&get.attitude(player,current)>0;
})) return 6-get.value(card)+valueFix;
return 4.5-get.value(card)+valueFix;
},
delay:false,
discard:false,
lose:false,
@ -152,7 +163,9 @@ game.import('character', function () {
const result = await player.chooseControl(['摸牌', '弃牌']).set('choiceList', [
`${name}${get.cnNumber(round)}张牌`,
`${name}随机弃置${get.cnNumber(round)}张手牌`
]).set('prompt', '滤心:请选择一项').forResult();
]).set('prompt', '滤心:请选择一项').set('ai', () => {
return get.event('choice');
}).set('choice', get.attitude(player, target) > 0 ? '摸牌' : '弃牌').forResult();
let cards2 = [];
const makeDraw = result.index === 0;
if (makeDraw) {
@ -219,6 +232,21 @@ game.import('character', function () {
content:'下次发动技能时失去#点体力',
},
}
},
ai:{
order:5,
result:{
target(player,target){
const round=game.roundNumber;
if(round<=2&&target.countCards('h')>round*2&&player.getCards('h').some(card=>{
return ['sha','shan'].includes(get.name(card))&&get.value(card)<=3;
})) return 1;
if(get.attitude(player,target)>0){
return round+Math.sqrt(1+target.getDamagedHp());
}
return -(round+Math.sqrt(Math.max(0,2-target.getHp())));
},
}
}
},
huandao:{