[Economy] House always wins in slots (#2875)

* [Economy] House always wins in slots

 - Expected payout is negative
 - No flat increase payouts, all payouts are multiplicative

* actually do math properly

* UX + Changelog

* How the hell did I mess that up?!
This commit is contained in:
Michael H
2019-08-27 12:38:56 -04:00
committed by GitHub
parent 0c773134f2
commit 68018c924e
2 changed files with 23 additions and 17 deletions

View File

@@ -0,0 +1 @@
Slots now has a 62.5% expected payout and won't inflate economy when spammed.

View File

@@ -38,40 +38,43 @@ class SMReel(Enum):
_ = lambda s: s _ = lambda s: s
PAYOUTS = { PAYOUTS = {
(SMReel.two, SMReel.two, SMReel.six): { (SMReel.two, SMReel.two, SMReel.six): {
"payout": lambda x: x * 2500 + x, "payout": lambda x: x * 50,
"phrase": _("JACKPOT! 226! Your bid has been multiplied * 2500!"), "phrase": _("JACKPOT! 226! Your bid has been multiplied * 50!"),
}, },
(SMReel.flc, SMReel.flc, SMReel.flc): { (SMReel.flc, SMReel.flc, SMReel.flc): {
"payout": lambda x: x + 1000, "payout": lambda x: x * 25,
"phrase": _("4LC! +1000!"), "phrase": _("4LC! Your bid has been multiplied * 25!"),
}, },
(SMReel.cherries, SMReel.cherries, SMReel.cherries): { (SMReel.cherries, SMReel.cherries, SMReel.cherries): {
"payout": lambda x: x + 800, "payout": lambda x: x * 20,
"phrase": _("Three cherries! +800!"), "phrase": _("Three cherries! Your bid has been multiplied * 20!"),
}, },
(SMReel.two, SMReel.six): { (SMReel.two, SMReel.six): {
"payout": lambda x: x * 4 + x, "payout": lambda x: x * 4,
"phrase": _("2 6! Your bid has been multiplied * 4!"), "phrase": _("2 6! Your bid has been multiplied * 4!"),
}, },
(SMReel.cherries, SMReel.cherries): { (SMReel.cherries, SMReel.cherries): {
"payout": lambda x: x * 3 + x, "payout": lambda x: x * 3,
"phrase": _("Two cherries! Your bid has been multiplied * 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": { "2 symbols": {
"payout": lambda x: x * 2 + x, "payout": lambda x: x * 2,
"phrase": _("Two consecutive symbols! Your bid has been multiplied * 2!"), "phrase": _("Two consecutive symbols! Your bid has been multiplied * 2!"),
}, },
} }
SLOT_PAYOUTS_MSG = _( SLOT_PAYOUTS_MSG = _(
"Slot machine payouts:\n" "Slot machine payouts:\n"
"{two.value} {two.value} {six.value} Bet * 2500\n" "{two.value} {two.value} {six.value} Bet * 50\n"
"{flc.value} {flc.value} {flc.value} +1000\n" "{flc.value} {flc.value} {flc.value} Bet * 25\n"
"{cherries.value} {cherries.value} {cherries.value} +800\n" "{cherries.value} {cherries.value} {cherries.value} Bet * 20\n"
"{two.value} {six.value} Bet * 4\n" "{two.value} {six.value} Bet * 4\n"
"{cherries.value} {cherries.value} Bet * 3\n\n" "{cherries.value} {cherries.value} Bet * 3\n\n"
"Three symbols: +500\n" "Three symbols: Bet * 10\n"
"Two symbols: Bet * 2" "Two symbols: Bet * 2"
).format(**SMReel.__dict__) ).format(**SMReel.__dict__)
_ = T_ _ = T_
@@ -485,6 +488,7 @@ class Economy(commands.Cog):
elif has_two: elif has_two:
payout = PAYOUTS["2 symbols"] payout = PAYOUTS["2 symbols"]
pay = 0
if payout: if payout:
then = await bank.get_balance(author) then = await bank.get_balance(author)
pay = payout["payout"](bid) pay = payout["payout"](bid)
@@ -513,15 +517,16 @@ class Economy(commands.Cog):
await channel.send( await channel.send(
( (
"{slot}\n{author.mention} {phrase}\n\n" "{slot}\n{author.mention} {phrase}\n\n"
+ _("Your bid: {amount}") + _("Your bid: {bid}")
+ "\n{old_balance}{new_balance}!" + _("\n{old_balance} - {bid} (Your bid) + {pay} (Winnings){new_balance}!")
).format( ).format(
slot=slot, slot=slot,
author=author, author=author,
phrase=phrase, phrase=phrase,
amount=bid, bid=bid,
old_balance=then, old_balance=then,
new_balance=now, new_balance=now,
pay=pay,
) )
) )