/// <summary> /// Cleanses using the SpellList buffs as input /// </summary> static void SpellCleansing() { if (OneReady()) { CleanseSpell mySpell = null; if ( QssSpells.Where( spell => ObjectManager.Player.HasBuff(spell.SpellBuff) && SpellEnabledAlways(spell.SpellBuff)) .OrderBy( spell => GetChampByName(spell.ChampName).GetSpellDamage(ObjectManager.Player, spell.Slot)) .Any()) { mySpell = QssSpells.Where( spell => ObjectManager.Player.HasBuff(spell.SpellBuff) && SpellEnabledAlways(spell.SpellBuff)) .OrderBy( spell => GetChampByName(spell.ChampName).GetSpellDamage(ObjectManager.Player, spell.Slot)) .First(); } if (mySpell != null) { UseCleanser(mySpell, ObjectManager.Player); } } if (!MichaelReady()) { return; } // Ally Cleansing var allies = ObjectManager.Player.GetAlliesInRange(600f); var highestAlly = ObjectManager.Player; var highestDamage = 0f; CleanseSpell highestSpell = null; foreach (var ally in allies) { CleanseSpell theSpell = null; if ( QssSpells.Where(spell => ally.HasBuff(spell.SpellBuff) && SpellEnabledAlways(spell.SpellBuff)) .OrderBy(spell => GetChampByName(spell.ChampName).GetSpellDamage(ally, spell.Slot)) .Any()) { theSpell = QssSpells.Where(spell => ally.HasBuff(spell.SpellBuff) && SpellEnabledAlways(spell.SpellBuff)) .OrderBy(spell => GetChampByName(spell.ChampName).GetSpellDamage(ally, spell.Slot)) .First(); } if (theSpell != null) { var damageDone = GetChampByName(theSpell.ChampName).GetSpellDamage(ally, theSpell.Slot); if (damageDone >= highestDamage && Variables.Menu.IsEnabled("ilucian.cleanser.allies.useon." + ally.ChampionName)) { highestSpell = theSpell; highestDamage = (float)damageDone; highestAlly = ally; } } } if (!highestAlly.IsMe && highestSpell != null) { UseCleanser(highestSpell, highestAlly); } }
static void UseCleanser(CleanseSpell spell, Obj_AI_Hero target) { Utility.DelayAction.Add(SpellDelay(spell.RealName), () => CastCleanseItem(target)); }
static void UseCleanser(CleanseSpell spell, AIHeroClient target) { LeagueSharp.Common.Utility.DelayAction.Add(SpellDelay(spell.RealName), () => CastCleanseItem(target)); }