Jacke -> Zwerg -> Schachtel -> Karte
This commit is contained in:
@@ -24,9 +24,17 @@ class ActionBasics:
|
|||||||
def clearFehler(self):
|
def clearFehler(self):
|
||||||
self.world.fehler = ''
|
self.world.fehler = ''
|
||||||
|
|
||||||
|
def wechsleRaum(self,raum):
|
||||||
|
self.world.aktuellerRaum = raum
|
||||||
|
raum.entdeckt = True
|
||||||
|
|
||||||
def liegtItemInRaum(self,itemid, raum):
|
def liegtItemInRaum(self,itemid, raum):
|
||||||
return itemid in raum.items
|
return itemid in raum.items
|
||||||
|
|
||||||
|
def macheItemSichtbar(self, item):
|
||||||
|
logging.debug(f'mache sichtbar {item.name} in Raum {item.raumid}')
|
||||||
|
item.sichtbar = True
|
||||||
|
|
||||||
def moveItemVonRaumNachInventar(self,item):
|
def moveItemVonRaumNachInventar(self,item):
|
||||||
logging.debug(f'entferne aus aktuellen Raum {item.name}')
|
logging.debug(f'entferne aus aktuellen Raum {item.name}')
|
||||||
del self.world.aktuellerRaum.items[item.id]
|
del self.world.aktuellerRaum.items[item.id]
|
||||||
|
@@ -99,6 +99,11 @@ class ActionModul(ActionBasics):
|
|||||||
self.setFehler('Das Gatter steht offen.')
|
self.setFehler('Das Gatter steht offen.')
|
||||||
else:
|
else:
|
||||||
self.setFehler(f'Der Stier steht dir im Weg.')
|
self.setFehler(f'Der Stier steht dir im Weg.')
|
||||||
|
elif item.id == self.world.ITEM_SCHACHTEL:
|
||||||
|
karte = self.world.findItemById(self.world.ITEM_KARTE)
|
||||||
|
logging.debug('Schachtel öffnen')
|
||||||
|
item.zustand = item.OFFEN
|
||||||
|
self.macheItemSichtbar(karte)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -264,6 +269,7 @@ class ActionModul(ActionBasics):
|
|||||||
schluessel.sichtbar = True
|
schluessel.sichtbar = True
|
||||||
elif item.id == self.world.ITEM_TEICH:
|
elif item.id == self.world.ITEM_TEICH:
|
||||||
fisch = self.world.findItemById(self.world.ITEM_FISCH)
|
fisch = self.world.findItemById(self.world.ITEM_FISCH)
|
||||||
|
|
||||||
|
|
||||||
if fisch.raumid == self.world.RAUM_TEICH:
|
if fisch.raumid == self.world.RAUM_TEICH:
|
||||||
fisch.sichtbar = True
|
fisch.sichtbar = True
|
||||||
@@ -276,10 +282,14 @@ class ActionModul(ActionBasics):
|
|||||||
self.zeigeItemBeschreibung(item)
|
self.zeigeItemBeschreibung(item)
|
||||||
item.sichtbar = False
|
item.sichtbar = False
|
||||||
self.ausDemInventar(item)
|
self.ausDemInventar(item)
|
||||||
|
elif self.isItem(item,self.world.ITEM_KARTE):
|
||||||
|
self.world.printKarte()
|
||||||
else:
|
else:
|
||||||
self.zeigeItemBeschreibung(item)
|
self.zeigeItemBeschreibung(item)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
person = self.world.findPersonImAktuellenRaum(self.world.PERSON_ZWERG)
|
||||||
|
|
||||||
logging.debug('Kein Item gefunden, suche nach Raum')
|
logging.debug('Kein Item gefunden, suche nach Raum')
|
||||||
self.untersucheAktuellenRaum(parsedCommand)
|
self.untersucheAktuellenRaum(parsedCommand)
|
||||||
|
|
||||||
@@ -429,12 +439,12 @@ class ActionModul(ActionBasics):
|
|||||||
|
|
||||||
|
|
||||||
def sprich(self,parsedCommand):
|
def sprich(self,parsedCommand):
|
||||||
geist = self.world.findPersonImAktuellenRaum(parsedCommand.gegenstand)
|
person = self.world.findPersonImAktuellenRaum(parsedCommand.gegenstand)
|
||||||
|
|
||||||
if geist != None:
|
if person != None:
|
||||||
self.world.printText('geist')
|
self.world.printText(f'npc-{person.id}')
|
||||||
else:
|
else:
|
||||||
self.setFehler(f'{parsedCommand.gegenstand} ist nicht im Raum.')
|
self.setFehler(f'{parsedCommand.gegenstand} ist nicht im Raum.')
|
||||||
|
|
||||||
def hilfe(self,parsedCommand):
|
def hilfe(self,parsedCommand):
|
||||||
if parsedCommand.gegenstand == 'befehle':
|
if parsedCommand.gegenstand == 'befehle':
|
||||||
@@ -470,10 +480,25 @@ class ActionModul(ActionBasics):
|
|||||||
else:
|
else:
|
||||||
self.geheNachItem(parsedCommand)
|
self.geheNachItem(parsedCommand)
|
||||||
|
|
||||||
|
def gib(self, parsedCommand):
|
||||||
def wechsleRaum(self,raum):
|
item = self.world.findItemImInventar(parsedCommand.gegenstand)
|
||||||
self.world.aktuellerRaum = raum
|
|
||||||
raum.entdeckt = True
|
if item == None:
|
||||||
|
self.setFehler('Das besitzt du nicht')
|
||||||
|
return
|
||||||
|
|
||||||
|
if item.id == self.world.ITEM_JACKE:
|
||||||
|
zwerg = self.world.findPersonImAktuellenRaumById(self.world.PERSON_ZWERG)
|
||||||
|
|
||||||
|
logging.debug(f'gib() Zwerg {zwerg}')
|
||||||
|
|
||||||
|
if zwerg != None:
|
||||||
|
schachtel = self.world.findItemById(self.world.ITEM_SCHACHTEL)
|
||||||
|
self.setFehler('Der Zwerg zieht sich die Jacke an, grinst erleichtert und verschwindet.')
|
||||||
|
del self.world.aktuellerRaum.personen[zwerg.id]
|
||||||
|
self.macheItemSichtbar(schachtel)
|
||||||
|
|
||||||
|
|
||||||
def geheNach(self,richtung):
|
def geheNach(self,richtung):
|
||||||
logging.debug(f'Richtung {richtung}')
|
logging.debug(f'Richtung {richtung}')
|
||||||
raum = self.world.aktuellerRaum
|
raum = self.world.aktuellerRaum
|
||||||
|
2
World.py
2
World.py
@@ -375,6 +375,8 @@ class World:
|
|||||||
self.ITEM_ELEFANT = '22'
|
self.ITEM_ELEFANT = '22'
|
||||||
self.ITEM_HAFEN = '23'
|
self.ITEM_HAFEN = '23'
|
||||||
self.ITEM_GATTER = '25'
|
self.ITEM_GATTER = '25'
|
||||||
|
self.ITEM_SCHACHTEL = '26'
|
||||||
|
self.ITEM_KARTE = '27'
|
||||||
|
|
||||||
# Räume
|
# Räume
|
||||||
|
|
||||||
|
2
tomb.py
2
tomb.py
@@ -68,6 +68,8 @@ def verarbeiteBefehl(parsedCommand):
|
|||||||
actionmodul.fuelle(parsedCommand)
|
actionmodul.fuelle(parsedCommand)
|
||||||
elif id == '28':
|
elif id == '28':
|
||||||
actionmodul.wirf(parsedCommand)
|
actionmodul.wirf(parsedCommand)
|
||||||
|
elif id == '29':
|
||||||
|
actionmodul.gib(parsedCommand)
|
||||||
elif id == '-1':
|
elif id == '-1':
|
||||||
world.fehler = 'Ich verstehe diesen Befehl nicht'
|
world.fehler = 'Ich verstehe diesen Befehl nicht'
|
||||||
else:
|
else:
|
||||||
|
@@ -265,6 +265,8 @@
|
|||||||
<item name='Hafen' id='23' display='' raum='21' imobil='true' adjektiv = '0' msgid='10' visible='true' />
|
<item name='Hafen' id='23' display='' raum='21' imobil='true' adjektiv = '0' msgid='10' visible='true' />
|
||||||
<item name='Segelschiff' id='24' display='' raum='22' imobil='true' adjektiv = '0' msgid='10' visible='true' />
|
<item name='Segelschiff' id='24' display='' raum='22' imobil='true' adjektiv = '0' msgid='10' visible='true' />
|
||||||
<item name='Gatter' id='25' display='' raum='13' imobil='true' adjektiv = '0' msgid='11' visible='true' />
|
<item name='Gatter' id='25' display='' raum='13' imobil='true' adjektiv = '0' msgid='11' visible='true' />
|
||||||
|
<item name='Schachtel' id='26' display='' raum='24' imobil='false' adjektiv = '0' msgid='11' visible='false' />
|
||||||
|
<item name='Karte' id='27' display='' raum='24' imobil='false' adjektiv = '0' msgid='11' visible='false' />
|
||||||
|
|
||||||
</items>
|
</items>
|
||||||
<personen>
|
<personen>
|
||||||
|
Reference in New Issue
Block a user