public DamageMaker(Obj_AI_Base sourceIn, Obj_AI_Base targetIn, GameObject missleIn, SpellData dataIn, bool meleeIn = false) { Source = sourceIn; Target = targetIn; Missle = missleIn; SData = dataIn; Melee = !meleeIn; CreatedTick = Now; IsAutoAtack = SData.IsAutoAttack(); if (IsAutoAtack) { DealDamage = (float)Source.GetAutoAttackDamage(Target, true); if (Source.IsMelee) { Cycle = (int)(Source.AttackDelay * 1000); } else { //var dist = source.Distance(target); Cycle = (int)((Source.AttackDelay * 1000)) /*+ (dist*1000)/sData.MissileSpeed)*/; //Console.WriteLine("cycle: " + cycle); } //Console.WriteLine("cycle: " + source.AttackSpeedMod); } else { Cycle = 0; var client = Source as AIHeroClient; if (client != null) { var tSpell = TargetSpellDatabase.GetByName(SData.Name); if (tSpell == null) { //Console.WriteLine("Unknown targeted spell: " + sData.Name); DealDamage = 0; } else { try { DealDamage = (float)client.GetSpellDamage(Target, tSpell.Spellslot); } catch (Exception) { DealDamage = 0; } } } else { DealDamage = 0; } } }
public DamageMaker(Obj_AI_Base sourceIn, Obj_AI_Base targetIn, GameObject missleIn, SpellData dataIn, bool meleeIn = false) { source = sourceIn; target = targetIn; missle = missleIn; sData = dataIn; melee = !meleeIn; createdTick = now; isAutoAtack = sData.IsAutoAttack(); if (isAutoAtack) { dealDamage = (float)source.GetAutoAttackDamage(target, true); if (source.IsMelee) { cycle = (int)(source.AttackDelay * 1000); } else { //var dist = source.Distance(target); cycle = (int)((source.AttackDelay * 1000)) /*+ (dist*1000)/sData.MissileSpeed)*/; //Console.WriteLine("cycle: " + cycle); } //Console.WriteLine("cycle: " + source.AttackSpeedMod); } else { cycle = 0; if (source is AIHeroClient) { var tSpell = TargetSpellDatabase.GetByName(sData.Name); if (tSpell == null) { //Console.WriteLine("Unknown targeted spell: " + sData.Name); dealDamage = 0; } else { try { dealDamage = (float)((AIHeroClient)source).GetSpellDamage(target, tSpell.Spellslot); } catch (Exception) { dealDamage = 0; } } } else { dealDamage = 0; } } }
private static void OnTargetSpellDetection(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { try { // TODO: add menu check //Cassiopeia_Base_E_TwinFang_tar.troy //Cassiopeia_Base_E_TwinFang_mis.troy /* foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(args.SData)) * { * string name = descriptor.Name; * object value = descriptor.GetValue(args.SData); * // if (value == "Cassiopeia_Base_E_TwinFang_mis.troy") * Console.WriteLine("{0}={1}", name, value); * }*/ var caster = sender as AIHeroClient; var target = args.Target as Obj_AI_Base; if (caster == null || target == null) { return; } var data = TargetSpellDatabase.GetByName(args.SData.Name); if (Orbwalking.IsAutoAttack(args.SData.Name)) { data = new TargetSpellData( caster.ChampionName.ToLower(), args.SData.Name.ToLower(), SpellSlot.Unknown, SpellType.AutoAttack, CcType.No, caster.AttackRange, caster.AttackDelay, caster.BasicAttack.MissileSpeed); // TODO: check melee } return; /*if (data == null) * { * Console.WriteLine("Target Spell not Found: " + args.SData.Name); * return; * }*/ ActiveTargeted.Add(new TargetSpell { Caster = caster, Target = target, Spell = data, StartTick = Environment.TickCount, StartPosition = args.Start.To2D(), blockBelow = TargetedSpellManager.blockSpellOnHP(caster.ChampionName, args.SData.Name), spellArgs = args, particleName = getParticleName(args.SData.MissileEffectName) }); } catch (Exception e) { Console.WriteLine(e); } }
private static void OnTargetSpellDetection(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { try { //MissileEffect=Cassiopeia_Base_E_TwinFang_mis.troy if (sender.Position.Distance(ObjectManager.Player.Position) > DetectionRange) { return; // only detect spells in range } if (!sender.IsValid <Obj_AI_Hero>()) { return; // only hero } if (!args.Target.IsValid <Obj_AI_Base>()) { return; // only targeted } if (args.SData.Name.ToLower().Contains("summoner") || args.SData.Name.ToLower().Contains("recall")) { return; // ignore summoners TODO: add summoners to database } // TODO: add menu check //Cassiopeia_Base_E_TwinFang_tar.troy //Cassiopeia_Base_E_TwinFang_mis.troy /* foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(args.SData)) * { * string name = descriptor.Name; * object value = descriptor.GetValue(args.SData); * // if (value == "Cassiopeia_Base_E_TwinFang_mis.troy") * Console.WriteLine("{0}={1}", name, value); * }*/ var caster = (Obj_AI_Hero)sender; var target = (Obj_AI_Base)args.Target; var data = TargetSpellDatabase.GetByName(args.SData.Name); if (Orbwalking.IsAutoAttack(args.SData.Name)) { data = new TargetSpellData( caster.ChampionName.ToLower(), args.SData.Name.ToLower(), SpellSlot.Unknown, SpellType.AutoAttack, CcType.No, caster.AttackRange, caster.AttackDelay, caster.BasicAttack.MissileSpeed); // TODO: check melee } /*if (data == null) * { * Console.WriteLine("Target Spell not Found: " + args.SData.Name); * return; * }*/ ActiveTargeted.Add(new TargetSpell { Caster = caster, Target = target, Spell = data, StartTick = Environment.TickCount, StartPosition = args.Start.To2D(), blockBelow = TargetedSpellManager.blockSpellOnHP(caster.ChampionName, args.SData.Name), spellArgs = args, particleName = getParticleName(args.SData.MissileEffect) }); } catch (Exception e) { Console.WriteLine(e); } }
private static void OnTargetSpellDetection(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { try { if (OnTargetSpell == null) { return; // only if subscribers } if (sender.Position.Distance(ObjectManager.Player.Position) > DetectionRange) { return; // only detect spells in range } if (!sender.IsValid <Obj_AI_Hero>()) { return; // only hero } if (!args.Target.IsValid <Obj_AI_Base>()) { return; // only targeted } if (args.SData.Name.ToLower().Contains("summoner") || args.SData.Name.ToLower().Contains("recall")) { return; // ignore summoners TODO: add summoners to database } // TODO: add menu check var caster = (Obj_AI_Hero)sender; var target = (Obj_AI_Base)args.Target; var data = TargetSpellDatabase.GetByName(args.SData.Name); if (Orbwalking.IsAutoAttack(args.SData.Name)) { data = new TargetSpellData( caster.ChampionName.ToLower(), args.SData.Name.ToLower(), SpellSlot.Unknown, SpellType.AutoAttack, CcType.No, caster.AttackRange, caster.AttackDelay, caster.BasicAttack.MissileSpeed); // TODO: check melee } if (data == null) { Console.WriteLine("Target Spell not Found: " + args.SData.Name); return; } ActiveTargeted.Add(new TargetSpell { Caster = caster, Target = target, Spell = data, StartTick = Environment.TickCount, StartPosition = args.Start.To2D() }); } catch (Exception e) { Console.WriteLine(e); } }
public static void autoE(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (!sender.IsValidTarget() || !sender.IsChampion(sender.BaseSkinName) || sender.Distance(ObjectManager.Player) > 1500 || !SpellHandler._spells[LeagueSharp.SpellSlot.E].IsReady() || args.SData.IsAutoAttack()) { return; } var sData = TargetSpellDatabase.GetByName(args.SData.Name); if (MenuHandler.Config.Item(sData.Name) == null) { Console.WriteLine("Menu missing"); return; } if ((MenuHandler.Config.Item("donteCC").GetValue <bool>() && sData.Type != SpellType.AutoAttack && sData.CcType != CcType.No) || !MenuHandler.Config.Item(sData.Name).GetValue <bool>() || sData.Type == SpellType.Self) { return; } if (sData.Type == SpellType.Skillshot) { var sShot = SpellDatabase.GetByName(args.SData.Name); if (sShot.Type == SkillShotType.SkillshotMissileLine || sShot.Type == SkillShotType.SkillshotLine) { var value = sShot.Range / sShot.Radius; for (int i = 0; i < value; i++) { var vector = sender.Position.Extend(args.End, (i * sShot.Radius)); if (ObjectManager.Player.Distance(vector) < sShot.Radius) { SpellHandler.CastE((MenuHandler.Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None) ? (StateHandler.Target.IsValidTarget() ? StateHandler.Target.Position : Game.CursorPos) : Game.CursorPos); break; } } } if (sShot.Type == SkillShotType.SkillshotCircle) { if (sShot.MissileSpeed == int.MaxValue) { return; } if (ObjectManager.Player.Position.Distance(args.End) < sShot.Radius) { SpellHandler.CastE((MenuHandler.Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None) ? (StateHandler.Target.IsValidTarget() ? StateHandler.Target.Position : Game.CursorPos) : Game.CursorPos); } } if (args.End.Distance(ObjectManager.Player.Position) < 100) { SpellHandler.CastE((MenuHandler.Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None) ? (StateHandler.Target.IsValidTarget() ? StateHandler.Target.Position : Game.CursorPos) : Game.CursorPos); return; } } if (sData.Type == SpellType.Targeted && args.Target.IsMe) { SpellHandler.CastE((MenuHandler.Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None) ? (StateHandler.Target.IsValidTarget() ? StateHandler.Target.Position : Game.CursorPos) : Game.CursorPos); } }