Add treasure boxes (#188)

* Filter out slots from the body. (#181)

* Slots changes (#182)

* Switch slots result to title and fix snappy

* These two guys again

* These two guys again

* Fix breaking-even

* ...??

* Initial commit

* Finalize initial blackjack attempt

* Fix blackjack issue

* Add treasure functionality

* Remove obsolete file

* Add blackjack winnings to user winnings

* Minor changes to treasure functionality

* 25 percent chance of mimic
This commit is contained in:
outruncolors 2022-01-28 22:48:30 -06:00 committed by GitHub
parent fef0dcf0cc
commit 90d1263440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 7 deletions

View file

@ -64,11 +64,9 @@ class Blackjack:
if self.command_word in in_text:
for word in in_text.split():
if self.command_word in word:
try:
wager = word[len(self.command_word):]
wager_value = int(wager)
except: break
wager = word[len(self.command_word):]
wager_value = int(wager)
if (wager_value < self.minimum_bet):
break
elif (wager_value > self.maximum_bet):
@ -158,11 +156,12 @@ class Blackjack:
elif result == 'won':
reward = int(wager) * 2
elif result == 'blackjack':
reward = floor(int(wager) * (3/2))
reward = int(wager) + floor(int(wager) * (3/2))
if (reward > 0):
user = from_comment.author
user.coins += reward
user.winnings += reward - int(wager)
self.db.add(user)
self.db.commit()