Fix coin/pony chances

This commit is contained in:
skizzerz 2016-11-20 12:33:39 -06:00
parent e922bb220e
commit 73fb0c65c9
2 changed files with 28 additions and 19 deletions

View File

@ -737,22 +737,19 @@
"consecrate_success": "You have consecrated the body of \u0002{0}\u0002.",
"no_acting_on_succubus": "You may not {0} a succubus.",
"coin_toss": "\u0002{0}\u0002 tosses a coin into the air...",
"coin_choices": [
"heads",
"tails"
],
"coin_special": [
"its side",
"{bot_nick}"
],
"coin_land": "The coin lands on \u0002{0}\u0002.",
"coin_choices": [
"tails",
"heads",
"its side"
],
"pony_toss": "\u0002{0}\u0002 tosses a pony into the air...",
"pony_land": "The pony lands on \u0002{0}\u0002.",
"pony_choices": [
"hoof",
"plot",
"{nick}"
],
"pony_land": "The pony lands on \u0002{0}\u0002.",
"pony_fly": "The pony flies away.",
"cat_toss": "\u0002{0}\u0002 tosses a cat into the air...",
"cat_land": "The cat lands on its \u0002feet\u0002.",

View File

@ -6833,10 +6833,15 @@ def coin(cli, nick, chan, rest):
"""It's a bad idea to base any decisions on this command."""
reply(cli, nick, chan, messages["coin_toss"].format(nick))
coin = random.choice(messages["coin_choices"])
specialty = random.randrange(0,10)
if specialty < 2:
coin = messages["coin_special"][specialty].format(bot_nick=botconfig.NICK)
rnd = random.random()
print(rnd)
# 59/29/12 split, 59+29=88
if rnd < 0.59:
coin = messages["coin_choices"][0]
elif rnd < 0.88:
coin = messages["coin_choices"][1]
else:
coin = messages["coin_choices"][2]
cmsg = messages["coin_land"].format(coin)
reply(cli, nick, chan, cmsg)
@ -6845,11 +6850,18 @@ def pony(cli, nick, chan, rest):
"""Toss a magical pony into the air and see what happens!"""
reply(cli, nick, chan, messages["pony_toss"].format(nick))
if random.random() < 1 / (len(messages["pony_choices"]) + 1):
reply(cli, nick, chan, messages["pony_fly"])
# 59/29/7/5 split
rnd = random.random()
print(rnd)
if rnd < 0.59:
pony = messages["pony_choices"][0]
elif rnd < 0.88:
pony = messages["pony_choices"][1]
elif rnd < 0.95:
pony = messages["pony_choices"][2].format(nick=nick)
else:
pony = random.choice(messages["pony_choices"]).format(nick=nick)
reply(cli, nick, chan, messages["pony_fly"])
return
cmsg = messages["pony_land"].format(pony)
reply(cli, nick, chan, cmsg)