private IEnumerable <(Player, TimeSpan)> GetTaunts(TimeSpan start, TimeSpan end, IEnumerable <Player> alive, Replay replay) { IEnumerable <GameEvent> gameEvents = replay.GameEvents.Where(e => replayHelper.IsWithin(e.TimeSpan, start, end)); foreach (IGrouping <Player, GameEvent> events in gameEvents.Where(e => replayHelper.IsHearthStone(replay, e)).GroupBy(e => e.player)) { // May need to also find click events within the same time frame to confirm legitimate bstepping var bsteps = events.GroupBy(cmd => cmd.TimeSpan).Where(g => g.Count() > 3); if (bsteps.Any() && alive.Contains(events.Key)) { yield return(events.Key, bsteps.Max(x => x.Key)); } } foreach (IGrouping <Player, GameEvent> events in gameEvents.Where(e => replayHelper.IsTaunt(replay, e)).GroupBy(e => e.player)) { if (alive.Contains(events.Key)) { yield return(events.Key, events.Max(t => t.TimeSpan)); } } foreach (IGrouping <Player, GameEvent> events in gameEvents.Where(e => replayHelper.IsDance(replay, e)).GroupBy(e => e.player)) { if (alive.Contains(events.Key)) { yield return(events.Key, events.Max(t => t.TimeSpan)); } } }
// https://github.com/ebshimizu/hots-parser/blob/97a03da10c9922ded6c64d8660756dfc95ad13a1/parser.js#L2159 private void PrintBStepping(Replay replay, TimeSpan timer) { IEnumerable <IGrouping <Player, GameEvent> > bStepping = replay.GameEvents .Where(gameEvent => replayHelper.IsHearthStone(replay, gameEvent) && replayHelper.IsWithin(gameEvent.TimeSpan, timer, timer.Add(TimeSpan.FromSeconds(1)))) .GroupBy(gameEvent => gameEvent.player); // This could actually be wrong, because we dont check sequence for right click, which is what cancels a hearth back, to produce the b-stepping effect // more than 3+ within a second is probably b-stepping behaviour foreach (IGrouping <Player, GameEvent> commands in bStepping.Where(cmds => cmds.Count() >= 3)) { logger.LogDebug($"BStepping: {commands.Key.HeroId}:{commands.Count()}"); } }