[priority: 3] Mana Tide pulse factor incorrect — ranges 0.5x-1.0x instead of 0.5x-1.5x #83

Closed
opened 2026-05-19 09:11:19 +02:00 by Anexim · 2 comments
Owner

Severity: 3 — Medium
File: src/lib/game/effects/dynamic-compute.ts, lines 68-71

Description:

const pulseFactor = 0.5 + 0.5 * Math.sin(Date.now() / 10000);
regen *= (0.5 + pulseFactor * 0.5);

pulseFactor ranges from 0 to 1. Then regen *= (0.5 + pulseFactor * 0.5) means regen is multiplied by 0.5 to 1.0. The comment says "Regen pulses ±50%" which should range from 0.5x to 1.5x. The current formula only pulses -50% to 0%.

Fix: Change to regen *= (1.0 + 0.5 * Math.sin(Date.now() / 10000)) to get 0.5x to 1.5x.

**Severity:** 3 — Medium **File:** `src/lib/game/effects/dynamic-compute.ts`, lines 68-71 **Description:** ```ts const pulseFactor = 0.5 + 0.5 * Math.sin(Date.now() / 10000); regen *= (0.5 + pulseFactor * 0.5); ``` `pulseFactor` ranges from 0 to 1. Then `regen *= (0.5 + pulseFactor * 0.5)` means regen is multiplied by 0.5 to 1.0. The comment says "Regen pulses ±50%" which should range from 0.5x to 1.5x. The current formula only pulses -50% to 0%. **Fix:** Change to `regen *= (1.0 + 0.5 * Math.sin(Date.now() / 10000))` to get 0.5x to 1.5x.
Anexim added the ai:todo label 2026-05-19 09:11:19 +02:00
n8n-gitea was assigned by Anexim 2026-05-19 09:11:19 +02:00
Author
Owner

Starting work on Mana Tide pulse factor fix.

Starting work on Mana Tide pulse factor fix.
Author
Owner

Fixed. Changed regen *= (0.5 + pulseFactor * 0.5) to regen *= (1.0 + 0.5 * Math.sin(Date.now() / 10000)) in src/lib/game/effects/dynamic-compute.ts. Pulse now correctly ranges 0.5x-1.5x. Regression tests added.

✅ Fixed. Changed `regen *= (0.5 + pulseFactor * 0.5)` to `regen *= (1.0 + 0.5 * Math.sin(Date.now() / 10000))` in `src/lib/game/effects/dynamic-compute.ts`. Pulse now correctly ranges 0.5x-1.5x. Regression tests added.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#83