From ae6f6cefd982ea9480806803ac6b30ac9afe6d16 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 12:31:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=85tuxi=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8async=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/standard.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/character/standard.js b/character/standard.js index 4b12947be..e16a467d0 100755 --- a/character/standard.js +++ b/character/standard.js @@ -466,31 +466,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return !event.numFixed; }, - content:function(){ - "step 0" - var check; - var i,num=game.countPlayer(function(current){ + async content(event,trigger,player){ + let check; + let i,num=game.countPlayer(function(current){ return current!=player&¤t.countCards('h')&&get.attitude(player,current)<=0; }); 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; - },function(target){ + },target=>{ 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; return 1-att; }).set('aicheck',check); - "step 1" - if(result.bool){ - player.logSkill('tuxi',result.targets); - player.gainMultiple(result.targets); - trigger.changeToZero(); - } - else{ - event.finish(); - } - "step 2" + if(!bool) return; + player.logSkill('tuxi',targets); + await player.promises.gainMultiple(targets); + trigger.changeToZero(); game.delay(); }, ai:{