• The Lancer. How to solve this problem?

 

Hello. The Lancer. How to solve this problem? Don't know how to properly attack two opponents with the Lancer. Please tell me how to solve this problem? What to read? Reluctance crutches in the form of heap conditions to do.

class Warrior:

    def __init__(self):
        self.health = 50
        self.attack = 5        
        self.defense = 0

    @property
    def is_alive(self):
        return self.health > 0       

    def hit(self, victim):
        if self.attack > victim.defense:
            victim.health -= (self.attack - victim.defense)




class Knight(Warrior):

    def __init__(self):  
        Warrior.__init__(self)
        self.attack = 7       




class Defender(Warrior):

    def __init__(self):
        Warrior.__init__(self)
        self.health = 60
        self.attack = 3
        self.defense = 2                      




class Rookie(Warrior):
    def __init__(self):
        Warrior.__init__(self)
        self.attack = 1




class Vampire(Warrior):
    def __init__(self):
        Warrior.__init__(self)
        self.health = 40
        self.attack = 4 
        self.vampirism = 50 #%

    def hit(self, victim):
        if self.attack > victim.defense:
            victim.health -= (self.attack - victim.defense)
            self.health += (self.attack - victim.defense)*0.5



class Lancer(Warrior):
    def __init__(self):
        Warrior.__init__(self)
        self.attack = 6

    def hit(self, victim):
        if self.attack > victim.defense:
            damage = self.attack - victim.defense
            victim.health -= damage
            #???????????????





class Army:

    def __init__(self):
        self.units = []

    def add_units(self, nameClass, count):
        for i in range(count):
            self.units.append(nameClass())    

    @property
    def is_alive(self):
        return bool(self.units)




class Battle:

    def fight(self, army_1:Army, army_2:Army) -> bool:
        while army_1.is_alive and army_2.is_alive:        
            if fight(army_1.units[0], army_2.units[0]):
                army_2.units.pop(0)                
            else:
                army_1.units.pop(0)               
        return army_1.is_alive




def fight(unit_1, unit_2) -> bool:
    stepUnit_1 = True
    while unit_1.is_alive and unit_2.is_alive:        
        if stepUnit_1:            
            unit_1.hit(unit_2)            
        else:
            unit_2.hit(unit_1)            
        stepUnit_1 = not stepUnit_1
    return unit_1.is_alive
10