Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDinko Galetic <dgaletic@everflame.(none)>2010-06-13 15:51:07 (GMT)
committer Dinko Galetic <dgaletic@everflame.(none)>2010-06-13 15:51:07 (GMT)
commit37fdb92019e01a27856b5e528aff7bb45228db49 (patch)
tree44843778ef730fccc193b0fdd6815005be9925a3
parent3eb7e3326672960866b157ccf648766c0ff1aa06 (diff)
Exits are no longer hardcoded in the game.
-rw-r--r--library/pippy/scholar/scholar.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/library/pippy/scholar/scholar.py b/library/pippy/scholar/scholar.py
index 13d6245..514f66e 100644
--- a/library/pippy/scholar/scholar.py
+++ b/library/pippy/scholar/scholar.py
@@ -62,6 +62,26 @@ class Room(GameObject):
return True
else:
return False
+ @property
+ def description(self):
+ msg = self._description + "\n"
+
+ n_exits = len(self.exits)
+ if n_exits == 0:
+ msg += "There are no visible exits."
+ else:
+ if n_exits == 1:
+ msg += "There is 1 exit: "
+ else:
+ msg += "There are " + str(n_exits) + " exits: "
+ for exit in self.exits.keys():
+ msg += exit.name + ", "
+ msg = msg.rstrip(", ")
+ msg += "."
+ return msg
+ @description.setter
+ def description(self, value):
+ self._description = value
#### functions
@@ -83,11 +103,10 @@ def create_some_rooms():
starting = Room()
balcony = Room()
- # TODO: exits shouldn't be hardcoded in room descriptions!
- starting.description = "Though rather small, this room looks quite cozy, mostly due to an inviting bed. There is a desk by the north wall, with a painting hung low on the wall so that one can easily glance at it while working at the desk. The door and windows keep most of the noise out. There is an exit to the west."
+ starting.description = "Though rather small, this room looks quite cozy, mostly due to an inviting bed. There is a desk by the north wall, with a painting hung low on the wall so that one can easily glance at it while working at the desk. The door and windows keep most of the noise out."
starting.contains = [starting_painting, starting_bed]
starting.add_exit(West, balcony)
- balcony.description = "This is a balcony overlooking the large waterfalls over which this mansion was built. Enormous amounts of water spill over it each second and fall hundreds of meters before hitting the ground. It is no wonder many artists choose this particular room when staying here. There is an exit to the east."
+ balcony.description = "This is a balcony overlooking the large waterfalls over which this mansion was built. Enormous amounts of water spill over it each second and fall hundreds of meters before hitting the ground. It is no wonder many artists choose this particular room when staying here."
return [starting, balcony]
def opposite_exit(side):