Jacke -> Zwerg -> Schachtel -> Karte
This commit is contained in:
@@ -24,9 +24,17 @@ class ActionBasics:
|
||||
def clearFehler(self):
|
||||
self.world.fehler = ''
|
||||
|
||||
def wechsleRaum(self,raum):
|
||||
self.world.aktuellerRaum = raum
|
||||
raum.entdeckt = True
|
||||
|
||||
def liegtItemInRaum(self,itemid, raum):
|
||||
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):
|
||||
logging.debug(f'entferne aus aktuellen Raum {item.name}')
|
||||
del self.world.aktuellerRaum.items[item.id]
|
||||
|
@@ -99,6 +99,11 @@ class ActionModul(ActionBasics):
|
||||
self.setFehler('Das Gatter steht offen.')
|
||||
else:
|
||||
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
|
||||
elif item.id == self.world.ITEM_TEICH:
|
||||
fisch = self.world.findItemById(self.world.ITEM_FISCH)
|
||||
|
||||
|
||||
if fisch.raumid == self.world.RAUM_TEICH:
|
||||
fisch.sichtbar = True
|
||||
@@ -276,10 +282,14 @@ class ActionModul(ActionBasics):
|
||||
self.zeigeItemBeschreibung(item)
|
||||
item.sichtbar = False
|
||||
self.ausDemInventar(item)
|
||||
elif self.isItem(item,self.world.ITEM_KARTE):
|
||||
self.world.printKarte()
|
||||
else:
|
||||
self.zeigeItemBeschreibung(item)
|
||||
|
||||
else:
|
||||
person = self.world.findPersonImAktuellenRaum(self.world.PERSON_ZWERG)
|
||||
|
||||
logging.debug('Kein Item gefunden, suche nach Raum')
|
||||
self.untersucheAktuellenRaum(parsedCommand)
|
||||
|
||||
@@ -429,12 +439,12 @@ class ActionModul(ActionBasics):
|
||||
|
||||
|
||||
def sprich(self,parsedCommand):
|
||||
geist = self.world.findPersonImAktuellenRaum(parsedCommand.gegenstand)
|
||||
person = self.world.findPersonImAktuellenRaum(parsedCommand.gegenstand)
|
||||
|
||||
if geist != None:
|
||||
self.world.printText('geist')
|
||||
if person != None:
|
||||
self.world.printText(f'npc-{person.id}')
|
||||
else:
|
||||
self.setFehler(f'{parsedCommand.gegenstand} ist nicht im Raum.')
|
||||
self.setFehler(f'{parsedCommand.gegenstand} ist nicht im Raum.')
|
||||
|
||||
def hilfe(self,parsedCommand):
|
||||
if parsedCommand.gegenstand == 'befehle':
|
||||
@@ -470,10 +480,25 @@ class ActionModul(ActionBasics):
|
||||
else:
|
||||
self.geheNachItem(parsedCommand)
|
||||
|
||||
|
||||
def wechsleRaum(self,raum):
|
||||
self.world.aktuellerRaum = raum
|
||||
raum.entdeckt = True
|
||||
def gib(self, parsedCommand):
|
||||
item = self.world.findItemImInventar(parsedCommand.gegenstand)
|
||||
|
||||
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):
|
||||
logging.debug(f'Richtung {richtung}')
|
||||
raum = self.world.aktuellerRaum
|
||||
|
2
World.py
2
World.py
@@ -375,6 +375,8 @@ class World:
|
||||
self.ITEM_ELEFANT = '22'
|
||||
self.ITEM_HAFEN = '23'
|
||||
self.ITEM_GATTER = '25'
|
||||
self.ITEM_SCHACHTEL = '26'
|
||||
self.ITEM_KARTE = '27'
|
||||
|
||||
# Räume
|
||||
|
||||
|
2
tomb.py
2
tomb.py
@@ -68,6 +68,8 @@ def verarbeiteBefehl(parsedCommand):
|
||||
actionmodul.fuelle(parsedCommand)
|
||||
elif id == '28':
|
||||
actionmodul.wirf(parsedCommand)
|
||||
elif id == '29':
|
||||
actionmodul.gib(parsedCommand)
|
||||
elif id == '-1':
|
||||
world.fehler = 'Ich verstehe diesen Befehl nicht'
|
||||
else:
|
||||
|
@@ -265,6 +265,8 @@
|
||||
<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='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>
|
||||
<personen>
|
||||
|
Reference in New Issue
Block a user