Weight jokers by rarity in the shop (#152)

* Added weight for the rarity of jokers in the shop

* Includes manual conflict resolution

---------

Co-authored-by: JustinL-12 <jlong30@uic.edu>
Co-authored-by: MeirGavish <meir.gavish@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
JustinL-12
2025-10-27 10:18:48 -07:00
committed by GitHub
parent 5a3e891e43
commit b38433d191
3 changed files with 71 additions and 4 deletions
+24
View File
@@ -332,3 +332,27 @@ Sprite* joker_object_get_sprite(JokerObject* joker_object)
return NULL;
return sprite_object_get_sprite(joker_object->sprite_object);
}
int joker_get_random_rarity()
{
int joker_rarity = 0;
int rarity_roll = random() % 100;
if (rarity_roll < COMMON_JOKER_CHANCE)
{
joker_rarity = COMMON_JOKER;
}
else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE)
{
joker_rarity = UNCOMMON_JOKER;
}
else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE + RARE_JOKER_CHANCE)
{
joker_rarity = RARE_JOKER;
}
else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE + RARE_JOKER_CHANCE + LEGENDARY_JOKER_CHANCE)
{
joker_rarity = LEGENDARY_JOKER;
}
return joker_rarity;
}