简化lib.skill.rehuashen.createAudio索引配音audioname2的写法,并添加可修改derivation的audioname2

This commit is contained in:
mengxinzxz 2023-11-28 12:35:01 +08:00
parent 9cc8c95982
commit 902e6c45a3
2 changed files with 28 additions and 23 deletions

View File

@ -10548,10 +10548,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.popup(link); player.popup(link);
player.syncStorage('rehuashen'); player.syncStorage('rehuashen');
player.updateMarks('rehuashen'); player.updateMarks('rehuashen');
var skills=game.expandSkills([link]); lib.skill.rehuashen.createAudio(event.card,link,'re_zuoci');
skills.forEach(skill=>{
lib.skill.rehuashen.createAudio(event.card,skill,'re_zuoci');
});
} }
}, },
init:function(player,skill){ init:function(player,skill){
@ -10667,22 +10664,33 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
return node; return node;
}, },
createAudio:(character,skill,name)=>{ createAudio:(character,skillx,name)=>{
var info=lib.skill[skill]; var skills=game.expandSkills([skillx]);
if(!info) return; skills=skills.filter(skill=>get.info(skill));
if(!info.audioname2) info.audioname2={}; if(!skills.length) return;
if(info.audioname&&info.audioname.includes(character)){ var skillss=skills.filter(skill=>get.info(skill).derivation);
if(info.audio&&typeof info.audio=='string') skill=info.audio; if(skillss.length){
if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2}; skillss.forEach(skill=>{
info.audioname2[name]=(skill+'_'+character); var derivationSkill=get.info(skill).derivation;
} skills[Array.isArray(derivationSkill)?'addArray':'add'](derivationSkill);
else if(info.audioname2[character]){ });
info.audioname2[name]=info.audioname2[character];
}
else{
if(info.audio&&typeof info.audio=='string') skill=info.audio;
info.audioname2[name]=skill;
} }
skills.forEach(skill=>{
var info=lib.skill[skill];
if(!info.audioname2) info.audioname2={};
if(info.audioname&&info.audioname.includes(character)){
if(info.audio&&typeof info.audio=='string') skill=info.audio;
if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2};
info.audioname2[name]=(skill+'_'+character);
}
else if(info.audioname2[character]){
info.audioname2[name]=info.audioname2[character];
}
else{
if(info.audio&&typeof info.audio=='string') skill=info.audio;
info.audioname2[name]=skill;
}
});
}, },
mark:true, mark:true,
intro:{ intro:{

View File

@ -4459,10 +4459,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.popup(skill); player.popup(skill);
player.syncStorage('huashen'); player.syncStorage('huashen');
player.updateMarks('huashen'); player.updateMarks('huashen');
var skills=game.expandSkills([skill]); lib.skill.rehuashen.createAudio(character,skill,'zuoci');
skills.forEach(skillx=>{
lib.skill.rehuashen.createAudio(character,skillx,'zuoci');
});
} }
} }
} }