当前位置: 首页>>代码示例>>C#>>正文


C# Hero.CanCast方法代码示例

本文整理汇总了C#中Hero.CanCast方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.CanCast方法的具体用法?C# Hero.CanCast怎么用?C# Hero.CanCast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hero的用法示例。


在下文中一共展示了Hero.CanCast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Tick

        public static void Tick(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;
            me = ObjectMgr.LocalHero;
            target = ObjectMgr.GetEntities<Hero>().Where(x => x.Health <= 100 && x.Distance2D(me) <= 950 && !x.IsIllusion && x.IsAlive && x.Team != me.Team).ToList();
            if (me == null || target.FirstOrDefault() == null)
                return;
            urn_of_shadows = me.FindItem("item_urn_of_shadows");

            if (!me.IsChanneling() && target.FirstOrDefault() != null && urn_of_shadows != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki))
            {
                if (me.CanCast() && urn_of_shadows.CanBeCasted() && Utils.SleepCheck("urn"))
                {
                    urn_of_shadows.UseAbility(target.FirstOrDefault());
                    Utils.Sleep(200, "urn");
                }
            }
        }
开发者ID:jaddyknight,项目名称:EnsageSharp,代码行数:19,代码来源:AutoUrn.cs

示例2: Game_OnUpdate


//.........这里部分代码省略.........
            medall = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest");
            if (e == null) return;
            sheep = e.ClassID == ClassID.CDOTA_Unit_Hero_Tidehunter ? null : me.FindItem("item_sheepstick");
            vail = me.FindItem("item_veil_of_discord");
            cheese = me.FindItem("item_cheese");
            ghost = me.FindItem("item_ghost");
            atos = me.FindItem("item_rod_of_atos");
            soul = me.FindItem("item_soul_ring");
            arcane = me.FindItem("item_arcane_boots");
            stick = me.FindItem("item_magic_stick") ?? me.FindItem("item_magic_wand");
            Shiva = me.FindItem("item_shivas_guard");

            var stoneModif = e.Modifiers.Any(y => y.Name == "modifier_medusa_stone_gaze_stone");

            var v =
                ObjectManager.GetEntities<Hero>()
                    .Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion && !x.IsMagicImmune())
                    .ToList();

            if ((Active || wKey) && me.Distance2D(e) <= 1400 && e != null && e.IsAlive)
            {
                if (Menu.Item("orbwalk").GetValue<bool>() && me.Distance2D(e) <= 1900)
                {
                    Orbwalking.Orbwalk(e, 0, 1600, true, true);
                }
            }

            if (Active && me.Distance2D(e) <= 1400 && e != null && e.IsAlive && (!me.IsInvisible()|| me.IsVisibleToEnemies))
            {
                if (stoneModif) return;
                if ( // MOM
                    mom != null
                    && mom.CanBeCasted()
                    && me.CanCast()
                    && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(mom.Name)
                    && Utils.SleepCheck("mom")
                    && me.Distance2D(e) <= 700
                    )
                {
                    mom.UseAbility();
                    Utils.Sleep(250, "mom");
                }
                if ( // Hellbard
                    halberd != null
                    && halberd.CanBeCasted()
                    && me.CanCast()
                    && !e.IsMagicImmune()
                    && (e.NetworkActivity == NetworkActivity.Attack
                        || e.NetworkActivity == NetworkActivity.Crit
                        || e.NetworkActivity == NetworkActivity.Attack2)
                    && Utils.SleepCheck("halberd")
                    && me.Distance2D(e) <= 700
                    && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(halberd.Name)
                    )
                {
                    halberd.UseAbility(e);
                    Utils.Sleep(250, "halberd");
                }
                if ( //Ghost
                    ghost != null
                    && ghost.CanBeCasted()
                    && me.CanCast()
                    && ((me.Position.Distance2D(e) < 300
                         && me.Health <= (me.MaximumHealth * 0.7))
                        || me.Health <= (me.MaximumHealth * 0.3))
                    && Menu.Item("Item").GetValue<AbilityToggler>().IsEnabled(ghost.Name)
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:67,代码来源:Program.cs

示例3: Universe

        public static void Universe(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;
            me = ObjectMgr.LocalHero;
            if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Brewmaster)
                return;
			FindItems();
			//manta (when silenced)
			if ((manta != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(manta.Name)) && manta.CanBeCasted() && me.IsSilenced() && Utils.SleepCheck("manta"))
             {
                manta.UseAbility();
                Utils.Sleep(400 + Game.Ping, "manta");
             }
			if (Game.IsKeyDown(Menu.Item("Using Ultimate").GetValue<KeyBind>().Key) && !Game.IsChatOpen && Utils.SleepCheck("toggle"))
            {
                activated = !activated;
                Utils.Sleep(250, "toggle");
            }
            if (Game.IsKeyDown(Menu.Item("Combo Key").GetValue<KeyBind>().Key) && !Game.IsChatOpen)
            {
                if (me.CanCast())
                {
                    mousepos = Game.MousePosition;
					var target = me.ClosestToMouseTarget(1200);
					var CheckDrunken = target.Modifiers.Any(y => y.Name == "modifier_brewmaster_drunken_haze");
                    if (me.Distance2D(mousepos) <= 1200)
                    {
                            //drunken haze (main combo)
							if ((drunkenhaze != null && Menu.Item("Skills: ").GetValue<AbilityToggler>().IsEnabled(drunkenhaze.Name)) && drunkenhaze.CanBeCasted() && ((target.Position.Distance2D(me.Position) < 850) && (target.Position.Distance2D(me.Position) > 300)) && primalsplit.CanBeCasted() && Utils.SleepCheck("thunderclap"))
                            {
                                drunkenhaze.UseAbility(target);
                                Utils.Sleep(150 + Game.Ping, "drunkenhaze");
                            }
							//drunken haze (if can't cast ult) --->Сюда добавить переменную отвечающую за ручное выключение ульты из комбо && если ульт выключен
							if ((drunkenhaze != null && Menu.Item("Skills: ").GetValue<AbilityToggler>().IsEnabled(drunkenhaze.Name)) && drunkenhaze.CanBeCasted() && target.Position.Distance2D(me.Position) < 850 && (!primalsplit.CanBeCasted() || (target.Health < (target.MaximumHealth*0.50)) || !activated || !(Menu.Item("Skills: ").GetValue<AbilityToggler>().IsEnabled(primalsplit.Name))) && !CheckDrunken && (target.Health > (target.MaximumHealth*0.07)) && Utils.SleepCheck("drunkenhaze"))
                            {
                                drunkenhaze.UseAbility(target);
                                Utils.Sleep(150 + Game.Ping, "drunkenhaze");
                            }
							//black king bar
							if ((bkb != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(bkb.Name)) && bkb.CanBeCasted() && Utils.SleepCheck("bkb"))
                            {
                                bkb.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "bkb");
                            }
							//blink
                            if ((blink != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(blink.Name)) && blink.CanBeCasted() && target.Position.Distance2D(me.Position) > 300 && Utils.SleepCheck("blink"))
                            {
                                blink.UseAbility(me.Distance2D(mousepos) < 1200 ? mousepos : new Vector3(me.NetworkPosition.X + 1150 * (float)Math.Cos(me.NetworkPosition.ToVector2().FindAngleBetween(mousepos.ToVector2(), true)), me.NetworkPosition.Y + 1150 * (float)Math.Sin(me.NetworkPosition.ToVector2().FindAngleBetween(mousepos.ToVector2(), true)), 100), false);
                                Utils.Sleep(150 + Game.Ping, "blink");
                            }
							//orchid
							if ((orchid != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(orchid.Name)) && orchid.CanBeCasted() && (target.Position.Distance2D(me.Position) < 300) && Utils.SleepCheck("orchid"))
                            {
                                orchid.UseAbility(target);
                                Utils.Sleep(150 + Game.Ping, "orchid");
                            }
							//dust
							if ((dust != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(dust.Name)) && dust.CanBeCasted() && Utils.SleepCheck("dust"))
                            {
                                dust.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "dust");
                            }
							//necronomicon
							if ((necronomicon != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(necronomicon.Name)) && necronomicon.CanBeCasted() && (target.Health > (target.MaximumHealth*0.20)) && (target.Position.Distance2D(me.Position) < 400) && Utils.SleepCheck("necronomicon"))
                            {
                                necronomicon.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "necronomicon");
                            }
							if ((necronomicon2 != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(necronomicon2.Name)) && necronomicon2.CanBeCasted() && (target.Health > (target.MaximumHealth*0.20)) && (target.Position.Distance2D(me.Position) < 400) && Utils.SleepCheck("necronomicon2"))
                            {
                                necronomicon2.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "necronomicon2");
                            }
							if ((necronomicon3 != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(necronomicon3.Name)) && necronomicon3.CanBeCasted() && (target.Health > (target.MaximumHealth*0.20)) && (target.Position.Distance2D(me.Position) < 400) && Utils.SleepCheck("necronomicon3"))
                            {
                                necronomicon3.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "necronomicon3");
                            }
							//thunder clap
                            if ((thunderclap != null && Menu.Item("Skills: ").GetValue<AbilityToggler>().IsEnabled(thunderclap.Name)) && thunderclap.CanBeCasted() && (target.Position.Distance2D(me.Position) < 300) && Utils.SleepCheck("thunderclap"))
                            {
                                thunderclap.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "thunderclap");
                            }
							//urn of shadow
							if ((urn != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(urn.Name)) && urn.CanBeCasted() && Utils.SleepCheck("urn"))
                            {
                                urn.UseAbility(target);
                                Utils.Sleep(150 + Game.Ping, "urn");
                            }
							//medal
							if ((medal != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(medal.Name)) && medal.CanBeCasted() && (target.Position.Distance2D(me.Position) < 300) && Utils.SleepCheck("medal"))
                            {
                                medal.UseAbility(target);
                                Utils.Sleep(150 + Game.Ping, "medal");
                            }
							//shiva
							if ((shiva != null && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(shiva.Name)) && shiva.CanBeCasted() && (target.Position.Distance2D(me.Position) <= 800) && Utils.SleepCheck("shiva"))
