mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(stats): heals, repairs and restores count what they applied
Live sent TotalArmorRepaired / TotalImaginationRestored with what a repair or restore applied, 0 included (1,050 and 2,148 zeros in the captures: a power-up picked up at full), and never a TotalDamageHealed or TotalDamageTaken of 0. DLU counted every change of the value instead, so setting stats up (loading, respawning, level changes) counted as healing and a heal at full health counted as 0 damage taken. Now Heal, Repair and Imagine count what they applied; health lost and imagination spent still count wherever they change. Check in game: pick up an armor or imagination power-up when full; the passport's Armor Repaired / Imagination Restored stay the same. Take damage and heal; Damage Taken and Damage Healed go up by what the bar shows. Respawn: Damage Healed doesn't jump. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -585,15 +585,16 @@ std::optional<StatisticID> CharacterComponent::GetPowerUpStatistic(const LOT lot
|
||||
}
|
||||
|
||||
void CharacterComponent::TrackHealthDelta(int32_t health) {
|
||||
// Live sent no TotalDamageHealed or TotalDamageTaken of 0
|
||||
if (health > 0) {
|
||||
UpdatePlayerStatistic(TotalDamageHealed, health);
|
||||
} else {
|
||||
} else if (health < 0) {
|
||||
UpdatePlayerStatistic(TotalDamageTaken, -health);
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterComponent::TrackImaginationDelta(int32_t imagination) {
|
||||
if (imagination > 0) {
|
||||
if (imagination >= 0) {
|
||||
UpdatePlayerStatistic(TotalImaginationRestored, imagination);
|
||||
} else {
|
||||
UpdatePlayerStatistic(TotalImaginationUsed, -imagination);
|
||||
@@ -601,7 +602,7 @@ void CharacterComponent::TrackImaginationDelta(int32_t imagination) {
|
||||
}
|
||||
|
||||
void CharacterComponent::TrackArmorDelta(int32_t armor) {
|
||||
if (armor > 0) {
|
||||
if (armor >= 0) {
|
||||
UpdatePlayerStatistic(TotalArmorRepaired, armor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user