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


C# Hero.HasItem方法代码示例

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


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

示例1: Game_OnUpdate

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

            if (me.ClassID != ClassID.CDOTA_Unit_Hero_Axe)
                return;
            if (me == null)
                return;

            if (Blink == null)
                Blink = me.FindItem("item_blink");

            if (Chop == null)
                Chop = me.Spellbook.Spell4;

            if (me.HasItem(ClassID.CDOTA_Item_UltimateScepter))
            {
                _chopDmg = new int[3] { 300, 425, 550 };
            }
            else
            {
                _chopDmg = new int[3] { 250, 325, 400 };
            }

            var ChopDmg = _chopDmg[Chop.Level - 1];

            if (Menu.Item("toggle").GetValue<bool>())
            {
                var enemies = ObjectMgr.GetEntities<Hero>().Where(x => x.IsVisible && x.IsAlive && !x.IsIllusion && x.Team != me.Team && x.Health <= ChopDmg).ToList();

                foreach (var hero in enemies)
                {
                    var distance = me.Distance2D(hero);
                    if (target == null || distance < minimumDistance)
                    {
                        target = hero;
                    }
                }

                if (target != null && Utils.SleepCheck("chop") && Chop.CanBeCasted() && me.IsAlive && target.IsAlive)
                {
                    if (Blink != null && me.Distance2D(target) > 400 && me.Distance2D(target) < Blink.CastRange && Utils.SleepCheck("blink") && Blink.CanBeCasted() && me.Health > 250)
                    {
                        Blink.UseAbility(target.Position);
                        Utils.Sleep(150 + Game.Ping, "blink");
                    }
                    else
                    {
                        if (target != null && Chop != null)
                        {
                            Chop.UseAbility(target);
                            target = null;
                            Utils.Sleep(150 + Game.Ping, "chop");
                        }
                    }
                }
            }
        }
开发者ID:Evervolv1337,项目名称:EnsageSharp,代码行数:58,代码来源:Program.cs

示例2: Game_OnUpdate


//.........这里部分代码省略.........
            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)
                    {
                        medallion.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "item_atos");
                    }
                    if (solar != null && solar.CanBeCasted() && Utils.SleepCheck("item_solar") && !linken)
                    {
                        solar.UseAbility(_target);
                        Utils.Sleep(200 + Game.Ping, "item_solar");
                    }
                    if (dust != null && dust.CanBeCasted() && (_target.CanGoInvis() || _target.IsInvisible()) && Utils.SleepCheck("dust"))
                    {
                        dust.UseAbility();
                        Utils.Sleep(200 + Game.Ping, "dust");
                    }
                    if (Goo.CanBeCasted() && _source.CanAttack() && !_target.IsInvul() && Utils.SleepCheck("Goo"))
                    {
                        if (_source.HasItem(ClassID.CDOTA_Item_UltimateScepter))
                        {
                            if (GetDistance2D(_target.Position, _source.Position) < Goo.CastRange)
                            {
                                Goo.UseAbility();
                                Utils.Sleep(150 + Game.Ping, "Goo");
                            }

                        }
                        else
                        {
                            Goo.UseAbility(_target);
                            Utils.Sleep(150 + Game.Ping, "Goo");
                        }
                    }
                    if (!Goo.CanBeCasted() && Utils.SleepCheck("animationatk"))
                    {
                        _source.Attack(_target);
                        Utils.Sleep(Game.Ping + 150, "animationatk");
                    }
                    if (Quill.CanBeCasted() && Utils.SleepCheck("quill"))
                    {
                        Quill.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "quill");
                    }
                }
                else
                {
                    if(Utils.SleepCheck("atk"))
                    _source.Attack(_target);
                    Utils.Sleep(1000, "atk");
                }
            }
        }