//.........这里部分代码省略.........
开发者ID:Rgern100,项目名称:memes,代码行数:101,代码来源:BrewMaster.cs

示例4: Game_OnUpdate

        public static void Game_OnUpdate(EventArgs args)
        {
            me = ObjectMgr.LocalHero;

            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;

            if (me.ClassID != ClassID.CDOTA_Unit_Hero_Sven)
                return;

            if (me == null)
                return;

            if (stun == null)
                stun = me.Spellbook.Spell1;
            if (armor == null)
                armor = me.Spellbook.Spell3;
            if (ulti == null)
                ulti = me.Spellbook.Spell4;

            if (Lompat == null)
                Lompat = me.FindItem("item_blink");
            if (bloodthorn == null)
                bloodthorn = me.FindItem("item_bloodthorn");
            if (armlet == null)
                armlet = me.FindItem("item_armlet");
            if (mjollnir == null)
                mjollnir = me.FindItem("item_mjollnir");
            if (dust == null)
                dust = me.FindItem("item_dust");
            if (bladeMail == null)
                bladeMail = me.FindItem("item_blade_mail");
            if (mom == null)
                mom = me.FindItem("item_mask_of_madness");
            if (medallion == null)
                medallion = me.FindItem("item_medallion_of_courage");
            if (solar == null)
                solar = me.FindItem("item_solar_crest");
            if (soulRing == null)
                soulRing = me.FindItem("item_soul_ring");
            if (bkb == null)
                bkb = me.FindItem("item_black_king_bar");
            if (abyssal == null)
                abyssal = me.FindItem("item_abyssal_blade");

            if (combo && Menu.Item("enable").GetValue<bool>())
            {
                target = me.ClosestToMouseTarget(1000);
                if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion)
                {
                    if (me.CanAttack() && me.CanCast())
                    {

                        var linkens = target.Modifiers.Any(x => x.Name == "modifier_item_spheretarget") || target.Inventory.Items.Any(x => x.Name == "item_sphere");

                        if (bladeMail != null && bladeMail.CanBeCasted() && Utils.SleepCheck("blademail"))
                        {
                            bladeMail.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "blademail");
                        }
                        if (bloodthorn != null && bloodthorn.CanBeCasted() && Utils.SleepCheck("bloodthorn"))
                        {
                            bloodthorn.UseAbility(target);
                            Utils.Sleep(150 + Game.Ping, "bloodthorn");
                        }
                        if (mom != null && mom.CanBeCasted() && Utils.SleepCheck("mom"))
                        {
                            mom.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "mom");
                        }

                        if (armlet != null && armlet.CanBeCasted() && Utils.SleepCheck("armlet1") && !armlet.IsToggled)
                        {
                            armlet.ToggleAbility();
                            Utils.Sleep(150 + Game.Ping, "armlet1");
                        }

                        if (mjollnir != null && mjollnir.CanBeCasted() && Utils.SleepCheck("mjollnir"))
                        {
                            mjollnir.UseAbility(me);
                            Utils.Sleep(150 + Game.Ping, "mjollnir");
                        }

                        if (ulti.CanBeCasted() && Utils.SleepCheck("ulti"))
                        {
                            ulti.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "ulti");
                        }
                        if (armor.CanBeCasted() && Utils.SleepCheck("armor"))
                        {
                            armor.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "armor");
                        }
                        Utils.ChainStun(me, 100, null, false);

                        if (bkb != null && bkb.CanBeCasted() && Utils.SleepCheck("bkb") && Menu.Item("useBKB").GetValue<bool>())
                        {
                            bkb.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "bkb");
                        }
//.........这里部分代码省略.........
开发者ID:spyware293,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例5: Game_OnUpdate


