@@ -292,19 +292,24 @@ def _handle_turn_cast_spells(self, msg):
292292 affected_unit_id in
293293 cast_spell_msg ["affectedUnits" ]]
294294 if spell .is_area_spell ():
295- self ._cast_spells .append (
296- CastAreaSpell (spell = spell , id = cast_spell_msg ["id" ],
295+ cast_area_spell = CastAreaSpell (spell = spell , id = cast_spell_msg ["id" ],
297296 caster_id = cast_spell_msg ["casterId" ], cell = cell ,
298297 remaining_turns = cast_spell_msg ["remainingTurns" ],
299- affected_units = affected_units ))
298+ affected_units = affected_units )
299+ self ._cast_spells .append (cast_area_spell )
300+ if cast_spell_msg ["wasCastThisTurn" ]:
301+ self .get_player_by_id (cast_spell_msg ["casterId" ]).cast_area_spell = cast_area_spell
302+
300303 elif spell .is_unit_spell ():
301- self ._cast_spells .append (
302- CastUnitSpell (spell = spell , id = cast_spell_msg ["id" ],
304+ cast_unit_spell = CastUnitSpell (spell = spell , id = cast_spell_msg ["id" ],
303305 caster_id = cast_spell_msg ["casterId" ],
304306 cell = cell ,
305307 unit = self .get_unit_by_id (cast_spell_msg ["unitId" ]),
306308 path = self ._map .get_path_by_id (cast_spell_msg ["pathId" ]),
307- affected_units = affected_units ))
309+ affected_units = affected_units )
310+ self ._cast_spells .append (cast_unit_spell )
311+ if cast_spell_msg ["wasCastThisTurn" ]:
312+ self .get_player_by_id (cast_spell_msg ["casterId" ]).cast_unit_spell = cast_unit_spell
308313
309314 def get_cast_spell_by_id (self , id : int ) -> Optional ["CastSpell" ]:
310315 for cast_spell in self ._cast_spells :
@@ -333,6 +338,7 @@ def _handle_turn_message(self, msg):
333338 self ._player_friend .set_spells ([self .get_spell_by_id (spell_id ) for spell_id in msg ["friendSpells" ]])
334339 self ._player .ap = msg ["remainingAP" ]
335340
341+
336342 def choose_hand_by_id (self , type_ids : List [int ]) -> None :
337343 message = Message (type = "pick" , turn = self .get_current_turn (), info = None )
338344 if type_ids is not None :
0 commit comments