• The_Weapons: Some bg Straight_Fight Test Case fail

Question related to mission The Weapons


and I have no clue why. Apparently Anastasya figured it out. The logic I implemented is not object oriented at all and yet, there s no reason why it should not work. The straight_fight missions disconnect each participant from their own army, so Healers and Lancers should have no effect whatsoever. And yet, the following code fails:

army_1 = Army()
army_2 = Army()
army_1.add_units(Lancer, 7)
army_1.add_units(Vampire, 3)
army_1.add_units(Healer, 1)
army_1.add_units(Warrior, 4)
army_1.add_units(Healer, 1)
army_1.add_units(Defender, 2)
army_2.add_units(Warrior, 4)
army_2.add_units(Defender, 4)
army_2.add_units(Healer, 1)
army_2.add_units(Vampire, 6)
army_2.add_units(Lancer, 4)

battle = Battle()
assert battle.straight_fight(army_1, army_2) == False

The only potential reason I can think of for this is an inconsistent take_it() implementation between the Warrior and Defender classes. Code is attached. Help is is in dire need!