//.........这里部分代码省略.........
                        Utils.Sleep(50+Game.Ping, "veil");
                    }

                    if (ethereal != null && ethereal.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion && !linkedsph &&
                        Utils.SleepCheck("ethereal") && menuValue.IsEnabled(ethereal.Name))
                    {
                        ethereal.UseAbility(target);
                        Utils.Sleep(50+Game.Ping, "ethereal");
                    }

                    if (halberd != null && halberd.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion &&
                        !linkedsph &&
                        Utils.SleepCheck("halberd") && Menu.Item("active").GetValue<KeyBind>().Active && menuValue.IsEnabled(halberd.Name))
                    {
                        halberd.UseAbility(target);
                        Utils.Sleep(50 + Game.Ping, "halberd");
                    }

                    if (dagon != null && dagon.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion && !linkedsph && (ethereal == null || ethereal.Cooldown < ethereal.CooldownLength-2 || ghostform) &&
                        Utils.SleepCheck("dagon") && menuValue.IsEnabled("item_dagon_5"))
                    {
                        dagon.UseAbility(target);
                        Utils.Sleep(50+Game.Ping, "dagon");
                    }

                    if (shiva != null && shiva.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion && me.Distance2D(target) < 850 &&
                        Utils.SleepCheck("shiva") && Menu.Item("active").GetValue<KeyBind>().Active && menuValue.IsEnabled(shiva.Name))
                    {
                        shiva.UseAbility();
                        Utils.Sleep(50+Game.Ping, "shiva");
                    }
                    
                    if (me.Spellbook.SpellQ != null && me.Spellbook.SpellQ.CanBeCasted() &&
                        me.Mana > me.Spellbook.Spell1.ManaCost && !target.IsMagicImmune() && !target.IsIllusion && me.CanCast() &&
                        Utils.SleepCheck("Q") && (!me.Spellbook.Spell2.CanBeCasted() || linkedsph) && (ethereal == null || ethereal.Cooldown < ethereal.CooldownLength-1.5 || ghostform))
                    {
                        me.Spellbook.SpellQ.UseAbility(target);
                        Utils.Sleep(200 + Game.Ping, "Q");
                    }

                    if (me.Spellbook.Spell2 != null && (me.Distance2D(target) < Wrange) &&
                        me.Spellbook.Spell2.CanBeCasted() && me.Mana > me.Spellbook.Spell2.ManaCost && !linkedsph && me.CanCast() &&
                        !target.IsMagicImmune() && !target.IsIllusion && Utils.SleepCheck("W") && (ethereal == null || ethereal.Cooldown < ethereal.CooldownLength - 1.5 || ghostform || target.IsChanneling()))
                    {
                        me.Spellbook.Spell2.UseAbility(target);
                        Utils.Sleep(400 + Game.Ping, "W");
                    }

                    if (me.Spellbook.Spell2 != null &&
                        (me.Distance2D(target) < realWrange) &&
                        (me.Distance2D(target) > Wrange) && me.Spellbook.Spell2.CanBeCasted() && me.CanCast() &&
                        me.Mana > me.Spellbook.Spell2.ManaCost && !target.IsMagicImmune() && !target.IsIllusion && !linkedsph &&
                        Utils.SleepCheck("W") && (ethereal == null || ethereal.Cooldown < ethereal.CooldownLength-1.5 || ghostform || target.IsChanneling()))
                    {
                        me.Spellbook.Spell2.CastSkillShot(target);
                        Utils.Sleep(400 + Game.Ping, "W");
                    }

                    if (
                        (!(me.Spellbook.Spell2.CanBeCasted() && me.Spellbook.Spell1.CanBeCasted()) || target.IsMagicImmune() || !me.CanCast()) && !ghostform &&
                        me.CanAttack() && me.Distance2D(target) < 350+me.HullRadius+target.HullRadius &&
                        target != null)
                    {
                        Orbwalking.Orbwalk(target);
                    }
                    else if (me.CanMove() && !me.IsChanneling() && Utils.SleepCheck("movesleep") && (me.Distance2D(target) >= 350 + me.HullRadius + target.HullRadius || ghostform || !me.CanAttack()))
开发者ID:Evervolv1337,项目名称:Ensage,代码行数:67,代码来源:Program.cs

