예제 #1
0
 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.IsAutoAttackLS(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)
                                         LeagueSharp.Common.Damage.GetSpellDamageLS(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) {}
     }
 }