Merge 01fde6c4a46c84d13ac28ae59b007810e0a11342 into d51ef24c205b6b05330b3c4d7ce79c402db44447

This commit is contained in:
Rob Loach 2025-09-18 13:09:14 +00:00 committed by GitHub
commit 66ec1a6caa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 22 deletions

View File

@ -115,7 +115,7 @@ class Milestone(val uniqueDescription: String, private val parentVictory: Victor
* Gets the percentage progress of one civilization's countable against another's countable. * Gets the percentage progress of one civilization's countable against another's countable.
* *
* @return The progress percentage (0-100). When the result is >100, it qualifies as "more than". * @return The progress percentage (0-100). When the result is >100, it qualifies as "more than".
* @see getMoreCountableThanOtherCivRelevent() * @see getMoreCountableThanOtherCivRelevant()
*/ */
@Readonly @Readonly
fun getMoreCountableThanOtherCivPercent(civ: Civilization, otherCiv: Civilization): Float { fun getMoreCountableThanOtherCivPercent(civ: Civilization, otherCiv: Civilization): Float {
@ -134,7 +134,7 @@ class Milestone(val uniqueDescription: String, private val parentVictory: Victor
* @see getMoreCountableThanOtherCivPercent() * @see getMoreCountableThanOtherCivPercent()
*/ */
@Readonly @Readonly
fun getMoreCountableThanOtherCivRelevent(civ: Civilization, otherCiv: Civilization): Boolean = fun getMoreCountableThanOtherCivRelevant(civ: Civilization, otherCiv: Civilization): Boolean =
civ != otherCiv && otherCiv.isMajorCiv() && otherCiv.isAlive() civ != otherCiv && otherCiv.isMajorCiv() && otherCiv.isAlive()
@Readonly @Readonly
@ -151,11 +151,10 @@ class Milestone(val uniqueDescription: String, private val parentVictory: Victor
originalMajorCapitalsOwned(civInfo) == civsWithPotentialCapitalsToOwn(civInfo.gameInfo).size originalMajorCapitalsOwned(civInfo) == civsWithPotentialCapitalsToOwn(civInfo.gameInfo).size
MilestoneType.CompletePolicyBranches -> MilestoneType.CompletePolicyBranches ->
civInfo.policies.completedBranches.size >= params[0].toInt() civInfo.policies.completedBranches.size >= params[0].toInt()
MilestoneType.MoreCountableThanEachPlayer -> MilestoneType.MoreCountableThanEachPlayer -> {
civInfo.gameInfo.civilizations.filter { val relevantCivs = civInfo.gameInfo.civilizations.filter { getMoreCountableThanOtherCivRelevant(civInfo, it) }
getMoreCountableThanOtherCivRelevent(civInfo, it) && relevantCivs.isNotEmpty() && relevantCivs.all { getMoreCountableThanOtherCivPercent(civInfo, it) > 100f }
getMoreCountableThanOtherCivPercent(civInfo, it) > 100f }
}.isNotEmpty()
MilestoneType.BuildingBuiltGlobally -> civInfo.gameInfo.getCities().any { MilestoneType.BuildingBuiltGlobally -> civInfo.gameInfo.getCities().any {
it.cityConstructions.isBuilt(params[0]) it.cityConstructions.isBuilt(params[0])
} }
@ -218,12 +217,9 @@ class Milestone(val uniqueDescription: String, private val parentVictory: Victor
"{$uniqueDescription} (${amountDone.tr()}/${amountToDo.tr()})" "{$uniqueDescription} (${amountDone.tr()}/${amountToDo.tr()})"
} }
MilestoneType.MoreCountableThanEachPlayer -> { MilestoneType.MoreCountableThanEachPlayer -> {
var amountToDo = 0; var amountDone = 0; val relevantCivs = civInfo.gameInfo.civilizations.filter { getMoreCountableThanOtherCivRelevant(civInfo, it) }
for (otherCiv in civInfo.gameInfo.civilizations) { val amountToDo = relevantCivs.size
if (!getMoreCountableThanOtherCivRelevent(civInfo, otherCiv)) continue val amountDone = relevantCivs.count { getMoreCountableThanOtherCivPercent(civInfo, it) > 100f }
amountToDo++
if (getMoreCountableThanOtherCivPercent(civInfo, otherCiv) > 100f) amountDone++
}
if (civInfo.shouldHideCivCount()) if (civInfo.shouldHideCivCount())
"{$uniqueDescription} (${amountDone.tr()}/?)" "{$uniqueDescription} (${amountDone.tr()}/?)"
else else
@ -337,7 +333,7 @@ class Milestone(val uniqueDescription: String, private val parentVictory: Victor
MilestoneType.MoreCountableThanEachPlayer -> { MilestoneType.MoreCountableThanEachPlayer -> {
val hideCivCount = civInfo.shouldHideCivCount() val hideCivCount = civInfo.shouldHideCivCount()
for (otherCiv in civInfo.gameInfo.civilizations) { for (otherCiv in civInfo.gameInfo.civilizations) {
if (!getMoreCountableThanOtherCivRelevent(civInfo, otherCiv)) continue if (!getMoreCountableThanOtherCivRelevant(civInfo, otherCiv)) continue
if (hideCivCount && !civInfo.knows(otherCiv)) continue if (hideCivCount && !civInfo.knows(otherCiv)) continue
val civName = if (civInfo.knows(otherCiv)) otherCiv.civName else Constants.unknownNationName val civName = if (civInfo.knows(otherCiv)) otherCiv.civName else Constants.unknownNationName
val percent = getMoreCountableThanOtherCivPercent(civInfo, otherCiv) val percent = getMoreCountableThanOtherCivPercent(civInfo, otherCiv)

View File

@ -246,14 +246,9 @@ class VictoryScreenIllustrations(
civ.policies.completedBranches.size civ.policies.completedBranches.size
} }
MilestoneType.MoreCountableThanEachPlayer -> { MilestoneType.MoreCountableThanEachPlayer -> {
var amountDone = 0; var amountToDo = 0; val relevantCivs = civ.gameInfo.civilizations.filter { milestone.getMoreCountableThanOtherCivRelevant(civ, it) }
for (otherCiv in civ.gameInfo.civilizations) { total += if (selectedCiv.shouldHideCivCount()) game.gameParameters.maxNumberOfPlayers - 1 else relevantCivs.size
if (!milestone.getMoreCountableThanOtherCivRelevent(civ, otherCiv)) continue relevantCivs.count { milestone.getMoreCountableThanOtherCivPercent(civ, it) > 100f }
amountToDo++
if (milestone.getMoreCountableThanOtherCivPercent(civ, otherCiv) > 100f) amountDone++
}
total += if (selectedCiv.shouldHideCivCount()) game.gameParameters.maxNumberOfPlayers - 1 else amountToDo
amountDone
} }
MilestoneType.WorldReligion -> { MilestoneType.WorldReligion -> {
total += game.civilizations.count { it.isMajorCiv() && it.isAlive() } total += game.civilizations.count { it.isMajorCiv() && it.isAlive() }