@@ -126,26 +126,28 @@ def load_context(self, replay):
126126class AbilityEvent (PlayerActionEvent ):
127127 def __init__ (self , framestamp , player , type , code , ability ):
128128 super (AbilityEvent , self ).__init__ (framestamp , player , type , code )
129- self .ability = ability
129+ self .ability_code = ability
130130
131131 def load_context (self , replay ):
132132 super (AbilityEvent , self ).load_context (replay )
133133
134- if self .ability not in replay .datapack .abilities :
134+ if self .ability_code not in replay .datapack .abilities :
135135 if not getattr (replay , 'marked_error' , None ):
136136 replay .marked_error = True
137137 self .logger .error (replay .filename )
138138 self .logger .error ("Release String: " + replay .release_string )
139139 for player in replay .players :
140140 self .logger .error ("\t " + str (player ))
141- self .logger .error ("{0}\t {1}\t Missing ability {2} from {3}" .format (self .frame , self .player .name , hex (self .ability ), replay .datapack .__class__ .__name__ ))
141+ self .logger .error ("{0}\t {1}\t Missing ability {2} from {3}" .format (self .frame , self .player .name , hex (self .ability_code ), replay .datapack .__class__ .__name__ ))
142+ self .ability = "UNKNOWN"
143+ else :
144+ self .ability = replay .datapack .abilities [self .ability_code ]
142145
143146 def __str__ (self ):
144- if not self .ability :
147+ if not self .ability_code :
145148 return self ._str_prefix () + "Move"
146149 else :
147- ability_name = self .data .ability (self .ability ) if self .ability in self .data .abilities else "UNKNOWN"
148- return self ._str_prefix () + "Ability (%s) - %s" % (hex (self .ability ), ability_name )
150+ return self ._str_prefix () + "Ability (%s) - %s" % (hex (self .ability_code ), self .ability )
149151
150152@loggable
151153class TargetAbilityEvent (AbilityEvent ):
0 commit comments