You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up from #79 live validation. #79 fixed current power/mana persistence; current health has the same C++ save/load shape but should be handled as its own focused issue.
Context
C++ saves current health and current powers to characters, then on load recalculates stats/max values and restores saved current health/powers clamped to their new maximums. Rust now handles represented current power correctly for #79, but current health still appears to be initialized from max health during login/stat setup and is not clearly persisted from the canonical/session player state on save.
C++ anchors
Player::SaveToDB writes GetHealth() before the class power fields: /home/server/woltk-trinity-legacy/src/server/game/Entities/Player/Player.cpp
Player::LoadFromDB reads fields.health, marks zero health as corpse/dead state, runs stat recalculation, then restores SetHealth(min(savedHealth, GetMaxHealth())): /home/server/woltk-trinity-legacy/src/server/game/Entities/Player/Player.cpp
The same load block restores fields.powers[] into current powers clamped to max; use this as the sibling behavior, not as a substitute for health.
Current Rust gap
Login/stat setup has paths that construct player combat stats with health: max_health.
This means a damaged but alive character can plausibly relog as full health, which is not C++ parity.
Do
Load characters.health as the saved current health field and keep it distinct from power1 and max-health calculations.
After base stats/items/auras recalculate max health, restore current health as min(saved_health, max_health) like C++.
Preserve the C++ zero-health/death-state behavior boundary; do not paper over death/corpse flows by forcing max health.
Save current health from the authoritative canonical/session player state on logout/disconnect/periodic save where Rust already saves represented current powers.
Done means C++-anchored implementation, focused tests, PROTOC=/home/cdmonio/.local/protoc/bin/protoc cargo check/test, and live validation of damaged-player relog behavior against the running server.
Follow-up from #79 live validation. #79 fixed current power/mana persistence; current health has the same C++ save/load shape but should be handled as its own focused issue.
Context
C++ saves current health and current powers to
characters, then on load recalculates stats/max values and restores saved current health/powers clamped to their new maximums. Rust now handles represented current power correctly for #79, but current health still appears to be initialized from max health during login/stat setup and is not clearly persisted from the canonical/session player state on save.C++ anchors
Player::SaveToDBwritesGetHealth()before the class power fields:/home/server/woltk-trinity-legacy/src/server/game/Entities/Player/Player.cppPlayer::LoadFromDBreadsfields.health, marks zero health as corpse/dead state, runs stat recalculation, then restoresSetHealth(min(savedHealth, GetMaxHealth())):/home/server/woltk-trinity-legacy/src/server/game/Entities/Player/Player.cppfields.powers[]into current powers clamped to max; use this as the sibling behavior, not as a substitute for health.Current Rust gap
health: max_health.Do
characters.healthas the saved current health field and keep it distinct frompower1and max-health calculations.min(saved_health, max_health)like C++.Tests
Add focused positive/negative tests for:
power1..power10fields.Related
Done means C++-anchored implementation, focused tests,
PROTOC=/home/cdmonio/.local/protoc/bin/protoc cargo check/test, and live validation of damaged-player relog behavior against the running server.