Merge pull request #1136 from PZ157/PR-Branch

【决斗】AI修复,3D于禁【整军】修复
This commit is contained in:
Spmario233 2024-03-27 17:33:02 +08:00 committed by GitHub
commit 612d0231b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -1535,7 +1535,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if (get.damageEffect(target, player, target) >= 0) return 0; if (get.damageEffect(target, player, target) >= 0) return 0;
let pd = get.damageEffect(player, target, player), att = get.attitude(player, target); let pd = get.damageEffect(player, target, player), att = get.attitude(player, target);
if (att > 0 && get.damageEffect(target, player, player) > pd) return 0; if (att > 0 && get.damageEffect(target, player, player) > pd) return 0;
let ts = target.mayHaveSha(player, 'respond', null, 'count'), ps = player.mayHaveSha(player, 'respond', null, 'count'); let ts = target.mayHaveSha(player, 'respond', null, 'count'), ps = player.mayHaveSha(player, 'respond', player.getCards('h', i => {
return card === i || card.cards && card.cards.includes(i) || ui.selected.cards.includes(i);
}), 'count');
if (ts < 1 && ts << 3 < Math.pow(player.hp, 2)) return 0; if (ts < 1 && ts << 3 < Math.pow(player.hp, 2)) return 0;
if (att > 0) { if (att > 0) {
if (ts < 1) return 0; if (ts < 1) return 0;
@ -1554,7 +1556,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if (td >= 0) return td / get.attitude(target, target); if (td >= 0) return td / get.attitude(target, target);
let pd = get.damageEffect(player, target, player), att = get.attitude(player, target); let pd = get.damageEffect(player, target, player), att = get.attitude(player, target);
if (att > 0 && get.damageEffect(target, player, player) > pd) return -2; if (att > 0 && get.damageEffect(target, player, player) > pd) return -2;
let ts = target.mayHaveSha(player, 'respond', null, 'count'), ps = player.mayHaveSha(player, 'respond', null, 'count'); let ts = target.mayHaveSha(player, 'respond', null, 'count'), ps = player.mayHaveSha(player, 'respond', player.getCards('h', i => {
return card === i || card.cards && card.cards.includes(i) || ui.selected.cards.includes(i);
}), 'count');
if (ts < 1) return -1.5; if (ts < 1) return -1.5;
if (att > 0) return -2; if (att > 0) return -2;
if (ts - ps < 1) return -2 - ts; if (ts - ps < 1) return -2 - ts;

View File

@ -1689,12 +1689,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
let target; let target;
if(hs_targets.length==1) target=hs_targets[0]; if(hs_targets.length==1) target=hs_targets[0];
else{ else{
target=await player.chooseTarget(get.prompt('dddzhengjun'),'令其中一名角色摸一张牌或弃置一张牌',(card,player,target)=>{ let targets=await player.chooseTarget(get.prompt('dddzhengjun'),'令其中一名角色摸一张牌或弃置一张牌',(card,player,target)=>{
return get.event('targets').includes(target); return get.event('targets').includes(target);
}).set('ai',target=>{ }).set('ai',target=>{
const player=get.event('player'); const player=get.event('player');
return Math.max(get.effect(target,{name:'guohe_copy2'},target,player),get.effect(target,{name:'draw'},player,player)); return Math.max(get.effect(target,{name:'guohe_copy2'},target,player),get.effect(target,{name:'draw'},player,player));
}).set('targets',hs_targets).forResultTargets()[0]; }).set('targets',hs_targets).forResultTargets();
if(targets&&targets.length) target=targets[0];
} }
if(target){ if(target){
let list=['摸牌']; let list=['摸牌'];
@ -1722,12 +1723,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(bool) target=hs_targets[0]; if(bool) target=hs_targets[0];
} }
else{ else{
target=await player.chooseTarget(get.prompt('dddzhengjun'),'移动其中一名角色的一张装备牌',(card,player,target)=>{ let targets=await player.chooseTarget(get.prompt('dddzhengjun'),'移动其中一名角色的一张装备牌',(card,player,target)=>{
return get.event('targets').includes(target); return get.event('targets').includes(target);
}).set('ai',target=>{ }).set('ai',target=>{
const player=get.event('player'); const player=get.event('player');
return player.canMoveCard(true,true,target)?(1+Math.random()):0; return player.canMoveCard(true,true,target)?(1+Math.random()):0;
}).set('targets',es_targets).forResultTargets()[0]; }).set('targets',es_targets).forResultTargets();
if(targets&&targets.length) target=targets[0];
} }
if(target){ if(target){
map.es_target=target; map.es_target=target;