Commit 576e15ac authored by Constantin's avatar Constantin
Browse files

Merge branch 'master' of

parents 26b196bc 66e4ec86
from util import *
from thing import Thing
import treasure
from labyrinth import directions as directionOffsets
from labyrinth import directions_inv as directions_t
import random
goVerbs = ['go', 'walk', 'run', 'stroll']
sayVerbs = ['say', 'talk', 'scream', 'whisper']
......@@ -120,7 +122,7 @@ class Player(Thing):
if self.obstinacy < len(obstinacyTable):
self.obstinacy += 1
if self.obstinacy == len(obstinacyTable): # final message, do it
else: # final message, do it
while target is not None and not target.isWalkable():
target = target.neighbor(dy=dy,dx=dx)
if target is None:
......@@ -130,6 +132,8 @@ class Player(Thing):
# not return
# move around
self.obstinacy = 0
playerToPush = None
for thing in target.things:
if thing != self and isinstance(thing, Player):
......@@ -159,6 +163,22 @@ class Player(Thing):
desc =
self.send(desc, end="")
elif verb in grabVerbs:
# FIXME we ignore the object...
objs = filter(lambda thing: thing != self, self.field.things)
if not len(objs):
self.send("There's nothing here, sorry!")
if isinstance(objs[0], treasure.Treasure):
self.send("Finally - after a long journey - you are close enough to the treasure to reach for it. What a moment! But what's that? The treasure fades to transparent. You try to grab it, but it's too late. Quantum effects seem to be really weird in this place. All you are left with is a note, saying \"I found the treasure in the Haxogreen maze, and didn't even get a lousy T-Shirt\".")
for player in
if player == self: continue
player.send("Someone *else* found the trasure. Why have you been so slow? But do not despair, by the law of preservation of treasures, there has to be a new treasure somewhere.")
newField = random.choice([0], newField)
self.send("Congratulations! This cannot happen.")
elif verb ==
self.send("Welcome to the vault, my son")
......@@ -2,4 +2,7 @@ import thing
class Treasure(Thing):
def __str__(self):
return "the treasure"
\ No newline at end of file
return "the treasure"
def __repr__(self):
return "T"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment