Skip to content

Commit

Permalink
解决武器给的属性和类型,不受地下城强化影响的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
Mapaler committed Aug 27, 2024
1 parent 5cee369 commit efa03db
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 32 deletions.
6 changes: 3 additions & 3 deletions multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -1608,9 +1608,9 @@
<li><label for="dungeon-gacha-id"></label><input id="dungeon-gacha-id" name="dungeon-gacha-id" type="text" /></li>
</ul>
<ul class="stats-list">
<li><label for="dungeon-hp"></label><input id="dungeon-hp" name="dungeon-hp" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" name="dungeon-atk" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-rcv"></label><input id="dungeon-rcv" name="dungeon-rcv" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-hp"></label><input id="dungeon-hp" name="dungeon-hp" type="number" min=0 step=0.001 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" name="dungeon-atk" type="number" min=0 step=0.001 value=1 /></li>
<li><label for="dungeon-rcv"></label><input id="dungeon-rcv" name="dungeon-rcv" type="number" min=0 step=0.001 value=1 /></li>
</ul>
<hr>
<ul class="benefit-list"><!--阴阳加护-->
Expand Down
49 changes: 30 additions & 19 deletions script-universal_function.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,15 +797,6 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) {
];
const memberCurves = [memberCard?.hp, memberCard?.atk, memberCard?.rcv];
const assistCurves = assistCard?.canAssist && [assistCard.hp, assistCard.atk, assistCard.rcv];

const dge = formation.dungeonEnchance;
const dgeRate = [dge.rate.hp, dge.rate.atk, dge.rate.rcv];
const isDge = dge.rarities.includes(memberCard.rarity) || //符合星级
memberCard.attrs.some(attr=>dge.attrs.includes(attr)) || //符合属性
memberCard.types.some(type=>dge.types.includes(type)) || //符合类型
dge?.collabs?.includes(memberCard.collabId) || //符合合作
dge?.gachas?.some(n=>memberCard.gachaIds.includes(n)); //符合抽蛋桶


//储存点亮的觉醒
let awokenList = memberCard.awakenings.slice(0, member.awoken);
Expand All @@ -826,6 +817,25 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) {
enableBouns = memberCard.attrs[0] === assistCard.attrs[0] || memberCard.attrs[0] == 6 || assistCard.attrs[0] == 6;
}

//地下城强化
const dge = formation.dungeonEnchance;
const dgeRate = [dge.rate.hp, dge.rate.atk, dge.rate.rcv];
const isDge = (memberAttrsTypesWithWeapon=>{
const baseBool = dge.rarities.includes(memberCard.rarity) //符合星级
|| dge?.collabs?.includes(memberCard.collabId) //符合合作
||dge?.gachas?.some(n=>memberCard.gachaIds.includes(n)); //符合抽蛋桶
return {
awoken: baseBool //计算武器觉醒
|| memberAttrsTypesWithWeapon.attrs.some(attr=>dge.attrs.includes(attr)) //符合属性
|| memberAttrsTypesWithWeapon.types.some(type=>dge.types.includes(type)) //符合类型
,
noAwoken: baseBool //不计算武器觉醒
|| memberCard.attrs.some(attr=>dge.attrs.includes(attr)) //符合属性
|| memberCard.types.some(type=>dge.types.includes(type)) //符合类型
,
};
})(member.getAttrsTypesWithWeapon(assist));

//地下城阴阳加护强化
if (dge.benefit) { //当存在加护
const benefitAwokens = [128 , 129]; //0b1是阳,0b10是阴,可以两者都强化
Expand Down Expand Up @@ -885,25 +895,26 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) {
return previous + la.scale * latentCount;
}, 0) :
0;
let dgeScale = 1; //地下城强化
if (isDge && dgeRate[idx] !== 1) {
dgeScale = dgeRate[idx];
//计算攻击力,有浮游觉醒,且比例小于1时
if (idx === 1 && dgeScale < 1 && awokenList.includes(106)) {
//比例乘以20,但是不得大于1
dgeScale = Math.min(1, rate * 20);
}


const dgeScale = { //地下城强化比例
awoken: isDge.awoken && dgeRate[idx] !== 1 ? dgeRate[idx] : 1,
noAwoken: isDge.noAwoken && dgeRate[idx] !== 1 ? dgeRate[idx] : 1,
};
if (idx === 1 && dgeScale.awoken < 1 && awokenList.includes(106)) {
//觉醒有浮游,比例乘以20
dgeScale.awoken = Math.min(1, dgeScale.awoken * 20);
}

let reValue = Math.round(n_base * n_previousAwokenScale) + n_plus +
Math.round(n_base * n_latentScale) + n_awoken +
Math.round((n_assist_base + n_assist_plus) * bonusScale[idx]);
//觉醒生效时的协力、1.5三维、阴阳、熟成等的倍率
reValue = Math.floor(reValue * latterAwokenScale[idx].reduce(calculateAwokenScale, 1) * dgeScale);
reValue = Math.floor(reValue * latterAwokenScale[idx].reduce(calculateAwokenScale, 1) * dgeScale.awoken);
//因为语音觉醒觉醒无效也生效,所以这里需要计算
let reValueNoAwoken = Math.round(n_base * n_previousAwokenScale) + n_plus +
Math.round((n_assist_base + n_assist_plus) * bonusScale[idx]);
reValueNoAwoken = Math.floor(reValueNoAwoken * dgeScale)
reValueNoAwoken = Math.floor(reValueNoAwoken * dgeScale.noAwoken)

if (idx < 2) //idx顺序为HP、ATK、RCV
{ //HP和ATK最低为1
Expand Down
8 changes: 4 additions & 4 deletions service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -33499,7 +33499,7 @@ const cachesMap = new Map([
],
[
"multi.html",
"30b245a3cb46e63d025daa1e542a5062"
"ab50928a604685c3c53033df1ca2f8f9"
],
[
"script-custom_elements.js",
Expand All @@ -33515,15 +33515,15 @@ const cachesMap = new Map([
],
[
"script-universal_function.js",
"b174b63d715ff8bc139c484b6e6e49c5"
"d6f10d009ef4d6b6cae7d833ac3a7422"
],
[
"script.js",
"efc4df4ad3c4471c02c20748bec3884a"
],
[
"solo.html",
"f7f862a75c625703ae9cdf609fb4f33d"
"755dbcca9b0bca24d36b8b1f602fd214"
],
[
"style-fix-html2canvas.css",
Expand All @@ -33543,7 +33543,7 @@ const cachesMap = new Map([
],
[
"triple.html",
"65f7c3709167adf5cb0c961535604679"
"374c82a640ba53a6431abe49673802b0"
],
[
"languages/en.css",
Expand Down
6 changes: 3 additions & 3 deletions solo.html
Original file line number Diff line number Diff line change
Expand Up @@ -1424,9 +1424,9 @@
<li><label for="dungeon-gacha-id"></label><input id="dungeon-gacha-id" name="dungeon-gacha-id" type="text" /></li>
</ul>
<ul class="stats-list">
<li><label for="dungeon-hp"></label><input id="dungeon-hp" name="dungeon-hp" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" name="dungeon-atk" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-rcv"></label><input id="dungeon-rcv" name="dungeon-rcv" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-hp"></label><input id="dungeon-hp" name="dungeon-hp" type="number" min=0 step=0.001 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" name="dungeon-atk" type="number" min=0 step=0.001 value=1 /></li>
<li><label for="dungeon-rcv"></label><input id="dungeon-rcv" name="dungeon-rcv" type="number" min=0 step=0.001 value=1 /></li>
</ul>
<hr>
<ul class="benefit-list"><!--阴阳加护-->
Expand Down
6 changes: 3 additions & 3 deletions triple.html
Original file line number Diff line number Diff line change
Expand Up @@ -2269,9 +2269,9 @@
<li><label for="dungeon-gacha-id"></label><input id="dungeon-gacha-id" name="dungeon-gacha-id" type="text" /></li>
</ul>
<ul class="stats-list">
<li><label for="dungeon-hp"></label><input id="dungeon-hp" name="dungeon-hp" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" name="dungeon-atk" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-rcv"></label><input id="dungeon-rcv" name="dungeon-rcv" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-hp"></label><input id="dungeon-hp" name="dungeon-hp" type="number" min=0 step=0.001 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" name="dungeon-atk" type="number" min=0 step=0.001 value=1 /></li>
<li><label for="dungeon-rcv"></label><input id="dungeon-rcv" name="dungeon-rcv" type="number" min=0 step=0.001 value=1 /></li>
</ul>
<hr>
<ul class="benefit-list"><!--阴阳加护-->
Expand Down

0 comments on commit efa03db

Please sign in to comment.