Clamp rarity redistribution rates at zero #529

Open
opened 2026-09-15 12:26:13 +01:00 by Smithy-bot · 0 comments
Member

Spun out of the non-blocking review note on PR #527.

Why

Rarity chance-up redistribution doubles the active rarity rate and spreads the delta across the other four rarities. For large boosts, that can drive other rarity buckets below zero (already noted in docs/effects.md). Current behaviour is acceptable for merge, but clamping at 0 would make the math safer and avoid negative rates.

Suggested approach

  1. In the rarity redistribution logic (e.g. GetCardsHelper), clamp redistributed rarity rates so no bucket goes below 0.
  2. Decide how leftover delta is handled when clamping would leave remaining probability unaccounted for (renormalise, absorb into the boosted rarity, or another explicit rule).
  3. Add/adjust unit tests for large boosts that previously produced negative buckets.
  4. Update docs/effects.md so the documented edge case matches the new clamping behaviour.

Notes

Spun out of the non-blocking review note on PR #527. ## Why Rarity chance-up redistribution doubles the active rarity rate and spreads the delta across the other four rarities. For large boosts, that can drive other rarity buckets below zero (already noted in `docs/effects.md`). Current behaviour is acceptable for merge, but clamping at 0 would make the math safer and avoid negative rates. ## Suggested approach 1. In the rarity redistribution logic (e.g. `GetCardsHelper`), clamp redistributed rarity rates so no bucket goes below 0. 2. Decide how leftover delta is handled when clamping would leave remaining probability unaccounted for (renormalise, absorb into the boosted rarity, or another explicit rule). 3. Add/adjust unit tests for large boosts that previously produced negative buckets. 4. Update `docs/effects.md` so the documented edge case matches the new clamping behaviour. ## Notes - Source: https://git.vylpes.xyz/External/card-drop/pulls/527#issuecomment-21271
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
External/card-drop#529
No description provided.