Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- #Character List
- Character_List = {
- 0:{
- "name":"Xor Gay",
- "hp":random.randrange(50, 150),
- "dmg":random.randrange(1,10)
- },
- 1:{
- "name":"Suriya Gay",
- "hp": random.randrange(50, 150),
- "dmg":random.randrange(1,10)
- },
- 2:{
- "name":"Gunner Man",
- "hp":random.randrange(100, 200),
- "dmg":random.randrange(1,10)
- }
- }
- #Monster List
- Monster_List = {
- 0:{
- "name":"Goblin",
- "hp":random.randrange(10, 50),
- "dmg":random.randrange(1,7)
- },
- 1:{
- "name":"Naked Xor",
- "hp":random.randrange(30, 150),
- "dmg":random.randrange(1,15)
- },
- 2:{
- "name":"Naked Suriya",
- "hp":random.randrange(1,2),
- "dmg":random.randrange(1, 10)
- }
- }
- #Variable Declaration
- main_char = Character_List[random.randrange(0,len(Character_List))] #Pick random character in Character_List
- main_monst = Monster_List[random.randrange(0,len(Monster_List))] #Pick random monster in Monster_List
- gold = random.randrange(1,1000) #Spawn gold from 1 to 1000
- char_name = main_char["name"]
- #Print the chosen character and his attributes
- print("The chosen one is: " + char_name + " with attribute [HP:" + str(main_char["hp"]) + ", DMG:" + str(main_char["dmg"]) + ", Gold:" + str(gold) + "]")
- while main_char["hp"] > 0:
- time.sleep(1)
- #Wealth Title Giver
- if gold >= 1500:
- char_name = "Wealthy " + main_char["name"]
- elif gold < 1500 and gold >= 850:
- char_name = "Rich " + main_char["name"]
- elif gold < 850 and gold >= 300:
- char_name = main_char["name"]
- elif gold < 300 and gold >= 75:
- char_name = "Poor " + main_char["name"]
- elif gold < 75:
- char_name = "Homeless " + main_char["name"]
- #If random.randrange generate a number from 0-100 below 10 then execute the following..
- if random.randrange(0,101) < 2: # 2% chance of happening
- lost_hp = random.randrange(1, 1000) #Assign a random number from 1 to 1000 to lost_hp
- main_char["hp"] -= lost_hp #Subtract main_char hp from lost_hp
- print(char_name + " has tripped on a rock and lost " + str(lost_hp) + " hp.")
- if main_char["hp"] < 0: #If main_char hp is less than 0 after the subtraction, then execute the following..
- print("-and as a result, " + char_name + " has died. HP:" + str(main_char["hp"]))
- #If random.randrange generate a number from 0-100 below 20 then execute the following..
- elif random.randrange(0,101) < 20: # 20% chance of happening
- gold_found = random.randrange(1,100)
- gold += gold_found
- print(char_name + " found " + str(gold_found) + " golds along his journey. Total gold acquired: " + str(gold))
- #If random.randrange generate a number from 0-100 below 7 then execute the following..
- elif random.randrange(0,101) < 7: # 7% chance of happening
- gold_robbed = random.randrange(0, gold-1)
- gold -= gold_robbed
- print(char_name + " was robbed of " + str(gold_robbed) + " golds. Total gold remaining: " + str(gold))
- #If none of the number generated above is less than their value, then execute the following..
- else:
- print(char_name + " is traveling through the continent..")
- #End of while loop
- print("Total gold acquired so far: " + str(gold))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement