Files
SurvivorCore/docs
Samuel LisonandClaude Opus 4.8 619052a790 feat(stats): dynamic per-player stat effects (adjust + rate modifiers)
The base ratePerSecond is a constant drift per stat — fine for hunger creeping
up, but it can't express event-driven, per-player behaviour: poison ticking
until cured, bleeding until clotted, sprint draining energy until you stop.
(That's why Poison/Blood ship at rate 0 and Energy is display-only.)

Adds a server-side modifier layer on top of the baseline, surfaced on
SurvivorCore.Stats once start() has run:

  - adjust(player, name, delta)       one-time signed delta, clamped to 0..max
  - addModifier(player, name, spec)   named rate modifier {ratePerSecond, source, duration?}
  - removeModifier(player, name, src) remove by source key
  - getValue(player, name)            read current value

The tick now applies base + Σ(active modifiers) per player; timed modifiers
expire on their own; a leaver's modifiers are dropped (no leak). Same-source
re-add replaces (no implicit stacking). Server-only / authoritative.

Verified: gate green (stylua/selene/luau-lsp/build); algorithm exercised in
Studio (adjust→clamp, poison modifier ticks up, cure stops it, timed expiry,
negative bleed). Foundation for sprint/jump energy + poison/bleed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 18:18:25 +10:00
..