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


C# Unit.IsAttackImmune方法代码示例

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


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

示例1: AttackIfCan

 private static void AttackIfCan(Unit source, Unit target)
 {
     if (target == null) return;
     if (source.CanAttack() && AttackTarget.isActive && !target.IsAttackImmune() && !target.IsInvul()) source.Attack(target);
 }
开发者ID:LimbViolencer,项目名称:EnsageSharp-6,代码行数:5,代码来源:EzUnitControl.cs

示例2: Orbwalk

 /// <summary>
 ///     Orbwalks on given target if they are in range, while moving to mouse position
 /// </summary>
 /// <param name="target"></param>
 /// <param name="bonusWindupMs"></param>
 /// <param name="bonusRange"></param>
 /// <param name="attackmodifiers"></param>
 public static void Orbwalk(
     Unit target,
     float bonusWindupMs = 0,
     float bonusRange = 0,
     bool attackmodifiers = false)
 {
     if (me == null)
     {
         return;
     }
     var targetHull = 0f;
     if (target != null)
     {
         targetHull = target.HullRadius;
     }
     float distance = 0;
     if (target != null)
     {
         var pos = Prediction.InFront(
             me,
             (float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
         distance = pos.Distance2D(target) - me.Distance2D(target);
     }
     var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible
                   && target.Distance2D(me)
                   <= (me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + distance);
     if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
     {
         var canAttack = (!AttackOnCooldown(target, bonusWindupMs) || !CanCancelAnimation())
                         && !target.IsAttackImmune() && !target.IsInvul() && me.CanAttack();
         if (canAttack && Utils.SleepCheck("Orbwalk.Attack"))
         {
             Attack(target, attackmodifiers);
             Utils.Sleep(100, "Orbwalk.Attack");
             return;
         }
     }
     var canCancel = (CanCancelAnimation() && AttackOnCooldown(target, bonusWindupMs))
                     || (!isValid && !me.IsAttacking());
     if (!canCancel || !Utils.SleepCheck("Orbwalk.Move"))
     {
         return;
     }
     me.Move(Game.MousePosition);
     Utils.Sleep(100, "Orbwalk.Move");
 }
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:53,代码来源:Orbwalking.cs

示例3: Orbwalk

        /// <summary>
        ///     Orbwalks on given target if they are in range, while moving to mouse position
        /// </summary>
        /// <param name="target"></param>
        /// <param name="bonusWindupMs"></param>
        /// <param name="bonusRange"></param>
        /// <param name="attackmodifiers"></param>
        public static void Orbwalk(
            Unit target, 
            float bonusWindupMs = 0, 
            float bonusRange = 0, 
            bool attackmodifiers = false)
        {
            if (me == null)
            {
                return;
            }

            // if (!Utils.SleepCheck("GlobalCasting"))
            // {
            // return;
            // }
            var targetHull = 0f;
            if (target != null)
            {
                targetHull = target.HullRadius;
            }

            float distance = 0;
            if (target != null)
            {
                var pos = Prediction.InFront(
                    me, 
                    (float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
                distance = pos.Distance2D(target) - me.Distance2D(target);
            }

            var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible && !target.IsInvul()
                          && !target.HasModifiers(
                              new[] { "modifier_ghost_state", "modifier_item_ethereal_blade_slow" }, 
                              false)
                          && target.Distance2D(me)
                          <= me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + Math.Max(distance, 0);
            if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
            {
                var canAttack = !AttackOnCooldown(target, bonusWindupMs) && !target.IsAttackImmune()
                                && !target.IsInvul() && me.CanAttack();
                if (canAttack && Utils.SleepCheck("Orbwalk.Attack"))
                {
                    Attack(target, attackmodifiers);
                    Utils.Sleep(
                        UnitDatabase.GetAttackPoint(me) * 1000 + me.GetTurnTime(target) * 1000, 
                        "Orbwalk.Attack");
                    return;
                }
            }

            var canCancel = (CanCancelAnimation() && AttackOnCooldown(target, bonusWindupMs))
                            || (!isValid && !me.IsAttacking() && CanCancelAnimation());
            if (!canCancel || !Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack"))
            {
                return;
            }

            me.Move(Game.MousePosition);
            Utils.Sleep(100, "Orbwalk.Move");
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:67,代码来源:Orbwalking.cs

示例4: Orbwalk

 private static void Orbwalk(Hero me,Unit target,float bonusWindupMs = 100,float bonusRange = 0)
 {
     if (me == null)
     {
         return;
     }
     var targetHull = 0f;
     if (target != null)
     {
         targetHull = target.HullRadius;
     }
     float distance = 0;
     if (target != null)
     {
         var pos = Prediction.InFront(
             me,
             (float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
         distance = pos.Distance2D(target) - me.Distance2D(target);
     }
     var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible && !target.IsInvul()
                   && !target.Modifiers.Any(
                       x => x.Name == "modifier_ghost_state" || x.Name == "modifier_item_ethereal_blade_slow")
                   && target.Distance2D(me)
                   <= (me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + Math.Max(distance, 0));
     if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
     {
         var canAttack = !AttackOnCooldown(me,target, bonusWindupMs)
                         && !target.IsAttackImmune() && !target.IsInvul() && me.CanAttack();
         if (canAttack && Utils.SleepCheck("!Orbwalk.Attack"))
         {
             me.Attack(target);
             Utils.Sleep(
                 UnitDatabase.GetAttackPoint(me) * 1000 + me.GetTurnTime(target) * 1000,
                 "!Orbwalk.Attack");
             return;
         }
     }
     var canCancel = (CanCancelAnimation(me) && AttackOnCooldown(me,target, bonusWindupMs))
                     || (!isValid && !me.IsAttacking() && CanCancelAnimation(me));
     if (!canCancel || !Utils.SleepCheck("!Orbwalk.Move") || !Utils.SleepCheck("!Orbwalk.Attack"))
     {
         return;
     }
     if (target != null) me.Move(target.Position);
     Utils.Sleep(100, "!Orbwalk.Move");
 }
开发者ID:DevGdos,项目名称:EnsageSharp,代码行数:46,代码来源:Program.cs

示例5: OrbwalkOn

        /// <summary>
        ///     The orbwalk.
        /// </summary>
        /// <param name="target">
        ///     The target.
        /// </param>
        /// <param name="movePosition">
        ///     The move Position.
        /// </param>
        /// <param name="bonusWindupMs">
        ///     The bonus windup ms.
        /// </param>
        /// <param name="bonusRange">
        ///     The bonus range.
        /// </param>
        /// <param name="attackmodifiers">
        ///     The attackmodifiers.
        /// </param>
        /// <param name="followTarget">
        ///     The follow target.
        /// </param>
        public void OrbwalkOn(
            Unit target, 
            Vector3 movePosition, 
            float bonusWindupMs = 0, 
            float bonusRange = 0, 
            bool attackmodifiers = true, 
            bool followTarget = false)
        {
            if (this.Unit == null || !this.Unit.IsValid)
            {
                return;
            }

            var targetHull = 0f;
            if (target != null)
            {
                targetHull = target.HullRadius;
            }

            float distance = 0;
            if (target != null)
            {
                var pos = Prediction.InFront(
                    this.Unit, 
                    (float)(Game.Ping / 1000 + this.Unit.GetTurnTime(target.Position) * this.Unit.MovementSpeed));
                distance = pos.Distance2D(target) - this.Unit.Distance2D(target);
            }

            var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible;
            var isAttackable = target != null && target.IsValid && !target.IsInvul() && !target.IsAttackImmune()
                               && !target.HasModifiers(
                                   new[] { "modifier_ghost_state", "modifier_item_ethereal_blade_slow" }, 
                                   false)
                               && target.Distance2D(this.Unit)
                               <= this.Unit.GetAttackRange() + this.Unit.HullRadius + 50 + targetHull + bonusRange
                               + Math.Max(distance, 0);
            if ((isValid && isAttackable)
                || (!isAttackable && target != null && target.IsValid && this.Unit.IsAttacking()
                    && this.Unit.GetTurnTime(target.Position) < 0.1))
            {
                var canAttack = !this.IsAttackOnCoolDown(target, bonusWindupMs) && this.Unit.CanAttack();
                if (canAttack && !this.attackSleeper.Sleeping && (!this.hero || Utils.SleepCheck("Orbwalk.Attack")))
                {
                    this.attacker.Attack(target, attackmodifiers);
                    this.AttackOrder();
                    this.attackSleeper.Sleep(
                        (float)
                        (UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000
                         + Game.Ping + 100));
                    this.moveSleeper.Sleep(
                        (float)
                        (UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + 50));
                    if (!this.hero)
                    {
                        return;
                    }

                    Utils.Sleep(
                        UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + Game.Ping
                        + 100, 
                        "Orbwalk.Attack");
                    Utils.Sleep(
                        UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + 50, 
                        "Orbwalk.Move");
                    return;
                }

                if (canAttack && !this.attackSleeper2.Sleeping)
                {
                    this.attacker.Attack(target, attackmodifiers);
                    this.AttackOrder();
                    this.attackSleeper2.Sleep(100);
                    return;
                }
            }

            var userdelay = this.setUserDelayManually ? this.UserDelay : Orbwalking.UserDelay;
            var canCancel = (this.CanCancelAttack(userdelay) && this.IsAttackOnCoolDown(target, bonusWindupMs))
                            || ((!isValid || !isAttackable)
//.........这里部分代码省略.........
开发者ID:EnsageSharp,项目名称:Ensage.Common,代码行数:101,代码来源:Orbwalker.cs


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