Skip to content

Commit

Permalink
Protected in python is a damn joke
Browse files Browse the repository at this point in the history
  • Loading branch information
AH-Pooya committed Feb 12, 2019
1 parent b335f79 commit 79d7c16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion AI.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import Model
from random import randint

Expand Down Expand Up @@ -25,4 +26,4 @@ def action(self, world):
col_num = randint(0, world.map.column_num)
abilities = hero.abilities
world.cast_ability(hero=hero, ability=abilities[randint(0, len(abilities) - 1)],
cell=world.map.get_cell(row_num, col_num))
cell=world.map.get_cell(row_num, col_num))
8 changes: 4 additions & 4 deletions Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,13 @@ def get_ability_targets(self, ability_name=None, ability=None, ability_constant=
return None
target_cell = self.map.get_cell(target_row, target_column)

cells = self.get_impact_cells(ability_name, start_cell, target_cell)
cells = self.get_impact_cells(ability_constant, start_cell, target_cell)
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:
return self.get_my_heroes_in_cells(cells)
return self.get_opp_heroes_in_cells(cells)
return self._get_opp_heroes_in_cells(cells)

def get_my_heroes_in_cells(self, cells):
heroes = []
Expand All @@ -760,10 +760,10 @@ def get_my_heroes_in_cells(self, cells):
heroes.append(hero)
return heroes

def get_opp_heroes_in_cells(self, cells):
def _get_opp_heroes_in_cells(self, cells):
heroes = []
for cell in cells:
hero = self.get_opp_hero(cell)
hero = self._get_opp_hero(cell)
if hero:
heroes.append(hero)
return heroes
Expand Down

0 comments on commit 79d7c16

Please sign in to comment.