Skip to content

Commit

Permalink
Merge pull request #11 from gravelweb/update-target
Browse files Browse the repository at this point in the history
ZergMacroTracker: Look for UpdateTargetAbilityEvent to track injects.
  • Loading branch information
dsjoerg authored Jun 13, 2016
2 parents 00db359 + aa61415 commit 68e0a0f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sc2parse/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ def ZergMacroTracker(replay):
for player in replay.players:
player.hatches = dict()

efilter = lambda e: e.name == "TargetAbilityEvent" and hasattr(e, "ability") and e.ability_name == 'SpawnLarva'
efilter = lambda e: e.name.endswith("TargetAbilityEvent") and hasattr(e, "ability") and e.ability_name == "SpawnLarva"
for event in filter(efilter, replay.events):
owner = event.player
target_hatch = event.target
Expand Down
Binary file added sc2parse/testfiles/replay33.SC2Replay
Binary file not shown.
13 changes: 13 additions & 0 deletions sc2parse/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,19 @@ def dont_test_creepspread_speed(self):
after = datetime.now()
print after - before

def test_zerg_macro_injects(self):
# FIXME: Not handling queued injects in LOTV (ggtrackerstack issue#50)
# Will need tests for expansions < LOTV as well
replay = self.get_parsed_replay(33)

hatches = sorted(replay.players[1].hatches.itervalues())
injects = [h.injects for h in hatches]
self.assertEqual(injects, [
[3774, 4508, 5297, 6343, 7346, 8147, 9668],
[3811, 4518, 5307, 6352, 7355, 8155, 9678],
[],
])


class SC2ReaderToEsdbPKDependentTestCases(TransactionTestCase):
reset_sequences = True
Expand Down

0 comments on commit 68e0a0f

Please sign in to comment.