示例6: Game_OnUpdate

        public static void Game_OnUpdate(EventArgs args)
        {
            me = ObjectMgr.LocalHero;

            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;

            if (me.ClassID != ClassID.CDOTA_Unit_Hero_Legion_Commander)
                return;

            if (me == null)
                return;

            if (Duel == null)
                Duel = me.Spellbook.Spell4;
            if (Heal == null)
                Heal = me.Spellbook.Spell2;
            if (Odds == null)
                Odds = me.Spellbook.Spell1;

            if (Blink == null)
                Blink = me.FindItem("item_blink");
            if (armlet == null)
                armlet = me.FindItem("item_armlet");
            if (mjollnir == null)
                mjollnir = me.FindItem("item_mjollnir");
            if (medallion == null)
                medallion = me.FindItem("item_medallion_of_courage");
            if (solar == null)
                solar = me.FindItem("item_solar_crest");
            if (soulRing == null)
                soulRing = me.FindItem("item_soul_ring");
            if (bkb == null)
                bkb = me.FindItem("item_black_king_bar");
            if (abyssal == null)
                abyssal = me.FindItem("item_abyssal_blade");
            if (dust == null)
                dust = me.FindItem("item_dust");
            if (bladeMail == null)
                bladeMail = me.FindItem("item_blade_mail");

            var duelManacost = Heal.ManaCost + Duel.ManaCost;

            // Main combo

            if (active && toggle)
            {
                target = me.ClosestToMouseTarget(1000);
                if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion)
                {
                    if (me.CanAttack() && me.CanCast()) {

                        var linkens = target.Modifiers.Any(x => x.Name == "modifier_item_spheretarget") || target.Inventory.Items.Any(x => x.Name == "item_sphere");

                        // here allied skills & items

                        if (soulRing != null && soulRing.CanBeCasted() && me.Mana < duelManacost && me.Health > 300 && Utils.SleepCheck("soulring"))
                        {
                            soulRing.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "soulring");
                        }

                        if (bladeMail != null && bladeMail.CanBeCasted() && Utils.SleepCheck("blademail"))
                        {
                            bladeMail.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "blademail");
                        }

                        if (armlet != null && armlet.CanBeCasted() && Utils.SleepCheck("armlet1") && !armlet.IsToggled)
                        {
                            armlet.ToggleAbility();
                            Utils.Sleep(150 + Game.Ping, "armlet1");
                        }

                        if (mjollnir != null && mjollnir.CanBeCasted() && Utils.SleepCheck("mjollnir"))
                        {
                            mjollnir.UseAbility(me);
                            Utils.Sleep(150 + Game.Ping, "mjollnir");
                        }

                        if (Heal.CanBeCasted() && Utils.SleepCheck("heal") && (!bkb.CanBeCasted() || !me.IsMagicImmune()))
                        {
                            Heal.UseAbility(me);
                            Utils.Sleep(150 + Game.Ping, "heal");
                        }
                        Utils.ChainStun(me, 100, null, false);

                        if (bkb != null && bkb.CanBeCasted() && Utils.SleepCheck("bkb") && bkbToggle)
                        {
                            bkb.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "bkb");
                        }

                        Utils.ChainStun(me, 200, null, false);

                        // Blink

                        if (Blink != null && Blink.CanBeCasted() && me.Distance2D(target) > 300 && Utils.SleepCheck("blink1"))
                        {
                            Blink.UseAbility(target.Position);
//.........这里部分代码省略.........
开发者ID:unsteeled101,项目名称:EnsageSharp-3,代码行数:101,代码来源:Program.cs

示例7: AutoUsage

        public static bool AutoUsage(
            Hero enemyHero, 
            Hero[] enemyHeroes, 
            float meMissingHp,
            float ping, 
            Hero me, 
            float mana)
        {
            var hero = enemyHero;
            var heroName = NameManager.Name(hero);
            var heroDistance = MyHeroInfo.Position.Distance2D(hero);
            if (Utils.SleepCheck("GlobalCasting") && Utils.SleepCheck("casting"))
            {
                if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tusk
                    && Dictionaries.InDamageDictionary.ContainsKey(hero.Handle)
                    && (Dictionaries.OutDamageDictionary[hero.Handle] + Dictionaries.InDamageDictionary[hero.Handle])
                    >= enemyHero.Health && Utils.SleepCheck("tusk_snowball") && heroDistance <= 1350
                    && me.FindSpell("tusk_snowball").CanBeCasted())
                {
                    if (!Nuke.Cast(me.FindSpell("tusk_snowball"), hero, "tusk_snowball"))
                    {
                        return false;
                    }

                    DelayAction.Add(
                        new DelayActionItem(300, () => { AbilityMain.LaunchSnowball(); }, CancellationToken.None));
                    Utils.Sleep(100 + me.GetTurnTime(hero) * 1000 + ping, "tusk_snowball");
                    Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000 + 100, "GlobalCasting");
                    Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000 + 100, "calculate");
                    Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000, "cancelorder");

                    return true;
                }

                foreach (var data in
                    MyAbilities.OffensiveAbilities.Where(
                        x =>
                        x.Value.IsValid
                        && (x.Value.CanBeCasted()
                            || (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
                        && ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast()))
                        && (Utils.SleepCheck(x.Value.Handle.ToString())
                            || (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0)))
                        .OrderBy(x => ComboOrder.GetAbilityOrder(x.Value)))
                {
                    var ability = data.Value;
                    var name = NameManager.Name(ability);
                    var category = data.Key.Substring(name.Length);
                    var handleString = ability.Handle.ToString();
                    if (category != "buff" && hero.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
                    {
                        continue;
                    }

                    if (!CastingChecks.All(name, hero))
                    {
                        continue;
                    }

                    var delay = ability.GetCastDelay(me, hero, useCastPoint: false, abilityName: name) * 1000;
                    var canHit = ability.CanHit(hero, MyHeroInfo.Position, name);
                    if (name == "omniknight_purification")
                    {
                        if (Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue<Slider>().Value < mana
                            && MainMenu.Menu.Item("nukesToggler").GetValue<AbilityToggler>().IsEnabled(name)
                            && Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
                                   .GetValue<HeroToggler>()
                                   .IsEnabled(heroName)
                            && (etherealHitTime < (Environment.TickCount + ability.GetHitDelay(hero, name) * 1000))
                            && hero.Health
                            > Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
                                  .GetValue<Slider>()
                                  .Value && CastingChecks.Killsteal(ability, hero, name))
                        {
                            var target = FindPurificationTarget(hero);
                            if (target != null && ability.CanHit(target, MyHeroInfo.Position, name)
                                && target.PredictedPosition().Distance2D(hero.PredictedPosition())
                                < ability.GetRadius(name)
                                && target.PredictedPosition()
                                       .Distance2D(
                                           hero.PredictedPosition(ability.FindCastPoint(NameManager.Name(ability))))
                                < ability.GetRadius(name))
                            {
                                if (Nuke.Cast(ability, target, name))
                                {
                                    Utils.Sleep(
                                        ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, 
                                        handleString);
                                    Utils.Sleep(delay, "GlobalCasting");
                                    Utils.Sleep(delay, "cancelorder");

                                    // Utils.Sleep(ping, "killsteal");
                                    return true;
                                }
                            }
                        }

                        return false;
                    }

//.........这里部分代码省略.........
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:101,代码来源:FullCombo.cs

示例8: Game_OnUpdate


//.........这里部分代码省略.........

            if (manta != null && manta.CanBeCasted() && Menu.Item("Manta").GetValue<bool>() && me.IsSilenced())
            {
                manta.UseAbility();
                Utils.Sleep(150 + Game.Ping, "manta");
            }

            var illus = ObjectMgr.GetEntities<Hero>().Where(x => x.IsAlive && x.IsControllable && x.Team == me.Team && x.IsIllusion && x.Modifiers.Any(y => y.Name != "modifier_kill")).ToList();

            if (Menu.Item("Illusion").GetValue<bool>())
            {
                foreach (var enemy in targets)
                {
                    if (enemy.Health > 0)
                    {
                        foreach (var illusion in illus)
                        {
                            if (GetDistance2D(enemy.Position, illusion.Position) < 400 && Utils.SleepCheck(illusion.Handle.ToString()))
                            {
                                illusion.Attack(enemy);
                                Utils.Sleep(1000, illusion.Handle.ToString());
                            }
                        }
                    }
                }
            }
            if (combo && Menu.Item("enable").GetValue<bool>())
            {
                target = me.ClosestToMouseTarget(1000);

                if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion)
                {

                    if (me.CanAttack() && me.CanCast())
                         {

                        var linkens = target.Modifiers.Any(x => x.Name == "modifier_item_spheretarget") || target.Inventory.Items.Any(x => x.Name == "item_sphere");

                        if (bladeMail != null && bladeMail.CanBeCasted() && Utils.SleepCheck("blademail"))
                        {
                            bladeMail.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "blademail");
                        }
                        if (mom != null && mom.CanBeCasted() && Utils.SleepCheck("mom"))
                        {
                            mom.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "mom");
                        }

                        if (armlet != null && armlet.CanBeCasted() && Utils.SleepCheck("armlet1") && !armlet.IsToggled)
                        {
                            armlet.ToggleAbility();
                            Utils.Sleep(150 + Game.Ping, "armlet1");
                        }

                        if (mjollnir != null && mjollnir.CanBeCasted() && Utils.SleepCheck("mjollnir"))
                        {
                            mjollnir.UseAbility(me);
                            Utils.Sleep(150 + Game.Ping, "mjollnir");
                        }

                        Utils.ChainStun(me, 100, null, false);
                        if (blink != null && blink.CanBeCasted() && me.Distance2D(target) > 300 && me.Distance2D(target) <= 1300 && Utils.SleepCheck("blink"))
                        {
                            blink.UseAbility(target.Position);
                            Utils.Sleep(150 + Game.Ping, "blink");
开发者ID:spyware293,项目名称:Ensage,代码行数:67,代码来源:Program.cs

示例9: Working

 public static void Working(EventArgs args)
 {
     if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
         return;
     me = ObjectMgr.LocalHero;
     if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Legion_Commander)
         return;
     if (Game.IsKeyDown(Menu.Item("Black King Bar Toggle").GetValue<KeyBind>().Key) && !Game.IsChatOpen && Utils.SleepCheck("BKBTOGGLE"))
     {
         defensive_items["item_black_king_bar"] = !Menu.Item("Defensive Items").GetValue<AbilityToggler>().IsEnabled("item_black_king_bar");
         Utils.Sleep(750, "BKBTOGGLE");
     }
         if (Game.IsKeyDown(Menu.Item("DUEL!").GetValue<KeyBind>().Key) && !Game.IsChatOpen)
     {
         FindItems();
         target = me.ClosestToMouseTarget(1000);
         if (target != null && target.IsAlive && !target.IsIllusion && !target.IsInvul() && (blink != null ? me.Distance2D(target) <= 1300 : me.Distance2D(target) <= 600))
         {
             if (me.CanAttack() && me.CanCast())
             {
                 if (CanInvisCrit(me))
                     me.Attack(target);
                 else
                 {
                     manacheck();
                     if (target.IsLinkensProtected())
                     {
                         if ((cyclone.CanBeCasted() || force.CanBeCasted() || halberd.CanBeCasted() || vyse.CanBeCasted() || abyssal.CanBeCasted()) && Utils.SleepCheck("Combo2"))
                         {
                             if (blademail != null && blademail.Cooldown <= 0 && Menu.Item("Defensive Items").GetValue<AbilityToggler>().IsEnabled(blademail.Name) && me.Mana - blademail.ManaCost >= 75)
                                 blademail.UseAbility();
                             if (satanic != null && satanic.Cooldown <= 0 && me.Health <= me.MaximumHealth * 0.5 && Menu.Item("Defensive Items").GetValue<AbilityToggler>().IsEnabled(satanic.Name))
                                 satanic.UseAbility();
                             if (crimson != null && crimson.Cooldown <= 0 && Menu.Item("Consume Items").GetValue<AbilityToggler>().IsEnabled(crimson.Name))
                                 crimson.UseAbility();
                             if (buckler != null && buckler.Cooldown <= 0 && Menu.Item("Consume Items").GetValue<AbilityToggler>().IsEnabled(buckler.Name) && me.Mana - buckler.ManaCost >= 75)
                                 buckler.UseAbility();
                             if (lotusorb != null && lotusorb.Cooldown <= 0 && Menu.Item("Defensive Items").GetValue<AbilityToggler>().IsEnabled(lotusorb.Name) && me.Mana - lotusorb.ManaCost >= 75)
                                 lotusorb.UseAbility(me);
                             if (mjollnir != null && mjollnir.Cooldown <= 0 && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(mjollnir.Name) && me.Mana - mjollnir.ManaCost >= 75)
                                 mjollnir.UseAbility(me);
                             if (armlet != null && !armlet.IsToggled && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(armlet.Name) && Utils.SleepCheck("armlet"))
                             {
                                 armlet.ToggleAbility();
                                 Utils.Sleep(300, "armlet");
                             }
                             if (madness != null && madness.Cooldown <= 0 && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(madness.Name) && me.Mana - madness.ManaCost >= 75)
                                 madness.UseAbility();
                             if (Heal != null && Heal.Level > 0 && Heal.Cooldown <= 0 && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(Heal.Name) && !me.IsMagicImmune() && me.Mana - Heal.ManaCost >= 75)
                                 Heal.UseAbility(me);
                             if (bkb != null && bkb.Cooldown <= 0 && Menu.Item("Defensive Items").GetValue<AbilityToggler>().IsEnabled(bkb.Name) && (!Heal.CanBeCasted() || Heal == null))
                                 bkb.UseAbility();
                             if (blink != null && blink.Cooldown <= 0 && me.Distance2D(target) <= 1300 && me.Distance2D(target) >= 200 && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(blink.Name))
                                 blink.UseAbility(target.Position);
                             if (urn != null && urn.CurrentCharges > 0 && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(urn.Name))
                                 urn.UseAbility(target);
                             if (solar != null && solar.CanBeCasted() && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(solar.Name))
                                 solar.UseAbility(target);
                             if (medallion != null && medallion.CanBeCasted() && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(medallion.Name))
                                 medallion.UseAbility(target);
                             if (cyclone != null && cyclone.CanBeCasted() && Utils.SleepCheck("CycloneRemoveLinkens") && Menu.Item("Remove Linkens Items").GetValue<AbilityToggler>().IsEnabled(cyclone.Name) && me.Mana - cyclone.ManaCost >= 75)
                             {
                                 cyclone.UseAbility(target);
                                 Utils.Sleep(100, "CycloneRemoveLinkens");
                             }
                             else if (force != null && force.CanBeCasted() && Utils.SleepCheck("ForceRemoveLinkens") && Menu.Item("Remove Linkens Items").GetValue<AbilityToggler>().IsEnabled(force.Name) && me.Mana - force.ManaCost >= 75)
                             {
                                 force.UseAbility(target);
                                 Utils.Sleep(100, "ForceRemoveLinkens");
                             }
                             else if (halberd != null && halberd.CanBeCasted() && Utils.SleepCheck("halberdLinkens") && Menu.Item("Remove Linkens Items").GetValue<AbilityToggler>().IsEnabled(halberd.Name) && me.Mana - halberd.ManaCost >= 75)
                             {
                                 halberd.UseAbility(target);
                                 Utils.Sleep(100, "halberdLinkens");
                             }
                             else if (vyse != null && vyse.CanBeCasted() && Utils.SleepCheck("vyseLinkens") && Menu.Item("Remove Linkens Items").GetValue<AbilityToggler>().IsEnabled(vyse.Name) && me.Mana - vyse.ManaCost >= 75)
                             {
                                 vyse.UseAbility(target);
                                 Utils.Sleep(100, "vyseLinkens");
                             }
                             else if (abyssal != null && abyssal.CanBeCasted() && Utils.SleepCheck("abyssal") && Menu.Item("Ofensive Items").GetValue<AbilityToggler>().IsEnabled(abyssal.Name) && me.Mana - abyssal.ManaCost >= 75)
                             {
                                 abyssal.UseAbility(target);
                                 Utils.Sleep(100, "abyssal");
                             }
                             Utils.Sleep(200, "Combo2");
                         }
                     }
                     else
                     {
                         if (UsedInvis(target))
                         {
                             if (me.Distance2D(target) <= 500)
                             {
                                 if (dust != null && dust.CanBeCasted() && Utils.SleepCheck("dust") && dust != null && Menu.Item("Consume Items").GetValue<AbilityToggler>().IsEnabled(dust.Name))
                                 {
                                     dust.UseAbility();
                                     Utils.Sleep(100, "dust");
                                 }
                                 else if (sentry != null && sentry.CanBeCasted() && Utils.SleepCheck("sentry") && sentry != null && Menu.Item("Consume Items").GetValue<AbilityToggler>().IsEnabled(sentry.Name))
//.........这里部分代码省略.........
开发者ID:jaddyknight,项目名称:EnsageSharp,代码行数:101,代码来源:ChallengeAccepted.cs

示例10: Tick

        public static void Tick(EventArgs args)
        {
            // initial things
            me = ObjectMgr.LocalHero;
            if ((Game.IsKeyDown(Menu.Item("2001").GetValue<KeyBind>().Key)) || (Game.IsKeyDown(Menu.Item("2002").GetValue<KeyBind>().Key)) || target == null || Utils.SleepCheck("selected"))
            {
                target = me.ClosestToMouseTarget(1000);
                Utils.Sleep(1200,"selected");
            }
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame || Game.IsChatOpen)
                return;
            if (me.ClassID != ClassID.CDOTA_Unit_Hero_Necrolyte)
                return;
            if (me == null || target == null)
                return;
            // skills
            if (Qskill == null)
                Qskill = me.Spellbook.Spell1;
            if (Rskill == null)
                Rskill = me.Spellbook.Spell4;
            // itens
            Blink = me.FindItem("item_blink");
            shadow = me.FindItem("item_invis_sword");
            silveredge = me.FindItem("item_silver_edge");
            dagon = me.Inventory.Items.FirstOrDefault(x => x.Name.Contains("item_dagon"));
            ethereal = me.FindItem("item_ethereal_blade");
            veil = me.FindItem("item_veil_of_discord");
            euls = me.FindItem("item_cyclone");
            shivas = me.FindItem("item_shivas_guard");
            malevo = me.FindItem("item_orchid");
            forcestaff = me.FindItem("item_force_staff");
            int ComboDamage = 0;
            if (target != null && !target.IsIllusion)
                ComboDamage = Damagetokill();
            else
                ComboDamage = 0;
            //Starting Combo
            var blinkposition = ((me.Position - target.Position) * 300 / me.Distance2D(target) + target.Position);
            var IsLinkensProtected = (target.Modifiers.Any(x => x.Name == "modifier_item_sphere_target") || (target.FindItem("item_sphere") != null && (target.FindItem("item_sphere").Cooldown <= 0)));
            var _Is_in_Advantage = (target.Modifiers.Any(x => x.Name == "modifier_item_blade_mail_reflect") || target.Modifiers.Any(x => x.Name == "modifier_item_lotus_orb_active") || target.Modifiers.Any(x => x.Name == "modifier_nyx_assassin_spiked_carapace") || target.Modifiers.Any(x => x.Name == "modifier_templar_assassin_refraction_damage") || target.Modifiers.Any(x => x.Name == "modifier_ursa_enrage") || target.Modifiers.Any(x => x.Name == "modifier_abaddon_borrowed_time") || (target.Modifiers.Any(x => x.Name == "modifier_dazzle_shallow_grave")));
            var WindWalkMod = me.Modifiers.Any(x => x.Name == "modifier_item_silver_edge_windwalk" || x.Name == "modifier_item_invisibility_edge_windwalk");
            if (((Game.IsKeyDown(Menu.Item("2001").GetValue<KeyBind>().Key) && (ComboDamage <= 0 || stage == 1) && me.Distance2D(target) <= 1000 && target.IsVisible && target.IsAlive && !target.IsMagicImmune() && !target.IsIllusion && target != null && !_Is_in_Advantage) || ( me.Distance2D(target) <= 1000 && target.IsVisible && target.IsAlive && !target.IsMagicImmune() && !target.IsIllusion && target != null && Game.IsKeyDown(Menu.Item("2002").GetValue<KeyBind>().Key))) && Utils.SleepCheck("combo"))
            {
                stage = 1;
                if (me.CanCast() && !me.IsChanneling())
                {
                    if (WindWalkMod)
                    {
                        me.Attack(target);
                        Utils.ChainStun(me, Game.Ping + shadow.GetCastDelay(me, target, true, true), null, false);
                    }
                    else
                    {
                        if (IsLinkensProtected && (!WindWalkMod))
                        {
                            if (euls != null && euls.Cooldown <= 0 && IsLinkensProtected && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(euls.Name))
                            {
                                euls.UseAbility(target);
                                Utils.ChainStun(me,Game.Ping+euls.GetCastDelay(me,target,true,true),null,false);
                            }
                            else if (forcestaff != null && forcestaff.Cooldown <= 0 && IsLinkensProtected && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(forcestaff.Name))
                            {
                                forcestaff.UseAbility(target);
                                Utils.ChainStun(me, Game.Ping + forcestaff.GetCastDelay(me, target, true, true), null, false);
                            }
                            else if (dagon != null && dagon.Cooldown <= 0 && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled("item_dagon"))
                            {
                                dagon.UseAbility(target);
                                Utils.ChainStun(me, Game.Ping + dagon.GetCastDelay(me, target, true, true), null, false);
                            }
                            else if (ethereal != null && ethereal.Cooldown <= 0 && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(ethereal.Name))
                            {
                                ethereal.UseAbility(target);
                                Utils.ChainStun(me, Game.Ping + ethereal.GetCastDelay(me, target, true, true), null, false);
                            }
                        }
                        else if (!IsLinkensProtected && (!WindWalkMod))
                        {
                            if (Blink != null && Blink.Cooldown <= 0 && me.Distance2D(blinkposition) > 300 && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(Blink.Name))
                            {
                                Blink.UseAbility(blinkposition);
                                Utils.ChainStun(me, Game.Ping + Blink.GetCastDelay(me, target, true, true), null, false);
                            }
                            if (malevo != null && malevo.Cooldown <= 0 && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(malevo.Name))
                            {
                                malevo.UseAbility(target);
                                Utils.ChainStun(me, Game.Ping + malevo.GetCastDelay(me, target, true, true), null, false);
                            }
                            if (Rskill.Cooldown <= 0 && Menu.Item("Abilities: ").GetValue<AbilityToggler>().IsEnabled(Rskill.Name))
                            {
                                Rskill.UseAbility(target);
                                Utils.ChainStun(me, Game.Ping + Rskill.GetCastDelay(me, target, true, true), null, false);
                            }
                            if (ethereal != null && ethereal.Cooldown <= 0 && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(ethereal.Name))
                            {
                                ethereal.UseAbility(target);
                                Utils.ChainStun(me, Game.Ping + ethereal.GetCastDelay(me, target, true, true), null, false);
                                ethereal_used = true;
                                ethereal_used2 = true;
                            }
//.........这里部分代码省略.........
开发者ID:jaddyknight,项目名称:EnsageSharp,代码行数:101,代码来源:Necrophos.cs

示例11: DeffensiveAutoUsage

        public static bool DeffensiveAutoUsage(Hero allyHero, Hero me, Hero[] enemyHeroes, float ping)
        {
            var hero = allyHero;
            var heroName = NameManager.Name(hero);

            // var heroDistance = position.Distance2D(hero);
            var heroMissingHp = hero.MaximumHealth - hero.Health;
            var heroMissingMana = hero.MaximumMana - hero.Mana;
            var heroManaPercentage = (hero.Mana / hero.MaximumMana) * 100;
            var heroHpPercentage = ((float)hero.Health / hero.MaximumHealth) * 100;
            foreach (var data in
                MyAbilities.DeffensiveAbilities.Where(
                    x =>
                    (x.Value.IsValid
                     && (x.Value.CanBeCasted() || (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
                     && ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast()))
                     && (Utils.SleepCheck(x.Value.Handle.ToString())
                         || (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0)))))
            {
                var ability = data.Value;
                var name = NameManager.Name(ability);
                if (name == "item_soul_ring")
                {
                    continue;
                }

                if (hero.IsMagicImmune() && ability.ImmunityType != (ImmunityType)1)
                {
                    continue;
                }

                var category = data.Key.Substring(name.Length);
                var handleString = ability.Handle.ToString();
                if (!CastingChecks.All(name, hero))
                {
                    continue;
                }

                var delay = ability.GetCastDelay(me, hero, abilityName: name) * 1000;
                var canHit = ability.CanHit(hero, MyHeroInfo.Position, name);
                if (category == "heal" && !hero.HasModifier("modifier_ice_blast")
                    && MainMenu.Menu.Item("healsToggler").GetValue<AbilityToggler>().IsEnabled(name)
                    && ((!(name == "item_soul_ring" || name == "item_magic_wand" || name == "item_magic_stick")
                         && Heals.HealsMenuDictionary[name].Item(name + "useonallies")
                                .GetValue<HeroToggler>()
                                .IsEnabled(heroName)) || hero.Equals(AbilityMain.Me)) && canHit
                    && (name == "item_arcane_boots"
                            ? (Heals.HealsMenuDictionary[name].Item(name + "missingmanamin").GetValue<Slider>().Value
                               < heroMissingMana
                               && Heals.HealsMenuDictionary[name].Item(name + "manapercentbelow")
                                      .GetValue<Slider>()
                                      .Value > heroManaPercentage
                               && (!AllyHeroes.Heroes.Any(
                                   x =>
                                   !x.Equals(hero)
                                   && Heals.HealsMenuDictionary[name].Item(name + "useonallies")
                                          .GetValue<HeroToggler>()
                                          .IsEnabled(x.Name)
                                   && x.Distance2D(AbilityMain.Me)
                                   < Heals.HealsMenuDictionary[name].Item(name + "waitrange").GetValue<Slider>().Value
                                   && !ability.CanHit(x, MyHeroInfo.Position))))
                            : (Heals.HealsMenuDictionary[name].Item(name + "missinghpmin").GetValue<Slider>().Value
                               < heroMissingHp
                               && Heals.HealsMenuDictionary[name].Item(name + "hppercentbelow").GetValue<Slider>().Value
                               > heroHpPercentage))
                    && (name == "item_urn_of_shadows"
                            ? (!enemyHeroes.Any(x => x.Distance2D(hero) < Math.Max(x.GetAttackRange(), 500))
                               && !hero.HasModifiers(
                                   new[]
                                       {
                                           "modifier_doom_bringer_doom", "modifier_axe_battle_hunger",
                                           "modifier_queenofpain_shadow_strike", "modifier_phoenix_fire_spirit_burn",
                                           "modifier_venomancer_poison_nova", "modifier_venomancer_venomous_gale"
                                       },
                                   false))
                            : (name == "item_arcane_boots"
                               || (enemyHeroes.Count(
                                   x =>
                                   (!Heals.HealsMenuDictionary[name].Item(name + "usenearbool").GetValue<bool>()
                                    || Heals.HealsMenuDictionary[name].Item(name + "usenear")
                                           .GetValue<HeroToggler>()
                                           .IsEnabled(NameManager.Name(x)))
                                   && (x.Distance2D(hero) < Math.Max(x.GetAttackRange(), 700))) - 1
                                   >= Heals.HealsMenuDictionary[name].Item(name + "minenemiesaround")
                                          .GetValue<StringList>()
                                          .SelectedIndex)))
                    && (name != "omniknight_purification" || hero.Health < hero.MaximumHealth * 0.22
                        || enemyHeroes.Any(
                            x => x.Predict(Game.Ping).Distance2D(hero.Predict(Game.Ping)) <= ability.GetRadius(name)))
                    && (!(name == "item_mekansm" || name == "item_guardian_greaves" || name == "chen_hand_of_god")
                        || ((!AllyHeroes.Heroes.Any(
                            x =>
                            !x.Equals(hero)
                            && Heals.HealsMenuDictionary[name].Item(name + "useonallies")
                                   .GetValue<HeroToggler>()
                                   .IsEnabled(x.Name)
                            && x.Distance2D(AbilityMain.Me)
                            < Heals.HealsMenuDictionary[name].Item(name + "waitrange").GetValue<Slider>().Value
                            && !ability.CanHit(x, MyHeroInfo.Position)))
                            && Heals.HealsMenuDictionary[name].Item(name + "minalliesheal")
//.........这里部分代码省略.........
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:101,代码来源:FullCombo.cs

示例12: Execute

        public static bool Execute(
            Hero target, 
            Hero[] enemyHeroes, 
            float ping, 
            bool onlyDamage, 
            bool onlyDisable, 
            Hero me,
            float mana)
        {
            var toggler = MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>();
            if (Utils.SleepCheck("UpdateCombo"))
            {
                MyAbilities.Combo =
                    MyAbilities.OffensiveAbilities.Where(
                        x => x.Value.IsValid && x.Value.Owner.Equals(me) && toggler.IsEnabled(NameManager.Name(x.Value)))
                        .OrderBy(x => ComboOrder.GetComboOrder(x.Value, onlyDisable));
                Utils.Sleep(500, "UpdateCombo");
            }

            if (Utils.SleepCheck("casting") && MyAbilities.Combo != null)
            {
                if (target != null)
                {
                    if (Dictionaries.HitDamageDictionary.ContainsKey(target.Handle)
                        && Dictionaries.HitDamageDictionary[target.Handle] * 1.5 >= target.Health
                        && target.Distance2D(MyHeroInfo.Position) <= me.GetAttackRange() + 150)
                    {
                        return false;
                    }

                    if (!Utils.SleepCheck(target.Handle + "KeyCombo"))
                    {
                        return false;
                    }

                    if (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin)
                    {
                        var r = MyAbilities.Combo.FirstOrDefault(x => x.Key == "templar_assassin_psionic_trapslow");
                        var modifier = target.FindModifier("modifier_templar_assassin_trap_slow");
                        if (modifier == null || modifier.RemainingTime < r.Value.GetHitDelay(target))
                        {
                            Slow.TemplarAssasinUseTrap(target);
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tinker && toggler.IsEnabled("tinker_rearm")
                        && MyAbilities.TinkerRearm.CanBeCasted() && Utils.SleepCheck("Ability.TinkerRearm")
                        && !MyAbilities.Combo.Any(
                            x =>
                            x.Value.CanBeCasted()
                            || (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value))))
                    {
                        MyAbilities.TinkerRearm.UseAbility();
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000 + 500, 
                            "Ability.TinkerRearm");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000, 
                            "GlobalCasting");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000, 
                            "casting");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000, 
                            "cancelorder");
                        return true;
                    }

                    foreach (var data in
                        MyAbilities.Combo.Where(
                            x =>
                            x.Value.IsValid
                            && (x.Value.CanBeCasted()
                                || (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
                            && !x.Value.IsAbilityBehavior(AbilityBehavior.Hidden)
                            && ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast()))
                            && (Utils.SleepCheck(x.Value.Handle.ToString())
                                || (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0))))
                    {
                        var ability = data.Value;
                        var name = NameManager.Name(ability);
                        var category = (name == "lion_impale") ? "disable" : data.Key.Substring(name.Length);

                        // if (category == "special" || category == "buff")
                        // {
                        // continue;
                        // }
                        // if (onlyDamage && (category == "disable" || category == "slow" || category == "silence"))
                        // {
                        // continue;
                        // }
                        // if (onlyDisable && (category == "nuke" || category == "harras"))
                        // {
                        // continue;
                        // }
                        if (category != "buff" && target.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
//.........这里部分代码省略.........
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:101,代码来源:FullCombo.cs

示例13: Game_OnUpdate

        public static void Game_OnUpdate(EventArgs args)
        {
            _source = ObjectMgr.LocalHero;

            if (!Game.IsInGame||Game.IsPaused||Game.IsWatchingGame)
            {
                return;
            }
            if (_source.ClassID != ClassID.CDOTA_Unit_Hero_Bristleback)
            {
                return;
            }
            var _enemy = ObjectMgr.GetEntities<Hero>().Where(hero => hero.IsAlive && !hero.IsIllusion && hero.IsVisible && hero.Team != _source.Team);
            var _creep = ObjectMgr.GetEntities<Creep>().Where(x => (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege) && x.IsAlive && x.IsSpawned && x.IsVisible).ToList();
            if (_source == null)
            {
                return;
            }
            if (Quill == null)
            {
                Quill = _source.Spellbook.Spell2;
            }
            if (Goo == null)
            {
                Goo = _source.Spellbook.Spell1;
            }
            if (abyssal == null)
            {
                abyssal = _source.FindItem("item_abyssal_blade");
            }
            if (dust == null)
            {
                dust = _source.FindItem("item_dust");
            }
            if (atos == null)
            {
                atos = _source.FindItem("item_rod_of_atos");
            }
            if (solar == null)
            {
                solar = _source.FindItem("item_solar_crest");
            }
            if (medallion == null)
            {
                medallion = _source.FindItem("item_medallion_of_courage");
            }
            if (halberd == null)
            {
                halberd = _source.FindItem("item_heavens_halberd");
            }
            if (Menu.Item("Quill").GetValue<StringList>().SelectedIndex == 3 && Quill.CanBeCasted() && _source.CanCast() && Utils.SleepCheck("quill") && !_source.IsChanneling() && !_source.IsInvisible())
            {

                foreach (var x in _creep)
                {
                    if (x.Team == _source.GetEnemyTeam() && x.Health > 0 && x.Health < (Quilldmg[Quill.Level-1] * (1-x.DamageResist)+20) && GetDistance2D(x.Position, _source.Position) < Quill.CastRange && Utils.SleepCheck("quill"))
                    {
                        Quill.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "quill");
                    }
                }
            }
            if (Menu.Item("Quill").GetValue<StringList>().SelectedIndex == 0 && Quill.CanBeCasted() && _source.CanCast() && Utils.SleepCheck("quill") && !_source.IsChanneling() && !_source.IsInvisible())
            {
                Quill.UseAbility();
                Utils.Sleep(150 + Game.Ping, "quill");
            }
            if (Menu.Item("Quill").GetValue<StringList>().SelectedIndex == 1 && Quill.CanBeCasted() && _source.CanCast() && Utils.SleepCheck("quill") && !_source.IsChanneling() && !_source.IsInvisible())
            {
                foreach (var enemy in _enemy)
                {
                    if (GetDistance2D(enemy.Position, _source.Position) < Quill.CastRange)
                    {
                        Quill.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "quill");
                    }
                }

            }
            if (chase && Menu.Item("enable").GetValue<bool>())
            {
                _target = _source.ClosestToMouseTarget(1000);
                if (_source.CanAttack() && _source.CanCast())
                {
                    var linken = _target.Modifiers.Any(x => x.Name == "modifier_item_spheretarget") || _target.Inventory.Items.Any(x => x.Name == "item_sphere");
                    if (abyssal != null && abyssal.CanBeCasted() && Utils.SleepCheck("item_abyssal") && !linken)
                    {
                        abyssal.UseAbility(_target);
                        Utils.Sleep(400 + Game.Ping, "item_abyssal");
                    }
                    if (abyssal != null)
                    {
                        Utils.ChainStun(_source, 310, null, false);
                    }
                    if (medallion != null && medallion.CanBeCasted() && Utils.SleepCheck("item_medal") && !linken)
                    {
                        medallion.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "item_medal");
                    }
                    if (atos != null && atos.CanBeCasted() && Utils.SleepCheck("item_atos") && !linken)
//.........这里部分代码省略.........
开发者ID:spyware293,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例14: Tick

        public static void Tick(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;
            me = ObjectMgr.LocalHero;
            if (me == null)
                return;
            if (me.ClassID != ClassID.CDOTA_Unit_Hero_EarthSpirit)
                return;


            //SKILLS
            
            if (Qskill == null)
                Qskill = me.Spellbook.SpellQ;
            if (Wskill == null)
                Wskill = me.Spellbook.SpellW;
            if (Eskill == null)
                Eskill = me.Spellbook.SpellE;
            if (DRemnant == null)
                DRemnant = me.Spellbook.SpellD;
            if (Rskill == null)
                Rskill = me.Spellbook.SpellR;
            if (Fskill == null)
                Fskill = me.Spellbook.SpellF;

            // UNIT VARIABLES

            stone_for_combo = ObjectMgr.GetEntities<Unit>().Where(x => x.ClassID == ClassID.CDOTA_Unit_Earth_Spirit_Stone && me.Distance2D(x.NetworkPosition) < 200).FirstOrDefault();
            stone = ObjectMgr.GetEntities<Unit>().Where(x => x.ClassID == ClassID.CDOTA_Unit_Earth_Spirit_Stone && x.NetworkPosition.Distance2D(me.NetworkPosition) <= 1300).ToList();
            if (boulder_slow == null || stage_combo4 == 0)
                boulder_slow = ObjectMgr.GetEntities<Hero>().Where(x => x.Team != me.Team && x.IsVisible && !x.IsIllusion && x.NetworkPosition.Distance2D(me.NetworkPosition) < 200 && x.Modifiers.Any(y => y.Name == "modifier_earth_spirit_rolling_boulder_slow")).FirstOrDefault();
            if (stage == 2 && stunned == null)
                stunned = ObjectMgr.GetEntities<Hero>().Where(x => x.Modifiers.Any(y => y.Name == "modifier_stunned") && !x.IsIllusion && x.Team != me.Team && x.IsVisible).FirstOrDefault();

            //KEYS TOGGLE

            if ((Game.IsKeyDown(_hotkeys_config.Item("hotkeycombo1").GetValue<KeyBind>().Key)) && !Game.IsChatOpen && stunned == null)
                key_active = true;
            if ((Game.IsKeyDown(_hotkeys_config.Item("hotkeycombo3").GetValue<KeyBind>().Key)) && !Game.IsChatOpen)
                key_active_2 = true;
            if ((Game.IsKeyDown(_hotkeys_config.Item("hotkeycombo5").GetValue<KeyBind>().Key)) && !Game.IsChatOpen)
                key_active_4 = true;

            if (key_active == false)
            { stage = 0; key_active = false; stunned = null; }

            if (me.CanCast() && !me.IsChanneling() && key_active)
            {
                Mouse_Position = Game.MousePosition;
                if ((!Eskill.CanBeCasted() && !Qskill.CanBeCasted() && !Wskill.CanBeCasted() && (!DRemnant.CanBeCasted() && stone_for_combo == null) || ((!DRemnant.CanBeCasted() && stone_for_combo == null))) || (Game.IsKeyDown(_hotkeys_config.Item("hotkeycombo2").GetValue<KeyBind>().Key)))
                {
                    if (auto_atack_after_spell)
                    {
                        Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
                        auto_atack_after_spell = false;
                    }
                    if (auto_atack)
                    {
                        Game.ExecuteCommand("dota_player_units_auto_attack 1");
                        auto_atack = false;
                    }
                    key_active = false;
                    stage = 0;
                    stunned = null;
                }
                if (stage == 0 && Utils.SleepCheck("auto_atack_change"))
                {
                    if (Game.GetConsoleVar("dota_player_units_auto_attack_after_spell").GetInt() == 1)
                    {
                        Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
                        auto_atack_after_spell = true;
                    }
                    else
                        auto_atack_after_spell = false;
                    if (Game.GetConsoleVar("dota_player_units_auto_attack").GetInt() == 1)
                    {
                        Game.ExecuteCommand("dota_player_units_auto_attack 0");
                        auto_atack = true;
                    }
                    else
                        auto_atack = false;
                    stage = 1;
                    Utils.Sleep(Game.Ping, "auto_atack_change");

                }
                else if (stage == 1 && Utils.SleepCheck("Qskill") && Utils.SleepCheck("auto_atack_change"))
                {
                    if (DRemnant.CanBeCasted() && Utils.SleepCheck("DRemnant") && stone_for_combo == null && (Qskill.CanBeCasted() && Wskill.CanBeCasted() && Eskill.CanBeCasted()))
                    {
                        DRemnant.UseAbility(me.NetworkPosition);
                        Utils.Sleep(500 - (int)Game.Ping, "DRemnant");
                    }
                    if (Qskill.CanBeCasted())
                    {
                        Qskill.UseAbility((Mouse_Position - me.NetworkPosition) * 200 / Mouse_Position.Distance2D(me) + me.NetworkPosition);
                        Utils.Sleep((int)Game.Ping + 50, "Qskill");
                    }
                    else
                        stage = 2;
//.........这里部分代码省略.........
开发者ID:jaddyknight,项目名称:EnsageSharp,代码行数:101,代码来源:ES_NINJA.cs

示例15: Kill

        private static void Kill(Hero me, Ability ability, IReadOnlyList<double> damage, uint spellTargetType, uint? range = null, bool lsblock = true, bool piercesSpellImmunity = false, bool smartKill = false, bool complexKill = false, IReadOnlyList<double> adamage = null)
        {
            if (ability.Level > 0)
            {
                double normalDamage;
                if (adamage == null)
                    normalDamage = damage[(int) ability.Level];
                else
                    normalDamage = me.AghanimState() ? damage[(int) ability.Level] : adamage[(int) ability.Level];

                var spellDamageType = ability.DamageType;
                var spellRange = range ?? (ability.CastRange + 50);
                var spellCastPoint = (float)(ability.GetCastPoint() + Game.AvgPing / 1000);

                var enemies = ObjectMgr.GetEntities<Hero>().Where(enemy => enemy.Team == me.GetEnemyTeam() && !enemy.IsIllusion() && enemy.IsVisible && enemy.IsAlive && enemy.Health > 0).ToList();
                foreach (var enemy in enemies)
                {
                    double spellDamage;
                    if (complexKill)
                        spellDamage = GetComplexDamage(ability.Level, enemy, me, normalDamage);
                    else if (smartKill)
                        spellDamage = GetSmartDamage(ability.Level, me, damage);
                    else
                        spellDamage = normalDamage;

                    var damageDone = enemy.DamageTaken((float)spellDamage, spellDamageType, me, piercesSpellImmunity);

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Axe)
                        damageDone = (float) spellDamage;

                    float damageNeeded;

                    if (!HeroDamageDictionary.TryGetValue(enemy, out damageNeeded))
                    {
                        damageNeeded = enemy.Health - damageDone + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
                        HeroDamageDictionary.Add(enemy, damageNeeded);
                        HeroSpellDictionary.Add(enemy, ability);
                    }
                    else
                    {
                        HeroDamageDictionary.Remove(enemy);
                        HeroSpellDictionary.Remove(enemy);
                        damageNeeded = enemy.Health - damageDone + spellCastPoint * enemy.HealthRegeneration + MorphMustDie(enemy, spellCastPoint);
                        HeroDamageDictionary.Add(enemy, damageNeeded);
                        HeroSpellDictionary.Add(enemy, ability);
                    }

                    if (_killstealEnabled && !me.IsChanneling())
                    {
                        if (damageNeeded < 0 && me.Distance2D(enemy) < spellRange && MeCanSurvive(enemy, me, ability, damageDone))
                        {
                            switch (spellTargetType)
                            {
                                case 1:
                                    CastSpell(ability, enemy, me, lsblock);
                                    break;
                                case 2:
                                    CastSpell(ability, enemy.Position, me, lsblock);
                                    break;
                                case 3:
                                    if (ability.CanBeCasted() && me.CanCast())
                                        ability.UseAbility();
                                    break;
                            }
                            break;
                        }
                    }
                }
            }
        }
开发者ID:YukinoAguria,项目名称:ensagesharp,代码行数:70,代码来源:Program.cs


注:本文中的Hero.CanCast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。