Skip to content

Commit bdfc99f

Browse files
committed
Adds new SelfAbilityEvent subclass for abilities with no target object or location.
1 parent 0c391fc commit bdfc99f

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

sc2reader/events.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ def __init__(self, framestamp, player, type, code, ability, location):
180180
def __str__(self):
181181
return AbilityEvent.__str__(self) + "; Location: %s" % str(self.location)
182182

183+
class SelfAbilityEvent(AbilityEvent):
184+
pass
185+
183186
class UnknownAbilityEvent(AbilityEvent):
184187
pass
185188

sc2reader/readers.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def command_card(self, buffer, frames, type, code, pid, flag, atype):
573573
return TargetAbilityEvent(frames, pid, type, code, ability, target)
574574

575575
else:
576-
return AbilityEvent(frames,pid,type,code,ability)
576+
return SelfAbilityEvent(frames,pid,type,code,ability)
577577

578578
def right_click_target(self, buffer, frames, type, code, pid, flag, atype):
579579
# ability (2), object id (4), object type (2), ?? (10)
@@ -696,9 +696,7 @@ def command_card(self, buffer, frames, type, code, pid, flag, atype):
696696
return TargetAbilityEvent(frames, pid, type, code, ability, target)
697697

698698
else:
699-
pass
700-
701-
return UnknownLocationAbilityEvent(frames, pid, type, code, ability)
699+
return SelfAbilityEvent(frames, pid, type, code, ability)
702700

703701

704702
class GameEventsReader_19595(GameEventsReader_18574):
@@ -725,9 +723,7 @@ def command_card(self, buffer, frames, type, code, pid, flag, atype):
725723
return TargetAbilityEvent(frames, pid, type, code, ability, target)
726724

727725
else:
728-
pass
729-
730-
return UnknownLocationAbilityEvent(frames, pid, type, code, ability)
726+
return SelfAbilityEvent(frames, pid, type, code, ability)
731727

732728
def right_click_target(self, buffer, frames, type, code, pid, flag, atype):
733729
# extra byte long

0 commit comments

Comments
 (0)