Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BattleBot:
- def __init__(self, name):
- self.name = name
- self.health = 100
- self.base_damage = 10
- self.base_speed = 10
- self.armor = 10
- def attack(self, opponent):
- damage_dealt = robotBaseDamage - (robotBaseDamage * robotBaseArmor/100)
- opponent.take_damage(damage_dealt)
- def take_damage(self, damage_dealt):
- self.health -= damage_dealt
- class GoodBot(BattleBot):
- def __init__(self, name):
- self.name = Bob
- self.health = 1000
- self.base_damage = 40
- self.base_speed = 20
- self.armor = 20
- def attack(self, opponent):
- damage_dealt = robotBaseDamage - (robotBaseDamage * robotBaseArmor/1000)
- opponent.take_damage(damage_dealt)
- def take_damage(self, damage_dealt):
- self.health -= (damage_dealt/1000)
- if self.health > 0:
- print("Bob feels good")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement