The Vampires The Vampires
RU English
The flocks of crows circled over the battlefield. Many brave warriors have fallen in this battle, many have continued to fight.
"If this goes on, we’ll simply kill each other, and there will be no winners - we’ll all lose." - reflected Sir Ronald, watching a bleak picture in front of him.
"I have to make an important decision. I know what it’ll cost, but now that’s the only thing that can save us all..."
A long time ago, when he was often in search of trouble and adventure, he went to hunt a witch who had a huge bounty on her head. The bloody creature was able to save her life by persuading the knight to take a gift from her - a vial of vampire blood. This blood poured into the dying man’s mouth could bring him back to life in vampire form.
Is it really the day when he has to use it?..
It seemed to be the only way to win this battle.
Sir Ronald began to lean over the barely living bodies of his knights, who were lying beside him. To each of them he said:
- "Drink. You’ll be given a new life..."

So we have 3 types of units: the Warrior, Knight and Defender. Let's make the battles even more epic and add another type - the Vampire!
Vampire should be the subclass of the Warrior class and have the additional vampirism parameter, which helps him to heal himself. When the Vampire hits the other unit, he restores his health by +50% of the dealt damage (enemy defense makes the dealt damage value lower).
The basic parameters of the Vampire:
health = 40
attack = 4
vampirism = 50%



chuck = Warrior()
bruce = Warrior()
carl = Knight()
dave = Warrior()
mark = Warrior()
bob = Defender()
mike = Knight()
rog = Warrior()
lancelot = Defender()
eric = Vampire()
adam = Vampire()
richard = Defender()
ogre = Warrior()

fight(chuck, bruce) == True
fight(dave, carl) == False
chuck.is_alive == True
bruce.is_alive == False
carl.is_alive == True
dave.is_alive == False
fight(carl, mark) == False
carl.is_alive == False
fight(bob, mike) == False
fight(lancelot, rog) == True
fight(eric, richard) == False
fight(ogre, adam) == True

my_army = Army()
my_army.add_units(Defender, 2)
my_army.add_units(Vampire, 2)
my_army.add_units(Warrior, 1)
enemy_army = Army()
enemy_army.add_units(Warrior, 2)
enemy_army.add_units(Defender, 2)
enemy_army.add_units(Vampire, 3)

army_3 = Army()
army_3.add_units(Warrior, 1)
army_3.add_units(Defender, 4)

army_4 = Army()
army_4.add_units(Vampire, 3)
army_4.add_units(Warrior, 2)

battle = Battle()

battle.fight(my_army, enemy_army) == False
battle.fight(army_3, army_4) == True

Input: The warriors and armies.

Output: The result of the battle (True or False).

How it is used: For the computer games development.

Precondition: 4 types of units