Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. import random
  2. import time
  3.  
  4. #Character List
  5. Character_List = {
  6. 0:{
  7. "name":"Xor Gay",
  8. "hp":random.randrange(50, 150),
  9. "dmg":random.randrange(1,10)
  10. },
  11. 1:{
  12. "name":"Suriya Gay",
  13. "hp": random.randrange(50, 150),
  14. "dmg":random.randrange(1,10)
  15. },
  16. 2:{
  17. "name":"Gunner Man",
  18. "hp":random.randrange(100, 200),
  19. "dmg":random.randrange(1,10)
  20. }
  21. }
  22.  
  23. #Monster List
  24. Monster_List = {
  25. 0:{
  26. "name":"Goblin",
  27. "hp":random.randrange(10, 50),
  28. "dmg":random.randrange(1,7)
  29. },
  30. 1:{
  31. "name":"Naked Xor",
  32. "hp":random.randrange(30, 150),
  33. "dmg":random.randrange(1,15)
  34. },
  35. 2:{
  36. "name":"Naked Suriya",
  37. "hp":random.randrange(1,2),
  38. "dmg":random.randrange(1, 10)
  39. }
  40. }
  41.  
  42. #Variable Declaration
  43. main_char = Character_List[random.randrange(0,len(Character_List))] #Pick random character in Character_List
  44. main_monst = Monster_List[random.randrange(0,len(Monster_List))] #Pick random monster in Monster_List
  45. gold = random.randrange(1,1000) #Spawn gold from 1 to 1000
  46. char_name = main_char["name"]
  47.  
  48. #Print the chosen character and his attributes
  49. print("The chosen one is: " + char_name + " with attribute [HP:" + str(main_char["hp"]) + ", DMG:" + str(main_char["dmg"]) + ", Gold:" + str(gold) + "]")
  50.  
  51. while main_char["hp"] > 0:
  52. time.sleep(1)
  53.  
  54. #Wealth Title Giver
  55. if gold >= 1500:
  56. char_name = "Wealthy " + main_char["name"]
  57. elif gold < 1500 and gold >= 850:
  58. char_name = "Rich " + main_char["name"]
  59. elif gold < 850 and gold >= 300:
  60. char_name = main_char["name"]
  61. elif gold < 300 and gold >= 75:
  62. char_name = "Poor " + main_char["name"]
  63. elif gold < 75:
  64. char_name = "Homeless " + main_char["name"]
  65.  
  66. #If random.randrange generate a number from 0-100 below 10 then execute the following..
  67. if random.randrange(0,101) < 2: # 2% chance of happening
  68. lost_hp = random.randrange(1, 1000) #Assign a random number from 1 to 1000 to lost_hp
  69. main_char["hp"] -= lost_hp #Subtract main_char hp from lost_hp
  70.  
  71. print(char_name + " has tripped on a rock and lost " + str(lost_hp) + " hp.")
  72. if main_char["hp"] < 0: #If main_char hp is less than 0 after the subtraction, then execute the following..
  73. print("-and as a result, " + char_name + " has died. HP:" + str(main_char["hp"]))
  74.  
  75. #If random.randrange generate a number from 0-100 below 20 then execute the following..
  76. elif random.randrange(0,101) < 20: # 20% chance of happening
  77. gold_found = random.randrange(1,100)
  78. gold += gold_found
  79. print(char_name + " found " + str(gold_found) + " golds along his journey. Total gold acquired: " + str(gold))
  80.  
  81. #If random.randrange generate a number from 0-100 below 7 then execute the following..
  82. elif random.randrange(0,101) < 7: # 7% chance of happening
  83. gold_robbed = random.randrange(0, gold-1)
  84. gold -= gold_robbed
  85. print(char_name + " was robbed of " + str(gold_robbed) + " golds. Total gold remaining: " + str(gold))
  86.  
  87. #If none of the number generated above is less than their value, then execute the following..
  88. else:
  89. print(char_name + " is traveling through the continent..")
  90.  
  91. #End of while loop
  92. print("Total gold acquired so far: " + str(gold))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement