mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:55:41 +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 hostility = unit.hostilityStatus.toString
|
||||||
val hero = unit.attachedHero.map { attachedHero =>
|
val hero = unit.attachedHero.map { attachedHero =>
|
||||||
val id = attachedHero.eagleHeroId.map(_.toString).getOrElse("-")
|
val id = attachedHero.eagleHeroId.map(_.toString).getOrElse("-")
|
||||||
val vigor = attachedHero.stats
|
val vigor = attachedHero.stats.map { stats =>
|
||||||
.map(stats => s" vigor=${decimal(stats.vigor)}/${decimal(stats.startingVigor)}")
|
val recoveryCeiling = Option
|
||||||
|
.when(stats.startingVigor > 0)(
|
||||||
|
s" battle-start-recovery-ceiling=${decimal(stats.startingVigor)}"
|
||||||
|
)
|
||||||
|
.getOrElse("")
|
||||||
|
s" current-vigor=${decimal(stats.vigor)}$recoveryCeiling"
|
||||||
|
}
|
||||||
.getOrElse("")
|
.getOrElse("")
|
||||||
val profession = attachedHero.professionInfo.map(info => s" profession=${info.profession}").getOrElse("")
|
val profession = attachedHero.professionInfo.map(info => s" profession=${info.profession}").getOrElse("")
|
||||||
val magic = attachedHero.professionInfo
|
val magic = attachedHero.professionInfo
|
||||||
|
|||||||
@@ -731,6 +731,18 @@ class ClientStateTest extends AnyFlatSpec with Matchers {
|
|||||||
vigorLow = Some(true),
|
vigorLow = Some(true),
|
||||||
hasMovedInZoc = true,
|
hasMovedInZoc = true,
|
||||||
foodRemaining = Some(8.25)
|
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(
|
changedTileModifiers = Vector(
|
||||||
@@ -778,7 +790,9 @@ class ClientStateTest extends AnyFlatSpec with Matchers {
|
|||||||
|
|
||||||
val output = state.describeShardokUnits(rawJson = false)
|
val output = state.describeShardokUnits(rawJson = false)
|
||||||
output should include("gameStatus=GAME_RUNNING round=4 currentPlayer=1 weather=THUNDERSTORM")
|
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("morale=31.5")
|
||||||
output should include(
|
output should include(
|
||||||
"flags=fortified,low-morale,low-vigor,stunned:2,volleys:1,moved-in-zoc,food:8.3,charge-eligible"
|
"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