Use bigint instead of number for calculateXP

This commit is contained in:
2026-02-08 01:11:58 -07:00
parent 45c90fcffb
commit bfe2eae7b2

View File

@@ -1,20 +1,20 @@
export const calculateXP = ( export const calculateXP = (
normalBerries: number, normalBerries: bigint,
poisonBerries: number, poisonBerries: bigint,
slowBerries: number, slowBerries: bigint,
ultraBerries: number, ultraBerries: bigint,
speedyBerries: number, speedyBerries: bigint,
coinBerries: number coinBerries: bigint
): number => { ): bigint => {
let totalXp: number = 0 let totalXp: bigint = 0n
totalXp += normalBerries totalXp += normalBerries
totalXp -= poisonBerries totalXp -= poisonBerries
totalXp -= slowBerries totalXp -= slowBerries
totalXp += ultraBerries * 5 totalXp += ultraBerries * 5n
totalXp += speedyBerries * 10 totalXp += speedyBerries * 10n
totalXp += coinBerries * 10 totalXp += coinBerries * 10n
if (totalXp < 0n) totalXp = 0 if (totalXp < 0n) totalXp = 0n
return totalXp return totalXp
} }