master
Aevann1 2022-02-04 17:50:21 +02:00
parent 1e83d32c2c
commit 51a45b5a42
1 changed files with 3 additions and 8 deletions

View File

@ -1,6 +1,5 @@
import random import random
class Treasure: class Treasure:
special_min = 100 special_min = 100
special_max = 1000 special_max = 1000
@ -21,20 +20,16 @@ class Treasure:
amount = random.randint(self.special_min, self.special_max) amount = random.randint(self.special_min, self.special_max)
elif is_standard: elif is_standard:
amount = random.randint(self.standard_min, self.standard_max) amount = random.randint(self.standard_min, self.standard_max)
if random.randint(1, 100) > 75: amount = -amount
# Mimic: 25% chance
if random.randint(1, 100) > 75:
amount = -amount
if amount != 0: if amount != 0:
user = from_comment.author user = from_comment.author
user.coins += amount user.coins += amount
if user.coins < 0: if user.coins < 0: user.coins = 0
user.coins = 0
from_comment.treasure_amount = str(amount) from_comment.treasure_amount = str(amount)
self.db.add(user) self.db.add(user)
self.db.add(from_comment) self.db.add(from_comment)
self.db.commit() self.db.commit()