Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. import random
  2.  
  3. class Robot:
  4.  
  5. def __init__ (self, robot_name, armor, damage, speed, health):
  6. self.name = robot_name
  7. self.armor = armor
  8. self.damage = damage
  9. self.speed = speed
  10. self.health = health
  11.  
  12. def dodge (self):
  13. if self.speed > 6 and self.health <= 70:
  14. self.health += 10
  15. self.speed -= 1
  16. self.armor += 1
  17. self.damage += 1
  18. print(self.name + " Dodged a hit!")
  19.  
  20. def die (self):
  21. if self.health < 0:
  22. print(self.name + " Died this round D:")
  23.  
  24. def get_buff (self):
  25. buff_chance = random.randint(1, 10)
  26. if buff_chance == 5:
  27. self.health += 15
  28. self.speed += 2
  29. self.armor += 2
  30. self.damage += 2
  31. print(self.name + " Was buffed")
  32. elif buff_chance == 1:
  33. self.health -= 15
  34. self.speed -= 2
  35. self.armor -= 2
  36. self.damage -= 2
  37. print(self.name + " Was debuffed")
  38. else:
  39. print(self.name + " Got no effects that round!")
  40.  
  41. class Good(Robot):
  42.  
  43. def attacked (self):
  44. if self.speed > random.randint(1, 3):
  45. self.health -= bad_bot.damage - (self.armor/10)
  46. print(self.name + " Took a hit!")
  47.  
  48. class Bad(Robot):
  49.  
  50. def attacked (self):
  51. if self.speed > random.randint(1, 3):
  52. self.health -= good_bot.damage - (self.armor/10)
  53. print(self.name + " Took a hit!")
  54.  
  55. good_bot = Good("Jeff", 8, 10, 10, 70)
  56. bad_bot = Bad("Bad Jeff", 10, 8, 7, 100)
  57.  
  58.  
  59. #========= TIMER ===========
  60. turn = 1
  61. while good_bot.health > 0 and bad_bot.health > 0:
  62. nextTurn = input('Say "Yes" to go to the next turn! Response: ')
  63. if nextTurn == "Yes" or nextTurn == "yes":
  64. print("")
  65. print("======= Turn: " + str(turn) + " =======")
  66. print("")
  67. good_bot.dodge()
  68. good_bot.attacked()
  69. bad_bot.dodge()
  70. bad_bot.attacked()
  71. good_bot.get_buff()
  72. bad_bot.get_buff()
  73. bad_bot.die()
  74. good_bot.die()
  75. print("")
  76. print("End Turn " + good_bot.name + " Stats: ")
  77. print(good_bot.name + "'s Health: " + str(good_bot.health))
  78. print(good_bot.name + "'s Armor: " + str(good_bot.armor))
  79. print(good_bot.name + "'s Speed: " + str(good_bot.speed))
  80. print(good_bot.name + "'s Damage: " + str(good_bot.damage))
  81. print("")
  82. print("End Turn " + bad_bot.name + " Stats: ")
  83. print(bad_bot.name + "'s Health: " + str(bad_bot.health))
  84. print(bad_bot.name + "'s Armor: " + str(bad_bot.armor))
  85. print(bad_bot.name + "'s Speed: " + str(bad_bot.speed))
  86. print(bad_bot.name + "'s Damage: " + str(bad_bot.damage))
  87. print("")
  88. print("=======================")
  89. turn += 1
  90. else:
  91. print("Ok then D:")
  92. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement