uto: bis zur Klippe.

This commit is contained in:
Olli Graf
2022-06-11 14:08:42 +02:00
parent 3b848ffb80
commit 0ff17aac13
7 changed files with 48 additions and 6 deletions

View File

@@ -415,9 +415,10 @@ class ActionModul(ActionBasics):
def nimm(self,parsedCommand): def nimm(self,parsedCommand):
logging.debug(f'start nimm() {parsedCommand.gegenstand}')
item = self.world.findItemInAktuellerRaum(parsedCommand.gegenstand) item = self.world.findItemInAktuellerRaum(parsedCommand.gegenstand)
logging.debug(f'nimm(): item == {item}') logging.debug(f'nimm(): item == {item.name}')
if item != None: if item != None:
if item.imobil: if item.imobil:
text = self.world.msg[item.pickupmsg] text = self.world.msg[item.pickupmsg]
@@ -459,9 +460,10 @@ class ActionModul(ActionBasics):
def spring(self,parsedCommand): def spring(self,parsedCommand):
if self.isRaum(self.world.RAUM_KLIPPE): if self.isAktuellerRaum(self.world.RAUM_KLIPPE):
weste = self.world.findItemImInventarById(self.world.ITEM_SCHWIMMWESTE) weste = self.world.findItemImInventarById(self.world.ITEM_SCHWIMMWESTE)
logging.debug(f'weste={weste.zustand}')
if weste != None and weste.zustand == weste.ANGEZOGEN: if weste != None and weste.zustand == weste.ANGEZOGEN:
imwasser = self.world.findRaumById(self.world.RAUM_WASSER) imwasser = self.world.findRaumById(self.world.RAUM_WASSER)
@@ -565,11 +567,14 @@ class ActionModul(ActionBasics):
def entzuende(self,parsedCommand): def entzuende(self,parsedCommand):
logging.debug(f'entzünde {parsedCommand.gegenstand}')
item = self.world.findItemImInventar(parsedCommand.gegenstand) item = self.world.findItemImInventar(parsedCommand.gegenstand)
if item == None: if item == None:
self.setFehler('Das besitzt du nicht.') self.setFehler('Das besitzt du nicht.')
return
logging.debug(f'item={item}')
if self.isItem(item, self.world.ITEM_FACKEL): if self.isItem(item, self.world.ITEM_FACKEL):
self.toggleFackel(item) self.toggleFackel(item)

View File

@@ -44,7 +44,6 @@ class TestModule:
self.ac.untersuche(pcmd) self.ac.untersuche(pcmd)
self.schrittzaehler += 1 self.schrittzaehler += 1
self.debug(f'Ausgänge: {self.world.aktuellerRaum.ausgaenge}')
# In den Keller # In den Keller
self.ac.runter() self.ac.runter()
self.schrittzaehler += 1 self.schrittzaehler += 1
@@ -147,8 +146,6 @@ class TestModule:
self.testTeich() self.testTeich()
logging.debug('===== Beginn Testmodul Stier =====') logging.debug('===== Beginn Testmodul Stier =====')
pcmd = self.parseInput('nimm Fisch')
self.ac.nimm(pcmd)
# zum Bach # zum Bach
self.ac.west() self.ac.west()
@@ -358,3 +355,36 @@ class TestModule:
self.ac.ost() self.ac.ost()
self.schrittzaehler += 1 self.schrittzaehler += 1
def testKlippe(self):
self.testInsel()
logging.debug('===== Beginn Testmodul Klippe =====')
pcmd = self.parseInput('entzünde Fackel')
self.ac.entzuende(pcmd)
self.schrittzaehler += 1
#Loch
self.ac.runter()
self.schrittzaehler += 1
pcmd = self.parseInput('nimm Schwimmweste')
self.ac.nimm(pcmd)
self.schrittzaehler += 1
# Insel
self.ac.rauf()
self.schrittzaehler += 1
# return
#Beiboot
self.ac.ost()
self.schrittzaehler += 1
#Boot
self.ac.rauf()
self.schrittzaehler += 1
#klippe
self.ac.nord()
self.schrittzaehler += 1

View File

@@ -169,6 +169,7 @@ class World:
return raum return raum
return None return None
def sucheRaumName(self,name): def sucheRaumName(self,name):
if name == None: if name == None:
return self.aktuellerRaum return self.aktuellerRaum
@@ -214,6 +215,7 @@ class World:
logging.debug(f'item.raumid={item.raumid}') logging.debug(f'item.raumid={item.raumid}')
logging.debug(f'findItemInAktuellerRaum() {itemname} - {item.name}') logging.debug(f'findItemInAktuellerRaum() {itemname} - {item.name}')
if item.raumid == raum.id and item.name.lower() == itemname.lower(): if item.raumid == raum.id and item.name.lower() == itemname.lower():
logging.debug(f'return {item.name}')
return item return item
logging.debug(f'Item {itemname} nicht im aktuellen Raum gefunden') logging.debug(f'Item {itemname} nicht im aktuellen Raum gefunden')

Binary file not shown.

View File

@@ -74,6 +74,8 @@ def verarbeiteBefehl(parsedCommand):
actionmodul.entzuende(parsedCommand) actionmodul.entzuende(parsedCommand)
elif id == '31': elif id == '31':
actionmodul.loesche(parsedCommand) actionmodul.loesche(parsedCommand)
elif id == '32':
actionmodul.spring(parsedCommand)
elif id == '-1': elif id == '-1':
world.fehler = 'Ich verstehe diesen Befehl nicht' world.fehler = 'Ich verstehe diesen Befehl nicht'
else: else:
@@ -152,6 +154,8 @@ def inputLoop(stdscr):
testmodul.testHafen() testmodul.testHafen()
elif debugcommand[1] == 'insel': elif debugcommand[1] == 'insel':
testmodul.testInsel() testmodul.testInsel()
elif debugcommand[1] == 'klippe':
testmodul.testKlippe()
world.fehler = '' world.fehler = ''

View File

@@ -301,6 +301,7 @@
<command name='gib' id='39' key='29' /> <command name='gib' id='39' key='29' />
<command name='entzünde' id='40' key='30' /> <command name='entzünde' id='40' key='30' />
<command name='lösche' id='41' key='31' /> <command name='lösche' id='41' key='31' />
<command name='spring' id='42' key='32' />
</commandset> </commandset>