コード例 #1
0
 public static bool IsFullMagiclResistZuus(this Unit source)
 {
     return source.HasModifier("modifier_medusa_stone_gaze_stone")
            || source.HasModifier("modifier_huskar_life_break_charge")
            || source.HasModifier("modifier_oracle_fates_edict")
            || source.HasModifier("modifier_obsidian_destroyer_astral_imprisonment_prison")
            || source.HasModifier("modifier_puck_phase_shift")
            || source.HasModifier("modifier_eul_cyclone")
            || source.HasModifier("modifier_invoker_tornado")
            || source.HasModifier("modifier_dazzle_shallow_grave")
            || source.HasModifier("modifier_winter_wyvern_winters_curse")
            || (source.HasModifier("modifier_legion_commander_duel") && source.ClassID== ClassID.CDOTA_Unit_Hero_Legion_Commander && source.AghanimState())
            || source.HasModifier("modifier_brewmaster_storm_cyclone")
            || source.HasModifier("modifier_shadow_demon_disruption")
            || source.HasModifier("modifier_tusk_snowball_movement")
            || source.HasModifier("modifier_abaddon_borrowed_time")
            || source.HasModifier("modifier_faceless_void_time_walk")
            || source.HasModifier("modifier_huskar_life_break_charge");
 }
コード例 #2
0
 /// <summary>
 ///     Returns actual attack range of a unit
 /// </summary>
 /// <param name="unit"></param>
 /// <returns></returns>
 public static float GetAttackRange(this Unit unit)
 {
     var bonus = 0.0;
     var classId = unit.ClassID;
     switch (classId)
     {
         case ClassID.CDOTA_Unit_Hero_TemplarAssassin:
             var psi = unit.Spellbook.SpellE;
             if (psi != null && psi.Level > 0)
             {
                 var firstOrDefault = psi.AbilityData.FirstOrDefault(x => x.Name == "bonus_attack_range");
                 if (firstOrDefault != null)
                 {
                     bonus = firstOrDefault.GetValue(psi.Level - 1);
                 }
             }
             break;
         case ClassID.CDOTA_Unit_Hero_Sniper:
             var aim = unit.Spellbook.SpellE;
             if (aim != null && aim.Level > 0)
             {
                 var firstOrDefault = aim.AbilityData.FirstOrDefault(x => x.Name == "bonus_attack_range");
                 if (firstOrDefault != null)
                 {
                     bonus = firstOrDefault.GetValue(aim.Level - 1);
                 }
             }
             break;
         case ClassID.CDOTA_Unit_Hero_Enchantress:
             var impetus = unit.Spellbook.SpellR;
             if (impetus.Level > 0 && unit.AghanimState())
             {
                 bonus = 190;
             }
             break;
         default:
             if (unit.Modifiers.Any(x => (x.Name == "modifier_lone_druid_true_form")))
             {
                 bonus = -423;
             }
             else if (unit.Modifiers.Any(x => (x.Name == "modifier_dragon_knight_dragon_form")))
             {
                 bonus = 372;
             }
             else if (unit.Modifiers.Any(x => (x.Name == "modifier_terrorblade_metamorphosis")))
             {
                 bonus = 422;
             }
             break;
     }
     return (float)(unit.AttackRange + bonus + unit.HullRadius / 2);
 }
