From 0a0ffcbc5f974bf81c79697c9396497c254670a4 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Sat, 14 May 2022 10:16:06 +0200 Subject: [PATCH] gehe funktioniert wieder. hilfe Kommando. --- ActionModul.py | 17 ++++++++++++----- TestModule.py | 4 ++++ World.py | 1 + tomb.py | 2 ++ world.xml | 11 ++++++++--- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ActionModul.py b/ActionModul.py index ba9cde7..1753ff0 100644 --- a/ActionModul.py +++ b/ActionModul.py @@ -87,7 +87,8 @@ class ActionModul: if self.isAktuellerRaum(self.world.RAUM_BACH): baueBruecke() self.setFehler('Du legst die Planke über den Bach und es ensteht eine Brücke über den Bach') - + else: + self.setFehler('Das macht hier keinen Sinn.') def baueBruecke(self): @@ -102,7 +103,7 @@ class ActionModul: if item != None: del self.world.inventar[item.id] - if self.world.aktuellerRaum.id == self.world.RAUM_BACH: + if self.isAktuellerRaum(self.world.RAUM_BACH): if item.id == self.world.ITEM_PLANKE: baueBruecke() self.setFehler('Du legst die Planke über den Bach und es ensteht eine Brücke über den Bach') @@ -136,7 +137,7 @@ class ActionModul: logging.debug(f'raumId {raum.id}') logging.debug(f'untersucheAktuellenRaum() {parsedCommand.gegenstand} in {self.world.aktuellerRaum.id}') - if raum.id == self.world.aktuellerRaum.id: + if self.isAktuellerRaum(raum.id): logging.debug(f'untersuche aktuellen Raum {raum.name}') @@ -205,7 +206,7 @@ class ActionModul: logging.debug(f'klettere(): Leiter is {leiter}') if leiter != None: - if(self.world.aktuellerRaum.id == self.world.RAUM_ESSZIMMER): + if self.isAktuellerRaum(self.world.RAUM_ESSZIMMER): logging.debug(f'aktuellerRaum ist {self.world.aktuellerRaum.id}') self.rauf() else: @@ -237,7 +238,7 @@ class ActionModul: self.insInventar(item) logging.debug(f'nimm: RaumId== {self.world.aktuellerRaum.id}') - if self.world.aktuellerRaum.id == self.world.RAUM_BACH: + if self.isAktuellerRaum(self.world.RAUM_BACH): logging.debug(f'nimm: ItemId == {item.id}') if item.id == self.world.ITEM_PLANKE: logging.debug('nehme Planke am Bach') @@ -248,6 +249,9 @@ class ActionModul: self.setFehler("diesen Gegenstand sehe ich hier nicht.") + def hilfe(self): + self.world.printText('hilfe') + def gehe(self,parsedCommand): richtung = parsedCommand.gegenstand.lower() logging.debug("gehe nach " + richtung) @@ -260,6 +264,9 @@ class ActionModul: self.west() if richtung == 'ost': self.ost() + if richtung == 'rauf': + self.rauf() + def geheNach(self,richtung): logging.debug(f'geheNach() Richtung {richtung}') diff --git a/TestModule.py b/TestModule.py index 24924c5..b151d14 100644 --- a/TestModule.py +++ b/TestModule.py @@ -57,6 +57,10 @@ class TestModule: #In den Flur self.ac.ost() + pcmd = self.world.parseInput('untersuche Pflanze') + self.ac.untersuche(pcmd) + pcmd = self.world.parseInput('nimm Krug') + self.ac.nimm(pcmd) diff --git a/World.py b/World.py index a871c94..f630242 100644 --- a/World.py +++ b/World.py @@ -151,6 +151,7 @@ class World: def ermittleBefehlId(self,befehl): for id in self.befehle: name = self.befehle[id].name + logging.debug(f'ermittleBefehlId(): {befehl} - {name}') if name == befehl: return id return None diff --git a/tomb.py b/tomb.py index 108bade..b6675c2 100755 --- a/tomb.py +++ b/tomb.py @@ -54,6 +54,8 @@ def verarbeiteBefehl(parsedCommand): actionmodul.klettere(parsedCommand) elif id == '22': actionmodul.fange(parsedCommand) + elif id == '23': + actionmodul.hilfe() elif id == '-1': world.fehler = 'Ich verstehe diesen Befehl nicht' else: diff --git a/world.xml b/world.xml index e30f32e..819eae4 100644 --- a/world.xml +++ b/world.xml @@ -71,7 +71,7 @@ - + @@ -82,7 +82,6 @@ - @@ -97,7 +96,7 @@ - + @@ -117,6 +116,7 @@ + @@ -176,5 +176,10 @@ Das Tor besteht aus schmideeisernen Stäben, die geschmiedete Querträger halten. Das Tor ist an den Seiten in Führungsschienen eingelassen. Auf der rechten Seite befindet sich etwa in der Mitte ein Schloss. Hinter dem Tor scheint ein Treppenhaus zu sein. + + Das Grab des Azteken ist ein klassisches Textadventure. + Du bedienst es durch Befehle wie "nimm Schwert" oder "gehe Süd". Die Eingabe ist so flexibel wie möglich gestaltet, so dass + auch ganze Sätze wie "nimm das Schwert" verstanden werden. +