Update index.js
Browse files
index.js
CHANGED
|
@@ -41,25 +41,29 @@ const fruits = [
|
|
| 41 |
const mutationMultiplier = {
|
| 42 |
Dawnbound: 150, Voidtouched: 135, Disco: 125, Meteoric: 125, Galactic: 120,
|
| 43 |
Celestial: 120, Shocked: 100, Alienlike: 100, Sundried: 85, Molten: 25,
|
| 44 |
-
Zombified: 25, Paradisal:
|
| 45 |
Heavenly: 5, HoneyGlazed: 5, Twisted: 5, Burnt: 4, Bloodlit: 4,
|
| 46 |
Verdant: 4, Pollinated: 3, Windstruck: 2, Wet: 2, Chilled: 2,
|
| 47 |
-
Choc: 2, Moonlit: 2
|
| 48 |
}
|
| 49 |
|
| 50 |
const rarityMultiplier = { Normal: 1, Gold: 20, Rainbow: 50 }
|
| 51 |
|
| 52 |
function clamp(v, min, max) { return Math.min(Math.max(v, min), max) }
|
| 53 |
-
|
| 54 |
-
Math.max(1, mutations.reduce((t, m) => t + (mutationMultiplier[m] ?? 1) - 1, 0));
|
| 55 |
function format(n) { return n.toLocaleString("en-US") + "¢" }
|
|
|
|
| 56 |
function calcValue(name, weight, rarity = "Normal", mutations = []) {
|
| 57 |
const item = fruits.find(f => f[0] === name)
|
| 58 |
if (!item) return "0¢"
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
const clamped = clamp(weight / item[1], 0.95, 1e8)
|
| 62 |
-
const
|
|
|
|
| 63 |
return format(value)
|
| 64 |
}
|
| 65 |
|
|
|
|
| 41 |
const mutationMultiplier = {
|
| 42 |
Dawnbound: 150, Voidtouched: 135, Disco: 125, Meteoric: 125, Galactic: 120,
|
| 43 |
Celestial: 120, Shocked: 100, Alienlike: 100, Sundried: 85, Molten: 25,
|
| 44 |
+
Zombified: 25, Paradisal: 100, Frozen: 10, Cooked: 10, Plasma: 5,
|
| 45 |
Heavenly: 5, HoneyGlazed: 5, Twisted: 5, Burnt: 4, Bloodlit: 4,
|
| 46 |
Verdant: 4, Pollinated: 3, Windstruck: 2, Wet: 2, Chilled: 2,
|
| 47 |
+
Choc: 2, Moonlit: 2,
|
| 48 |
}
|
| 49 |
|
| 50 |
const rarityMultiplier = { Normal: 1, Gold: 20, Rainbow: 50 }
|
| 51 |
|
| 52 |
function clamp(v, min, max) { return Math.min(Math.max(v, min), max) }
|
| 53 |
+
|
|
|
|
| 54 |
function format(n) { return n.toLocaleString("en-US") + "¢" }
|
| 55 |
+
|
| 56 |
function calcValue(name, weight, rarity = "Normal", mutations = []) {
|
| 57 |
const item = fruits.find(f => f[0] === name)
|
| 58 |
if (!item) return "0¢"
|
| 59 |
+
let mutationMult = 1
|
| 60 |
+
for (const m of mutations) {
|
| 61 |
+
mutationMult += (mutationMultiplier[m] || 1) - 1
|
| 62 |
+
}
|
| 63 |
+
mutationMult = Math.max(1, mutationMult)
|
| 64 |
const clamped = clamp(weight / item[1], 0.95, 1e8)
|
| 65 |
+
const mult = (rarityMultiplier[rarity] || 1) * mutationMult
|
| 66 |
+
const value = Math.round(item[2] * mult * (clamped * clamped) + 1)
|
| 67 |
return format(value)
|
| 68 |
}
|
| 69 |
|