优化诸葛瑾【弘援】结算流程

This commit is contained in:
mengxinzxz 2024-02-11 23:15:20 +08:00
parent 672b8c5b4d
commit 8682cb4924
1 changed files with 39 additions and 55 deletions

View File

@ -7273,63 +7273,47 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
olhongyuan:{ olhongyuan:{
audio:'hongyuan', audio:'hongyuan',
trigger:{ trigger:{player:'gainAfter',global:'loseAsyncAfter'},
player:'gainAfter', filter(event,player){
global:'loseAsyncAfter', if(!player.countCards('he')||player.hasSkill('olhongyuan_blocker',null,null,false)) return false;
return event.getg(player).length>=2;
}, },
direct:true, async content(event,trigger,player){
filter:function(event,player){ player.addTempSkill('olhongyuan_blocker',['phaseZhunbeiBefore','phaseJudgeBefore','phaseDrawBefore','phaseUseBefore','phaseDiscardBefore','phaseJieshuBefore','phaseBefore']);
var cards=event.getg(player); let selectedTargets=[];
return cards.length>=2&&!player.hasSkill('olhongyuan_blocker',null,null,false); while(selectedTargets.length<2&&player.countCards('he')&&game.hasPlayer(target=>{
}, return target!=player&&!selectedTargets.includes(target);
content:function(){ })){
'step 0' const {result:{bool,targets,cards}}=await player.chooseCardTarget({
var max=Math.min(2,game.countPlayer()-1,player.countCards('he')); prompt:'弘援:将一张牌交给一名其他角色',
player.chooseCardTarget({ filterCard:true,
prompt:get.prompt('olhongyuan'), position:'he',
prompt2:'操作提示:按顺序选择任意张要交出的牌,并按任意顺序选择等量的获得牌的角色', filterTarget(card,player,target){
filterCard:true, return target!=player&&!get.event('selectedTargets').includes(target);
selectCard:[1,max], },
position:'he', complexCard:true,
filterTarget:lib.filter.notMe, complexTarget:true,
selectTarget:[1,max], complexSelect:true,
filterOk:function(){ ai1(card){
return ui.selected.cards.length==ui.selected.targets.length; const player=get.event('player');
}, if(!game.hasPlayer(current=>current!=player&&get.attitude(player,current)>0&&!current.hasSkillTag('nogain'))) return -get.value(card);
ai1:function(card){ return 4+((player.hasSkill('olmingzhe')&&get.color(card)=='red')?2:0)-Math.max(player.getUseValue(card),get.value(card,player));
var player=_status.event.player; },
var num=game.countPlayer(function(current){ ai2(target){
return current!=player&&get.attitude(player,current)>0&&!current.hasSkillTag('nogain'); const player=_status.event.player,att=get.attitude(player,target);
}); if(!ui.selected.cards.length) return att;
if(num<=ui.selected.cards.length) return -get.value(card); const card=ui.selected.cards[0],val=get.value(card,target);
if(!player.hasSkill('olmingzhe')) return 4-Math.max(player.getUseValue(card),get.value(card,player)); if(val<0) return -att*Math.sqrt(-val);
if(ui.selected.cards.length&&get.color(card)=='red') return 6-get.value(card); return att*Math.sqrt(val+2);
return 4-Math.max(player.getUseValue(card),get.value(card,player)); },
}, }).set('selectedTargets',selectedTargets);
ai2:function(target){ if(bool){
var player=_status.event.player,att=get.attitude(player,target); const target=targets[0];
var card=ui.selected.cards[ui.selected.targets.length]; selectedTargets.push(target);
if(!card) return att; player.line(target);
var val=get.value(card,target); await player.give(cards,target);
if(val<0) return -att*Math.sqrt(-val);
return att*Math.sqrt(val+2);
},
});
'step 1'
if(result.bool){
player.logSkill('olhongyuan',result.targets);
player.addTempSkill('olhongyuan_blocker',['phaseZhunbeiBefore','phaseJudgeBefore','phaseDrawBefore','phaseUseBefore','phaseDiscardBefore','phaseJieshuBefore','phaseBefore']);
var map=[];
for(var i=0;i<result.cards.length;i++){
map.push([result.targets[i],[result.cards[i]]]);
} }
game.loseAsync({ else break;
gain_list:map,
player:player,
cards:result.cards,
giver:player,
animate:'giveAuto',
}).setContent('gaincardMultiple');
} }
}, },
ai:{threaten:0.8}, ai:{threaten:0.8},