标准包xiaoji技能使用async content,优化yiji技能写法

This commit is contained in:
shijian 2023-12-09 15:26:42 +08:00
parent 4be531224e
commit e2664760dd
1 changed files with 13 additions and 14 deletions

View File

@ -554,7 +554,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
async content(event,trigger,player){ async content(event,trigger,player){
event.count=trigger.num; event.count=trigger.num;
// event.goto -> while // event.goto -> while
while(event.count>0){ while(true){
event.count--; event.count--;
const {cards}=await game.cardsGotoOrdering(get.cards(2)).toPromise(); const {cards}=await game.cardsGotoOrdering(get.cards(2)).toPromise();
if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true}); if(_status.connectMode) game.broadcastAll(function(){_status.noclearcountdown=true});
@ -1797,20 +1797,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var evt=event.getl(player); var evt=event.getl(player);
return evt&&evt.player==player&&evt.es&&evt.es.length>0; return evt&&evt.player==player&&evt.es&&evt.es.length>0;
}, },
content:function(){ async content(event,trigger,player){
"step 0"
event.count=trigger.getl(player).es.length; event.count=trigger.getl(player).es.length;
"step 1" while(true){
event.count--; event.count--;
player.draw(2); await player.promises.draw(2);
"step 2"
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){ if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji').ai=lib.filter.all; const chooseBoolEvent=player.promises.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji');
} chooseBoolEvent.ai=lib.filter.all;
"step 3" const {result:{bool}}=await chooseBoolEvent;
if(result.bool){ if(bool){
player.logSkill('xiaoji'); player.logSkill('xiaoji');
event.goto(1); }else break;
}
} }
}, },
ai:{ ai:{