@@ -201,7 +201,8 @@ def _handle_turn_kings(self, msg):
201
201
self .get_player_by_id (king_msg ["playerId" ]).king .hp = king_msg ["hp" ]
202
202
if king_msg ["target" ] != - 1 :
203
203
self .get_player_by_id (king_msg ["playerId" ]).king .target = self .get_unit_by_id (king_msg ["target" ])
204
- self .get_player_by_id (king_msg ["playerId" ]).king .target_cell = self .get_unit_by_id (king_msg ["target" ]).cell
204
+ self .get_player_by_id (king_msg ["playerId" ]).king .target_cell = self .get_unit_by_id (
205
+ king_msg ["target" ]).cell
205
206
else :
206
207
self .get_player_by_id (king_msg ["playerId" ]).king .target = None
207
208
self .get_player_by_id (king_msg ["playerId" ]).king .target_cell = None
@@ -293,20 +294,20 @@ def _handle_turn_cast_spells(self, msg):
293
294
cast_spell_msg ["affectedUnits" ]]
294
295
if spell .is_area_spell ():
295
296
cast_area_spell = CastAreaSpell (spell = spell , id = cast_spell_msg ["id" ],
296
- caster_id = cast_spell_msg ["casterId" ], cell = cell ,
297
- remaining_turns = cast_spell_msg ["remainingTurns" ],
298
- affected_units = affected_units )
297
+ caster_id = cast_spell_msg ["casterId" ], cell = cell ,
298
+ remaining_turns = cast_spell_msg ["remainingTurns" ],
299
+ affected_units = affected_units )
299
300
self ._cast_spells .append (cast_area_spell )
300
301
if cast_spell_msg ["wasCastThisTurn" ]:
301
302
self .get_player_by_id (cast_spell_msg ["casterId" ]).cast_area_spell = cast_area_spell
302
303
303
304
elif spell .is_unit_spell ():
304
305
cast_unit_spell = CastUnitSpell (spell = spell , id = cast_spell_msg ["id" ],
305
- caster_id = cast_spell_msg ["casterId" ],
306
- cell = cell ,
307
- unit = self .get_unit_by_id (cast_spell_msg ["unitId" ]),
308
- path = self ._map .get_path_by_id (cast_spell_msg ["pathId" ]),
309
- affected_units = affected_units )
306
+ caster_id = cast_spell_msg ["casterId" ],
307
+ cell = cell ,
308
+ unit = self .get_unit_by_id (cast_spell_msg ["unitId" ]),
309
+ path = self ._map .get_path_by_id (cast_spell_msg ["pathId" ]),
310
+ affected_units = affected_units )
310
311
self ._cast_spells .append (cast_unit_spell )
311
312
if cast_spell_msg ["wasCastThisTurn" ]:
312
313
self .get_player_by_id (cast_spell_msg ["casterId" ]).cast_unit_spell = cast_unit_spell
@@ -338,7 +339,6 @@ def _handle_turn_message(self, msg):
338
339
self ._player_friend .set_spells ([self .get_spell_by_id (spell_id ) for spell_id in msg ["friendSpells" ]])
339
340
self ._player .ap = msg ["remainingAP" ]
340
341
341
-
342
342
def choose_hand_by_id (self , type_ids : List [int ]) -> None :
343
343
message = Message (type = "pick" , turn = self .get_current_turn (), info = None )
344
344
if type_ids is not None :
@@ -400,7 +400,7 @@ def get_paths_crossing_cell(self, cell: Cell = None, row: int = None, col: int =
400
400
Logs .show_log ("get_paths_crossing cell function called with no valid argument" )
401
401
return []
402
402
cell = self ._map .get_cell (row , col )
403
-
403
+ cell = self . _map . get_cell ( cell . row , cell . col )
404
404
if not isinstance (cell , Cell ):
405
405
Logs .show_log ("Given cell is invalid!" )
406
406
return []
@@ -418,6 +418,7 @@ def get_cell_units(self, cell: Cell = None, row: int = None, col: int = None) ->
418
418
Logs .show_log ("get_paths_crossing cell function called with no valid argument" )
419
419
return []
420
420
cell = self ._map .get_cell (row , col )
421
+ cell = self ._map .get_cell (cell .row , cell .col )
421
422
if not isinstance (cell , Cell ):
422
423
Logs .show_log ("Given cell is invalid!" )
423
424
return []
@@ -440,6 +441,8 @@ def get_shortest_path_to_cell(self, from_player_id: int = None, from_player: Pla
440
441
if row is None or col is None :
441
442
return None
442
443
cell = self ._map .get_cell (row , col )
444
+ else :
445
+ cell = self ._map .get_cell (cell .row , cell .col )
443
446
shortest_path_from_player = World ._shortest_path .get (from_player_id , None )
444
447
if shortest_path_from_player is None :
445
448
return None
0 commit comments