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


C# Hero.IsLinkensProtected方法代码示例

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


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

示例1: CastCombo

        private static void CastCombo(Hero globalTarget, Ability laser, Ability rockets, bool singleCombo = false)
        {
            var myInventory = Members.MyHero.Inventory.Items.ToList();
            var allItems = myInventory.Where(x =>
                Helper.IsItemEnable(x.StoredName()) && x.CanBeCasted()).ToList();
            var distance = Members.MyHero.Distance2D(globalTarget);
            var daggerCastRange = 1150 + (myInventory.Any(x => x.StoredName() == "item_aether_lens") ? 200 : 0);
            var inventory =
                allItems.Where(
                    x =>
                         ((x.StoredName() == "item_blink" && distance <= daggerCastRange + CloseRange) ||
                         (x.GetCastRange() > 0 && x.CanHit(globalTarget) /* && distance <= x.GetCastRange() + 150*/) ||
                         (x.GetCastRange() <= 0)) && Utils.SleepCheck($"{x.Handle}+item_usages"))
                    .ToList();

            if (laser != null && Helper.IsAbilityEnable(laser.StoredName()) && laser.CanBeCasted() &&
                laser.CanHit(globalTarget) && !_spellSleeper.Sleeping(laser))
            {
                laser.UseAbility(globalTarget);
                _spellSleeper.Sleep(1000, laser);
            }
            var slarkMod = globalTarget.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);
            foreach (var item in inventory.OrderByDescending(Helper.PriorityHelper))
            {
                var name = item.StoredName();
                if (name == "item_ethereal_blade")
                    _ethereal.Sleep(1000);
                if (name.Contains("dagon"))
                    if (_ethereal.Sleeping && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal"))
                        continue;
                if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
                {
                    item.UseAbility();
                }
                else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                    if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
                        item.TargetTeamType == TargetTeamType.Custom)
                    {
                        if (item.IsDisable())
                        {
                            if (!slarkMod && !globalTarget.IsLinkensProtected())
                                item.UseAbility(globalTarget);
                                /*if (item.CastStun(globalTarget))
                                {
                                    Utils.Sleep(250, $"{item.Handle}+item_usages");
                                    continue;
                                }*/
                        }
                        else if (item.IsSilence())
                        {
                            if (!slarkMod)
                                if (!globalTarget.IsSilenced())
                                {
                                    item.UseAbility(globalTarget);
                                }
                        }
                        else if ((item.StoredName().Contains("dagon") || item.StoredName() == "item_ethereal_blade") &&
                                 globalTarget.HasModifiers(
                                     new[]
                                     {
                                         /*"modifier_templar_assassin_refraction_absorb",
                                         "modifier_templar_assassin_refraction_absorb_stacks",*/
                                         "modifier_oracle_fates_edict",
                                         "modifier_abaddon_borrowed_time"
                                     }, false))
                        {
                            continue;
                        }
                        else
                        {
                            item.UseAbility(globalTarget);
                        }

                        /*item.UseAbility(target);
                        Print($"[Using]: {item.Name} (3)", print: false);*/
                    }
                    else
                    {
                        item.UseAbility(Members.MyHero);
                    }
                else
                {
                    if (name == "item_blink")
                    {
                        if (singleCombo || _spellSleeper.Sleeping("blink_fix"))
                            continue;
                        if (distance > daggerCastRange+CloseRange)
                        {
                            var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
                            var point = new Vector3(
                                (float)
                                    (globalTarget.Position.X -
                                     daggerCastRange *
                                     Math.Cos(angle)),
                                (float)
                                    (globalTarget.Position.Y -
                                     daggerCastRange *
                                     Math.Sin(angle)),
                                globalTarget.Position.Z);
                            var dist = Members.MyHero.Distance2D(point);
//.........这里部分代码省略.........
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:101,代码来源:ComboAction.cs

示例2: Evade

        private bool Evade(Hero ally, IEnumerable<uint> intersection)
        {
            var heroCanCast = Hero.CanCast();
            var heroCanUseItems = Hero.CanUseItems();
            var allyLinkens = ally.IsLinkensProtected();
            var allyMagicImmune = ally.IsMagicImmune();
            var allyIsMe = ally.Equals(Hero);
            var allyHp = ally.Health;
            //var heroMp = Hero.Mana;

            foreach (var ability in
                intersection.Select(
                        x =>
                            abilityUpdater.EvadableAbilities.FirstOrDefault(
                                z => z.Obstacle == x && (z.AllyHpIgnore <= 0 || allyHp < z.AllyHpIgnore)
                                     //&& (z.HeroMpIgnore <= 0 || heroMp > z.HeroMpIgnore)
                                     && (z.AbilityLevelIgnore <= 0 || z.Level > z.AbilityLevelIgnore)))
                    .Where(x => x != null)
                    .OrderByDescending(x => x.IsDisable))
            {
                if (ability == null || sleeper.Sleeping(ability))
                {
                    continue;
                }

                if ((allyLinkens && (ability is Projectile || ability is LinearTarget))
                    || (!ability.PiercesMagicImmunity && allyMagicImmune))
                {
                    continue;
                }

                Debugger.WriteLine(
                    ally.GetName() + " intersecting: " + ability.Name + " // " + Game.RawGameTime,
                    Debugger.Type.Intersectons);

                var abilityOwner = ability.AbilityOwner;
                var remainingTime = ability.GetRemainingTime(ally);

                foreach (var priority in
                    ability.UseCustomPriority ? ability.Priority : Menu.Settings.DefaultPriority)
                {
                    switch (priority)
                    {
                        case EvadePriority.Walk:
                            if (allyIsMe && !ability.DisablePathfinder && Menu.Hotkeys.EnabledPathfinder
                                && Hero.CanMove())
                            {
                                var remainingWalkTime = remainingTime - 0.1f;

                                if (sleeper.Sleeping("block"))
                                {
                                    continue;
                                }

                                bool success;
                                List<Vector3> path;

                                if (Hero.IsMoving && !movePosition.IsZero)
                                {
                                    if (ability.ObstacleStays && remainingWalkTime <= 0)
                                    {
                                        remainingWalkTime = ability.ObstacleRemainingTime();
                                    }

                                    if (remainingWalkTime <= 0)
                                    {
                                        continue;
                                    }

                                    if (Pathfinder.GetIntersectingObstacles(movePosition, Hero.HullRadius).Any()
                                        || Pathfinder.GetIntersectingObstacles(Hero.NetworkPosition, Hero.HullRadius)
                                            .Any())
                                    {
                                        Debugger.WriteLine("moving into obstacle", Debugger.Type.AbilityUsage);

                                        var tempPath =
                                            Pathfinder.CalculatePathFromObstacle(
                                                Hero.NetworkPosition,
                                                movePosition,
                                                remainingWalkTime,
                                                out success).ToList();

                                        if (success)
                                        {
                                            movePathfinderPosition = tempPath.Last();
                                        }
                                        else
                                        {
                                            continue;
                                        }
                                    }

                                    if (!ability.ObstacleStays)
                                    {
                                        Pathfinder.CalculatePathFromObstacle(remainingWalkTime - 0.2f, out success);

                                        if (success)
                                        {
                                            return false;
                                        }
//.........这里部分代码省略.........
开发者ID:IdcNoob,项目名称:Ensage,代码行数:101,代码来源:Evader.cs

示例3: ItemUsage

        /**
        * ItemUsage takes in a Hero me, its inventory inv, a Hero target, the distance between me and target, a boolean usebkb and byillusion
        * and uses all items as necessary
        * 1) Uses blink dagger to a point given by Dagger.CloseRange menu option
        * 2) Uses all other items specified in the Items list (line 53)
        * 3) Uses diffusal blade (to purge or dispel) if enabled
        * 4) Uses bkb if enabled
        * 5) Uses ultimate if all items expect of refresher was casted
        **/
        private static bool ItemUsage(Hero me, IEnumerable<Item> inv, Hero target, double distance, bool useBkb, bool byIllusion = false)
        {
            if (me.IsChanneling() || !Utils.SleepCheck("DaggerTime") || me.IsStunned()) return false;
            // use all items given in Items list (line 53)
            var enumerable = inv as Item[] ?? inv.ToArray();
            var phase =
                enumerable.Find(
                    x =>
                        x.StoredName() == HideItemList[0] && byIllusion &&
                        SpellBaseList.Find(z => z.Name == x.Name) == null && Utils.SleepCheck(x.Name + me.Handle));
            if (phase != null)
            {
                phase.UseAbility();
                Utils.Sleep(250, $"{phase.StoredName() + me.Handle}");
            }
            var inventory =
                enumerable.Where(
                    x =>
                        (IsItemEnable(x.StoredName(), byIllusion) || CloneOnlyComboItems.Contains(x.StoredName()) ||
                         x.StoredName() == "item_dust" || x.StoredName() == "item_black_king_bar") && x.CanBeCasted() &&
                        (!byIllusion || SpellBaseList.Find(z => z.Name == x.Name) == null)
                            /* && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(x.Name)*/ && CheckForPike(me,target,distance,x) ).ToList();
            var items =
                inventory.Where(
                    x =>
                        Utils.SleepCheck(x.Name + me.Handle) && Items.Keys.Contains(x.Name) &&
                        ((x.CastRange == 0 &&
                          distance <=
                          (x.Name == "item_blink" ? 1150 + Menu.Item("Dagger.CloseRange").GetValue<Slider>().Value : 1000)) ||
                         /*x.CastRange+50 >= distance*/x.CanHit(target))).OrderByDescending(y => GetComboOrder(y, byIllusion));
            var slarkMod = target.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);
            foreach (var item in items)
            {
                var name = item.StoredName();
                if (name == "item_ethereal_blade")
                    _ethereal.Sleep(1000);
                if (name == "item_dagon" || name == "item_dagon_2" || name == "item_dagon_3" || name == "item_dagon_4" || name == "item_dagon_5")
                    if (_ethereal.Sleeping && !target.HasModifier("modifier_item_ethereal_blade_ethereal"))
                        continue;
                if (name == "item_hurricane_pike")
                {
                    item.UseAbility(me);
                    Utils.Sleep(250, $"{name + me.Handle}");
                    continue;
                }
                if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
                {
                    item.UseAbility();
                    Print($"[Using]: {item.Name} (10)", print: false);
                }
                else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                    if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
                        item.TargetTeamType == TargetTeamType.Custom)
                    {
                        if (item.IsDisable())
                        {
                            if (!slarkMod && !target.IsLinkensProtected())
                                if (item.CastStun(target))
                                {
                                    Print($"[Using]: {item.Name} (9)", print: false);
                                    Utils.Sleep(350, $"{item.Name + me.Handle}");
                                    continue;
                                }
                        }
                        else if (item.IsSilence())
                        {
                            if (!slarkMod)
                                if (!target.IsSilenced())
                                {
                                    item.UseAbility(target);
                                    Print($"[Using]: {item.Name} (8)", print: false);
                                }
                        }
                        else if ((item.StoredName().Contains("dagon") || item.StoredName() == "item_ethereal_blade") &&
                                 target.HasModifiers(
                                     new[]
                                     {
                                         "modifier_templar_assassin_refraction_absorb",
                                         "modifier_templar_assassin_refraction_absorb_stacks",
                                         "modifier_oracle_fates_edict",
                                         "modifier_abaddon_borrowed_time"
                                     }, false))
                        {
                            Print("can damage this shit", print: false);
                            continue;
                        }
                        else
                        {
                            item.UseAbility(target);
                            Print($"[Using]: {item.Name} (1)", print: false);
                            Utils.Sleep(350, $"{item.Name + me.Handle}");
//.........这里部分代码省略.........
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:101,代码来源:Core.cs


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