Beispiel #1
0
 def melee_attack(self,
                  other_creature,
                  this_creature_army=None,
                  other_army=None,
                  first_attack=True):
     deeling_damage = count_damage(self.base, other_creature.base)
     message_to_return = [other_creature.get_damage(deeling_damage)]
     return message_to_return
Beispiel #2
0
 def melee_attack(self,
                  other_creature,
                  this_creature_army=None,
                  other_army=None,
                  first_attack=True):
     deeling_damage = count_damage(self.base, other_creature.base)
     message_to_return = [other_creature.get_damage(deeling_damage)]
     if other_creature.conter_attack != other_creature.can_conter_attack \
             and "is dead" not in message_to_return[0] and first_attack:
         other_creature.conter_attack += 1
         message_to_return += other_creature.melee_attack(
             self, other_army, this_creature_army, False)
     return message_to_return
Beispiel #3
0
 def move_and_melee_attack(self,
                           other_creature,
                           coordinates,
                           this_creature_army=None,
                           other_army=None):
     distance = abs(self.base.position_on_battle_ground[0] - coordinates[0]
                    ) + abs(self.base.position_on_battle_ground[1] -
                            coordinates[1])
     message_to_return = [self.base.move(coordinates)]
     deeling_damage = count_damage(self.base, other_creature.base) + 1.2 * \
                      distance
     message_to_return += [other_creature.get_damage(deeling_damage)]
     if other_creature.conter_attack != other_creature.can_conter_attack \
             and "is dead" not in message_to_return[0]:
         other_creature.conter_attack += 1
         message_to_return += other_creature.melee_attack(
             self, other_army, this_creature_army, False)
     return message_to_return
Beispiel #4
0
 def range_attack(self, other_creature, other_army=None,
                  first_attack=True, modificator=1):
     deeling_damage = modificator * count_damage(self.base,
                                                 other_creature.base)
     self.base.shots -= 1
     if abs(self.base.position_on_battle_ground[0] -
            other_creature.base.position_on_battle_ground[0]) + \
             abs(self.base.position_on_battle_ground[1] -
                 other_creature.base.position_on_battle_ground[1]) > 8:
         deeling_damage /= 2
     message_to_return = [other_creature.get_damage(deeling_damage)]
     if "Hunter" in self.base.name:
         message_to_return += [other_creature.get_damage(deeling_damage)]
     if other_creature.conter_attack != other_creature.can_conter_attack \
             and "is dead" not in message_to_return[0] and first_attack \
             and hasattr(other_creature, "range_attack") and \
             other_creature.base.shots > 0:
         other_creature.conter_attack += 1
         message_to_return += [other_creature.range_attack(self,
                                                           None,
                                                           False)]
     return message_to_return
Beispiel #5
0
 def melee_attack(self,
                  other_creature,
                  this_creature_army=None,
                  other_army=None,
                  first_attack=True):
     deeling_damage = count_damage(self.base, other_creature.base)
     self.base.last_creature_hp += int(deeling_damage / 2)
     self.base.add_count(
         self.base, self.base.last_creature_hp // self.base.health_points)
     self.base.last_creature_hp %= self.base.health_points
     message_to_return = [other_creature.get_damage(deeling_damage)]
     message_to_return += [
         "Restoring " + str(int(deeling_damage / 2)) +
         " health points. Adding " +
         str(self.base.last_creature_hp // self.health_points) +
         " creatures"
     ]
     if other_creature.conter_attack != other_creature.can_conter_attack \
             and "is dead" not in message_to_return[0] and first_attack:
         other_creature.conter_attack += 1
         message_to_return += other_creature.melee_attack(
             self, other_army, this_creature_army, False)
     return message_to_return