From 280043d78c6a5e52425ba1fa8dace485c3fb9796 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sat, 9 Dec 2023 11:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E5=87=86=E7=89=88=E5=8C=85hujia?= =?UTF-8?q?=E6=8A=80=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 | 67 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/character/standard.js b/character/standard.js index 6fd397e34..e8d500d1b 100755 --- a/character/standard.js +++ b/character/standard.js @@ -233,42 +233,41 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.damageEffect(player,event.player,player)>=0) return false; return true; }, - content:function(){ - "step 0" - if(event.current==undefined) event.current=player.next; - if(event.current==player){ - event.finish(); - } - else if(event.current.group=='wei'){ - if((event.current==game.me&&!_status.auto)||( - get.attitude(event.current,player)>2)|| - event.current.isOnline()){ - player.storage.hujiaing=true; - var next=event.current.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); - next.set('ai',function(){ - var event=_status.event; - return (get.attitude(event.player,event.source)-2); - }); - next.set('skillwarn','替'+get.translation(player)+'打出一张闪'); - next.autochoose=lib.filter.autoRespondShan; - next.set('source',player); + async content(event,trigger,player){ + while(true){ + let bool; + if(!event.current) event.current=player.next; + if(event.current==player) return; + else if(event.current.group=='wei'){ + if((event.current==game.me&&!_status.auto)||( + get.attitude(event.current,player)>2)|| + event.current.isOnline()){ + player.storage.hujiaing=true; + const next=event.current.promises.chooseToRespond('是否替'+get.translation(player)+'打出一张闪?',{name:'shan'}); + next.set('ai',()=>{ + const event=_status.event; + return (get.attitude(event.player,event.source)-2); + }); + next.set('skillwarn','替'+get.translation(player)+'打出一张闪'); + next.autochoose=lib.filter.autoRespondShan; + next.set('source',player); + bool=(await next).result.bool; + } } - } - "step 1" - player.storage.hujiaing=false; - if(result.bool){ - event.finish(); - trigger.result={bool:true,card:{name:'shan',isCard:true}}; - trigger.responded=true; - trigger.animate=false; - if(typeof event.current.ai.shown=='number'&&event.current.ai.shown<0.95){ - event.current.ai.shown+=0.3; - if(event.current.ai.shown>0.95) event.current.ai.shown=0.95; + player.storage.hujiaing=false; + if(bool){ + trigger.result={bool:true,card:{name:'shan',isCard:true}}; + trigger.responded=true; + trigger.animate=false; + if(typeof event.current.ai.shown=='number'&&event.current.ai.shown<0.95){ + event.current.ai.shown+=0.3; + if(event.current.ai.shown>0.95) event.current.ai.shown=0.95; + } + return; + } + else{ + event.current=event.current.next; } - } - else{ - event.current=event.current.next; - event.goto(0); } }, ai:{