Make tutorial_world roots give clearer errors. Allow home/quit from dark room. Resolves #1584.
This commit is contained in:
parent
c153a1d7e4
commit
3b75780b40
2 changed files with 18 additions and 8 deletions
|
|
@ -475,14 +475,14 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["blue"] -= 1
|
root_pos["blue"] -= 1
|
||||||
self.caller.msg("The root with blue flowers gets in the way and is pushed to the left.")
|
self.caller.msg("The root with blue flowers gets in the way and is pushed to the left.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs straight down - you can only move it left or right.")
|
||||||
elif color == "blue":
|
elif color == "blue":
|
||||||
if direction == "left":
|
if direction == "left":
|
||||||
root_pos[color] = max(-1, root_pos[color] - 1)
|
root_pos[color] = max(-1, root_pos[color] - 1)
|
||||||
self.caller.msg("You shift the root with small blue flowers to the left.")
|
self.caller.msg("You shift the root with small blue flowers to the left.")
|
||||||
if root_pos[color] != 0 and root_pos[color] == root_pos["red"]:
|
if root_pos[color] != 0 and root_pos[color] == root_pos["red"]:
|
||||||
root_pos["red"] += 1
|
root_pos["red"] += 1
|
||||||
self.caller.msg("The reddish root is to big to fit as well, so that one falls away to the left.")
|
self.caller.msg("The reddish root is too big to fit as well, so that one falls away to the left.")
|
||||||
elif direction == "right":
|
elif direction == "right":
|
||||||
root_pos[color] = min(1, root_pos[color] + 1)
|
root_pos[color] = min(1, root_pos[color] + 1)
|
||||||
self.caller.msg("You shove the root adorned with small blue flowers to the right.")
|
self.caller.msg("You shove the root adorned with small blue flowers to the right.")
|
||||||
|
|
@ -490,7 +490,7 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["red"] -= 1
|
root_pos["red"] -= 1
|
||||||
self.caller.msg("The thick reddish root gets in the way and is pushed back to the left.")
|
self.caller.msg("The thick reddish root gets in the way and is pushed back to the left.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs straight down - you can only move it left or right.")
|
||||||
|
|
||||||
# now the horizontal roots (yellow/green). They can be moved up/down
|
# now the horizontal roots (yellow/green). They can be moved up/down
|
||||||
elif color == "yellow":
|
elif color == "yellow":
|
||||||
|
|
@ -507,7 +507,7 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["green"] -= 1
|
root_pos["green"] -= 1
|
||||||
self.caller.msg("The weedy green root is shifted upwards to make room.")
|
self.caller.msg("The weedy green root is shifted upwards to make room.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs across the wall - you can only move it up or down.")
|
||||||
elif color == "green":
|
elif color == "green":
|
||||||
if direction == "up":
|
if direction == "up":
|
||||||
root_pos[color] = max(-1, root_pos[color] - 1)
|
root_pos[color] = max(-1, root_pos[color] - 1)
|
||||||
|
|
@ -522,7 +522,7 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["yellow"] -= 1
|
root_pos["yellow"] -= 1
|
||||||
self.caller.msg("The root with yellow flowers gets in the way and is pushed upwards.")
|
self.caller.msg("The root with yellow flowers gets in the way and is pushed upwards.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs across the wall - you can only move it up or down.")
|
||||||
|
|
||||||
# we have moved the root. Store new position
|
# we have moved the root. Store new position
|
||||||
self.obj.db.root_pos = root_pos
|
self.obj.db.root_pos = root_pos
|
||||||
|
|
|
||||||
|
|
@ -747,9 +747,16 @@ class CmdLookDark(Command):
|
||||||
"""
|
"""
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
|
|
||||||
if random.random() < 0.75:
|
# count how many searches we've done
|
||||||
|
nr_searches = caller.ndb.dark_searches
|
||||||
|
if nr_searches is None:
|
||||||
|
nr_searches = 0
|
||||||
|
caller.ndb.dark_searches = nr_searches
|
||||||
|
|
||||||
|
if nr_searches < 4 and random.random() < 0.90:
|
||||||
# we don't find anything
|
# we don't find anything
|
||||||
caller.msg(random.choice(DARK_MESSAGES))
|
caller.msg(random.choice(DARK_MESSAGES))
|
||||||
|
caller.ndb.dark_searches += 1
|
||||||
else:
|
else:
|
||||||
# we could have found something!
|
# we could have found something!
|
||||||
if any(obj for obj in caller.contents if utils.inherits_from(obj, LightSource)):
|
if any(obj for obj in caller.contents if utils.inherits_from(obj, LightSource)):
|
||||||
|
|
@ -791,7 +798,8 @@ class CmdDarkNoMatch(Command):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"""Implements the command."""
|
"""Implements the command."""
|
||||||
self.caller.msg("Until you find some light, there's not much you can do. Try feeling around.")
|
self.caller.msg("Until you find some light, there's not much you can do. "
|
||||||
|
"Try feeling around, maybe you'll find something helpful!")
|
||||||
|
|
||||||
|
|
||||||
class DarkCmdSet(CmdSet):
|
class DarkCmdSet(CmdSet):
|
||||||
|
|
@ -814,7 +822,9 @@ class DarkCmdSet(CmdSet):
|
||||||
self.add(CmdLookDark())
|
self.add(CmdLookDark())
|
||||||
self.add(CmdDarkHelp())
|
self.add(CmdDarkHelp())
|
||||||
self.add(CmdDarkNoMatch())
|
self.add(CmdDarkNoMatch())
|
||||||
self.add(default_cmds.CmdSay)
|
self.add(default_cmds.CmdSay())
|
||||||
|
self.add(default_cmds.CmdQuit())
|
||||||
|
self.add(default_cmds.CmdHome())
|
||||||
|
|
||||||
|
|
||||||
class DarkRoom(TutorialRoom):
|
class DarkRoom(TutorialRoom):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue