fixes to nightmares

This commit is contained in:
jacob1 2015-10-30 18:01:58 -04:00
parent 2cf3852518
commit e77ad447ef
2 changed files with 7 additions and 5 deletions

View File

@ -798,13 +798,15 @@ class SleepyMode(GameMode):
def setup_nightmares(self, evt, cli, var):
if random.random() < 1/5:
self.having_nightmare = random.choice(var.list_players())
self.having_nightmare = True
with var.WARNING_LOCK:
t = threading.Timer(60, self.do_nightmare, (cli,))
t = threading.Timer(60, self.do_nightmare, (cli, random.choice(var.list_players()))
t.start()
else:
self.having_nightmare = None
def do_nightmare(self, cli):
def do_nightmare(self, cli, target):
self.having_nightmare = target
pm(cli, self.having_nightmare, ("While walking through the woods, you hear the clopping of hooves behind you. Turning around, " +
"you see a large black horse with dark red eyes and flames where its mane and tail would be. " +
"After a brief period of time, it starts chasing after you! You think if you can cross the bridge " +
@ -818,7 +820,7 @@ class SleepyMode(GameMode):
self.correct[i] = random.choice(directions)
self.fake1[i] = random.choice(directions)
self.fake2[i] = random.choice(directions)
self.prev_direction = "s" if correct[0] != "s" else "w"
self.prev_direction = "s" if self.correct[0] != "s" else "w"
self.start_direction = self.prev_direction
self.on_path = set()
self.nightmare_step(cli)

View File

@ -56,7 +56,7 @@ def on_privmsg(cli, rawnick, chan, msg, notice = False):
raise
for x in decorators.COMMANDS:
for x in list(decorators.COMMANDS.keys()):
if chan != parse_nick(rawnick)[0] and not msg.lower().startswith(botconfig.CMD_CHAR):
break # channel message but no prefix; ignore
if msg.lower().startswith(botconfig.CMD_CHAR+x):