private void Game_ProcessSpell(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (enabled) { try { AIHeroClient target = args.Target as AIHeroClient; if (target != null && target.Team != sender.Team) { if (sender.IsValid && !sender.IsDead) { var data = IncomingDamagesAlly.Concat(IncomingDamagesEnemy) .FirstOrDefault(i => i.Hero.NetworkId == target.NetworkId); if (data != null) { var missileSpeed = (sender.Distance(target) / args.SData.MissileSpeed) + args.SData.SpellCastTime; missileSpeed = missileSpeed > 1f ? 0.8f : missileSpeed; if (Orbwalking.IsAutoAttack(args.SData.Name)) { var dmg = (float) (sender.GetAutoAttackDamage(target, true) + ItemHandler.GetSheenDmg(target)); if (args.SData.Name.ToLower().Contains("crit")) { dmg = dmg * 2; } data.Damages.Add( new Dmg(target, dmg, missileSpeed, !sender.Name.ToLower().Contains("turret"))); } else { var hero = sender as AIHeroClient; if (hero == null) { return; } if (!DrawHelper.damagePredEnabled(hero.ChampionName, args.Slot)) { return; } if ( !CombatHelper.BuffsList.Any( b => args.Slot == b.Slot && hero.ChampionName == b.ChampionName)) { data.Damages.Add( new Dmg( target, (float) Damage.GetSpellDamage(hero, (Obj_AI_Base)args.Target, args.Slot), missileSpeed, false, SpellDatabase.CcList.Any( cc => cc.Slot == args.Slot && cc.Champion.ChampionName == hero.ChampionName))); } } } } } } catch (Exception) {} } }
private static AttackableUnit GetTarget(bool isCombo, bool isFarm, bool isLastHit, int targetMode) { AttackableUnit gtarget = null; if (isCombo) { switch (targetMode) { case 0: gtarget = DrawHelper.GetBetterTarget(range, TargetSelector.DamageType.Magical); break; case 1: gtarget = HeroManager.Enemies.Where(i => player.Distance(i) <= range) .OrderBy(i => i.Health) .FirstOrDefault(); break; case 2: gtarget = HeroManager.Enemies.Where(i => player.Distance(i) <= range) .OrderBy(i => player.Distance(i)) .FirstOrDefault(); break; default: break; } } else { List <AttackableUnit> otherTarget = MinionManager.GetMinions(1000, MinionTypes.All, MinionTeam.NotAlly) .Where( m => HealthPrediction.GetHealthPrediction(m, 2000) > Pet.GetAutoAttackDamage(m) || m.Health < Pet.GetAutoAttackDamage(m)) .Select(m => m as AttackableUnit) .ToList() .Concat( ObjectManager.Get <Obj_AI_Turret>() .Where(t => t.IsValidTarget() && t.Position.Distance(player.Position) < range)) .ToList(); if (isFarm) { gtarget = otherTarget.OrderByDescending(m => Pet.GetAutoAttackDamage((Obj_AI_Base)m) > m.Health) .ThenByDescending(m => m.MaxHealth) .ThenByDescending(m => player.Distance(m)) .FirstOrDefault(); } if (isLastHit) { gtarget = otherTarget.Where(m => Pet.GetAutoAttackDamage((Obj_AI_Base)m) > m.Health) .OrderByDescending(m => player.Distance(m)) .FirstOrDefault(); } } return(gtarget); }