# Neurotoads Python RPG — занятие 40
# Классы: Enemy и взаимодействие объектов

class Hero:
    def __init__(self,name,hp): self.name=name; self.hp=hp
class Enemy:
    def __init__(self,name,damage): self.name=name; self.damage=damage
    def attack(self,target): target.hp=max(0,target.hp-self.damage)
hero=Hero("Лея",10); wolf=Enemy("Волк",3); wolf.attack(hero); print(hero.hp)
hero2=Hero("Рин",2); wolf.attack(hero2); print(hero2.hp)
