Clarify vigor values in text client (#8640)

This commit is contained in:
2026-07-16 08:45:58 -07:00
committed by GitHub
parent 08f7e4ebfc
commit 4abdefd40d
2 changed files with 23 additions and 3 deletions
@@ -1758,8 +1758,14 @@ final class ClientState {
val hostility = unit.hostilityStatus.toString
val hero = unit.attachedHero.map { attachedHero =>
val id = attachedHero.eagleHeroId.map(_.toString).getOrElse("-")
val vigor = attachedHero.stats
.map(stats => s" vigor=${decimal(stats.vigor)}/${decimal(stats.startingVigor)}")
val vigor = attachedHero.stats.map { stats =>
val recoveryCeiling = Option
.when(stats.startingVigor > 0)(
s" battle-start-recovery-ceiling=${decimal(stats.startingVigor)}"
)
.getOrElse("")
s" current-vigor=${decimal(stats.vigor)}$recoveryCeiling"
}
.getOrElse("")
val profession = attachedHero.professionInfo.map(info => s" profession=${info.profession}").getOrElse("")
val magic = attachedHero.professionInfo
@@ -731,6 +731,18 @@ class ClientStateTest extends AnyFlatSpec with Matchers {
vigorLow = Some(true),
hasMovedInZoc = true,
foodRemaining = Some(8.25)
),
UnitView(
unitId = 13,
playerId = 2,
location = Some(Coords(row = 6, column = 6)),
hostilityStatus = Hostility.ENEMY_HOSTILITY,
attachedHero = Some(
ShardokHeroView(
eagleHeroId = Some(101),
stats = Some(ShardokHeroView.Stats(vigor = 95.9, startingVigor = 0.0))
)
)
)
),
changedTileModifiers = Vector(
@@ -778,7 +790,9 @@ class ClientStateTest extends AnyFlatSpec with Matchers {
val output = state.describeShardokUnits(rawJson = false)
output should include("gameStatus=GAME_RUNNING round=4 currentPlayer=1 weather=THUNDERSTORM")
output should include("vigor=42.5/100.0")
output should include("current-vigor=42.5 battle-start-recovery-ceiling=100.0")
output should include("current-vigor=95.9")
output should not include "battle-start-recovery-ceiling=0.0"
output should include("morale=31.5")
output should include(
"flags=fortified,low-morale,low-vigor,stunned:2,volleys:1,moved-in-zoc,food:8.3,charge-eligible"