sekai-calculator 0.9.2 → 0.9.4

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
@@ -275,15 +275,15 @@ class CardPowerCalculator {
275
275
  for (const areaItem of usedAreaItems) {
276
276
  const allMatch = (areaItem.targetUnit !== 'any' && sameUnit) ||
277
277
  (areaItem.targetCardAttr !== 'any' && sameAttr);
278
- areaItemBonus[0] = Math.fround(areaItemBonus[0] +
279
- Math.fround(Math.fround(allMatch ? areaItem.power1AllMatchBonusRate : areaItem.power1BonusRate) *
280
- Math.fround(0.01) * basePower[0]));
281
- areaItemBonus[1] = Math.fround(areaItemBonus[1] +
282
- Math.fround(Math.fround(allMatch ? areaItem.power2AllMatchBonusRate : areaItem.power2BonusRate) *
283
- Math.fround(0.01) * basePower[1]));
284
- areaItemBonus[2] = Math.fround(areaItemBonus[2] +
285
- Math.fround(Math.fround(allMatch ? areaItem.power3AllMatchBonusRate : areaItem.power3BonusRate) *
286
- Math.fround(0.01) * basePower[2]));
278
+ const rates = [
279
+ allMatch ? areaItem.power1AllMatchBonusRate : areaItem.power1BonusRate,
280
+ allMatch ? areaItem.power2AllMatchBonusRate : areaItem.power2BonusRate,
281
+ allMatch ? areaItem.power3AllMatchBonusRate : areaItem.power3BonusRate
282
+ ];
283
+ rates.forEach((rate, i) => {
284
+ areaItemBonus[i] = Math.fround(areaItemBonus[i] +
285
+ Math.fround(Math.fround(Math.fround(rate) * Math.fround(0.01)) * basePower[i]));
286
+ });
287
287
  }
288
288
  return areaItemBonus.reduce((v, it) => v + Math.floor(it), 0);
289
289
  }
@@ -294,13 +294,13 @@ class CardPowerCalculator {
294
294
  const characterRank = findOrThrow(characterRanks, it => it.characterId === userCharacter.characterId &&
295
295
  it.characterRank === userCharacter.characterRank);
296
296
  const rates = [
297
- Math.fround(characterRank.power1BonusRate),
298
- Math.fround(characterRank.power2BonusRate),
299
- Math.fround(characterRank.power3BonusRate)
297
+ characterRank.power1BonusRate,
298
+ characterRank.power2BonusRate,
299
+ characterRank.power3BonusRate
300
300
  ];
301
301
  return rates
302
302
  .reduce((v, it, i) => v +
303
- Math.floor(Math.fround(Math.fround(it * Math.fround(0.01)) * basePower[i])), 0);
303
+ Math.floor(Math.fround(Math.fround(Math.fround(it) * Math.fround(0.01)) * basePower[i])), 0);
304
304
  }
305
305
  }
306
306
 
package/dist/index.mjs CHANGED
@@ -273,15 +273,15 @@ class CardPowerCalculator {
273
273
  for (const areaItem of usedAreaItems) {
274
274
  const allMatch = (areaItem.targetUnit !== 'any' && sameUnit) ||
275
275
  (areaItem.targetCardAttr !== 'any' && sameAttr);
276
- areaItemBonus[0] = Math.fround(areaItemBonus[0] +
277
- Math.fround(Math.fround(allMatch ? areaItem.power1AllMatchBonusRate : areaItem.power1BonusRate) *
278
- Math.fround(0.01) * basePower[0]));
279
- areaItemBonus[1] = Math.fround(areaItemBonus[1] +
280
- Math.fround(Math.fround(allMatch ? areaItem.power2AllMatchBonusRate : areaItem.power2BonusRate) *
281
- Math.fround(0.01) * basePower[1]));
282
- areaItemBonus[2] = Math.fround(areaItemBonus[2] +
283
- Math.fround(Math.fround(allMatch ? areaItem.power3AllMatchBonusRate : areaItem.power3BonusRate) *
284
- Math.fround(0.01) * basePower[2]));
276
+ const rates = [
277
+ allMatch ? areaItem.power1AllMatchBonusRate : areaItem.power1BonusRate,
278
+ allMatch ? areaItem.power2AllMatchBonusRate : areaItem.power2BonusRate,
279
+ allMatch ? areaItem.power3AllMatchBonusRate : areaItem.power3BonusRate
280
+ ];
281
+ rates.forEach((rate, i) => {
282
+ areaItemBonus[i] = Math.fround(areaItemBonus[i] +
283
+ Math.fround(Math.fround(Math.fround(rate) * Math.fround(0.01)) * basePower[i]));
284
+ });
285
285
  }
286
286
  return areaItemBonus.reduce((v, it) => v + Math.floor(it), 0);
287
287
  }
@@ -292,13 +292,13 @@ class CardPowerCalculator {
292
292
  const characterRank = findOrThrow(characterRanks, it => it.characterId === userCharacter.characterId &&
293
293
  it.characterRank === userCharacter.characterRank);
294
294
  const rates = [
295
- Math.fround(characterRank.power1BonusRate),
296
- Math.fround(characterRank.power2BonusRate),
297
- Math.fround(characterRank.power3BonusRate)
295
+ characterRank.power1BonusRate,
296
+ characterRank.power2BonusRate,
297
+ characterRank.power3BonusRate
298
298
  ];
299
299
  return rates
300
300
  .reduce((v, it, i) => v +
301
- Math.floor(Math.fround(Math.fround(it * Math.fround(0.01)) * basePower[i])), 0);
301
+ Math.floor(Math.fround(Math.fround(Math.fround(it) * Math.fround(0.01)) * basePower[i])), 0);
302
302
  }
303
303
  }
304
304
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sekai-calculator",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
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",