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


C# Ability.CanBeCasted方法代码示例

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


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

示例1: UseMidas

        // --→ Function: Use Midas
        private static void UseMidas(Ability midas, Unit owner)
        {
            if (midas.CanBeCasted() && owner.CanUseItems() && owner.Equals(mHero))
            {
                if (!heroCreateSideMessage)
                {
                    heroCreateSideMessage = true;
                    GenerateSideMessage(GetOwnerName(owner));
                }
                var creeps = ObjectMgr.GetEntities<Creep>().Where(creep => creep.Team != owner.Team && creep.IsAlive && creep.IsVisible && creep.IsSpawned && !creep.IsAncient && creep.Health > 0 && creep.Distance2D(owner) < midas.CastRange + 25).ToList();
                if (!creeps.Any()) return;
                midas.UseAbility(creeps.First());
            }
            else if(heroCreateSideMessage) heroCreateSideMessage = false;

            if (midas.CanBeCasted() && owner.CanUseItems() && owner.ClassID.Equals(ClassID.CDOTA_Unit_SpiritBear))
            {
                if (!bearCreateSideMessage)
                {
                    bearCreateSideMessage = true;
                    GenerateSideMessage(GetOwnerName(owner));
                }
                var creeps = ObjectMgr.GetEntities<Creep>().Where(creep => creep.Team != owner.Team && creep.IsAlive && creep.IsVisible && creep.IsSpawned && !creep.IsAncient && creep.Health > 0 && creep.Distance2D(owner) < midas.CastRange + 25).ToList();
                if (!creeps.Any()) return;
                midas.UseAbility(creeps.First());
            }
            else if(bearCreateSideMessage) bearCreateSideMessage = false;
        }
开发者ID:vitac1998,项目名称:ensagesharp-1,代码行数:29,代码来源:AutoMidas.cs

示例2: useAbility

		private static bool useAbility(Ability ability, string codeWord, Hero target, bool isPos, Hero me)
		{
			if (ability == null)
			{
				return true;
			}
			if (ability.CanBeCasted() && !ability.IsInAbilityPhase && Utils.SleepCheck(codeWord))
			{
				if (target != null)
				{
					if (isPos)
					{
						ability.UseAbility(target.Position);
					}
					else
					{
						ability.UseAbility(target);
					}
				}
				else
				{
					ability.UseAbility();
				}
				Utils.Sleep(ability.GetCastDelay(me, target, true) * 1000, codeWord);
				if (ability.CanBeCasted())
				{
					return false;
				}
			}
			return true;
			}
开发者ID:oleg9522,项目名称:Ensage,代码行数:31,代码来源:Program.cs

示例3: Game_OnUpdate

 public static void Game_OnUpdate(EventArgs args)
 {
     if (!Game.IsInGame) return;
     _me = ObjectMgr.LocalHero;
     if (_me == null || _me.ClassID != ClassID.CDOTA_Unit_Hero_Morphling)
     {
         return;
     }
     if (!_activated) return;
     if ((_target == null || !_target.IsVisible) && !_me.IsChanneling())
         _me.Move(Game.MousePosition);
     if (_target == null || _me.Distance2D(_target) > 500)
         _target = _me.ClosestToMouseTarget(1000);
     //Skills & Items
     waveform = _me.Spellbook.Spell1;
     adapt = _me.Spellbook.Spell2;
     eblade = _me.FindItem("item_ethereal_blade");
     bkb = _me.FindItem("item_black_king_bar");
     if (_target != null && _target.IsAlive && !_target.IsInvul())
     {
         if (!Utils.SleepCheck("Morph_Wait")) return;
         var targetDistance = _me.Distance2D(_target);
         var attackRange = 1000;
         if (targetDistance <= attackRange && waveform != null && waveform.CanBeCasted() && Utils.SleepCheck("waveform"))
         {
             waveform.UseAbility(_target.Position);
             Utils.Sleep(150 + Game.Ping, "waveform");
         }
         else if (bkb !=null && _bkbToggle && Utils.SleepCheck("BKB"))
         {
             bkb.UseAbility();
             Utils.Sleep(150 + Game.Ping, "BKB");
         }
         else if (eblade != null && eblade.CanBeCasted() && Utils.SleepCheck("eblade"))
         {
             eblade.UseAbility(_target);
             Utils.Sleep(150 + Game.Ping, "eblade");
         }
         else if (adapt != null && adapt.CanBeCasted() && Utils.SleepCheck("adapt"))
         {
             adapt.UseAbility(_target);
             Utils.Sleep(150 + Game.Ping, "adapt");
         }
     }
 }
开发者ID:potassiumsquare,项目名称:Morph,代码行数:45,代码来源:Program.cs

