Make badge retry transmutation on failure, instead of eating badges and not doing anything
This commit is contained in:
parent
ac05a26ccd
commit
0c4a565186
5
badge.py
5
badge.py
|
@ -100,6 +100,11 @@ class BadgePopulation:
|
|||
else:
|
||||
out=L
|
||||
possible_out = [badge_name for badge_name in rarities if rarities[badge_name][2]==out]
|
||||
if len(possible_out)==0:
|
||||
# refund and try again
|
||||
for badge in badge_names:
|
||||
self.give_badge(user,badge)
|
||||
return self.transmute(user,*badge_names)
|
||||
return _random.choice(possible_out)
|
||||
def to_json(self):
|
||||
items = [list(x) for x in self.badges.items()]
|
||||
|
|
Loading…
Reference in New Issue