Skip to content

Commit 8bb1d60

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 2bf8185 + fa842e5 commit 8bb1d60

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Diff for: model.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import copy
21
from enum import Enum
3-
42
from typing import *
53

64

Diff for: world.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ def _handle_turn_kings(self, msg):
201201
self.get_player_by_id(king_msg["playerId"]).king.hp = king_msg["hp"]
202202
if king_msg["target"] != -1:
203203
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
205206
else:
206207
self.get_player_by_id(king_msg["playerId"]).king.target = None
207208
self.get_player_by_id(king_msg["playerId"]).king.target_cell = None
@@ -293,20 +294,20 @@ def _handle_turn_cast_spells(self, msg):
293294
cast_spell_msg["affectedUnits"]]
294295
if spell.is_area_spell():
295296
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)
299300
self._cast_spells.append(cast_area_spell)
300301
if cast_spell_msg["wasCastThisTurn"]:
301302
self.get_player_by_id(cast_spell_msg["casterId"]).cast_area_spell = cast_area_spell
302303

303304
elif spell.is_unit_spell():
304305
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)
310311
self._cast_spells.append(cast_unit_spell)
311312
if cast_spell_msg["wasCastThisTurn"]:
312313
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):
338339
self._player_friend.set_spells([self.get_spell_by_id(spell_id) for spell_id in msg["friendSpells"]])
339340
self._player.ap = msg["remainingAP"]
340341

341-
342342
def choose_hand_by_id(self, type_ids: List[int]) -> None:
343343
message = Message(type="pick", turn=self.get_current_turn(), info=None)
344344
if type_ids is not None:
@@ -400,7 +400,7 @@ def get_paths_crossing_cell(self, cell: Cell = None, row: int = None, col: int =
400400
Logs.show_log("get_paths_crossing cell function called with no valid argument")
401401
return []
402402
cell = self._map.get_cell(row, col)
403-
403+
cell = self._map.get_cell(cell.row, cell.col)
404404
if not isinstance(cell, Cell):
405405
Logs.show_log("Given cell is invalid!")
406406
return []
@@ -418,6 +418,7 @@ def get_cell_units(self, cell: Cell = None, row: int = None, col: int = None) ->
418418
Logs.show_log("get_paths_crossing cell function called with no valid argument")
419419
return []
420420
cell = self._map.get_cell(row, col)
421+
cell = self._map.get_cell(cell.row, cell.col)
421422
if not isinstance(cell, Cell):
422423
Logs.show_log("Given cell is invalid!")
423424
return []
@@ -440,6 +441,8 @@ def get_shortest_path_to_cell(self, from_player_id: int = None, from_player: Pla
440441
if row is None or col is None:
441442
return None
442443
cell = self._map.get_cell(row, col)
444+
else:
445+
cell = self._map.get_cell(cell.row, cell.col)
443446
shortest_path_from_player = World._shortest_path.get(from_player_id, None)
444447
if shortest_path_from_player is None:
445448
return None

0 commit comments

Comments
 (0)