sekai-calculator 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +12 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -445,14 +445,13 @@ class CardPowerCalculator {
|
|
|
445
445
|
if (userFixtureBonuses === undefined || userFixtureBonuses === null || userFixtureBonuses.length === 0) {
|
|
446
446
|
return 0;
|
|
447
447
|
}
|
|
448
|
-
const
|
|
448
|
+
const fixtureBonus = userFixtureBonuses
|
|
449
449
|
.find(it => it.gameCharacterId === characterId);
|
|
450
|
-
if (
|
|
450
|
+
if (fixtureBonus === undefined || fixtureBonus === null) {
|
|
451
451
|
return 0;
|
|
452
452
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
Math.floor(Math.fround(it * Math.fround(fitureBonus.totalBonusRate * Math.fround(0.001)))), 0);
|
|
453
|
+
return Math.floor(Math.fround(CardPowerCalculator.mixBasePower(basePower, canvasBonus) *
|
|
454
|
+
Math.fround(Math.fround(fixtureBonus.totalBonusRate) * Math.fround(0.001))));
|
|
456
455
|
}
|
|
457
456
|
async getGateBonusPower(basePower, canvasBonus, userGateBonuses, cardUnits) {
|
|
458
457
|
const isOnlyPiapro = cardUnits.length === 1 && cardUnits[0] === 'piapro';
|
|
@@ -462,9 +461,14 @@ class CardPowerCalculator {
|
|
|
462
461
|
powerBonusRate = Math.max(powerBonusRate, bonus.powerBonusRate);
|
|
463
462
|
}
|
|
464
463
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
464
|
+
return Math.floor(Math.fround(CardPowerCalculator.mixBasePower(basePower, canvasBonus) *
|
|
465
|
+
Math.fround(Math.fround(powerBonusRate) * Math.fround(0.01))));
|
|
466
|
+
}
|
|
467
|
+
static mixBasePower(basePower, canvasBonus) {
|
|
468
|
+
return CardPowerCalculator.sumPower(basePower) + CardPowerCalculator.sumPower(canvasBonus);
|
|
469
|
+
}
|
|
470
|
+
static sumPower(power) {
|
|
471
|
+
return power.reduce((v, it) => v + it, 0);
|
|
468
472
|
}
|
|
469
473
|
}
|
|
470
474
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -443,14 +443,13 @@ class CardPowerCalculator {
|
|
|
443
443
|
if (userFixtureBonuses === undefined || userFixtureBonuses === null || userFixtureBonuses.length === 0) {
|
|
444
444
|
return 0;
|
|
445
445
|
}
|
|
446
|
-
const
|
|
446
|
+
const fixtureBonus = userFixtureBonuses
|
|
447
447
|
.find(it => it.gameCharacterId === characterId);
|
|
448
|
-
if (
|
|
448
|
+
if (fixtureBonus === undefined || fixtureBonus === null) {
|
|
449
449
|
return 0;
|
|
450
450
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
Math.floor(Math.fround(it * Math.fround(fitureBonus.totalBonusRate * Math.fround(0.001)))), 0);
|
|
451
|
+
return Math.floor(Math.fround(CardPowerCalculator.mixBasePower(basePower, canvasBonus) *
|
|
452
|
+
Math.fround(Math.fround(fixtureBonus.totalBonusRate) * Math.fround(0.001))));
|
|
454
453
|
}
|
|
455
454
|
async getGateBonusPower(basePower, canvasBonus, userGateBonuses, cardUnits) {
|
|
456
455
|
const isOnlyPiapro = cardUnits.length === 1 && cardUnits[0] === 'piapro';
|
|
@@ -460,9 +459,14 @@ class CardPowerCalculator {
|
|
|
460
459
|
powerBonusRate = Math.max(powerBonusRate, bonus.powerBonusRate);
|
|
461
460
|
}
|
|
462
461
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
462
|
+
return Math.floor(Math.fround(CardPowerCalculator.mixBasePower(basePower, canvasBonus) *
|
|
463
|
+
Math.fround(Math.fround(powerBonusRate) * Math.fround(0.01))));
|
|
464
|
+
}
|
|
465
|
+
static mixBasePower(basePower, canvasBonus) {
|
|
466
|
+
return CardPowerCalculator.sumPower(basePower) + CardPowerCalculator.sumPower(canvasBonus);
|
|
467
|
+
}
|
|
468
|
+
static sumPower(power) {
|
|
469
|
+
return power.reduce((v, it) => v + it, 0);
|
|
466
470
|
}
|
|
467
471
|
}
|
|
468
472
|
|