mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Resolved #7008 - Civs get *random* luxury resources near their starting location
This commit is contained in:
parent
ad7397de66
commit
983a9b705e
@ -871,11 +871,9 @@ class MapRegions (val ruleset: Ruleset){
|
|||||||
// Pick a luxury at random. Weight is reduced if the luxury has been picked before
|
// Pick a luxury at random. Weight is reduced if the luxury has been picked before
|
||||||
val modifiedWeights = candidateLuxuries.map {
|
val modifiedWeights = candidateLuxuries.map {
|
||||||
val weightingUnique = it.getMatchingUniques(UniqueType.ResourceWeighting, regionConditional).firstOrNull()
|
val weightingUnique = it.getMatchingUniques(UniqueType.ResourceWeighting, regionConditional).firstOrNull()
|
||||||
if (weightingUnique == null)
|
val relativeWeight = if (weightingUnique == null) 1f else weightingUnique.params[0].toFloat()
|
||||||
1f / (1f + amountRegionsWithLuxury[it.name]!!)
|
relativeWeight / (1f + amountRegionsWithLuxury[it.name]!!)
|
||||||
else
|
}.shuffled()
|
||||||
weightingUnique.params[0].toFloat() / (1f + amountRegionsWithLuxury[it.name]!!)
|
|
||||||
}
|
|
||||||
region.luxury = candidateLuxuries.randomWeighted(modifiedWeights).name
|
region.luxury = candidateLuxuries.randomWeighted(modifiedWeights).name
|
||||||
amountRegionsWithLuxury[region.luxury!!] = amountRegionsWithLuxury[region.luxury]!! + 1
|
amountRegionsWithLuxury[region.luxury!!] = amountRegionsWithLuxury[region.luxury]!! + 1
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user