private static void OnTick(EventArgs args) { // Update rend entities RendEntities.Clear(); RendBuffs.Clear(); foreach (var entity in ObjectManager.Get <Obj_AI_Base>().Where(o => o.IsValidTarget(onlyEnemyTeam: true))) { // Get the rend buff var rendBuff = GetRendBuffInternal(entity); if (rendBuff != null) { RendEntities.Add(entity); RendBuffs[entity.NetworkId] = rendBuff; } } RendMinions = new HashSet <Obj_AI_Minion>(RendEntities.OfType <Obj_AI_Minion>()); RendHeroes = new HashSet <AIHeroClient>(RendEntities.OfType <AIHeroClient>()); // Calculate rend damages and killable status RendDamages.Clear(); RendKillable.Clear(); foreach (var entity in RendEntities.ToArray()) { // Get the rend buff var rendBuff = entity.GetRendBuff(); // Should always be true if (rendBuff != null) { var damage = Damages.GetRendDamage(entity, rendBuff: rendBuff); var killable = Damages.IsRendKillable(entity, damage); // Update values RendDamages[entity.NetworkId] = damage; RendKillable[entity.NetworkId] = killable; } else { // Should never happen, but if so, remove from the lists RendEntities.Remove(entity); RendMinions.Remove(entity as Obj_AI_Minion); RendHeroes.Remove(entity as AIHeroClient); } } }
public static float GetRendDamage(this Obj_AI_Base target) { return(RendDamages.ContainsKey(target.NetworkId) ? RendDamages[target.NetworkId] : 0); }