@@ -13,6 +13,7 @@ class World:
1313
1414 def __init__ (self , world = None , queue = None ):
1515 self ._start_time = 0
16+ self ._init_message = None
1617 self ._game_constants = None
1718
1819 self ._turn_updates = None
@@ -30,6 +31,7 @@ def __init__(self, world=None, queue=None):
3031 self ._cast_spells = []
3132
3233 if world is not None :
34+ self ._init_message = world ._init_message
3335 self ._game_constants = world ._game_constants
3436
3537 self ._turn_updates = TurnUpdates (turn_updates = world ._turn_updates )
@@ -185,6 +187,7 @@ def _spells_init(self, msg):
185187 for spell in msg ]
186188
187189 def _handle_init_message (self , msg ):
190+ self ._init_message = msg
188191 self ._start_time = self ._get_current_time_millis ()
189192 self ._game_constant_init (msg ['gameConstants' ])
190193 self ._map_init (msg ["map" ])
@@ -311,6 +314,7 @@ def get_cast_spell_by_id(self, id: int) -> Optional["CastSpell"]:
311314
312315 def _handle_turn_message (self , msg ):
313316 self ._start_time = self ._get_current_time_millis ()
317+ self ._handle_init_message (self ._init_message )
314318 self ._current_turn = msg ['currTurn' ]
315319 self ._player .deck = [self ._get_base_unit_by_id (deck_type_id ) for deck_type_id in msg ["deck" ]]
316320 self ._player .hand = [self ._get_base_unit_by_id (hand_type_id ) for hand_type_id in msg ["hand" ]]
0 commit comments