Skip to content

Commit

Permalink
Heal is Defensive
Browse files Browse the repository at this point in the history
  • Loading branch information
AH-Pooya committed Feb 12, 2019
1 parent 79d7c16 commit 8ad7b75
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 8ad7b75

Please sign in to comment.