mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Delay ready hero tutorial guidance (#8683)
This commit is contained in:
@@ -71,7 +71,14 @@ object StrategicTutorialDialogueSelector {
|
||||
TutorialDialogueContent.expansion(marekId)
|
||||
),
|
||||
readyToJoinProvince(after)
|
||||
.filter(_ => tarnVanished || readyToJoinProvince(startingState).isEmpty)
|
||||
.filter(_ =>
|
||||
wasEmittedBeforeRound(
|
||||
startingState,
|
||||
TutorialDialogueContent.postBattleAlmsDialogueId,
|
||||
after.currentRoundId
|
||||
) &&
|
||||
!hasEmitted(startingState, TutorialDialogueContent.readyToJoinDialogueId)
|
||||
)
|
||||
.map(province => TutorialDialogueContent.readyToJoin(marekId, province.id)),
|
||||
Option.when(!isInTown(startingState) && isInTown(after))(
|
||||
TutorialDialogueContent.inTown(marekId)
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ object TutorialDialogueContent {
|
||||
val postBattleAftermathDialogueId: String = "post_battle_aftermath"
|
||||
val postBattleRebuildDialogueId: String = "post_battle_rebuild"
|
||||
val postBattleAlmsDialogueId: String = "post_battle_alms"
|
||||
val readyToJoinDialogueId: String = "tutorial_ready_to_join"
|
||||
val heroDepartedDialogueId: String = "tutorial_hero_departed"
|
||||
val heroDepartedAgainDialogueId: String = "tutorial_hero_departed_again"
|
||||
val attackPrepareOrganizeDialogueId = "tutorial_attack_prepare_organize"
|
||||
@@ -233,7 +234,7 @@ object TutorialDialogueContent {
|
||||
)
|
||||
|
||||
def readyToJoin(marekId: Int, provinceId: Int): TutorialDialogue = TutorialDialogue(
|
||||
id = "tutorial_ready_to_join",
|
||||
id = readyToJoinDialogueId,
|
||||
steps = Vector(
|
||||
step(
|
||||
marekId,
|
||||
|
||||
+53
-10
@@ -343,22 +343,65 @@ class StrategicTutorialDialogueSelectorTest extends AnyFlatSpec with Matchers {
|
||||
val stable = state(onmaa = stableOnmaa)
|
||||
selectedIds(october, stable, ActionResultType.HeroStatGained) should contain("tutorial_expansion")
|
||||
|
||||
val readyHero = UnaffiliatedHeroC(
|
||||
val inTown = state(onmaa = stableOnmaa.copy(rulerIsVisitingTown = true))
|
||||
selectedIds(stable, inTown, ActionResultType.HeroStatGained) should contain("tutorial_in_town")
|
||||
}
|
||||
|
||||
it should "offer ready-to-join guidance only after the month of Elena's Alms guidance" in {
|
||||
val readyHero = UnaffiliatedHeroC(
|
||||
heroId = 200,
|
||||
unaffiliatedHeroType = UnaffiliatedHeroType.Traveler,
|
||||
recruitmentInfo = RecruitmentInfo.WouldJoin
|
||||
)
|
||||
val readyOnmaa = stableOnmaa.copy(unaffiliatedHeroes = Vector(readyHero))
|
||||
val ready = state(onmaa = readyOnmaa)
|
||||
selectedIds(stable, ready, ActionResultType.HeroStatGained) should contain("tutorial_ready_to_join")
|
||||
selectedDialogues(stable, ready, ActionResultType.HeroStatGained)
|
||||
.find(_.id == "tutorial_ready_to_join")
|
||||
.map(_.steps.head.textReplacements) shouldBe Some(
|
||||
Vector(TutorialTextReplacement("{provinceName}", TutorialTextReplacementValue.ProvinceName(OnmaaId)))
|
||||
val readyOnmaa = ProvinceC(
|
||||
id = OnmaaId,
|
||||
rulingFactionId = Some(PlayerFactionId),
|
||||
support = 20,
|
||||
unaffiliatedHeroes = Vector(readyHero)
|
||||
)
|
||||
val beforeElena = state(currentRoundId = 4, onmaa = readyOnmaa)
|
||||
selectedIds(beforeElena, beforeElena, ActionResultType.HeroStatGained) should not contain
|
||||
TutorialDialogueContent.readyToJoinDialogueId
|
||||
|
||||
val elenasMonth = state(
|
||||
currentRoundId = 4,
|
||||
onmaa = readyOnmaa,
|
||||
emittedTutorialDialogueRounds = Map(TutorialDialogueContent.postBattleAlmsDialogueId -> 4)
|
||||
)
|
||||
selectedIds(elenasMonth, elenasMonth, ActionResultType.HeroStatGained) should not contain
|
||||
TutorialDialogueContent.readyToJoinDialogueId
|
||||
|
||||
val nextMonth = state(
|
||||
currentRoundId = 5,
|
||||
onmaa = readyOnmaa,
|
||||
emittedTutorialDialogueRounds = Map(TutorialDialogueContent.postBattleAlmsDialogueId -> 4)
|
||||
)
|
||||
val dialogue = selectedDialogues(elenasMonth, nextMonth, ActionResultType.NewRoundAction)
|
||||
.find(_.id == TutorialDialogueContent.readyToJoinDialogueId)
|
||||
.getOrElse(fail("Ready-to-join guidance was not emitted"))
|
||||
dialogue.steps.head.textReplacements shouldBe Vector(
|
||||
TutorialTextReplacement("{provinceName}", TutorialTextReplacementValue.ProvinceName(OnmaaId))
|
||||
)
|
||||
|
||||
val inTown = state(onmaa = readyOnmaa.copy(rulerIsVisitingTown = true))
|
||||
selectedIds(ready, inTown, ActionResultType.HeroStatGained) should contain("tutorial_in_town")
|
||||
val laterMonth = state(
|
||||
currentRoundId = 6,
|
||||
onmaa = readyOnmaa,
|
||||
emittedTutorialDialogueRounds = Map(TutorialDialogueContent.postBattleAlmsDialogueId -> 4)
|
||||
)
|
||||
selectedIds(laterMonth, laterMonth, ActionResultType.HeroStatGained) should contain(
|
||||
TutorialDialogueContent.readyToJoinDialogueId
|
||||
)
|
||||
|
||||
val alreadyEmitted = state(
|
||||
currentRoundId = 6,
|
||||
onmaa = readyOnmaa,
|
||||
emittedTutorialDialogueRounds = Map(
|
||||
TutorialDialogueContent.postBattleAlmsDialogueId -> 4,
|
||||
TutorialDialogueContent.readyToJoinDialogueId -> 5
|
||||
)
|
||||
)
|
||||
selectedIds(alreadyEmitted, alreadyEmitted, ActionResultType.HeroStatGained) should not contain
|
||||
TutorialDialogueContent.readyToJoinDialogueId
|
||||
}
|
||||
|
||||
it should "attach tax guidance only to a new-year result that increases player resources" in {
|
||||
|
||||
Reference in New Issue
Block a user