Untitled
unknown
plain_text
a year ago
438 B
5
Indexable
class Fighter:
def __init__(self, name, health, stamina, skill):
self.name = name
self.health = health
self.stamina = stamina
self.skill = skill
def attack(self, opponent):
damage = self.skill * random.uniform(0.8, 1.2)
opponent.health -= damage
# Example usage:
sarah = Fighter("Sarah", 100, 100, 80)
tommy = Fighter("Tommy", 80, 90, 70)
sarah.attack(tommy)
print(tommy.health)
Editor is loading...
Leave a Comment