@@ -364,29 +364,27 @@ def __init__(self, framestamp, player, type, code, ability, target):
364364 def apply (self , data ):
365365 self .data = data
366366 obj_id , obj_type = self .target
367- if not obj_id :
368- # fog of war
369- pass
370- else :
367+
368+ try :
371369 obj_type = obj_type << 8 | 0x01
372- try :
373- type_class = self .data .types [obj_type ]
374- # Could this be hallucinated?
375- create_obj = not ((obj_type & 0xfffffc | 0x2 ) in self .data .types )
376-
377- obj = None
378- if (obj_id , obj_type ) in self .player .replay .objects :
379- obj = self .player .replay .objects [(obj_id , obj_type )]
380- elif create_obj :
381- obj = type_class (obj_id , self .frame )
382- self .player .replay .objects [(obj_id , obj_type )] = obj
370+ type_class = self .data .types [obj_type ]
371+
372+ obj = None
373+ if (obj_id , obj_type ) in self .player .replay .objects :
374+ obj = self .player .replay .objects [(obj_id , obj_type )]
375+
376+ elif obj_id :
377+ obj = type_class (obj_id , self .frame )
378+ self .player .replay .objects [(obj_id , obj_type )] = obj
383379
384- if obj :
385- obj .visit (self .frame , self .player , type_class )
380+ if obj :
381+ obj .visit (self .frame , self .player , type_class )
386382 self .target = obj
387- except KeyError :
388- # print "Unknown object type (%s) at frame %s" % (hex(obj_type),self.frame)
389- pass
383+ else :
384+ self .target = (obj_id , obj_type )
385+ except KeyError :
386+ # print "Unknown object type (%s) at frame %s" % (hex(obj_type),self.frame)
387+ pass
390388 super (TargetAbilityEvent , self ).apply (data )
391389
392390 def __str__ (self ):
0 commit comments