ClanGenOfficial / clangen

Warrior Cats fan game
https://clangen.io
Other
229 stars 398 forks source link

Add constraint priority system #2541

Open j-gynn opened 2 days ago

j-gynn commented 2 days ago

About The Pull Request

Adds a kind of priority system for constraints. The way this works is the following:

  1. The number of types of constraint (and in some cases, the rarity of that particular constraint) are added up for each patrol.
  2. For each tier of rarity, the system runs a flat 1/x chance to only have that pool available.
  3. This check runs in order of rarity, rarest first - so the rarest tier gets a full 1/x, second rarest gets (x-1/x * 1/x) etc.
  4. If none of the rolls pass, then the list returns to the original behaviour of a flat chance across the board
  5. The subgroup is then rolled according to the weights on the JSON.

Why This Is Good For ClanGen

Allowing rarer patrols to show up is always a good thing!

Linked Issues

Closes #2539

Proof of Testing

For now, I need to get some feedback about the weighting as well as finding any bugs, so I'm setting it as a draft PR.

Link to the Discord testing channel

Changelog/Credits