diff --git a/sc2parse/plugins.py b/sc2parse/plugins.py index 9144350..703fa7c 100644 --- a/sc2parse/plugins.py +++ b/sc2parse/plugins.py @@ -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 diff --git a/sc2parse/testfiles/replay33.SC2Replay b/sc2parse/testfiles/replay33.SC2Replay new file mode 100644 index 0000000..d64f445 Binary files /dev/null and b/sc2parse/testfiles/replay33.SC2Replay differ diff --git a/sc2parse/tests.py b/sc2parse/tests.py index 0f67332..eaf7cf8 100644 --- a/sc2parse/tests.py +++ b/sc2parse/tests.py @@ -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