emipa606 / CombatReadinessCheck

MIT License
0 stars 0 forks source link

Wealth is not being translated into raid points #3

Closed Cardds closed 1 year ago

Cardds commented 1 year ago

Result of PlayerWealthForStoryteller is not being processed by the wealth curve to be translated into raid points. This results in maximum raid points at ~27000 wealth (post-adjustment). Currently, this behavior causes this mod to have the opposite effect from intended, vastly inflating raid points at low wealth values (though it is amusing to be overwhelmed by a swarm of raiders soon after starting a new game)

Recommend adding the wealth processing curve, PointsPerWealthCurve.Evaluate, to the result of target.PlayerWealthForStoryteller in https://github.com/emipa606/CombatReadinessCheck/blob/main/Source/CRC_Revivified/MarvsStoryTellerUtility.cs#L65, similar to how it applies to caravanArmouryWealth

Examples (same save file before and after change):

Before:

Logs:

CRC: begin output CE is loaded: False Armoury Points(pre-curve) for map Arkenstout: 13655.5 Armoury Points(post-curve) for map Arkenstout: 343.11 Building Points(pre-curve) for map Arkenstout: 93285.84(at 25%) Building Points(post-curve) for map Arkenstout: 466.5182 Adapted Colonist Points for Map-0-PlayerHome: 475.9975(adaptation factor: 0.9) Random factor for Map-0-PlayerHome: 1, Threat scale: 1, Point factor from days passed: 1 Unclamped Points for Map-0-PlayerHome: 391.425

PlayerWealthForStoryteller returns 343.11 + 466.5182 = 809.6282 (processed raid points)

CombatReadinessPoints: num1 = 0 + 809.6282 = 809.6282 num3 = 809.6282 + 475.9975 = 1285.6257 num4 = 1 num5 = 391.425

Now:

Logs:

Adapted Colonist Points for Map-0-PlayerHome: 475.9975(adaptation factor: 0.9) Random factor for Map-0-PlayerHome: 1, Threat scale: 1, Point factor from days passed: 1 Unclamped Points for Map-0-PlayerHome: 7700

PlayerWealthForStoryteller returns 36976.96 (adjusted wealth value)

CombatReadinessPoints: num1 = 0 + 36976.96 = 36976.96 num3 = 36976.96 + 475.9975 = 37,452.9575 num4 = 1 num5 = 7700

Ideal:

PlayerWealthForStoryteller returns 36976.96 (adjusted wealth value)

CombatReadinessPoints: processedWealth = PointsPerWealthCurve.Evaluate(36976.96 / 2) 2 = ~379 2 = 758 num1 = 0 + 758 = 758 num3 = 758+ 475.9975 = 1233.9975 num4 = 1 num5 = ~390

Note: The above ideal state has a division by two, followed by a post-process multiplication by two to mirror the prior two calls to PointsPerWealthCurve which originally occurred in MarvsMapWealthForStoryTeller.Prefix.

emipa606 commented 1 year ago

Do you think you could modify this in the code and do a PR instead? I must admit that this is a bit out of my comfort zone.

Cardds commented 1 year ago

@emipa606 Unfortunately, I can't do a full working PR, as I don't have the infra set up to modify the binaries. However, I can provide the git patch for the relevant files and logic, which can then be applied.

0001-Process-player-wealth-on-raid-point-curve.patch

emipa606 commented 1 year ago

Nice, should be added in 23059ea Thanks!