mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 11:34:54 -04:00
Adjust CS military rank tribute points to depend on number of alive players
This commit is contained in:
parent
d532a111a1
commit
d3b8e788a2
@ -463,11 +463,14 @@ class CityStateFunctions(val civInfo: Civilization) {
|
|||||||
if (!requireWholeList && modifiers.values.sum() < -200)
|
if (!requireWholeList && modifiers.values.sum() < -200)
|
||||||
return modifiers
|
return modifiers
|
||||||
|
|
||||||
// highest force gets rank=0
|
// highest force is rank=0
|
||||||
val forceRank = civInfo.gameInfo.getAliveMajorCivs().sortedByDescending { it.getStatForRanking(
|
val forceRank = civInfo.gameInfo.getAliveMajorCivs().sortedByDescending { it.getStatForRanking(
|
||||||
RankingType.Force) }.indexOf(demandingCiv)
|
RankingType.Force) }.indexOf(demandingCiv)
|
||||||
|
// probably not necessary, but just in case, avoid division by zero if there's some edge case where no players are alive
|
||||||
|
val numAlivePlayers = max(civInfo.gameInfo.getAliveMajorCivs().size, 1)
|
||||||
val globalModifier = civInfo.gameInfo.ruleset.modOptions.constants.tributeGlobalModifier
|
val globalModifier = civInfo.gameInfo.ruleset.modOptions.constants.tributeGlobalModifier
|
||||||
modifiers["Military Rank"] = globalModifier * (civInfo.gameInfo.gameParameters.players.size - forceRank) / civInfo.gameInfo.gameParameters.players.size
|
// apparently lowest force gets some pity points
|
||||||
|
modifiers["Military Rank"] = globalModifier * (numAlivePlayers - forceRank) / numAlivePlayers
|
||||||
|
|
||||||
if (!requireWholeList && modifiers.values.sum() < -100)
|
if (!requireWholeList && modifiers.values.sum() < -100)
|
||||||
return modifiers
|
return modifiers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user