标准包tuxi技能使用async content

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

View File

@ -466,31 +466,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){ filter:function(event,player){
return !event.numFixed; return !event.numFixed;
}, },
content:function(){ async content(event,trigger,player){
"step 0" let check;
var check; let i,num=game.countPlayer(function(current){
var i,num=game.countPlayer(function(current){
return current!=player&&current.countCards('h')&&get.attitude(player,current)<=0; return current!=player&&current.countCards('h')&&get.attitude(player,current)<=0;
}); });
check=(num>=2); check=(num>=2);
player.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],function(card,player,target){ const {result:{bool,targets}}=await player.promises.chooseTarget(get.prompt('tuxi'),'获得其他一至两名角色的各一张手牌',[1,2],(card,player,target)=>{
return target.countCards('h')>0&&player!=target; return target.countCards('h')>0&&player!=target;
},function(target){ },target=>{
if(!_status.event.aicheck) return 0; if(!_status.event.aicheck) return 0;
var att=get.attitude(_status.event.player,target); const att=get.attitude(_status.event.player,target);
if(target.hasSkill('tuntian')) return att/10; if(target.hasSkill('tuntian')) return att/10;
return 1-att; return 1-att;
}).set('aicheck',check); }).set('aicheck',check);
"step 1" if(!bool) return;
if(result.bool){ player.logSkill('tuxi',targets);
player.logSkill('tuxi',result.targets); await player.promises.gainMultiple(targets);
player.gainMultiple(result.targets); trigger.changeToZero();
trigger.changeToZero();
}
else{
event.finish();
}
"step 2"
game.delay(); game.delay();
}, },
ai:{ ai:{