Spell q = new Spell(SpellSlot.Q, 1000); if(q.CanCast() && ObjectManager.Player.Distance(target) < q.Range) { q.Cast(target); }
Spell q = new Spell(SpellSlot.Q, 1000); Spell w = new Spell(SpellSlot.W, 600); Spell e = new Spell(SpellSlot.E, 750); if(q.CanCast() && ObjectManager.Player.Distance(target) < q.Range) { q.Cast(target); return; } if(w.CanCast() && ObjectManager.Player.Distance(target) < w.Range) { w.Cast(target); return; } if(e.CanCast() && ObjectManager.Player.Distance(target) < e.Range) { e.Cast(target); return; }This code creates Spell objects for the champion's Q, W, and E abilities with their respective ranges. It then checks if the champion can cast each spell and if the enemy target is within range. If a spell can be cast and the target is within range, it casts the spell before returning to keep the combo going. Overall, the LeagueSharp.Common package library provides useful methods and objects for developing League of Legends scripts in C#. The Spell CanCast method is just one example of the many tools available in the library.