From 8ad7b759d9d16cfa6fb41af8b17b36e2509ae0a3 Mon Sep 17 00:00:00 2001 From: AH-Pooya Date: Wed, 13 Feb 2019 02:22:27 +0330 Subject: [PATCH] Heal is Defensive --- Model.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Model.py b/Model.py index 37869fe..b8f835f 100644 --- a/Model.py +++ b/Model.py @@ -146,7 +146,7 @@ def set_constants(self, hero_constant): def get_ability(self, ability_name): for ability in self.abilities: - if ability.name == ability_name: + if ability_name is AbilityName and ability_name.value == ability.name or ability.name == ability_name: return ability return None @@ -346,7 +346,7 @@ def _handle_cast_ability(self, cast_abilities, my_or_opp): def _get_ability_constants(self, name): for constant in self.ability_constants: - if constant.name == name: + if name is AbilityName and name.value == constant.name or constant.name == name: return constant def _update_heroes(self, heroes_list, main_hero_list): @@ -540,8 +540,8 @@ def get_impact_cells(self, ability_constant, start_cell, target_cell): return impact_cells def is_affected(self, ability_constant, cell): - return (self._get_opp_hero(cell) is not None and not ability_constant.type == AbilityType.HEAL) or ( - self._get_my_hero(cell) is not None and ability_constant.type == AbilityType.HEAL) + return (self._get_opp_hero(cell) is not None and not ability_constant.type == AbilityType.DEFENSIVE) or ( + self._get_my_hero(cell) is not None and ability_constant.type == AbilityType.DEFENSIVE) @staticmethod def manhattan_distance(start_cell=None, end_cell=None, start_cell_row=None, start_cell_column=None, @@ -748,7 +748,7 @@ def get_ability_targets(self, ability_name=None, ability=None, ability_constant= affected_cells = set() for cell in cells: affected_cells.update(self.get_cells_in_aoe(cell, ability_constant.area_of_effect)) - if ability_constant.type == AbilityType.HEAL: + if ability_constant.type == AbilityType.DEFENSIVE: return self.get_my_heroes_in_cells(cells) return self._get_opp_heroes_in_cells(cells)