Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Robot:
- def __init__ (self, robot_name, armor, damage, speed, health):
- self.name = robot_name
- self.armor = armor
- self.damage = damage
- self.speed = speed
- self.health = health
- def dodge (self):
- if self.speed > 6 and self.health <= 70:
- self.health += 10
- self.speed -= 1
- self.armor += 1
- self.damage += 1
- print(self.name + " Dodged a hit!")
- def die (self):
- if self.health < 0:
- print(self.name + " Died this round D:")
- def get_buff (self):
- buff_chance = random.randint(1, 10)
- if buff_chance == 5:
- self.health += 15
- self.speed += 2
- self.armor += 2
- self.damage += 2
- print(self.name + " Was buffed")
- elif buff_chance == 1:
- self.health -= 15
- self.speed -= 2
- self.armor -= 2
- self.damage -= 2
- print(self.name + " Was debuffed")
- else:
- print(self.name + " Got no effects that round!")
- class Good(Robot):
- def attacked (self):
- if self.speed > random.randint(1, 3):
- self.health -= bad_bot.damage - (self.armor/10)
- print(self.name + " Took a hit!")
- class Bad(Robot):
- def attacked (self):
- if self.speed > random.randint(1, 3):
- self.health -= good_bot.damage - (self.armor/10)
- print(self.name + " Took a hit!")
- good_bot = Good("Jeff", 8, 10, 10, 70)
- bad_bot = Bad("Bad Jeff", 10, 8, 7, 100)
- #========= TIMER ===========
- turn = 1
- while good_bot.health > 0 and bad_bot.health > 0:
- nextTurn = input('Say "Yes" to go to the next turn! Response: ')
- if nextTurn == "Yes" or nextTurn == "yes":
- print("")
- print("======= Turn: " + str(turn) + " =======")
- print("")
- good_bot.dodge()
- good_bot.attacked()
- bad_bot.dodge()
- bad_bot.attacked()
- good_bot.get_buff()
- bad_bot.get_buff()
- bad_bot.die()
- good_bot.die()
- print("")
- print("End Turn " + good_bot.name + " Stats: ")
- print(good_bot.name + "'s Health: " + str(good_bot.health))
- print(good_bot.name + "'s Armor: " + str(good_bot.armor))
- print(good_bot.name + "'s Speed: " + str(good_bot.speed))
- print(good_bot.name + "'s Damage: " + str(good_bot.damage))
- print("")
- print("End Turn " + bad_bot.name + " Stats: ")
- print(bad_bot.name + "'s Health: " + str(bad_bot.health))
- print(bad_bot.name + "'s Armor: " + str(bad_bot.armor))
- print(bad_bot.name + "'s Speed: " + str(bad_bot.speed))
- print(bad_bot.name + "'s Damage: " + str(bad_bot.damage))
- print("")
- print("=======================")
- turn += 1
- else:
- print("Ok then D:")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement