mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Clarify vigor values in text client (#8640)
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user