Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZergMacroTracker: Look for UpdateTargetAbilityEvent to track injects. #11

Merged
merged 2 commits into from
Jun 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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