Merge pull request #405 from kuangshen04/PR-Branch

inherit更改,支持嵌套
This commit is contained in:
Spmario233 2023-09-27 21:20:52 +08:00 committed by GitHub
commit 24dda1f57c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 8 deletions

View File

@ -39872,14 +39872,25 @@
});
}
if(info.inherit){
const skill=lib.skill[info.inherit];
if(skill) Object.keys(skill).forEach(value=>{
var inheritHistory=[];
doInherit(i);
function doInherit(i){
const info=lib.skill[i],iInfo=`${i}_info`;
if(!info.inherit) return;
if(inheritHistory.includes(info.inherit)) return;
inheritHistory.push(info.inherit);
const inheritInfo=lib.skill[info.inherit];
if(inheritInfo) Object.keys(inheritInfo).forEach(value=>{
if(info[value]!=undefined) return;
if(value=='audio'&&(typeof info[value]=='number'||typeof info[value]=='boolean')) info[value]=info.inherit;
else info[value]=skill[value];
else info[value]=inheritInfo[value];
});
if(lib.translate[i]==undefined) lib.translate[i]=lib.translate[info.inherit];
if(lib.translate[iInfo]==undefined) lib.translate[iInfo]=lib.translate[`${info.inherit}_info`];
doInherit(info.inherit);
}
}
if(info.limited){
if(info.mark===undefined) info.mark=true;