mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Resolved #13853 - Force rankings doesn't evaluate all unit conditionals as multiplicative
This commit is contained in:
parent
816425792c
commit
48941fb68e
@ -539,13 +539,18 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
promotions.asSequence()
|
||||
.mapNotNull { ruleset.unitPromotions[it] }
|
||||
.flatMap { it.uniqueObjects }
|
||||
|
||||
// When we have multiple conditional strength bonuses, only the highest one counts
|
||||
// Otherwise we get massive overvaluation of units with many conflicting conditionals
|
||||
var highestConditionalPowerBonus = 1f
|
||||
|
||||
for (unique in allUniques) {
|
||||
when (unique.type) {
|
||||
UniqueType.Strength -> {
|
||||
if (unique.params[0].toInt() <= 0) continue
|
||||
|
||||
if (unique.hasModifier(UniqueType.ConditionalVsUnits)) { // Bonus vs some units - a quarter of the bonus
|
||||
power *= (unique.params[0].toInt() / 4f).toPercent()
|
||||
highestConditionalPowerBonus = (unique.params[0].toInt() / 4f).toPercent()
|
||||
} else if (
|
||||
unique.modifiers.any {
|
||||
it.type == UniqueType.ConditionalVsCity // City Attack - half the bonus
|
||||
@ -554,9 +559,9 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
|| it.type == UniqueType.ConditionalFightingInTiles
|
||||
} // Bonus in terrain or feature - half the bonus
|
||||
) {
|
||||
power *= (unique.params[0].toInt() / 2f).toPercent()
|
||||
highestConditionalPowerBonus = (unique.params[0].toInt() / 2f).toPercent()
|
||||
} else {
|
||||
power *= (unique.params[0].toInt()).toPercent() // Static bonus
|
||||
highestConditionalPowerBonus = (unique.params[0].toInt()).toPercent() // Static bonus
|
||||
}
|
||||
}
|
||||
UniqueType.StrengthNearCapital ->
|
||||
@ -564,15 +569,16 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
power *= (unique.params[0].toInt() / 4f).toPercent() // Bonus decreasing with distance from capital - not worth much most of the map???
|
||||
|
||||
UniqueType.MayParadrop // Paradrop - 25% bonus
|
||||
-> power += power / 4
|
||||
-> power *= 1.25f
|
||||
UniqueType.MayParadropOld // ParadropOld - 25% bonus
|
||||
-> power += power / 4
|
||||
-> power *= 1.25f
|
||||
UniqueType.MustSetUp // Must set up - 20 % penalty
|
||||
-> power -= power / 5
|
||||
-> power /= 1.20f
|
||||
UniqueType.AdditionalAttacks // Extra attacks - 20% bonus per extra attack
|
||||
-> power += (power * unique.params[0].toInt()) / 5
|
||||
-> power *= (unique.params[0].toInt() * 20f).toPercent()
|
||||
else -> {}
|
||||
}
|
||||
power *= highestConditionalPowerBonus
|
||||
}
|
||||
|
||||
return power.toInt()
|
||||
|
Loading…
x
Reference in New Issue
Block a user