Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Economy] House always wins in slots #2875

Merged
merged 4 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/2875.enhance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Slots now has a 62.5% expected payout and won't inflate economy when spammed.
39 changes: 22 additions & 17 deletions redbot/cogs/economy/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,43 @@ class SMReel(Enum):
_ = lambda s: s
PAYOUTS = {
(SMReel.two, SMReel.two, SMReel.six): {
"payout": lambda x: x * 2500 + x,
"phrase": _("JACKPOT! 226! Your bid has been multiplied * 2500!"),
"payout": lambda x: x * 50,
"phrase": _("JACKPOT! 226! Your bid has been multiplied * 50!"),
},
(SMReel.flc, SMReel.flc, SMReel.flc): {
"payout": lambda x: x + 1000,
"phrase": _("4LC! +1000!"),
"payout": lambda x: x * 25,
"phrase": _("4LC! Your bid has been multiplied * 25!"),
},
(SMReel.cherries, SMReel.cherries, SMReel.cherries): {
"payout": lambda x: x + 800,
"phrase": _("Three cherries! +800!"),
"payout": lambda x: x * 20,
"phrase": _("Three cherries! Your bid has been multiplied * 20!"),
},
(SMReel.two, SMReel.six): {
"payout": lambda x: x * 4 + x,
"payout": lambda x: x * 4,
"phrase": _("2 6! Your bid has been multiplied * 4!"),
},
(SMReel.cherries, SMReel.cherries): {
"payout": lambda x: x * 3 + x,
"payout": lambda x: x * 3,
"phrase": _("Two cherries! Your bid has been multiplied * 3!"),
},
"3 symbols": {"payout": lambda x: x + 500, "phrase": _("Three symbols! +500!")},
"3 symbols": {
"payout": lambda x: x * 10,
"phrase": _("Three symbols! Your bid has been multiplied * 10!"),
},
"2 symbols": {
"payout": lambda x: x * 2 + x,
"payout": lambda x: x * 2,
"phrase": _("Two consecutive symbols! Your bid has been multiplied * 2!"),
},
}

SLOT_PAYOUTS_MSG = _(
"Slot machine payouts:\n"
"{two.value} {two.value} {six.value} Bet * 2500\n"
"{flc.value} {flc.value} {flc.value} +1000\n"
"{cherries.value} {cherries.value} {cherries.value} +800\n"
"{two.value} {two.value} {six.value} Bet * 50\n"
"{flc.value} {flc.value} {flc.value} Bet * 25\n"
"{cherries.value} {cherries.value} {cherries.value} Bet * 20\n"
"{two.value} {six.value} Bet * 4\n"
"{cherries.value} {cherries.value} Bet * 3\n\n"
"Three symbols: +500\n"
"Three symbols: Bet * 10\n"
"Two symbols: Bet * 2"
).format(**SMReel.__dict__)
_ = T_
Expand Down Expand Up @@ -485,6 +488,7 @@ async def slot_machine(author, channel, bid):
elif has_two:
payout = PAYOUTS["2 symbols"]

pay = 0
if payout:
then = await bank.get_balance(author)
pay = payout["payout"](bid)
Expand Down Expand Up @@ -513,15 +517,16 @@ async def slot_machine(author, channel, bid):
await channel.send(
(
"{slot}\n{author.mention} {phrase}\n\n"
+ _("Your bid: {amount}")
+ "\n{old_balance} → {new_balance}!"
+ _("Your bid: {bid}")
+ _("\n{old_balance} - {bid} (Your bid) + {pay} (Winnings) → {new_balance}!")
).format(
slot=slot,
author=author,
phrase=phrase,
amount=bid,
bid=bid,
old_balance=then,
new_balance=now,
pay=pay,
)
)

Expand Down