コード例 #3
0
        /// <summary>
        ///     Returns actual attack range of a hero
        /// </summary>
        /// <param name="hero">
        ///     The hero.
        /// </param>
        /// <returns>
        ///     The <see cref="float" />.
        /// </returns>
        public static float GetAttackRange(this Hero hero)
        {
            var bonus = 0.0;
            float range;
            if (rangeDictionary.TryGetValue(hero.Handle, out range)
                && !Utils.SleepCheck("Common.GetAttackRange." + hero.Handle))
            {
                return range;
            }

            var classId = hero.ClassID;
            switch (classId)
            {
                case ClassID.CDOTA_Unit_Hero_TemplarAssassin:
                    var psi = hero.Spellbook.SpellE;
                    if (psi != null && psi.Level > 0)
                    {
                        bonus = psi.GetAbilityData("bonus_attack_range");
                    }

                    break;
                case ClassID.CDOTA_Unit_Hero_Sniper:
                    var aim = hero.Spellbook.SpellE;
                    if (aim != null && aim.Level > 0)
                    {
                        bonus = aim.GetAbilityData("bonus_attack_range");
                    }

                    break;
                case ClassID.CDOTA_Unit_Hero_Enchantress:
                    var impetus = hero.Spellbook.SpellR;
                    if (impetus.Level > 0 && hero.AghanimState())
                    {
                        bonus = 190;
                    }

                    break;
                default:
                    if (hero.HasModifier("modifier_lone_druid_true_form"))
                    {
                        bonus = -423;
                    }
                    else if (hero.HasModifier("modifier_dragon_knight_dragon_form"))
                    {
                        bonus = 350;
                    }
                    else if (hero.HasModifier("modifier_terrorblade_metamorphosis"))
                    {
                        bonus = 400;
                    }

                    break;
            }

            if (hero.IsRanged)
            {
                var dragonLance = hero.FindItem("item_dragon_lance", true) ?? hero.FindItem("item_hurricane_pike", true);
                if (dragonLance != null && dragonLance.IsValid)
                {
                    bonus += dragonLance.GetAbilityData("base_attack_range");
                }
            }

            range = (float)(hero.AttackRange + bonus + hero.HullRadius);
            if (!rangeDictionary.ContainsKey(hero.Handle))
            {
                rangeDictionary.Add(hero.Handle, range);
            }
            else
            {
                rangeDictionary[hero.Handle] = range;
            }

            Utils.Sleep(500, "Common.GetAttackRange." + hero.Handle);

            return range;
        }
コード例 #4
0
        /// <summary>
        ///     Poofs all other meepos to this ones position.
        /// </summary>
        /// <param name="meepo">
        ///     The meepo.
        /// </param>
        public static void PoofAllToThisMeepo(this Meepo meepo)
        {
            var meepoCount = 1 + meepo.Spellbook.SpellR.Level + (meepo.AghanimState() ? 1 : 0);
            if (meeposList.Count(x => x.IsValid) <= meepoCount)
            {
                meeposList = ObjectManager.GetEntities<Meepo>().ToList();
            }

            foreach (var poof in
                meeposList.Where(x => x.IsValid && !x.Equals(meepo) && x.IsAlive && x.CanCast())
                    .Select(otherMeepo => otherMeepo.Spellbook.Spell2)
                    .Where(poof => poof.CanBeCasted()))
            {
                poof.UseAbility(meepo.Position);
            }
        }
コード例 #5
0
        /// <summary>
        ///     Returns actual attack range of a unit
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public static float GetAttackRange(this Unit unit)
        {
            var bonus = 0.0;
            float range;
            if (!RangeDictionary.TryGetValue(unit.Handle, out range)
                || Utils.SleepCheck("Common.GetAttackRange." + unit.Handle))
            {
                var classId = unit.ClassID;
                switch (classId)
                {
                    case ClassID.CDOTA_Unit_Hero_TemplarAssassin:
                        var psi = unit.Spellbook.SpellE;
                        if (psi != null && psi.Level > 0)
                        {
                            bonus = psi.GetAbilityData("bonus_attack_range");
                        }

                        break;
                    case ClassID.CDOTA_Unit_Hero_Sniper:
                        var aim = unit.Spellbook.SpellE;
                        if (aim != null && aim.Level > 0)
                        {
                            bonus = aim.GetAbilityData("bonus_attack_range");
                        }

                        break;
                    case ClassID.CDOTA_Unit_Hero_Enchantress:
                        var impetus = unit.Spellbook.SpellR;
                        if (impetus.Level > 0 && unit.AghanimState())
                        {
                            bonus = 190;
                        }

                        break;
                    default:
                        if (unit.HasModifier("modifier_lone_druid_true_form"))
                        {
                            bonus = -423;
                        }
                        else if (unit.HasModifier("modifier_dragon_knight_dragon_form"))
                        {
                            bonus = 372;
                        }
                        else if (unit.HasModifier("modifier_terrorblade_metamorphosis"))
                        {
                            bonus = 422;
                        }

                        break;
                }

                if (unit.IsRanged)
                {
                    var dragonLance = unit.FindItem("item_dragon_lance");
                    if (dragonLance != null)
                    {
                        bonus += dragonLance.GetAbilityData("base_attack_range");
                    }
                }

                range = (float)(unit.AttackRange + bonus + unit.HullRadius / 2);
                if (!RangeDictionary.ContainsKey(unit.Handle))
                {
                    RangeDictionary.Add(unit.Handle, range);
                }
                else
                {
                    RangeDictionary[unit.Handle] = range;
                }

                Utils.Sleep(500, "Common.GetAttackRange." + unit.Handle);
            }

            return range;
        }