import random HP=100 ###Damage Script### def My_Health(hit1): Current_Health=HP print (Current_Health) Current_Health=Current_Health-hit1 print (Current_Health) My_Health(10) ###Damage Script END### ###Monster Database### Orc = {"Name": "Orc", "Hits": str([random.randint(80,100)]), "Gold": [random.randint(4,10)]} Goblin = {"Name": "Goblin", "Hits": [random.randint(30,75)], "Gold": [random.randint(1,4)]} Ogre = {"Name": "Ogre", "Hits": [random.randint(100,150)], "Gold": [random.randint(8,13)]} Skeleton = {"Name": "Skeleton", "Hits": [random.randint(80,100)], "Gold": [random.randint(4,10)]} Drake = {"Name": "Drake", "Hits": [random.randint(130,160)], "Gold": [random.randint(10,15)]} Dragon = {"Name": "Dragon", "Hits": [random.randint(150,200)], "Gold": [random.randint(18,30)]} Monsters = [Orc, Goblin, Ogre, Skeleton, Drake, Dragon] for mobs in Monsters: Rank = random.choice(["Regular", "Regular" , "Regular", "Regular", "Elite"]) first=Rank[0] if first == "a" or first =="A" or first =="e" or first =="E" or first =="i" or first =="I" or first =="o" or first =="O" or first =="u" or first =="U": print ("This is an " + str(Rank) + " " + str(mobs["Name"])) else: print ("This is a " + str(Rank) + " " + str(mobs["Name"])) print ("It has " + str(mobs["Hits"]) + " Hit Points and " + str(mobs["Gold"]) + " gold.") ###Monster Database END### ###debug start### print ("") print ("###debug start###") print ("") print (HP) print ("") print ("###debug end###") ###debug end### while HP > 0: action = input ("Fight or Run? ") if action == "Fight" or action == "fight": hit1=random.randint(3,15) My_Health(hit1) else: break
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question