Ejemplo n.º 1
0
        /// <summary>
        ///     Returns true if the target will die before the spell finish him.
        /// </summary>
        public static bool WillDie(this Obj_AI_Base target, Spell.SpellBase spell)
        {
            if (spell.CastDelay == 0)
            {
                spell.CastDelay = 250;
            }

            var incDmg = 0f;
            var delay  = spell.CastDelay;

            var incSkillshots = SkillshotDetector.SkillshotsDetected.FindAll(s => s.WillHit(target));

            if (incSkillshots.Any())
            {
                incDmg += incSkillshots.Sum(s => (s.Caster as AIHeroClient)?.GetSpellDamage(target, s.Data.slot) ?? 0);
            }
            var incTargetedSpell = TargetedSpellDetector.DetectedTargetedSpells.FindAll(s => s.Target.IdEquals(target));

            if (incTargetedSpell.Any())
            {
                incDmg += incTargetedSpell.Sum(s => s.Caster.GetSpellDamage(target, s.Data.slot));
            }
            var incDangerBuff = DangerBuffDetector.DangerBuffsDetected.FindAll(s => s.Target.IdEquals(target));

            if (incDangerBuff.Any())
            {
                incDmg += incDangerBuff.Sum(s => s.Caster.GetSpellDamage(target, s.Data.Slot));
            }
            var incAA = EmpoweredAttackDetector.DetectedEmpoweredAttacks.FindAll(s => s.Target.IdEquals(target));

            if (incAA.Any())
            {
                incDmg += incAA.Sum(s => s.Caster.GetAutoAttackDamage(target, true));
            }

            return(spell.GetHealthPrediction(target) <= 0f || target.PredictHealth(delay) <= incDmg);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Returns true if the target will die before the spell finish him.
 /// </summary>
 public static bool WillDie(this Obj_AI_Base target, Spell.SpellBase spell)
 {
     return(spell.GetHealthPrediction(target) <= 0);
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Returns true if the spell will kill the target.
 /// </summary>
 public static bool WillKill(this Spell.SpellBase spell, Obj_AI_Base target, float MultiplyDmgBy = 1, float ExtraDamage = 0, DamageType ExtraDamageType = DamageType.True)
 {
     return(Player.Instance.GetSpellDamage(target, spell.Slot) * MultiplyDmgBy + Player.Instance.CalculateDamageOnUnit(target, ExtraDamageType, ExtraDamage) >= spell.GetHealthPrediction(target) && !target.WillDie(spell));
 }
Ejemplo n.º 4
0
 public static AIHeroClient GetKillStealTarget(this Spell.SpellBase spell, float dmg = 0, DamageType damageType = DamageType.Mixed)
 {
     if (dmg > 0)
     {
         return(EntityManager.Heroes.Enemies.OrderBy(TargetSelector.GetPriority).FirstOrDefault(t => t.IsKillable(spell.Range) && Player.Instance.CalculateDamageOnUnit(t, damageType, dmg) > spell.GetHealthPrediction(t)));
     }
     return(spell.GetKillStealTargets().FirstOrDefault(o => o.IsKillable(spell.Range)));
 }
Ejemplo n.º 5
0
 public static bool WillKill(Spell.SpellBase spell, Obj_AI_Base target, float multiplier = 1)
 {
     return(Player.Instance.GetSpellDamage(target, spell.Slot) * multiplier >= spell.GetHealthPrediction(target));
 }