private static void ClearFarmAfterAttackEvent(AttackableUnit target) { try { if (!MyManaManager.SpellFarm) { return; } if (target.IsBuilding()) { if (ClearMenu["FlowersRiven.ClearMenu.LaneClearQTurret"].Enabled && Q.Ready && Me.CountEnemyHeroesInRange(800) == 0) { Q.Cast(target.ServerPosition); } } else if (target.Type == GameObjectType.obj_AI_Minion) { if (target.IsMinion()) { if (ClearMenu["FlowersRiven.ClearMenu.LaneClearQ"].Enabled && Q.Ready) { var minions = GameObjects.EnemyMinions.Where(x => x.IsValidTarget(400, false, false, target.ServerPosition) && x.IsMinion()).ToArray(); if (minions.Length >= 2) { Q.Cast(target.ServerPosition); } } } else if (target.IsMob()) { var mob = target as Obj_AI_Minion; if (mob != null && mob.IsValidTarget() && target.Health > Me.GetAutoAttackDamage(mob) * 2) { if (ClearMenu["FlowersRiven.ClearMenu.JungleClearQ"].Enabled && Q.Ready) { Q.Cast(mob.ServerPosition); } else if (ClearMenu["FlowersRiven.ClearMenu.JungleClearW"].Enabled && W.Ready && target.IsValidTarget(W.Range)) { W.Cast(); } else if (ClearMenu["FlowersRiven.ClearMenu.JungleClearE"].Enabled && E.Ready) { E.Cast(mob.ServerPosition); } } } } } catch (Exception ex) { Console.WriteLine("Error in MyEventManager.ClearFarmAfterAttackEvent." + ex); } }