Skip to content

Fix loot reward system scale logic in BannerKings - #207

Open
f3bot wants to merge 1 commit into
R-Vaccari:mainfrom
f3bot:patch-1
Open

Fix loot reward system scale logic in BannerKings#207
f3bot wants to merge 1 commit into
R-Vaccari:mainfrom
f3bot:patch-1

Conversation

@f3bot

@f3bot f3bot commented Mar 4, 2025

Copy link
Copy Markdown

Fix loot reward scaling logic in BKBattleRewardModel

Problem:
The loot scaling system incorrectly discarded all items when the loot scale was set to 100%, despite the description stating that 100% should retain all loot. The issue came from the comparator sign, causing loot to be discarded whenever the scale was greater than the random float.

Solution:

In BKBattleRewardModel.GetLootedItemFromTroop, changed the comparator from scale > MBRandom.RandomFloat to scale < MBRandom.RandomFloat.
This ensures that if the random float exceeds the loot scale, items are discarded — meaning 100% scale now retains all loot, and lower scales progressively reduce loot as intended.

Result:

100% scale: All loot is kept (vanilla behavior).
50% scale: Roughly half the loot is retained.
20% scale: Roughly 20% of the loot is retained.

This fix aligns the loot system behavior with the settings menu description and player expectations.

Problem:
The loot scaling system incorrectly discards all items when set to 100%, despite the description stating that 100% reflects vanilla behavior where all loot is retained. The issue lies in the comparator sign, causing the loot scale to always exceed the random float, resulting in no items being looted.

Solution:
    Adjusted the comparator logic so that at 100% scale, all items are looted, aligning with the setting description.
    This change ensures that scaling works intuitively — lower percentages reduce loot, while 100% reliably retains all loot.

Result:
Setting loot scale to 100% now correctly retains all items, and lowering the percentage progressively reduces the loot pool, matching player expectations and the in-game description.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant