var spell = new LeagueSharp.Common.Spell(LeagueSharp.Common.SpellSlot.Q, 1000); var target = ObjectManager.Get().First(h => h.IsEnemy); var damage = spell.GetDamage(target); Console.WriteLine($"The Q spell does {damage} damage to {target.ChampionName}.");
var spell = new LeagueSharp.Common.Spell(LeagueSharp.Common.SpellSlot.W, 500); var target = ObjectManager.GetIn the second example, a new spell is created with a range of 500 units and then the damage that it can do to the nearest enemy champion is calculated using the GetDamage function. If the damage is greater than the target's current health, the spell is cast on the target using the CastOnUnit function. Overall, these examples showcase how to use the GetDamage function from the LeagueSharp.Common package library in C#.().First(h => h.IsEnemy); if (spell.GetDamage(target) > target.Health) { spell.CastOnUnit(target); }