优化一些ai,临时保证value返回有效值

This commit is contained in:
157 2024-01-31 14:16:18 +08:00
parent c8a6ac450a
commit e18250c81e
5 changed files with 23 additions and 18 deletions

View File

@ -4372,7 +4372,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
prompt:(event)=>('是否将【兵粮寸断】转移给'+get.translation(event.player)+''),
check(event,player){
return player.hasCard(card=>{
return (card.viewAs||card.name)=='bingliang'&&event.player.canAddJudge(card)&&get.effect(event.player,card,player,player)>=0;
return (card.viewAs||card.name)=='bingliang'&&event.player.canAddJudge(card)&&get.effect(event.player,new lib.element.VCard({
name:'bingliang',
cards:[card]
}),player,_status.event.player)>=0;
},'j');
},
content(){

View File

@ -4437,6 +4437,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var target=result.targets[0];
event.target=target;
player.logSkill('nsfeixiong',target);
if(get.mode()!=='identity'||player.identity!=='nei') player.addExpose(0.2);
player.chooseToCompare(target);
}
else event.finish();

View File

@ -10770,6 +10770,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 2'
if(result.bool){
target.line(player);
if(player!==target&&(get.mode()!=='identity'||target.identity!=='nei')) target.addExpose(0.15);
player.draw();
}
if(num<targets.length) event.goto(1);
@ -10784,6 +10785,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(result.bool){
var target=result.targets[0];
player.line(target,'green');
if(get.mode()!=='identity'||player.identity!=='nei') player.addExpose(0.15);
target.damage();
}
else event.finish();
@ -10798,6 +10800,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(result.bool){
var target=result.targets[0];
player.line(target);
if(player!==target&&(get.mode()!=='identity'||player.identity!=='nei')) player.addExpose(0.1);
target.draw();
}
},

View File

@ -4093,8 +4093,6 @@ export class Get extends Uninstantable {
if (aii && aii.value) value = aii.value;
else if (aii && aii.basic) value = aii.basic.value;
if (player == undefined || get.itemtype(player) != 'player') player = _status.event.player;
let cache = CacheContext.requireCacheContext();
player = cache.delegate(player);
var geti = function () {
return player.getCardIndex('hs',card.name,card,5);
};
@ -4105,7 +4103,7 @@ export class Get extends Uninstantable {
if (Array.isArray(value)) {
if (method == 'raw') result = value[0];
var num = geti();
if (num < value.length) result = value[num];
if (num < value.length) result = value[Math.max(0,num)];
else result = value[value.length - 1];
}
result = game.checkMod(player, card, result, 'aiValue', player);
@ -4186,10 +4184,10 @@ export class Get extends Uninstantable {
if (order == undefined) return -1;
var num = order;
if (typeof (order) == 'function') {
num = order(item, cache.delegate(_status.event.player));
num = order(item, _status.event.player);
}
if (typeof item == 'object' && _status.event.player) {
var player = cache.delegate(_status.event.player);
var player = _status.event.player;
num = game.checkMod(player, item, num, 'aiOrder', player);
}
return num;

View File

@ -6945,7 +6945,7 @@ export class Player extends HTMLDivElement {
cache = new CacheContext();
}
for (var i = 0; i < targets.length; i++) {
if (cache.delegate(player).canUse(card, targets[i], distance, includecard)) {
if (player.canUse(card, targets[i], distance, includecard)) {
var eff = cache.get.effect(targets[i], card, player, player);
value.push(eff);
}