/// <summary> /// Will Cleanse only on Kill /// </summary> static void KillCleansing() { if (OneReady()) { QssSpell mySpell = null; if ( QssSpells.Where( spell => ObjectManager.Player.HasBuff(spell.SpellBuff, true) && SpellEnabledOnKill(spell.SpellBuff) && GetChampByName(spell.ChampName).GetSpellDamage(ObjectManager.Player, spell.Slot) > ObjectManager.Player.Health + HealthBuffer) .OrderBy( spell => GetChampByName(spell.ChampName).GetSpellDamage(ObjectManager.Player, spell.Slot)) .Any()) { mySpell = QssSpells.Where( spell => ObjectManager.Player.HasBuff(spell.SpellBuff, true) && SpellEnabledOnKill(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; QssSpell highestSpell = null; foreach (var ally in allies) { QssSpell theSpell = null; if (QssSpells.Where(spell => ally.HasBuff(spell.SpellBuff, true) && SpellEnabledOnKill(spell.SpellBuff) && GetChampByName(spell.ChampName).GetSpellDamage(ally, spell.Slot) > ally.Health + HealthBuffer).OrderBy(spell => GetChampByName(spell.ChampName).GetSpellDamage(ally, spell.Slot)).Any()) { theSpell = QssSpells.Where( spell => ally.HasBuff(spell.SpellBuff, true) && SpellEnabledOnKill(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 && PennyJinx.IsMenuEnabled("pennyjinx.cleanser.allies.useon." + ally.ChampionName)) { highestSpell = theSpell; highestDamage = (float)damageDone; highestAlly = ally; } } } if (!highestAlly.IsMe && highestSpell != null) { UseCleanser(highestSpell, highestAlly); } }
private static bool WillSpellKillMe(QssSpell spell) { var spells = SpellSlot.R; if (spell.SpellName.Contains(spell.ChampName + " R")) { spells = SpellSlot.R; } if (spell.SpellName.Contains(spell.ChampName + " Q")) { spells = SpellSlot.Q; } if (spell.SpellName.Contains(spell.ChampName + " W")) { spells = SpellSlot.W; } if (spell.SpellName.Contains(spell.ChampName + " E")) { spells = SpellSlot.E; } var theDamage = GetByChampName(spell.ChampName).GetDamageSpell(Player, spells).CalculatedDamage; BuffInstance theBuff = null; foreach (var buff in Player.Buffs.Where(buff => buff.Name == spell.SpellBuff)) { theBuff = buff; } if (theBuff != null) { var endTime = theBuff.EndTime; var difference = endTime - Environment.TickCount; //TODO Factor Player Regen } return(theDamage >= (Player.Health)); }
static void UseCleanser(QssSpell spell, Obj_AI_Hero target) { Utility.DelayAction.Add(SpellDelay(spell.RealName), () => CastCleanseItem(target)); }
private static bool WillSpellKillMe(QssSpell spell) { var spells = SpellSlot.R; if (spell.SpellName.Contains(spell.ChampName + " R")) { spells = SpellSlot.R; } if (spell.SpellName.Contains(spell.ChampName + " Q")) { spells = SpellSlot.Q; } if (spell.SpellName.Contains(spell.ChampName + " W")) { spells = SpellSlot.W; } if (spell.SpellName.Contains(spell.ChampName + " E")) { spells = SpellSlot.E; } var theDamage = GetByChampName(spell.ChampName).GetDamageSpell(Player, spells).CalculatedDamage; BuffInstance theBuff = null; foreach (var buff in Player.Buffs) { if (buff.Name == spell.SpellBuff) { theBuff = buff; } } if (theBuff != null) { var endTime = theBuff.EndTime; var difference = endTime - Environment.TickCount; //TODO Factor Player Regen } return theDamage >= (Player.Health); }