Test cases don't require Lancer input
I defined the Lancer class but never added any code for it to do anything. It never attacks the 2nd person in line, no modifications were made to my code from Vampire test except to add the Lancer class. Still it passes Check and gives me a Mission Clear.
My code for reference:
class Warrior: def __init__(self, *args, **kwargs): self.health = 50 self.attack = 5 self.defense = 0 self.vampirism = 0 self.cleave = 0 self.is_alive = True pass class Rookie(Warrior): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.attack = 1 pass class Knight(Warrior): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.attack = 7 pass class Defender(Warrior): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.health = 60 self.attack = 3 self.defense = 2 pass class Vampire(Warrior): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.health = 40 self.attack = 4 self.vampirism = 50 pass class Lancer(Warrior): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.attack = 6 self.cleave = 50 pass class Army: def __init__(self, *args, **kwargs): self.units = [] def add_units(self, type, amount): for i in range(amount): self.units.append(type()) class Battle: def fight(self, army1, army2): while len(army1.units) != 0 and len(army2.units) != 0: if fight(army1.units[0], army2.units[0]): army2.units.pop(0) else: army1.units.pop(0) if len(army1.units) == 0: return False else: return True def damage(att, d): dam = att.attack - d.defense if dam < 0: dam = 0 return dam def vamp(att, d): res = (damage(att, d)*(att.vampirism/100))//1 return res def fight(unit_1, unit_2): while unit_1.is_alive and unit_2.is_alive: unit_2.health -= damage(unit_1, unit_2) unit_1.health += vamp(unit_1, unit_2) if unit_2.health > 0: unit_1.health -= damage(unit_2, unit_1) unit_2.health += vamp(unit_2, unit_1) else: unit_2.is_alive = False if unit_1.health <= 0: unit_1.is_alive = False return unit_1.is_alive