Summing of effects that should not reach 100%/1.0 values with diminishing returns formula #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation: there are several effects that on reaching 100%/1.0 or above value are leading to incorrect behavior.
What actually done:
MagicEffectType.AddPhysicalResistancePercentage,
MagicEffectType.AddBluntResistancePercentage,
MagicEffectType.AddSlashingResistancePercentage,
MagicEffectType.AddPiercingResistancePercentage,
MagicEffectType.AddChoppingResistancePercentage,
MagicEffectType.AddFireResistancePercentage,
MagicEffectType.AddFrostResistancePercentage,
MagicEffectType.AddLightningResistancePercentage,
MagicEffectType.AddPoisonResistancePercentage,
MagicEffectType.AddSpiritResistancePercentage,
MagicEffectType.AddElementalResistancePercentage,
MagicEffectType.AvoidDamageTaken,
MagicEffectType.AvoidDamageTakenLowHealth,
MagicEffectType.ModifyAttackStaminaUse,
MagicEffectType.ModifyBlockStaminaUse,
MagicEffectType.ModifyJumpStaminaUse,
MagicEffectType.ModifySprintStaminaUse,
MagicEffectType.Slow
the formula of their summing from different items changed. Each item value is capped at 0.9, then values are ordered from the max one to min one. Max is taken as sum, remaining ones applied as sum = sum + (1.0 - sum) * effect. For example, two effects with values 0.9 and 0.9 will sum not as 1.8 but as 0.9 + 0.1 * 0.9 = 0.99. Other example: effects with values 0.1 and 0.1 will sum not as 0.2 but as 0.1 + 0.9 * 0.1 = 0.19.
Backward compatibility: affects all users, theoretically can change the experience of the users using custom items or effects achieving elemental immunity etc. However, for the ones using default values in configuration files (that are in general very low in comparison with threshold of 0.9), changes are minor.