标准包ganglie_three技能使用async content

This commit is contained in:
shijian 2023-12-09 12:27:14 +08:00
parent c61d214cb7
commit 10ab434921
1 changed files with 14 additions and 23 deletions

View File

@ -423,38 +423,29 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:'ganglie', audio:'ganglie',
trigger:{player:'damageEnd'}, trigger:{player:'damageEnd'},
direct:true, direct:true,
content:function(){ async content(event,trigger,player){
"step 0" const {result:{bool:chooseTargetResultBool,targets:chooseTargetResultTargets}}=await player.promises.chooseTarget(get.prompt2('ganglie_three'),(card,player,target)=>{
player.chooseTarget(get.prompt2('ganglie_three'),function(card,player,target){
return target.isEnemyOf(player); return target.isEnemyOf(player);
}).set('ai',function(target){ }).set('ai',target=>{
return -get.attitude(_status.event.player,target)/(1+target.countCards('h')); return -get.attitude(_status.event.player,target)/(1+target.countCards('h'));
}); });
"step 1" if(!chooseTargetResultBool) return;
if(result.bool){ event.target=chooseTargetResultTargets[0];
event.target=result.targets[0]; player.logSkill('ganglie_three',event.target);
player.logSkill('ganglie_three',target); const judgeEvent=player.promises.judge(card=>{
}
else event.finish();
"step 2"
player.judge(function(card){
if(get.suit(card)=='heart') return -2; if(get.suit(card)=='heart') return -2;
return 2; return 2;
}).judge2=function(result){ });
return result.bool; judgeEvent.judge2=result=>result.bool;
}; const {result:{judge}}=await judgeEvent;
"step 3" if(judge<2) return;
if(result.judge<2){ const {result:{bool:chooseToDiscardResultBool}}=await player.promises.chooseToDiscard(2).set('ai',card=>{
event.finish();return;
}
target.chooseToDiscard(2).set('ai',function(card){
if(card.name=='tao') return -10; if(card.name=='tao') return -10;
if(card.name=='jiu'&&_status.event.player.hp==1) return -10; if(card.name=='jiu'&&_status.event.player.hp==1) return -10;
return get.unuseful(card)+2.5*(5-get.owner(card).hp); return get.unuseful(card)+2.5*(5-get.owner(card).hp);
}); });
"step 4" if(chooseToDiscardResultBool==false){
if(result.bool==false){ event.target.damage();
target.damage();
} }
}, },
ai:{ ai:{