简化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.syncStorage('rehuashen');
player.updateMarks('rehuashen');
var skills=game.expandSkills([link]);
skills.forEach(skill=>{
lib.skill.rehuashen.createAudio(event.card,skill,'re_zuoci');
});
lib.skill.rehuashen.createAudio(event.card,link,'re_zuoci');
}
},
init:function(player,skill){
@ -10667,22 +10664,33 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
return node;
},
createAudio:(character,skill,name)=>{
var info=lib.skill[skill];
if(!info) return;
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;
createAudio:(character,skillx,name)=>{
var skills=game.expandSkills([skillx]);
skills=skills.filter(skill=>get.info(skill));
if(!skills.length) return;
var skillss=skills.filter(skill=>get.info(skill).derivation);
if(skillss.length){
skillss.forEach(skill=>{
var derivationSkill=get.info(skill).derivation;
skills[Array.isArray(derivationSkill)?'addArray':'add'](derivationSkill);
});
}
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,
intro:{

View File

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