From f4e2a8230cdd748aac9134a2fbcb3bdbc3ea3e02 Mon Sep 17 00:00:00 2001 From: kuangshen04 <2832899707@qq.com> Date: Wed, 27 Sep 2023 17:04:20 +0800 Subject: [PATCH] =?UTF-8?q?inheit=E6=9B=B4=E6=94=B9=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=B5=8C=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/game/game.js b/game/game.js index 45260d21a..90392580d 100644 --- a/game/game.js +++ b/game/game.js @@ -39830,14 +39830,25 @@ }); } if(info.inherit){ - const skill=lib.skill[info.inherit]; - if(skill) Object.keys(skill).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]; - }); - 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`]; + 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]=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;