标准包xinluoshen技能使用async content

This commit is contained in:
shijian 2023-12-09 13:49:41 +08:00
parent 244c541aa6
commit 95572ccaad
1 changed files with 28 additions and 34 deletions

View File

@ -691,44 +691,38 @@ game.import('character',function(lib,game,ui,get,ai,_status){
// alter:true, // alter:true,
trigger:{player:'phaseZhunbeiBegin'}, trigger:{player:'phaseZhunbeiBegin'},
frequent:true, frequent:true,
content:function(){ async content(event,trigger,player){
"step 0" while(true){
if(event.cards==undefined) event.cards=[]; if(event.cards==undefined) event.cards=[];
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;
},ui.special).judge2=function(result){ },ui.special);
return result.bool; judgeEvent.judge2=result=>result.bool;
}; const {result:{judge,card}}=await judgeEvent;
"step 1" let bool;
if(result.judge>0){ if(judge>0){
event.cards.push(result.card); event.cards.push(card);
if(lib.config.autoskilllist.contains('luoshen')){ bool=lib.config.autoskilllist.contains('luoshen')?(await player.promises.chooseBool('是否再次发动【洛神】?')).result.bool:true;
player.chooseBool('是否再次发动【洛神】?');
} }
else{ else{
event._result={bool:true}; for(let i=0;i<event.cards.length;i++){
} if(get.position(event.cards[i])!='s'){
} event.cards.splice(i,1);
else{ i--;
for(var i=0;i<event.cards.length;i++){ }
if(get.position(event.cards[i])!='s'){
event.cards.splice(i,1);i--;
} }
} await player.promises.gain(event.cards,'gain2');
player.gain(event.cards,'gain2');
player.storage.xinluoshen=event.cards.slice(0);
event.finish();
}
"step 2"
if(result.bool){
event.goto(0);
}
else{
if(event.cards.length){
player.gain(event.cards,'gain2');
player.storage.xinluoshen=event.cards.slice(0); player.storage.xinluoshen=event.cards.slice(0);
return;
} }
if(!bool){
if(event.cards.length){
await player.promises.gain(event.cards,'gain2');
player.storage.xinluoshen=event.cards.slice(0);
return;
}
};
} }
}, },
mod:{ mod:{
@ -743,7 +737,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
clear:{ clear:{
trigger:{player:'phaseAfter'}, trigger:{player:'phaseAfter'},
silent:true, silent:true,
content:function(){ async content(event,trigger,player){
delete player.storage.xinluoshen; delete player.storage.xinluoshen;
} }
} }