@@ -526,9 +526,9 @@ def get_impact_cells(self, ability_constant, start_cell, target_cell):
526
526
if start_cell .is_wall or start_cell == target_cell and not ability_constant .is_lobbing :
527
527
return [start_cell ]
528
528
last_cell = None
529
- rey_cells = self .get_ray_cells (start_cell , target_cell )
529
+ ray_cells = self .get_ray_cells (start_cell , target_cell )
530
530
impact_cells = []
531
- for cell in rey_cells :
531
+ for cell in ray_cells :
532
532
if self .manhattan_distance (cell , start_cell ) > ability_constant .range :
533
533
continue
534
534
last_cell = cell
@@ -540,7 +540,7 @@ def get_impact_cells(self, ability_constant, start_cell, target_cell):
540
540
return impact_cells
541
541
542
542
def is_affected (self , ability_constant , cell ):
543
- return (self ._get_opp_hero (cell ) is not None and not ability_constant .type == AbilityType .DEFENSIVE ) or (
543
+ return (self ._get_opp_hero (cell ) is not None and ability_constant .type == AbilityType .OFFENSIVE ) or (
544
544
self ._get_my_hero (cell ) is not None and ability_constant .type == AbilityType .DEFENSIVE )
545
545
546
546
@staticmethod
@@ -596,17 +596,17 @@ def _calculate_neighbour(self, start, target, current, former):
596
596
if current is not former :
597
597
return possible_next_cell
598
598
options += [possible_next_cell ]
599
+ else :
600
+ x3 = (current .row + possible_next_cell .row ) / 2 + (possible_next_cell .column - current .column ) / 2
601
+ y3 = (possible_next_cell .column + current .column ) / 2 + (possible_next_cell .row - current .row ) / 2
599
602
600
- x3 = (current .row + possible_next_cell .row ) / 2 + (possible_next_cell .column - current .column ) / 2
601
- y3 = (possible_next_cell .column + current .column ) / 2 + (possible_next_cell .row - current .row ) / 2
603
+ x4 = (current .row + possible_next_cell .row ) / 2 - (possible_next_cell .column - current .column ) / 2
604
+ y4 = (possible_next_cell .column + current .column ) / 2 - (possible_next_cell .row - current .row ) / 2
602
605
603
- x4 = (current .row + possible_next_cell .row ) / 2 - (possible_next_cell .column - current .column ) / 2
604
- y4 = (possible_next_cell .column + current .column ) / 2 - (possible_next_cell .row - current .row ) / 2
605
-
606
- if self ._slope_equation (x1 , y1 , x2 , y2 , x3 , y3 ) * self ._slope_equation (x1 , y1 , x2 , y2 , x4 , y4 ) < 0 :
607
- if current is not former :
608
- return possible_next_cell
609
- options += [possible_next_cell ]
606
+ if self ._slope_equation (x1 , y1 , x2 , y2 , x3 , y3 ) * self ._slope_equation (x1 , y1 , x2 , y2 , x4 , y4 ) < 0 :
607
+ if current is not former :
608
+ return possible_next_cell
609
+ options += [possible_next_cell ]
610
610
611
611
def is_between (first , second , between ):
612
612
return (first .row <= between .row <= second .row or first .row >= between .row >= second .row ) and \
@@ -743,7 +743,6 @@ def get_ability_targets(self, ability_name=None, ability=None, ability_constant=
743
743
if target_row is None or target_column is None :
744
744
return None
745
745
target_cell = self .map .get_cell (target_row , target_column )
746
-
747
746
cells = self .get_impact_cells (ability_constant , start_cell , target_cell )
748
747
affected_cells = set ()
749
748
for cell in cells :
@@ -820,7 +819,7 @@ def pick_hero(self, hero_name):
820
819
def _get_ability_type (param ):
821
820
if param == 'DODGE' :
822
821
return AbilityType .DODGE
823
- if param == 'OFFENCIVE ' :
822
+ if param == 'OFFENSIVE ' :
824
823
return AbilityType .OFFENSIVE
825
824
if param == 'DEFENSIVE' :
826
825
return AbilityType .DEFENSIVE
0 commit comments