diff --git a/ActionBasics.py b/ActionBasics.py index 6f81c2c..786e333 100644 --- a/ActionBasics.py +++ b/ActionBasics.py @@ -50,8 +50,8 @@ class ActionBasics: else: beiboot.ausgaenge[self.world.RAUF] = '-1' logging.debug(f'Ausgang RAUF im Beiboot ist {beiboot.ausgaenge[self.world.RAUF]}') - beiboot.ausgaenge[self.world.OST] = -1 - if raum.id == self.world.RAUM_BOOT2: + beiboot.ausgaenge[self.world.OST] = '-1' + if self.world.weg[-1] == self.world.RAUM_BOOT2: beiboot.ausgaenge[self.world.OST] = self.world.RAUM_INSEL diff --git a/ActionModul.py b/ActionModul.py index 2369359..661ed61 100644 --- a/ActionModul.py +++ b/ActionModul.py @@ -477,6 +477,8 @@ class ActionModul(ActionBasics): elif self.isItemAndAktRaum(item, self.world.ITEM_BOOT, self.world.RAUM_HAFEN): boot = self.world.sucheRaum(self.world.RAUM_BOOT) self.wechsleRaum(boot) + elif self.isItemAndAktRaum(item, self.world.ITEM_LOCH, self.world.RAUM_INSEL): + self.runter() elif self.isItem(item,self.world.ITEM_KABINE): logging.debug(f'gehe in Kabine') raumid = self.world.aktuellerRaum.id @@ -525,6 +527,40 @@ class ActionModul(ActionBasics): del self.world.aktuellerRaum.personen[zwerg.id] self.macheItemSichtbar(schachtel) + def toggleFackel(self,item): + weste = self.world.findItemById(self.world.ITEM_FACKEL) + + if item.zustand == item.GELOESCHT: + + item.zustand = item.ENTZUENDED + weste.sichtbar = True + self.setFehler('Die Fackel brennt jetzt.') + else: + item.zustand = item.GELOESCHT + weste.sichtbar = False + self.setFehler('Du löscht die Fackel.') + + + + def entzuende(self,parsedCommand): + item = self.world.findItemImInventar(parsedCommand.gegenstand) + + if item == None: + self.setFehler('Das besitzt du nicht.') + + if self.isItem(item, self.world.ITEM_FACKEL): + self.toggleFackel(item) + + def loesche(self,parsedCommand): + item = self.world.findItemImInventar(parsedCommand.gegenstand) + + if item == None: + self.setFehler('Das besitzt du nicht.') + + if self.isItem(item, self.world.ITEM_FACKEL): + self.toggleFackel(item) + + def geheNach(self,richtung): logging.debug(f'Richtung {richtung}') diff --git a/TestModule.py b/TestModule.py index 6d5fc20..cf627dc 100644 --- a/TestModule.py +++ b/TestModule.py @@ -324,20 +324,37 @@ class TestModule: self.ac.ost() self.schrittzaehler += 1 + def testInsel(self): + self.testHafen() + #Boot + pcmd = self.parseInput('gehe Boot') + self.ac.gehe(pcmd) + self.schrittzaehler += 1 + #Kabine + pcmd = self.parseInput('gehe Kabine') + self.ac.gehe(pcmd) + self.schrittzaehler += 1 + pcmd = self.parseInput('nimm Fackel') + self.ac.nimm(pcmd) + self.schrittzaehler += 1 + #Boot + self.ac.rauf() + self.schrittzaehler += 1 + # vor Insel + self.ac.sued() + self.schrittzaehler += 1 + #Beiboot + pcmd = self.parseInput('gehe Beiboot') + self.ac.gehe(pcmd) + self.schrittzaehler += 1 + # Insel - - - - - - - - - + self.ac.ost() + self.schrittzaehler += 1 diff --git a/World.py b/World.py index 26f694b..cff38b7 100644 --- a/World.py +++ b/World.py @@ -103,13 +103,24 @@ class World: def printRaum(self): raum = self.aktuellerRaum + beschreibung = self.aktuellerRaum.beschreibung + + if self.aktuellerRaum.id == self.RAUM_LOCH: + fackel = self.findItemImInventarById(self.ITEM_FACKEL) + logging.debug(f'fackel={fackel}') + if fackel != None: + textid=f'raum-{self.RAUM_LOCH}-{fackel.zustand}' + beschreibung = self.texte[textid].name + self.clearScreen() if self.fehler != None and self.fehler != '': self.stdscr.addstr(self.fehler,curses.color_pair(1)) + + self.stdscr.addstr(3,0,'aktueller Raum: ' + raum.name,curses.color_pair(3)) - self.stdscr.addstr(4,0,raum.beschreibung) + self.stdscr.addstr(4,0,beschreibung) self.stdscr.addstr(7,0,'Gegenstände: ' + str(raum.labelsGegenstaende()),curses.color_pair(2)) self.stdscr.addstr(8,0,'Inventar: '+ str(self.labelsInventar()), curses.color_pair(2)) self.stdscr.addstr(9,0,'Personen: ' + str(raum.labelsPersonen()),curses.color_pair(2)) @@ -321,6 +332,8 @@ class World: return count, entdeckt + def findPrevRaumId(self): + return self.weg[-1] def debug_Items(self): logging.debug('liste Items') @@ -392,6 +405,8 @@ class World: self.ITEM_BEIBOOT = '32' self.ITEM_DIAMANT = '33' self.ITEM_SOCKEL = '34' + self.ITEM_PALME = '40' + self.ITEM_LOCH = '41' # Räume diff --git a/data/Raum.py b/data/Raum.py index 55e0dfc..a922cf6 100644 --- a/data/Raum.py +++ b/data/Raum.py @@ -81,6 +81,8 @@ class Gegenstand(SuperNode): self.LEER = 0 self.VOLL = 1 self.HAENGEND = 0 + self.GELOESCHT = 0 + self.ENTZUENDED = 1 self.zustand = self.GESCHLOSSEN class Adjektiv(SuperNode): diff --git a/map.txt b/map.txt index 600dfa0..c2fcfa1 100644 --- a/map.txt +++ b/map.txt @@ -34,17 +34,17 @@ | | V - Pfad<--> Pfad Kopf - ^ ^ - | | - | | - V V - Tal<---> Tunnel <--->Hafen<-->Boot Statue<-------------->Mauer - ^ ^ \ ^ ^ - | | Kabine | | - Boot2 | | | - | | / | | - V V / V V + Pfad<--> Pfad Kopf + ^ ^ + | | + | | + V V + Tal<---> Tunnel <--->Hafen<-->Boot Statue<-------------->Mauer + ^ ^ \ ^ ^ + | | Kabine | | + Boot2 | | | + | | / \ | | + V V / \ V V Baum <--> Baumhaus Klippe<-->Strand<--> Wald Grabkammer | | | Boot3 diff --git a/tomb.py b/tomb.py index 51a03b5..de7a95b 100755 --- a/tomb.py +++ b/tomb.py @@ -70,6 +70,10 @@ def verarbeiteBefehl(parsedCommand): actionmodul.wirf(parsedCommand) elif id == '29': actionmodul.gib(parsedCommand) + elif id == '30': + actionmodul.entzuende(parsedCommand) + elif id == '31': + actionmodul.loesche(parsedCommand) elif id == '-1': world.fehler = 'Ich verstehe diesen Befehl nicht' else: @@ -146,6 +150,9 @@ def inputLoop(stdscr): elif debugcommand[1] == 'hafen': testmodul.testHafen() + elif debugcommand[1] == 'insel': + testmodul.testInsel() + world.fehler = '' diff --git a/world.xml b/world.xml index bf8eabd..397b008 100644 --- a/world.xml +++ b/world.xml @@ -178,7 +178,7 @@ - + Du stehst an Deck des Segelboots. Vor dem Bug liegt eine kleine Insel. @@ -189,19 +189,21 @@ - + + + - Du stehst an Deck des Segelboots. Vor dem Bug liegt eine kleine Insel. + Auf der Insel wächst eine einzelne Palme. In Sand hat jemand ein großes Loch gegraben. - Du stehst an Deck des Segelboots. Vor dem Bug liegt eine kleine Insel. + Im Loch. - + Du stehst an Deck des Segelboots. Vor dem Bug liegt eine kleine Insel. @@ -297,6 +299,8 @@ + + @@ -350,12 +354,14 @@ - + + + @@ -439,6 +445,12 @@ Im Tunnel ist es zu dunkel, um etwas zu sehen. Aber du spürst einen leichten Wind, der von Osten durch den Tunnel weht. + + In das Loch dringt kein Sonnenlicht, du siehst gar nichts. + + + Im Licht der Fackel erkennst du, dass das Loch sorgfältig gegraben und mit Schiffsplanken abgestützt wurde. + Der Zwerg klappert vor Kälte mit den Zähnen und kann nicht sprechen.