Commit 079661b2 authored by Ralf's avatar Ralf

some small fixes

parent 67a1ab54
......@@ -15,7 +15,7 @@ def describeThings(things):
elif len(things) == 1:
return "there is "+str(things[0])
else:
return "there are "+(", ".join([x.toString() for x in things[:-1]]))+" and "+things[-1].toString()
return "there are "+(", ".join([str(x) for x in things[:-1]]))+" and "+str(things[-1])
class Labyrinth:
......@@ -103,7 +103,7 @@ class Labyrinth:
return reduce(lambda x,y:x+y, self.tiles)
def getFreeTiles (self):
return list(filter(Labyrinth.Field.isWalkable, self.getTiles()))
return list(filter(lambda field: not field.things, self.getTiles()))
def getDescription (self, player):
descr = ""
......@@ -116,6 +116,8 @@ class Labyrinth:
descr += "In the "+direction+", you see a weird kind of void. What could that be? Only time will tell...\n"
elif field.things:
descr += "In the "+direction+", "+describeThings(field.things)+".\n"
if not descr:
descr = "There is absolutely nothing around you.\n"
return descr
def moveThing (self, thing, newField, beforeFinish=None):
......
......@@ -22,7 +22,7 @@ obstinacyTable = [
"By repeatedly hammering against the wall with your full force, you break a hole in it. In that hole, you find the Triforce of Courage.\nlol jk, you ain't get shit.",
"YOU CAN'T GO THROUGH WALLS!",
"You run against the wall, faint and as you wake up, all your inventory is gone! Yes, all of it!",
"Okay, actually you can go through walls if you try really hard. I mean, it's just a game and it would be way too depressing for you, if you couldn't.",
"Okay, actually you can go through walls if you try really hard. I mean, it's just a game and it would be way too depressing for you if you couldn't.",
]
playerUID = 0
......@@ -122,6 +122,7 @@ class Player(Thing):
if self.obstinacy < len(obstinacyTable):
self.send(obstinacyTable[self.obstinacy])
self.obstinacy += 1
return
else: # final message, do it
while target is not None and not target.isWalkable():
target = target.neighbor(dy=dy,dx=dx)
......@@ -165,7 +166,7 @@ class Player(Thing):
elif verb in grabVerbs:
# FIXME we ignore the object...
objs = filter(lambda thing: thing != self, self.field.things)
objs = list(filter(lambda thing: thing != self, self.field.things))
if not len(objs):
self.send("There's nothing here, sorry!")
return
......@@ -173,7 +174,7 @@ class Player(Thing):
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 self.game.players:
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.")
player.send("Someone *else* found the treasure. 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(self.game.labyrinth.getFreeTiles())
self.game.labyrinth.moveThing(objs[0], newField)
else:
......@@ -182,6 +183,7 @@ class Player(Thing):
elif verb == self.game.adminPW:
self.send("Welcome to the vault, my son")
self.game.makeAdmin(self)
self.game.showAdmins()
elif verb in announceVerbs:
if self.game.isAdmin(self):
msg = " ".join(words[1:])
......
Markdown is supported
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