mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Avoid resting in safe shallow provinces (#8694)
This commit is contained in:
+1
-1
@@ -563,7 +563,7 @@ object CommandChoiceHelpers {
|
||||
val readyHeroCount = heroes.count(_.vigor >= DefenseReadyVigorForRest)
|
||||
val allHeroesTired = tiredHeroCount == heroes.size
|
||||
(readyHeroCount < FrontierReadyHeroesBeforeRest && tiredHeroCount >= 2) || allHeroesTired
|
||||
} else heroes.exists(_.vigor < ShallowProvinceRestVigor)
|
||||
} else false
|
||||
}
|
||||
end if
|
||||
}
|
||||
|
||||
+21
-7
@@ -1079,20 +1079,17 @@ class CommandChoiceHelpersTest extends AnyFlatSpec with Matchers with BeforeAndA
|
||||
.newValue shouldBe empty
|
||||
}
|
||||
|
||||
it should "rest a shallow province when a hero is below the recovery threshold" in {
|
||||
val chosen = CommandChoiceHelpers
|
||||
it should "not rest a safe shallow province even when both heroes are tired" in {
|
||||
CommandChoiceHelpers
|
||||
.chosenUniversalCommand(
|
||||
actingFactionId = 6,
|
||||
gameState = universalRestGameState(
|
||||
heroes = Vector(restedHero(1, vigor = 59), restedHero(2, vigor = 80))
|
||||
heroes = Vector(restedHero(1, vigor = 40), restedHero(2, vigor = 40))
|
||||
),
|
||||
availableCommands = Vector(RestAvailable(actingProvinceId = 1)),
|
||||
functionalRandom = functionalRandom
|
||||
)
|
||||
.newValue
|
||||
.get
|
||||
|
||||
chosen.selected shouldBe RestSelected
|
||||
.newValue shouldBe empty
|
||||
}
|
||||
|
||||
it should "not rest a shallow province at the recovery threshold" in {
|
||||
@@ -1108,6 +1105,23 @@ class CommandChoiceHelpersTest extends AnyFlatSpec with Matchers with BeforeAndA
|
||||
.newValue shouldBe empty
|
||||
}
|
||||
|
||||
it should "rest a hostile-border shallow province when defense readiness is at risk" in {
|
||||
val chosen = CommandChoiceHelpers
|
||||
.chosenUniversalCommand(
|
||||
actingFactionId = 6,
|
||||
gameState = universalRestGameState(
|
||||
heroes = Vector(restedHero(1, vigor = 40), restedHero(2, vigor = 40)),
|
||||
hasHostileNeighbor = true
|
||||
),
|
||||
availableCommands = Vector(RestAvailable(actingProvinceId = 1)),
|
||||
functionalRandom = functionalRandom
|
||||
)
|
||||
.newValue
|
||||
.get
|
||||
|
||||
chosen.selected shouldBe RestSelected
|
||||
}
|
||||
|
||||
it should "not rest three mildly fatigued heroes in a safe province" in {
|
||||
CommandChoiceHelpers
|
||||
.chosenUniversalCommand(
|
||||
|
||||
Reference in New Issue
Block a user