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


C# Obj_AI_Base.LSIsValid方法代码示例

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


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

示例1: Game_OnProcessSpell

        private static void Game_OnProcessSpell(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args)
        {
            var heroA = hero as AIHeroClient;
            if (!getCheckBoxItem("enemy.ward"))
            {
                return;
            }

            if (hero.IsEnemy && hero is AIHeroClient && hero.LSIsValid())
            {
                WardData wardData;
                if (WardDatabase.WardspellNames.TryGetValue(args.SData.Name.ToLower(), out wardData))
                {
                    var pos = args.End.ToVector2();

                    if (args.SData.Name.ToLower().Contains("TrinketTotem") || args.SData.Name.ToLower().Contains("trinkettotem"))
                    {
                        wardData.Duration = 1000 * (60 + (int)Math.Round(3.5 * (heroA.Level - 1))); // Not sure.
                    }

                    DelayAction.Add((float)50, () =>
                    {
                        if (Wards.Any(ward => ward.Position.ToVector2().Distance(pos) < 50 && Variables.TickCount - ward.Timestamp < 100))
                        {
                            return;
                        }

                        var newWard = new WardTrackerInfo(wardData, pos.To3D(), null)
                        {
                            StartPos = args.Start.ToVector2(),
                            EndPos = args.End.ToVector2()
                        };

                        Wards.Add(newWard);
                    });
                }
            }
        }
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:38,代码来源:WardTracker.cs

示例2: Cast

        /// <summary>
        ///     Casts the spell.
        /// </summary>
        /// <param name="unit">Unit to cast on</param>
        /// <param name="exactHitChance">
        ///     Is exact hit chance
        /// </param>
        /// <param name="areaOfEffect">
        ///     Is Area of Effect
        /// </param>
        /// <param name="minTargets">
        ///     Minimum of Targets
        /// </param>
        /// <param name="tempHitChance">
        ///     Temporary HitChance Override
        /// </param>
        /// <returns>
        ///     The <see cref="CastStates" />
        /// </returns>
        public CastStates Cast(
            Obj_AI_Base unit,
            bool exactHitChance = false,
            bool areaOfEffect = false,
            int minTargets = -1,
            Enumerations.HitChance tempHitChance = Enumerations.HitChance.None)
        {
            if (!unit.LSIsValid() || !unit.IsVisible || !unit.IsHPBarRendered)
            {
                return CastStates.InvalidTarget;
            }

            if (!this.IsReady())
            {
                return CastStates.NotReady;
            }

            if (!this.minManaPercent.Equals(0) && ObjectManager.Player.ManaPercent < this.minManaPercent)
            {
                return CastStates.LowMana;
            }

            if (this.CastCondition != null && !this.CastCondition())
            {
                return CastStates.FailedCondition;
            }

            if (!areaOfEffect && minTargets != -1)
            {
                areaOfEffect = true;
            }

            if (!this.IsSkillshot)
            {
                if (this.RangeCheckFrom.LSDistanceSquared(unit.ServerPosition) > this.RangeSqr)
                {
                    return CastStates.OutOfRange;
                }

                this.LastCastAttemptT = Variables.TickCount;

                return !GameObjects.Player.Spellbook.CastSpell(this.Slot, unit)
                           ? CastStates.NotCasted
                           : CastStates.SuccessfullyCasted;
            }

            var prediction = this.GetPrediction(unit, areaOfEffect);

            if (minTargets != -1 && prediction.AoeTargetsHitCount <= minTargets)
            {
                return CastStates.NotEnoughTargets;
            }

            if (prediction.CollisionObjects.Count > 0)
            {
                return CastStates.Collision;
            }

            if (this.RangeCheckFrom.LSDistanceSquared(prediction.CastPosition) > this.RangeSqr)
            {
                return CastStates.OutOfRange;
            }

            if (prediction.Hitchance < ((tempHitChance == Enumerations.HitChance.None) ? this.MinHitChance : tempHitChance)
                || (exactHitChance
                    && prediction.Hitchance != ((tempHitChance == Enumerations.HitChance.None) ? this.MinHitChance : tempHitChance)))
            {
                return CastStates.LowHitChance;
            }

            this.LastCastAttemptT = Variables.TickCount;

            if (this.IsChargedSpell)
            {
                if (this.IsCharging)
                {
                    ShootChargedSpell(this.Slot, prediction.CastPosition);
                }
                else
                {
                    this.StartCharging();
//.........这里部分代码省略.........
开发者ID:CONANLXF,项目名称:Berb.Common,代码行数:101,代码来源:Spell.cs


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