开发者ID:spyware293,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例3: Killsteal

        public static void Killsteal(EventArgs args)
        {
            if (!menuadded) return;
            me = ObjectMgr.LocalHero;

            if (Utils.SleepCheck("killstealR") && Game.IsInGame && me != null &&
                me.ClassID == ClassID.CDOTA_Unit_Hero_Zuus && me.IsAlive)
            {
                drawStealNotice = false;
                if (map == "forest_solo" || map == "desert_duo" || map == "mines_trio" || map =="desert_quintet")
                    if (me.HasItem(ClassID.CDOTA_Item_UltimateScepter))
                    {
                        rDmg = new int[3] {350, 450, 550};
                    }
                    else
                    {
                        rDmg = new int[3] {200, 300, 400};
                    }
                else if (me.HasItem(ClassID.CDOTA_Item_UltimateScepter))
                {
                    rDmg = new int[3] {440, 540, 640};
                }
                else
                {
                    rDmg = new int[3] {225, 350, 475};
                }
                if (
                    ((!Menu.Item("active").GetValue<KeyBind>().Active && Menu.Item("useRincombo").GetValue<bool>()) ||
                     !Menu.Item("useRincombo").GetValue<bool>() ||
                     !Menu.Item("stealToggle").GetValue<KeyBind>().Active) &&
                     me.Spellbook.Spell4.Level > 0 && me.Spellbook.Spell4.Cooldown == 0
                    )
                {
                    var enemy =
                        ObjectMgr.GetEntities<Hero>()
                            .Where(
                                e =>
                                    e.Team != me.Team && e.IsAlive && e.IsVisible && !e.IsIllusion &&
                                    !e.UnitState.HasFlag(UnitState.MagicImmune) &&
                                    e.ClassID != ClassID.CDOTA_Unit_Hero_Beastmaster_Hawk &&
                                    e.ClassID != ClassID.CDOTA_Unit_Hero_Beastmaster_Boar &&
                                    e.ClassID != ClassID.CDOTA_Unit_Hero_Beastmaster_Beasts &&
                                    e.ClassID != ClassID.CDOTA_Unit_Brewmaster_PrimalEarth &&
                                    e.ClassID != ClassID.CDOTA_Unit_Brewmaster_PrimalFire &&
                                    e.ClassID != ClassID.CDOTA_Unit_Brewmaster_PrimalStorm &&
                                    e.ClassID != ClassID.CDOTA_Unit_Undying_Tombstone &&
                                    e.ClassID != ClassID.CDOTA_Unit_Undying_Zombie &&
                                    e.ClassID != ClassID.CDOTA_Ability_Juggernaut_HealingWard).ToList();

                    foreach (var v in enemy)
                    {
                        var damage = Math.Floor(rDmg[me.Spellbook.Spell4.Level - 1]*(1 - v.MagicDamageResist));
                        if (Menu.Item("stealEdmg").GetValue<bool>() && me.Distance2D(v) < 1150)
                            damage = damage + eDmg[me.Spellbook.Spell3.Level] * 0.01 * v.Health * (1 - v.MagicDamageResist);
                        if (v.NetworkName == "CDOTA_Unit_Hero_Spectre" && v.Spellbook.Spell3.Level > 0)
                        {
                            damage =
                                Math.Floor(rDmg[me.Spellbook.Spell4.Level - 1]*
                                           (1 - (0.10 + v.Spellbook.Spell3.Level*0.04))*(1 - v.MagicDamageResist));
                            if (Menu.Item("stealEdmg").GetValue<bool>() && me.Distance2D(v) < 1150)
                                damage = damage + eDmg[me.Spellbook.Spell3.Level] * 0.01 * v.Health * (1 - v.MagicDamageResist);
                        }
                        if (v.NetworkName == "CDOTA_Unit_Hero_SkeletonKing" &&
                            v.Spellbook.SpellR.CanBeCasted())
                            damage = 0;
                        if (v.NetworkName == "CDOTA_Unit_Hero_Tusk" &&
                            v.Spellbook.SpellW.CooldownLength - 3 > v.Spellbook.SpellQ.Cooldown)
                            damage = 0;
                        if (lens) damage = damage*1.08;
                        var kunkkarum = v.Modifiers.Any(x => x.Name == "modifier_kunkka_ghost_ship_damage_absorb");
                        if (kunkkarum) damage = damage*0.5;
                        var momed = v.Modifiers.Any(x => x.Name == "modifier_item_mask_of_madness_berserk");
                        if (momed) damage = damage * 1.3;
                        var unkillabletarget = v.Modifiers.Any(
                        x => x.Name == "modifier_abaddon_borrowed_time" || x.Name == "modifier_dazzle_shallow_grave" ||
                             x.Name == "modifier_obsidian_destroyer_astral_imprisonment_prison" || x.Name == "modifier_puck_phase_shift" ||
                             x.Name == "modifier_brewmaster_storm_cyclone" || x.Name == "modifier_eul_cyclone" ||
                             x.Name == "modifier_item_aegis" || x.Name == "modifier_slark_shadow_dance" || x.Name == "modifier_ember_spirit_flame_guard" ||
                             x.Name == "modifier_abaddon_aphotic_shield" || x.Name == "modifier_phantom_lancer_doppelwalk_phase" ||
                             x.Name == "modifier_shadow_demon_disruption" || x.Name == "modifier_nyx_assassin_spiked_carapace" || 
                             x.Name == "modifier_templar_assassin_refraction_absorb" || x.Name == "modifier_necrolyte_reapers_scythe" ||
                             x.Name == "modifier_storm_spirit_ball_lightning" || x.Name == "modifier_ember_spirit_sleight_of_fist_caster_invulnerability" ||
                             x.Name == "modifier_ember_spirit_fire_remnant" || x.Name == "modifier_snowball_movement" || x.Name == "modifier_snowball_movement_friendly");
                        if (v.Health < damage && v != null && !v.IsIllusion && !unkillabletarget && (!v.IsInvisible() || (v.IsInvisible() && v.IsVisible)))
                        {
                            drawStealNotice = true;

                            steallableHero = v.NetworkName.Replace("CDOTA_Unit_Hero_", "").ToUpper();

                            if (
                                (Menu.Item("confirmSteal").GetValue<KeyBind>().Active ||
                                 Menu.Item("stealToggle").GetValue<KeyBind>().Active) && !v.IsIllusion)
                            {
                                if (soulring != null && soulring.CanBeCasted() && Utils.SleepCheck("soulring") &&
                                    me.Mana < me.Spellbook.Spell4.ManaCost &&
                                    me.Mana + 150 > me.Spellbook.Spell4.ManaCost)
                                {
                                    soulring.UseAbility();
                                    Utils.Sleep(Game.Ping, "soulring");
                                }
//.........这里部分代码省略.........
开发者ID:Evervolv1337,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例4: InvokerIngameUpdate

        private static void InvokerIngameUpdate(EventArgs args)
        {
            me = ObjectMgr.LocalHero;
            if (me == null || me.ClassID != myClassID)
            {
                return;
            }

            if (!onLoad)
            {
                CurrentCombo = Combos.EMPTornadoMeteorBlast;

                comboKeyDrawPos = new Vector2(Drawing.Width * 90 / 100, Drawing.Height * 10 / 100);
                harassKeyDrawPos = new Vector2(Drawing.Width * 90 / 100, Drawing.Height * 12 / 100);
                comboNextDrawPos = new Vector2(Drawing.Width * 90 / 100, Drawing.Height * 14 / 100);
                comboPrevDrawPos = new Vector2(Drawing.Width * 90 / 100, Drawing.Height * 16 / 100);
                orbToggleDrawPos = new Vector2(Drawing.Width * 90 / 100, Drawing.Height * 18 / 100);
                fleeDrawPos = new Vector2(Drawing.Width * 90 / 100, Drawing.Height * 20 / 100);
                isOrbwalkingDrawPos = new Vector2(Drawing.Width * 87 / 100, Drawing.Height * 23 / 100);
                currentComboDrawPos = new Vector2(Drawing.Width * 87 / 100, Drawing.Height * 27 / 100);
                customComboDrawPos = new Vector2(Drawing.Width * 85 / 100, Drawing.Height * 30 / 100);

                comboKey = new HKC("combo", "Combo", 32, HKC.KeyMode.HOLD, comboKeyDrawPos, Color.LightBlue);
                prepareComboKey = new HKC("harass", "Prepare Combo", 67, HKC.KeyMode.HOLD, harassKeyDrawPos, Color.LightBlue);
                comboNext = new HKC("nextCombo", "Next Combo", 105, HKC.KeyMode.HOLD, comboNextDrawPos, Color.Pink);
                comboPrev = new HKC("prevCombo", "Previous Combo", 103, HKC.KeyMode.HOLD, comboPrevDrawPos, Color.Pink);
                toggleOrb = new HKC("orbToggle", "Toggle Orbwalking", 101, HKC.KeyMode.TOGGLE, orbToggleDrawPos, Color.Pink);
                fleeKey = new HKC("fleeing", "Flee (Follows Mouse)", 71, HKC.KeyMode.HOLD, fleeDrawPos, Color.Pink);

                CurrentCooldowns.Add(SpellsInvoker.Cold_Snap, 0);
                CurrentCooldowns.Add(SpellsInvoker.Ghost_Walk, 0);
                CurrentCooldowns.Add(SpellsInvoker.Ice_Wall, 0);
                CurrentCooldowns.Add(SpellsInvoker.EMP, 0);
                CurrentCooldowns.Add(SpellsInvoker.Tornado, 0);
                CurrentCooldowns.Add(SpellsInvoker.Alacrity, 0);
                CurrentCooldowns.Add(SpellsInvoker.Sun_Strike, 0);
                CurrentCooldowns.Add(SpellsInvoker.Forge_Spirit, 0);
                CurrentCooldowns.Add(SpellsInvoker.Chaos_Meteor, 0);
                CurrentCooldowns.Add(SpellsInvoker.Deafening_Blast, 0);

                CurrentCanUse.Add(SpellsInvoker.Cold_Snap, false);
                CurrentCanUse.Add(SpellsInvoker.Ghost_Walk, false);
                CurrentCanUse.Add(SpellsInvoker.Ice_Wall, false);
                CurrentCanUse.Add(SpellsInvoker.EMP, false);
                CurrentCanUse.Add(SpellsInvoker.Tornado, false);
                CurrentCanUse.Add(SpellsInvoker.Alacrity, false);
                CurrentCanUse.Add(SpellsInvoker.Sun_Strike, false);
                CurrentCanUse.Add(SpellsInvoker.Forge_Spirit, false);
                CurrentCanUse.Add(SpellsInvoker.Chaos_Meteor, false);
                CurrentCanUse.Add(SpellsInvoker.Deafening_Blast, false);

                Orbwalking.Load();

                Thread formThread = new Thread(delegate ()
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new UserComboForm());
                });

                formThread.SetApartmentState(ApartmentState.STA);

                formThread.Start();

                onLoad = true;
            }

            Quas = me.Spellbook.SpellQ;
            Wex = me.Spellbook.SpellW;
            Exort = me.Spellbook.SpellE;
            Invoke = me.Spellbook.SpellR;
            spellD = me.Spellbook.SpellD;
            spellF = me.Spellbook.SpellF;

            myCustomCombo = UserComboForm.CheckedList;

            HasAghanim = me.HasItem(ClassID.CDOTA_Item_UltimateScepter);

            RunDrawings = true;

            ComboChecks();

            CooldownChecks();

            TornadoComboChecks();

            MiscStuff();

            /*
            foreach (var buff in me.Modifiers)
            {
                Console.WriteLine(buff.Name);
            }
            */
        }
开发者ID:pipigt,项目名称:Ensage,代码行数:95,代码来源:InvokingTits.cs

示例5: cancelult

        public static void cancelult()
        {
            me = ObjectMgr.LocalHero;
            if (me.HasItem(ClassID.CDOTA_Item_UltimateScepter))
            {
                rDmg = new int[3] {440, 540, 640};
            }
            else
            {
                rDmg = new int[3] {225, 350, 475};
            }
            var momd = vhero.Modifiers.Any(x => x.Name == "modifier_item_mask_of_madness_berserk");
            var damage = Math.Floor(rDmg[me.Spellbook.Spell4.Level - 1]*(1 - vhero.MagicDamageResist));
            if (Menu.Item("stealEdmg").GetValue<bool>() && me.Distance2D(vhero) < 1200)
                damage = damage + eDmg[me.Spellbook.Spell3.Level] * 0.01 * vhero.Health * (1 - vhero.MagicDamageResist);
            if (vhero.NetworkName == "CDOTA_Unit_Hero_Spectre" && vhero.Spellbook.Spell3.Level > 0)
            {
                damage =
                    Math.Floor(rDmg[me.Spellbook.Spell4.Level - 1] *
                               (1 - (0.10 + vhero.Spellbook.Spell3.Level * 0.04)) * (1 - vhero.MagicDamageResist));
                if (Menu.Item("stealEdmg").GetValue<bool>() && me.Distance2D(vhero) < 1150)
                    damage = damage + eDmg[me.Spellbook.Spell3.Level] * 0.01 * vhero.Health * (1 - vhero.MagicDamageResist);
            }
            if (vhero.NetworkName == "CDOTA_Unit_Hero_SkeletonKing" &&
                vhero.Spellbook.SpellR.CanBeCasted())
                damage = 0;
            if (vhero.NetworkName == "CDOTA_Unit_Hero_Tusk" &&
                vhero.Spellbook.SpellW.CooldownLength - 3 > vhero.Spellbook.SpellQ.Cooldown)
                damage = 0;
            if (lens) damage = damage * 1.08;
            var kunkkarum = vhero.Modifiers.Any(x => x.Name == "modifier_kunkka_ghost_ship_damage_absorb");
            if (kunkkarum) damage = damage * 0.5;
            if (momd) damage = damage*1.3;
            var unkillabletarget1 = vhero.Modifiers.Any(
                x => x.Name == "modifier_abaddon_borrowed_time" || x.Name == "modifier_dazzle_shallow_grave" ||
                     x.Name == "modifier_obsidian_destroyer_astral_imprisonment_prison" ||
                     x.Name == "modifier_puck_phase_shift" ||
                     x.Name == "modifier_brewmaster_storm_cyclone" || x.Name == "modifier_eul_cyclone" ||
                     x.Name == "modifier_item_aegis" || x.Name == "modifier_slark_shadow_dance" || x.Name == "modifier_ember_spirit_flame_guard" ||
                     x.Name == "modifier_abaddon_aphotic_shield" || x.Name == "modifier_phantom_lancer_doppelwalk_phase" ||
                     x.Name == "modifier_shadow_demon_disruption" || x.Name == "modifier_nyx_assassin_spiked_carapace" ||
                     x.Name == "modifier_templar_assassin_refraction_absorb" || x.Name == "modifier_necrolyte_reapers_scythe" ||
                     x.Name == "modifier_storm_spirit_ball_lightning" || x.Name == "modifier_ember_spirit_sleight_of_fist_caster_invulnerability" ||
                     x.Name == "modifier_ember_spirit_fire_remnant" || x.Name == "modifier_snowball_movement" || x.Name == "modifier_snowball_movement_friendly");

            if (vhero.Health > damage || !vhero.IsAlive || vhero.IsIllusion || unkillabletarget1 || vhero.IsMagicImmune() || (vhero.Name == "npc_dota_hero_slark" && !vhero.IsVisible)) me.Stop();
            vhero = null;
        }
开发者ID:Evervolv1337,项目名称:Ensage,代码行数:48,代码来源:Program.cs


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