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 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 fitureBonus = userFixtureBonuses
448
+ const fixtureBonus = userFixtureBonuses
449
449
  .find(it => it.gameCharacterId === characterId);
450
- if (fitureBonus === undefined || fitureBonus === null) {
450
+ if (fixtureBonus === undefined || fixtureBonus === null) {
451
451
  return 0;
452
452
  }
453
- const powers = [...basePower, ...canvasBonus];
454
- return powers.reduce((v, it) => v +
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
- const powers = [...basePower, ...canvasBonus];
466
- return powers.reduce((v, it) => v +
467
- Math.floor(Math.fround(it * Math.fround(Math.fround(powerBonusRate) * Math.fround(0.01)))), 0);
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
@@ -339,6 +339,8 @@ declare class CardPowerCalculator {
339
339
  private getCharacterBonusPower;
340
340
  private getFixtureBonusPower;
341
341
  private getGateBonusPower;
342
+ private static mixBasePower;
343
+ private static sumPower;
342
344
  }
343
345
 
344
346
  declare class CardSkillCalculator {
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 fitureBonus = userFixtureBonuses
446
+ const fixtureBonus = userFixtureBonuses
447
447
  .find(it => it.gameCharacterId === characterId);
448
- if (fitureBonus === undefined || fitureBonus === null) {
448
+ if (fixtureBonus === undefined || fixtureBonus === null) {
449
449
  return 0;
450
450
  }
451
- const powers = [...basePower, ...canvasBonus];
452
- return powers.reduce((v, it) => v +
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
- const powers = [...basePower, ...canvasBonus];
464
- return powers.reduce((v, it) => v +
465
- Math.floor(Math.fround(it * Math.fround(Math.fround(powerBonusRate) * Math.fround(0.01)))), 0);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sekai-calculator",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "Project SEKAI Calculator for deck power, live score, event point and more.",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",