Use bigint instead of number for calculateXP
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user