Enable battalion diversity quest generation (PR 3/3) (#5838)

* Enable battalion diversity quest generation (PR 3/3)

Adds quest creation logic for BattalionDiversityQuest to QuestCreationUtils.

Quest availability:
- Only if province currently has 1-2 battalion types
- This encourages players to diversify their army composition

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Clarify PR dependency structure in quest docs

PR 2 (client) and PR 3 (generation) both depend on PR 1 (types),
but are independent of each other. They can be developed in parallel
and merged in either order after PR 1.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 09:11:03 -08:00
committed by GitHub
co-authored by Claude Opus 4.5
parent ddbc960945
commit df916f9c29
2 changed files with 30 additions and 2 deletions
+8 -1
View File
@@ -12,7 +12,14 @@ When adding new quest types, use a three-PR strategy to ensure clients never see
3. **PR 3 - Quest Generation (Server)**: Add the actual quest creation logic to `QuestCreationUtils.scala`.
This order ensures that when the server starts generating the new quest type, all clients already know how to display it.
**PR Dependencies:**
```
PR 1 (types)
├── PR 2 (client)
└── PR 3 (generation)
```
PR 2 and PR 3 both depend on PR 1, but are independent of each other. They can be developed in parallel after PR 1 is merged, and merged in either order. The key constraint is that PR 3 should not be deployed before PR 2, so clients understand the quest type before the server starts generating it.
## Files to Modify
@@ -32,6 +32,7 @@ import net.eagle0.eagle.model.state.quest.{
AllianceQuest,
AlmsAcrossRealmQuest,
AlmsToProvinceQuest,
BattalionDiversityQuest,
DefeatFactionQuest,
DevelopProvincesQuest,
DismissSpecificVassalQuest,
@@ -130,7 +131,8 @@ object QuestCreationUtils {
QuestCreatorFrom(suppressRiotByForceQuests),
QuestCreatorFrom(fightBeastsAloneQuests),
developProvincesQuests,
mobilizeProvincesQuests
mobilizeProvincesQuests,
battalionDiversityQuests
)
) {
case (questCreator, fr) =>
@@ -770,4 +772,23 @@ object QuestCreationUtils {
}
end if
}
private def battalionDiversityQuests(
province: ProvinceT,
@unused allProvinces: Vector[ProvinceT],
@unused factions: Vector[FactionT],
battalions: Vector[BattalionT],
functionalRandom: FunctionalRandom
): RandomState[Vector[Quest]] = {
// Only available if province currently has 1-2 battalion types
val currentBattalionTypes = province.battalionIds
.flatMap(bid => battalions.find(_.id == bid))
.map(_.typeId)
.distinct
.size
if currentBattalionTypes >= 1 && currentBattalionTypes <= 2 then
RandomState(Vector(BattalionDiversityQuest), functionalRandom)
else RandomState(Vector(), functionalRandom)
}
}