示例4: CastHeal

 private static void CastHeal(Ability healSpell, Hero destination = null)
 {
     if (destination != null)
     {
         if (healSpell.CanBeCasted() && Utils.SleepCheck("Casting Heal"))
         {
             healSpell.UseAbility(destination);
             Utils.Sleep(100 + Game.Ping, "Casting Heal");
         }
     }
     else
     {
         if (Utils.SleepCheck("Casting Heal"))
         {
             healSpell.UseAbility();
             Utils.Sleep(healSpell.ChannelTime + Game.Ping, "Casting Heal");
         }
     }
 }
开发者ID:EmptyMer1s0n,项目名称:EnsageSharp,代码行数:19,代码来源:Program.cs

示例5: Combo

        //private int stage;
        public void Combo()
        {
            target = me.ClosestToMouseTarget(2000);

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

            if (me == null || target == null)
                return;
            // skills
                Q = me.Spellbook.SpellQ;
                W = me.Spellbook.SpellW;
                E = me.Spellbook.SpellE;
                D = me.Spellbook.SpellD;
                R = me.Spellbook.SpellR;
            // itens
            blink = me.FindItem("item_blink");
            dagon = me.Inventory.Items.FirstOrDefault(x => x.Name.Contains("item_dagon"));
            ethereal = me.FindItem("item_ethereal_blade");
            euls = me.FindItem("item_cyclone");
            Shiva = me.FindItem("item_shivas_guard");
            orchid = me.FindItem("item_orchid");
            vail = me.FindItem("item_veil_of_discord");
            forcestaff = me.FindItem("item_force_staff");
            sheep = me.FindItem("item_sheepstick");

            //Starting Combo

            var _Is_in_Advantage = (target.HasModifier("modifier_item_blade_mail_reflect") ||
                                    target.HasModifier("modifier_item_lotus_orb_active") ||
                                    target.HasModifier("modifier_nyx_assassin_spiked_carapace") ||
                                    target.HasModifier("modifier_templar_assassin_refraction_damage") ||
                                    target.HasModifier("modifier_ursa_enrage") ||
                                    target.HasModifier("modifier_abaddon_borrowed_time") ||
                                    (target.HasModifier("modifier_dazzle_shallow_grave")));
            if (Game.IsKeyDown(menu.Item("Full").GetValue<KeyBind>().Key) && Utils.SleepCheck("combo"))
            {
                if (me.CanCast() && !me.IsChanneling() && me.Distance2D(target) <= 1200 &&
                 target.IsVisible && target.IsAlive && !target.IsMagicImmune() &&
                 !_Is_in_Advantage)
                {
                    if (me.CanCast())
                    {
                        var v =
                      ObjectManager.GetEntities<Hero>()
                          .Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion && !x.IsMagicImmune())
                          .ToList();
                        var X = me.Position.X;
                        var Y = me.Position.Y;
                        var pos = new Vector3(X, Y, me.Position.Z);
                        if (me.Position.X < 0)
                        {
                            X = me.Position.X + 100;
                        }
                        else
                        {
                            X = me.Position.X - 100;
                        }
                        if (me.Position.Y < 0)
                        {
                            Y = me.Position.Y + 100;
                        }
                        else
                        {
                            Y = me.Position.Y - 100;
                        }
                        uint elsecount = 0;
                        if (blink != null
                            && blink.CanBeCasted()
                            && me.Distance2D(target.Position) > 300
                            && menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(blink.Name))
                        {
                            blink.UseAbility(target.Position);
                        }
                        elsecount++;
                        if ( // vail
                            vail != null
                            && vail.CanBeCasted()
                            && me.CanCast()
                            && menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(vail.Name)
                            && !target.IsMagicImmune()
                            && Utils.SleepCheck("vail")
                            && me.Distance2D(target) <= 1500
                            )
                        {
                            vail.UseAbility(target.Position);
                        }
                        else elsecount++;
                        if (orchid != null && orchid.CanBeCasted() &&
                                menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(orchid.Name))
                        {
                            orchid.UseAbility(target);
                        }
                        else elsecount++;
                        if (sheep != null && sheep.CanBeCasted() &&
                                      menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(sheep.Name))
                        {
                            sheep.UseAbility(target);
                        }
//.........这里部分代码省略.........
开发者ID:Rulfy,项目名称:ReworkAllScripts,代码行数:101,代码来源:PuckController.cs

示例6: Combo

        public void Combo()
        {
            Active = Game.IsKeyDown(Menu.Item("keyBind").GetValue<KeyBind>().Key);

            Q = me.Spellbook.SpellQ;
            W = me.Spellbook.SpellW;
            R = me.Spellbook.SpellR;

            mom = me.FindItem("item_mask_of_madness");
            urn = me.FindItem("item_urn_of_shadows");
            dagon = me.Inventory.Items.FirstOrDefault(x => x.Name.Contains("item_dagon"));
            halberd = me.FindItem("item_heavens_halberd");
            mjollnir = me.FindItem("item_mjollnir");
            armlet = me.FindItem("item_armlet");
            abyssal = me.FindItem("item_abyssal_blade");
            mail = me.FindItem("item_blade_mail");
            bkb = me.FindItem("item_black_king_bar");
            blink = me.FindItem("item_blink");
            satanic = me.FindItem("item_satanic");
            medall = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest");
            Shiva = me.FindItem("item_shivas_guard");
            manta = me.FindItem("item_manta");
            var v =
                ObjectManager.GetEntities<Hero>()
                    .Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion && !x.IsMagicImmune())
                    .ToList();
            e = Toolset.ClosestToMouse(me);
            if (e == null)
                return;
            var a = ObjectManager.GetEntities<Hero>()
                        .Where(x => x.Team == me.Team && x.IsAlive && x.IsVisible && x.IsIllusion && x.IsControllable).ToList();
            var illy = a.Count;
            if (illy >= 1)
            {
                for (int i = 0; i < illy; ++i)
                {
                    if (a[i].Distance2D(e) <= a[i].GetAttackRange() + a[i].HullRadius && !e.IsAttackImmune()
                        && !a[i].IsAttacking() && a[i].CanAttack() && Utils.SleepCheck(a[i].Handle + "Attack")
                        )
                    {
                        a[i].Attack(e);
                        Utils.Sleep(330, a[i].Handle + "Attack");
                    }
                    else if (a[i].Distance2D(e) <= 1000)
                    {
                        if ((!a[i].CanAttack() || a[i].Distance2D(e) >= 0)
                           && !a[i].IsAttacking()
                           && a[i].CanMove() && Utils.SleepCheck(a[i].Handle + "Move")
                           )
                        {
                            a[i].Move(Prediction.InFront(e, 100));
                            Utils.Sleep(400, a[i].Handle + "Move");
                        }
                    }
                }
            }
            if (Active)
            {
                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 && !Toolset.invUnit(me))
            {
                float angle = me.FindAngleBetween(e.Position, true);
                Vector3 pos = new Vector3((float) (e.Position.X - 70*Math.Cos(angle)), (float) (e.Position.Y - 70*Math.Sin(angle)),
                    0);
                if (
                    blink != null
                    && Q.CanBeCasted()
                    && me.CanCast()
                    && blink.CanBeCasted()
                    && me.Distance2D(e) >= 490
                    && me.Distance2D(pos) <= 1180
                    && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(blink.Name)
                    && Utils.SleepCheck("blink")
                    )
                {
                    blink.UseAbility(pos);
                    Utils.Sleep(250, "blink");
                }
                if (
                    Q != null
                    && Q.CanBeCasted()
                    && me.Distance2D(e) <= 900
                    && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(Q.Name)
                    && Utils.SleepCheck("Q")
                    )
                {
                    Q.UseAbility(e);
                    Utils.Sleep(200, "Q");
                }
                if (armlet != null
                    && !armlet.IsToggled
                    && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(armlet.Name) &&
                    Utils.SleepCheck("armlet"))
                {
                    armlet.ToggleAbility();
                    Utils.Sleep(300, "armlet");
//.........这里部分代码省略.........
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:101,代码来源:ChaosKnightController.cs

示例7: Combo

        public void Combo()
        {
            // Target initialization

            // Spells initialization
            Q = me.Spellbook.SpellQ;
            W = me.Spellbook.SpellW;
            E = me.Spellbook.SpellE;
            R = me.Spellbook.SpellR;
            // Items initialization
            ethereal = me.FindItem("item_ethereal_blade");
            vail = me.FindItem("item_veil_of_discord");
            cheese = me.FindItem("item_cheese");
            ghost = me.FindItem("item_ghost");
            orchid = me.FindItem("item_orchid") ?? me.FindItem("item_bloodthorn");
            atos = me.FindItem("item_rod_of_atos");
            soul = me.FindItem("item_soul_ring");
            arcane = me.FindItem("item_arcane_boots");
            blink = me.FindItem("item_blink");
            shiva = me.FindItem("item_shivas_guard");
            dagon = me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_dagon"));

            // State of keys initialization
            Active = Game.IsKeyDown(Menu.Item("keyBind").GetValue<KeyBind>().Key) && !Game.IsChatOpen;
            Push = Game.IsKeyDown(Menu.Item("keyQ").GetValue<KeyBind>().Key) && !Game.IsChatOpen;

            enemies = ObjectManager.GetEntities<Hero>()
                 .Where(x => x.IsVisible && x.IsAlive && x.Team != me.Team && !x.IsFullMagicResist() && !x.IsIllusion).ToList();
            // OnUpdateEvent::END

            // [VickTheRock]

            if (Push)
            {
                if (Q == null) return;

                var unitsList = ObjectManager.GetEntities<Unit>().Where(creep =>
                    (creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
                    || creep.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit
                    || creep.ClassID == ClassID.CDOTA_BaseNPC_Warlock_Golem
                    || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep
                    || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
                    || creep.ClassID == ClassID.CDOTA_Unit_Hero_Beastmaster_Boar
                    || creep.ClassID == ClassID.CDOTA_Unit_SpiritBear
                    || creep.ClassID == ClassID.CDOTA_Unit_Broodmother_Spiderling
                    )
                    && creep.IsAlive
                    && creep.Distance2D(me) <= Q.GetCastRange() + me.HullRadius
                    && creep.IsSpawned
                    && creep.Team != me.Team
                    ).ToList();

                foreach (var v in unitsList)
                {
                    var damageQ = qDmg[Q.Level];
                    if (me.Distance2D(v) < 1200)
                        damageQ += E.GetAbilityData("damage_health_pct") * 0.01 * v.Health;

                    var lens = me.HasModifier("modifier_item_aether_lens");
                    var spellamplymult = 1 + (me.TotalIntelligence / 16 / 100);
                    if (lens) damageQ *= 1.08;
                    damageQ *= spellamplymult;
                    damageQ *= (1 - v.MagicDamageResist);
                    if (Q.CanBeCasted() && v.Distance2D(me) <= Q.GetCastRange() + me.HullRadius && v.Health <= damageQ && Utils.SleepCheck("qq"))
                    {
                        Q.UseAbility(v);
                        Utils.Sleep(250, "qq");
                    }
                }
            } // if(Push)::END

            e = Toolset.ClosestToMouse(me);
            if (e == null) return;

            var modifEther = e.HasModifier("modifier_item_ethereal_blade_slow");
            var stoneModif = e.HasModifier("modifier_medusa_stone_gaze_stone");
            sheep = e.Name == "npc_dota_hero_tidehunter" ? null : me.FindItem("item_sheepstick");

            if (Active && me.IsAlive && e.IsAlive && Utils.SleepCheck("activated"))
            {
                var noBlade = e.HasModifier("modifier_item_blade_mail_reflect");
                if (e.IsVisible && me.Distance2D(e) <= 2300 && !noBlade)
                {
                    if ( // atos Blade
                        atos != null
                        && atos.CanBeCasted()
                        && me.CanCast()
                        && !e.IsLinkensProtected()
                        && !e.IsMagicImmune()
                        && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(atos.Name)
                        && me.Distance2D(e) <= 2000
                        && Utils.SleepCheck("atos")
                        )
                    {
                        atos.UseAbility(e);
                        Utils.Sleep(250, "atos");
                    } // atos Item end

                    if (
                        blink != null
//.........这里部分代码省略.........
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:101,代码来源:ZuusController.cs

示例8: CastHeal

        private static void CastHeal(Ability healSpell, Hero destination = null, bool toggle = false)
        {
            /*if (destination != null)
            {
                if (healSpell.CanBeCasted() && Utils.SleepCheck("Casting Heal"))
                {
                    healSpell.UseAbility(destination);
                    Utils.Sleep(100 + Game.Ping, "Casting Heal");
                }
            }
            else
            {
                if (Utils.SleepCheck("Casting Heal"))
                {
                    healSpell.UseAbility();
                    Utils.Sleep(healSpell.ChannelTime + Game.Ping, "Casting Heal");
                }
            }*/

            if (healSpell != null && healSpell.CanBeCasted() && me.CanCast())
            {
                if (toggle)
                {
                    if (!healSpell.IsToggled)
                    {
                        healSpell.ToggleAbility();
                    }
                }
                else
                {
                    if (destination == null)
                    {
                    }
                    else
                    {
                        healSpell.UseAbility(target);
                        if (healSpell.Name == "wisp_tether" && !me.Spellbook.SpellW.IsToggled &&
                            me.Spellbook.SpellW.Cooldown == 0)
                        {
                            me.Spellbook.Spell4.ToggleAbility();
                        }
                    }
                }
            }
        }
开发者ID:evezus,项目名称:EnsageSharp,代码行数:45,代码来源:Program.cs

示例9: Combo

        /* Доп. функции скрипта
        -----------------------------------------------------------------------------*/
        public void Combo()
        {
            e = Toolset.ClosestToMouse(me);
            if (e.HasModifier("modifier_abaddon_borrowed_time")
            || e.HasModifier("modifier_item_blade_mail_reflect")
            || e.IsMagicImmune())
            {
                var enemies = ObjectManager.GetEntities<Hero>()
                        .Where(x => x.IsAlive && x.Team != me.Team && !x.IsIllusion && !x.IsMagicImmune()
                        && (!x.HasModifier("modifier_abaddon_borrowed_time")
                        || !x.HasModifier("modifier_item_blade_mail_reflect"))
                        && x.Distance2D(e) > 200).ToList();
                e = GetClosestToTarget(enemies, e) ?? null;
                if (Utils.SleepCheck("spam"))
                {
                    Utils.Sleep(5000, "spam");
                }
            }
            if (e == null) return;
            //spell
            Q = me.Spellbook.SpellQ;

            W = me.Spellbook.SpellW;

            E = me.Spellbook.SpellE;

            R = me.Spellbook.SpellR;
            // Item
            ethereal = me.FindItem("item_ethereal_blade");

            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");

            orchid = me.FindItem("item_orchid") ?? me.FindItem("item_bloodthorn");

            atos = me.FindItem("item_rod_of_atos");

            soul = me.FindItem("item_soul_ring");

            arcane = me.FindItem("item_arcane_boots");

            blink = me.FindItem("item_blink");

            shiva = me.FindItem("item_shivas_guard");

            dagon = me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_dagon"));

            Active = Game.IsKeyDown(Menu.Item("keyBind").GetValue<KeyBind>().Key);

            Push = Game.IsKeyDown(Menu.Item("keyQ").GetValue<KeyBind>().Key);

            var stoneModif = e.HasModifier("modifier_medusa_stone_gaze_stone");
            A();
            if (Push && Q != null && Q.CanBeCasted())
            {
                if (
                    Q != null
                    && Q.CanBeCasted()
                    && (e.IsLinkensProtected()
                    || !e.IsLinkensProtected())
                    && me.CanCast()
                    && me.Distance2D(e) < Q.GetCastRange() + me.HullRadius + 24
                    && Utils.SleepCheck("Q")
                    )
                {
                    Q.UseAbility(e);
                    Utils.Sleep(200, "Q");
                }
            }
            if (Active && me.IsAlive && e.IsAlive && Utils.SleepCheck("activated"))
            {
                if (stoneModif) return;
                //var noBlade = e.HasModifier("modifier_item_blade_mail_reflect");
                if (e.IsVisible && me.Distance2D(e) <= 2300)
                {
                    var distance = me.IsVisibleToEnemies ? 1400 : E.GetCastRange() + me.HullRadius;
                    if (
                        Q != null
                        && Q.CanBeCasted()
                        && me.CanCast()
                        && e.IsLinkensProtected()
                        && !e.IsMagicImmune()
                        && me.Distance2D(e) < Q.GetCastRange() + me.HullRadius
                        && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(Q.Name)
                        && Utils.SleepCheck("Q")
                        )
                    {
                        Q.UseAbility(e);
                        Utils.Sleep(200, "Q");
                    }

                    if (
                        E != null
//.........这里部分代码省略.........
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:101,代码来源:SkywrathMageController.cs

示例10: 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

示例11: UseSpell

 private static void UseSpell(Ability spellForCast, Hero target,Hero me)
 {
     if (spellForCast.CanBeCasted(target))
     {
         spellForCast.UseAbility(target);
     }
     spellForCast.UseAbility();
     spellForCast.UseAbility(target.Position);
     spellForCast.UseAbility(me);
 }
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:10,代码来源:Program.cs

示例12: ChasingAll

        public void ChasingAll(EventArgs args)
        {
            e = Toolset.ClosestToMouse(me);
            if (e == null) return;
            if (Combokey  && e.IsAlive && !me.IsVisibleToEnemies)
            {

                if (Menu.Item("orbwalk").GetValue<bool>() && me.Distance2D(e) <= 1900)
                {
                    Orbwalking.Orbwalk(e, 0, 1600, true, true);
                }
            }
            if (Combokey && e.IsAlive && me.IsVisibleToEnemies)
            {

                var Spiderlings = ObjectManager.GetEntities<Unit>().Where(spiderlings => spiderlings.ClassID == ClassID.CDOTA_Unit_Broodmother_Spiderling).ToList();
                var count = Spiderlings.Count();
                for (int s = 0; s < count; ++s)
                {
                    if (Spiderlings[s].Distance2D(e) <= 1500 && Utils.SleepCheck(Spiderlings[s].Handle + "Spiderlings"))
                    {
                        Spiderlings[s].Attack(e);
                        Utils.Sleep(500, Spiderlings[s].Handle + "Spiderlings");
                    }
                }
                for (int s = 0; s < count; ++s)
                {
                    if (Spiderlings[s].Distance2D(e) >= 1500 && Utils.SleepCheck(Spiderlings[s].Handle + "Spiderlings"))
                    {
                        Spiderlings[s].Move(Game.MousePosition);
                        Utils.Sleep(500, Spiderlings[s].Handle + "Spiderlings");
                    }
                }

                var linkens = e.IsLinkensProtected();
                if (e.IsAlive && !e.IsIllusion && me.Distance2D(e) <= 1000)
                {

                        Q = me.Spellbook.SpellQ;

                        W = me.Spellbook.SpellW;

                        R = me.Spellbook.SpellR;

                    // Item

                    sheep = e.ClassID == ClassID.CDOTA_Unit_Hero_Tidehunter ? null : me.FindItem("item_sheepstick");

                    cheese = me.FindItem("item_cheese");

                    orchid = me.FindItem("item_orchid") ?? me.FindItem("item_bloodthorn");

                    Soul = me.FindItem("item_soul_ring");

                    shiva = me.FindItem("item_shivas_guard");

                    dagon = me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_dagon"));

                    mom = me.FindItem("item_mask_of_madness");

                    abyssal = me.FindItem("item_abyssal_blade");

                    mjollnir = me.FindItem("item_mjollnir");

                    halberd = me.FindItem("item_heavens_halberd");

                    mail = me.FindItem("item_blade_mail");

                    bkb = me.FindItem("item_black_king_bar");

                    medall = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest");

                    satanic = me.FindItem("item_satanic");

                    if ( // Q Skill
                           Q != null &&
                           Q.CanBeCasted() &&
                           me.CanCast()
                        && me.IsVisibleToEnemies &&
                           !e.IsMagicImmune()
                           && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(Q.Name)
                           && me.Distance2D(e) <= 600
                           && Utils.SleepCheck("Q")
                           )

                    {
                        Q.UseAbility(e);
                        Utils.Sleep(250, "Q");
                    } // Q Skill end

                    if (//R Skill
                        R != null &&
                        R.CanBeCasted() &&
                        me.CanCast() &&
                        me.Distance2D(e) <= 350
                        && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(R.Name)
                        && Utils.SleepCheck("R")
                        )
                    {
                        R.UseAbility();
//.........这里部分代码省略.........
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:101,代码来源:BroodmotherController.cs

示例13: Combo

        public void Combo()
        {
            if (!Menu.Item("enabled").IsActive())
                return;
            me = ObjectManager.LocalHero;
            e = Toolset.ClosestToMouse(me);
            LastHitkey = Menu.Item("LastHit").GetValue<KeyBind>().Active;
            Combokey = Game.IsKeyDown(Menu.Item("ComboKey").GetValue<KeyBind>().Key);
            Chasekey = Game.IsKeyDown(Menu.Item("ChaseKey").GetValue<KeyBind>().Key);
            useQ = Menu.Item("useQ").IsActive();

            if (LastHitkey && !Combokey && !Chasekey && Utils.SleepCheck("combo") && !Game.IsPaused)
            {

                Q = me.Spellbook.SpellQ;

                Soul = me.FindItem("item_soul_ring");

                var spiderlingsLevel = me.Spellbook.SpellQ.Level - 1;

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

                var creeps = ObjectManager.GetEntities<Creep>().Where(creep => (creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral ||
                (creep.ClassID == ClassID.CDOTA_Unit_VisageFamiliar && creep.Team != me.Team) || (creep.ClassID == ClassID.CDOTA_Unit_SpiritBear && creep.Team != me.Team) || (creep.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit &&
                creep.Team != me.Team) || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep &&
                creep.IsAlive && creep.IsVisible && creep.IsSpawned) && creep.Health <= 259).ToList();

                var creepQ = ObjectManager.GetEntities<Creep>().Where(creep => (creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral ||
                creep.ClassID == ClassID.CDOTA_Unit_SpiritBear || creep.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit || creep.ClassID == ClassID.CDOTA_BaseNPC_Creep &&
                creep.IsAlive && creep.IsVisible && creep.IsSpawned)).ToList();

                var Spiderlings = ObjectManager.GetEntities<Unit>().Where(spiderlings => spiderlings.ClassID == ClassID.CDOTA_Unit_Broodmother_Spiderling).ToList();

                // Creep Q lasthit
                if (useQ && Q.CanBeCasted() && me.IsAlive)
                    foreach (var creep in creepQ)
                    {
                        if (creep.Health <= Math.Floor((spiderQ[spiderlingsLevel]) * (1 - creep.MagicDamageResist)) && creep.Health > 45 && creep.Team != me.Team)
                        {
                            if (creep.Position.Distance2D(me.Position) <= 600 && Utils.SleepCheck("QQQ"))
                            {
                                if (Soul != null && Soul.CanBeCasted() && me.Health >= 400)
                                {
                                    Soul.UseAbility();
                                    Utils.Sleep(300, "QQQ");
                                }
                                else
                                    Q.UseAbility(creep);
                                Utils.Sleep(300, "QQQ");

                            }
                        }
                    }
                // Enemy Q lasthit
                if (Q.CanBeCasted() && me.IsAlive)
                {
                    foreach (var enemy in enemies)
                    {
                        if (enemy.Health <= (spiderQ[spiderlingsLevel] - enemy.MagicDamageResist) && enemy.Health > 0)
                        {
                            if (enemy.Position.Distance2D(me.Position) <= 600 && Utils.SleepCheck("QQQ"))
                            {
                                if (Soul != null && Soul.CanBeCasted() && me.Health >= 400)
                                {
                                    Soul.UseAbility();
                                    Utils.Sleep(300, "QQQ");
                                }
                                else
                                    Q.UseAbility(e);
                                Utils.Sleep(300, "QQQ");
                            }
                        }
                    }
                }

                //var Spiderling = ObjectManager.GetEntities<Unit>().Where(x => x.ClassID == ClassID.CDOTA_Unit_Broodmother_Spiderling && x.IsAlive && x.IsControllable && x.Team == me.Team).ToList();
                var count = Spiderlings.Count();
                if (count <= 0)
                    return;
                // Autodenies
                for (int s = 0; s < count; ++s)
                {
                    if (Spiderlings[s].Health > 0 && Spiderlings[s].Health <= spiderDenies)
                    {
                        for (int z = 0; z < count; ++z)
                        {
                            if (Spiderlings[s].Position.Distance2D(Spiderlings[z].Position) <= 500
                                && Utils.SleepCheck(Spiderlings[z].Handle + "Spiderlings"))
                            {
                                Spiderlings[z].Attack(Spiderlings[s]);
                                Utils.Sleep(350, Spiderlings[z].Handle + "Spiderlings");

                            }
                        }
                    }
                }

                // Auto spider deny and lasthit
                var countcreep = creeps.Count();
                if (countcreep>=1)
//.........这里部分代码省略.........
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:101,代码来源:BroodmotherController.cs

示例14: Game_OnUpdate

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

            if (me == null || !Game.IsInGame || Game.IsWatchingGame)
                return;

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

            // Ability init
            Laser = me.Spellbook.Spell1;
            Rocket = me.Spellbook.Spell2;
            Refresh = me.Spellbook.Spell4;

            // Item init
            Blink = me.FindItem("item_blink");
            Dagon = me.GetDagon();
            Hex = me.FindItem("item_sheepstick");
            Soulring = me.FindItem("item_soul_ring");
            Ethereal = me.FindItem("item_ethereal_blade");
            Veil = me.FindItem("item_veil_of_discord");
            Orchid = me.FindItem("item_orchid");
            Shiva = me.FindItem("item_shiva");

            // Manacost calculations
            var manaForCombo = Laser.ManaCost + Rocket.ManaCost;
            if (Dagon != null && Dagon.CanBeCasted())
                manaForCombo += 180;
            if (Hex != null && Hex.CanBeCasted())
                manaForCombo += 100;
            if (Ethereal != null && Ethereal.CanBeCasted())
                manaForCombo += 150;
            if (Veil != null && Veil.CanBeCasted())
                manaForCombo += 50;

            // Main combo
            if (active && toggle)
            {
                target = me.ClosestToMouseTarget(1000);
                if (target != null && target.IsAlive && !target.IsIllusion && !target.IsMagicImmune() && Utils.SleepCheck("refresh") && !Refresh.IsChanneling)
                {
                    if (Soulring != null && me.Mana < manaForCombo && Soulring.CanBeCasted() && me.Health > 400 && Utils.SleepCheck("soulring"))
                    {
                        Soulring.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "soulring");
                    }

                    // Blink
                    else if (Blink != null && Blink.CanBeCasted() && Utils.SleepCheck("blink"))
                    {
                        Utils.Sleep(300 + Game.Ping, "blink");
                        Utils.ChainStun(me, me.GetTurnTime(target) * 1000 + Game.Ping, null, false);
                        Blink.UseAbility(target.Position);
                    }

                    // Items
                    else if (Veil != null && Veil.CanBeCasted() && Utils.SleepCheck("veil"))
                    {
                        Veil.UseAbility(target.Position);
                        Utils.Sleep(150 + Game.Ping, "veil");
                        Utils.Sleep(300 + Game.Ping, "ve");
                        Utils.ChainStun(me, 170 + Game.Ping, null, false);
                    }

                    else if (Hex != null && Hex.CanBeCasted() && Utils.SleepCheck("hex"))
                    {
                        Hex.UseAbility(target);
                        Utils.Sleep(150 + Game.Ping, "hex");
                        Utils.Sleep(300 + Game.Ping, "h");
                        Utils.ChainStun(me, 170 + Game.Ping, null, false);
                    }

                    else if (Ethereal != null && Ethereal.CanBeCasted() && Utils.SleepCheck("ethereal"))
                    {
                        Ethereal.UseAbility(target);
                        Utils.Sleep(270 + Game.Ping, "ethereal");
                        Utils.ChainStun(me, 200 + Game.Ping, null, false);
                    }

                    else if (Dagon != null && Dagon.CanBeCasted() && Utils.SleepCheck("ethereal") && Utils.SleepCheck("h") && Utils.SleepCheck("dagon") && Utils.SleepCheck("veil"))
                    {
                        Dagon.UseAbility(target);
                        Utils.Sleep(270 + Game.Ping, "dagon");
                        Utils.ChainStun(me, 200 + Game.Ping, null, false);
                    }

                    // Skills
                    else if (Rocket != null && Rocket.CanBeCasted() && Utils.SleepCheck("rocket") && Utils.SleepCheck("ethereal") && Utils.SleepCheck("veil"))
                    {
                        Rocket.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "rocket");
                        Utils.ChainStun(me, 150 + Game.Ping, null, false);
                    }

                    else if (Laser != null && Laser.CanBeCasted() && Utils.SleepCheck("laser") && Utils.SleepCheck("ethereal") && Utils.SleepCheck("rocket"))
                    {
                        Laser.UseAbility(target);
                        Utils.Sleep(150 + Game.Ping, "laser");
                        Utils.ChainStun(me, 150 + Game.Ping, null, false);
//.........这里部分代码省略.........
开发者ID:Malicy,项目名称:EnsageSharp,代码行数:101,代码来源:Program.cs

示例15: Heal

        private static void Heal(Hero self, Ability healSpell, float[] amount, uint range, int targettingType)
        {
            if (healSpell != null && healSpell.CanBeCasted() && !self.IsChanneling())
            {
                if (self.IsAlive && !self.IsChanneling() &&
                    (!self.IsInvisible() || !me.Modifiers.Any(x => x.Name == "modifier_treant_natures_guise")) &&
                    self.Distance2D(fountain) > 2000)
                {
                    var heroes =
                        ObjectMgr.GetEntities<Hero>()
                            .Where(
                                entity =>
                                    entity.Team == self.Team && self.Distance2D(entity) <= range && !entity.IsIllusion &&
                                    entity.IsAlive)
                            .ToList();

                    if (heroes.Any())
                    {
                        foreach (var ally in heroes)
                        {
                            if (ally.Health <= (ally.MaximumHealth*0.7) && healSpell.CanBeCasted() &&
                                self.Distance2D(fountain) > 2000 && IsInDanger(ally) &&
                                ally.Health + amount[healSpell.Level - 1] <= ally.MaximumHealth)
                            {
                                if (targettingType == 1)
                                    CastHeal(healSpell, ally);
                                else if (targettingType == 2)
                                    CastHeal(healSpell);
                                else if (targettingType == 3)
                                {
                                    /*if (healSpell.CanBeCasted() && !healSpell.IsChanneling)
                                    {
                                        Console.Write("Casting Heal");
                                        CastHeal(healSpell);
                                    }
                                    else
                                    {
                                        if (ally.Health > (ally.MaximumHealth*0.7) && healSpell.IsChanneling)
                                        {
                                            Console.Write("Casting Heal");
                                            CastHeal(healSpell);
                                        }
                                    }*/

                                    if (healSpell.CanBeCasted() && Utils.SleepCheck("ToggleHeal"))
                                    {
                                        if (!healSpell.IsToggled)
                                        {
                                            CastHeal(healSpell);
                                            Utils.Sleep(100 + Game.Ping, "ToggleHeal");
                                        }
                                    }
                                }
                            }
                            else if (targettingType == 3 && ally.Health > (ally.MaximumHealth*0.7) && healSpell.IsToggled &&
                                     Utils.SleepCheck("ToggleHeal"))
                            {
                                CastHeal(healSpell);
                                Utils.Sleep(100 + Game.Ping, "ToggleHeal");
                            }
                        }
                    }
                }
            }
        }
开发者ID:EmptyMer1s0n,项目名称:EnsageSharp,代码行数:65,代码来源:Program.cs


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