Update game.py
Monster added, hitpoints added, Princess added
This commit is contained in:
parent
961fd7b347
commit
c895254fb6
107
game.py
107
game.py
|
@ -1,27 +1,71 @@
|
|||
|
||||
#Dungeon Spiel Emanuel
|
||||
import random
|
||||
eg=("Mmh...","Mhh...","Schmatz...","Mampf...")
|
||||
lg=("Lecker!","Das war aber gut!")
|
||||
dungeon="........................w............$...........w............€...........w............€...........w............€...........w............$...........w........................"
|
||||
dungeon="..w..K.w.G...K.w.G..K..w..K..G.w.K.$..K.w.G.K.w.w.K.w.G.K.€.K.G.w.K..wKG.K.G.K.€.G.K.G.K.w.G.K.G.K..€.G.K.G.K.w..K.G.w.K.w.$.w.K.w.G.K.p"
|
||||
#dungeon="""
|
||||
############################################################################################################################
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
#..........................................................................................................................#
|
||||
############################################################################################################################
|
||||
#"""
|
||||
hero="@"
|
||||
herox=0
|
||||
hero_Gold=0
|
||||
hero_Wurstsemmel=0
|
||||
hero_hunger=0
|
||||
hero_hp=1000
|
||||
|
||||
level=list(dungeon)
|
||||
while hero_hunger<30 and hero_hunger>-1:
|
||||
hero_hunger+=random.choice((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2))
|
||||
while True:
|
||||
if hero_hunger>30:
|
||||
print("Du bist verhungert!\nVersager")
|
||||
break
|
||||
if hero_hunger<-1:
|
||||
print("Dein Bauch ist geplatzt!\nVersager")
|
||||
break
|
||||
hero_hunger+=random.choice((0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2))
|
||||
for x,c in enumerate(level):
|
||||
if x==herox:
|
||||
print(hero,end="")
|
||||
else:
|
||||
print (c,end="")
|
||||
print()
|
||||
command=input("Gold:{} \nWurstsemmeln:{} \nHunger:{}\n?".format(hero_Gold,hero_Wurstsemmel,hero_hunger))
|
||||
command=input("Gold:{} \nWurstsemmeln:{} \nHunger:{}\nLeben:{}\n?".format(hero_Gold,hero_Wurstsemmel,hero_hunger,hero_hp))
|
||||
|
||||
|
||||
dx=0
|
||||
if command=="a":
|
||||
herox-=1
|
||||
#herox-=1
|
||||
dx=-1
|
||||
if command=="d":
|
||||
herox+=1
|
||||
#herox+=1
|
||||
dx=1
|
||||
if command=="e":
|
||||
if hero_Wurstsemmel>0:
|
||||
hero_hunger-= random.randint(4,20)
|
||||
|
@ -29,7 +73,49 @@ while hero_hunger<30 and hero_hunger>-1:
|
|||
print(random.choice(eg)+"\n"+random.choice(lg))
|
||||
else:
|
||||
print("Hilfe!!!\nkein essen mehr!!")
|
||||
#Aufheben
|
||||
if command=="Zaubertrank":
|
||||
hero_hp+=100
|
||||
# in Monster gelaufen?
|
||||
target=level[herox+dx]
|
||||
#
|
||||
#---Gorilla anfang---
|
||||
if target=="G":
|
||||
print("Ein Gorilla blockiert deinen Weg!")
|
||||
print("Der Gorilla schlägt dich mit einer Banane!")
|
||||
schaden=random.randint(1,10)
|
||||
hero_hp -=schaden
|
||||
print("Du erleidest {} Schaden".format(schaden))
|
||||
if hero_hp<1:
|
||||
print:("Du stirbst!\nVersager!")
|
||||
break
|
||||
sieg=0.333333
|
||||
if random.random() < sieg:
|
||||
level[herox+dx]="."
|
||||
print("Du erledigst heldenhaft den Gorilla!!")
|
||||
else:
|
||||
print("Du Verlierst!")
|
||||
dx=0
|
||||
# -------- gorilla ende ---------
|
||||
#---kobold anfang---
|
||||
if target=="K":
|
||||
print("Ein Kobold blockiert deinen Weg!")
|
||||
print("Der Kobold piekst dich mit einer Gabel!")
|
||||
schaden=random.randint(10,20)
|
||||
hero_hp-=schaden
|
||||
print("Du erleidest {} Schaden".format(schaden))
|
||||
if hero_hp<1:
|
||||
print:("Du stirbst!\nVersager!")
|
||||
break
|
||||
sieg=0.7
|
||||
if random.random() < sieg:
|
||||
print("Du erledigst heldenhaft den Kobold!!")
|
||||
level[herox+dx]="."
|
||||
else:
|
||||
print("Du Verlierst!")
|
||||
dx=0
|
||||
# -------- kobold ende ---------
|
||||
herox+=dx
|
||||
#Aufheben
|
||||
stuff=level[herox]
|
||||
if stuff=="€" or stuff=="$":
|
||||
hero_Gold+=1
|
||||
|
@ -37,9 +123,12 @@ while hero_hunger<30 and hero_hunger>-1:
|
|||
if stuff=="w":
|
||||
hero_Wurstsemmel+=1
|
||||
level[herox]="."
|
||||
|
||||
if stuff=="p":
|
||||
print("Du hast die Prinzessin befreit!")
|
||||
level[herox]="p"
|
||||
break
|
||||
|
||||
|
||||
|
||||
print("Game Over!")
|
||||
print("Ende")
|
||||
|
||||
|
|
Reference in New Issue