标准包luoshen技能使用async content

This commit is contained in:
shijian 2023-12-09 13:35:03 +08:00
parent 60596cd0c0
commit 5a73498601
1 changed files with 34 additions and 37 deletions

View File

@ -646,45 +646,42 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:'phaseZhunbeiBegin'}, trigger:{player:'phaseZhunbeiBegin'},
frequent:true, frequent:true,
preHidden:true, preHidden:true,
content:function(){ async content(event,trigger,player){
"step 0" while(true){
if(event.cards==undefined) event.cards=[]; if(event.cards==undefined) event.cards=[];
var next=player.judge(function(card){ const judgeEvent=player.promises.judge(card=>{
if(get.color(card)=='black') return 1.5; if(get.color(card)=='black') return 1.5;
return -1.5; return -1.5;
}); });
next.judge2=function(result){ judgeEvent.judge2=result=>result.bool;
return result.bool; if(get.mode()!='guozhan'&&!player.hasSkillTag('rejudge')) judgeEvent.set('callback',async event=>{
}; if(event.judgeResult.color=='black'&&get.position(event.card,true)=='o') await player.promises.gain(event.card,'gain2');
if(get.mode()!='guozhan'&&!player.hasSkillTag('rejudge')) next.set('callback',function(){ });
if(event.judgeResult.color=='black'&&get.position(card,true)=='o') player.gain(card,'gain2'); else judgeEvent.set('callback',async event=>{
}); if(event.judgeResult.color=='black') event.getParent().orderingCards.remove(event.card);
else next.set('callback',function(){ });
if(event.judgeResult.color=='black') event.getParent().orderingCards.remove(card); const {result:{judge,card}}=await judgeEvent;
}); let bool;
"step 1" if(judge>0){
if(result.judge>0){ event.cards.push(card);
event.cards.push(result.card); bool=(await player.promises.chooseBool('是否再次发动【洛神】?').set('frequentSkill','luoshen')).result.bool;
player.chooseBool('是否再次发动【洛神】?').set('frequentSkill','luoshen'); }
} else{
else{ for(let i=0;i<event.cards.length;i++){
for(var i=0;i<event.cards.length;i++){ if(get.position(event.cards[i],true)!='o'){
if(get.position(event.cards[i],true)!='o'){ event.cards.splice(i,1);i--;
event.cards.splice(i,1);i--; }
} }
if(event.cards.length){
await player.promises.gain(event.cards,'gain2');
}
return;
} }
if(event.cards.length){ if(!bool){
player.gain(event.cards,'gain2'); if(event.cards.length){
} await player.promises.gain(event.cards,'gain2');
event.finish(); }
} return;
"step 2"
if(result.bool){
event.goto(0);
}
else{
if(event.cards.length){
player.gain(event.cards,'gain2');
} }
} }
} }