Ejemplo n.º 1
0
        private static void CreateLineOfSightTargetCheck(ref Func <CacheUnit, bool> CombatCriteria, Skill ability)
        {
            if (ability.IsRanged)
            {
                CombatCriteria += (unit) =>
                {
                    if (!unit.IgnoresLOSCheck && unit.IsTargetableAndAttackable)
                    {
                        LOSInfo LOSINFO = unit.LineOfSight;
                        if (LOSINFO.LastLOSCheckMS > 2000)
                        {
                            //!LOSINFO.LOSTest(FunkyGame.Hero.Position, true, ServerObjectIntersection: ability.IsProjectile, Flags: NavCellFlags.AllowProjectile)
                            if (!LOSINFO.LOSTest(FunkyGame.Hero.Position, true, false, ability.IsProjectile, ability.IsProjectile ? NavCellFlags.AllowProjectile:NavCellFlags.None))
                            {
                                //Raycast failed.. reset LOS Check -- for valid checking.
                                if (!LOSINFO.RayCast.Value || (LOSINFO.ObjectIntersection.HasValue && !LOSINFO.ObjectIntersection.Value))
                                {
                                    unit.RequiresLOSCheck = true;
                                    return(false);
                                }

                                //if (LOSINFO.NavCellProjectile.HasValue && !LOSINFO.NavCellProjectile.Value) //NavCellFlag Walk Failed
                                //{
                                //	bool MovementException = ((FunkyGame.Targeting.Cache.CurrentUnitTarget.MonsterTeleport || FunkyGame.Targeting.Cache.CurrentTarget.IsTransformUnit) && FunkyGame.Targeting.Cache.CurrentUnitTarget.AnimState == AnimationState.Transform);
                                //	if (!MovementException) return false;
                                //}
                            }
                        }
                        //else if (LOSINFO.ObjectIntersection.HasValue && !LOSINFO.ObjectIntersection.Value)
                        //{
                        //	return false;
                        //}
                    }
                    return(true);
                };
            }
            else if (ability.Range > 0)
            {            //Melee
                CombatCriteria += (unit) =>
                {
                    if (!unit.IgnoresLOSCheck && unit.IsTargetableAndAttackable)
                    {
                        float radiusDistance = unit.RadiusDistance;
                        //Check if within interaction range..
                        if (radiusDistance > ability.Range)
                        {
                            //Verify LOS walk
                            LOSInfo LOSINFO = unit.LineOfSight;
                            if (LOSINFO.LastLOSCheckMS > 2000)                            //||!LOSINFO.NavCellWalk.HasValue)
                            {
                                if (!LOSINFO.LOSTest(FunkyGame.Hero.Position, true, ServerObjectIntersection: false))
                                {
                                    //bool MovementException=((FunkyGame.Targeting.Cache.CurrentUnitTarget.MonsterTeleport||FunkyGame.Targeting.Cache.CurrentTarget.IsTransformUnit)&&FunkyGame.Targeting.Cache.CurrentUnitTarget.AnimState==Zeta.Internals.Actors.AnimationState.Transform);
                                    //Raycast failed.. reset LOS Check -- for valid checking.
                                    if (!LOSINFO.RayCast.Value)
                                    {
                                        unit.RequiresLOSCheck = true;
                                    }
                                    //else if (!LOSINFO.NavCellWalk.Value) //NavCellFlag Walk Failed
                                    //{
                                    //    bool MovementException = ((FunkyGame.Targeting.Cache.CurrentUnitTarget.MonsterTeleport || FunkyGame.Targeting.Cache.CurrentTarget.IsTransformUnit) && FunkyGame.Targeting.Cache.CurrentUnitTarget.AnimState == Zeta.Internals.Actors.AnimationState.Transform);
                                    //    if (!MovementException)
                                    //        return false;
                                    //}
                                }
                            }
                            //else if (LOSINFO.NavCellWalk.HasValue&&!LOSINFO.NavCellWalk.Value)
                            //{
                            //     return false;
                            //}
                        }
                    }
                    return(true);
                };
            }
        }
Ejemplo n.º 2
0
        ///<summary>
        ///Returns Ability used for destructibles
        ///</summary>
        internal virtual Skill DestructibleAbility()
        {
            Skill        returnAbility            = Bot.Character.Class.DefaultAttack;
            List <Skill> nonDestructibleAbilities = new List <Skill>();

            foreach (var item in Abilities.Values)
            {
                if (item.IsADestructiblePower)
                {
                    //Check LOS -- Projectiles
                    if (item.IsRanged && !Bot.Targeting.Cache.CurrentTarget.IgnoresLOSCheck)
                    {
                        LOSInfo LOSINFO = Bot.Targeting.Cache.CurrentTarget.LineOfSight;
                        if (LOSINFO.LastLOSCheckMS > 3000 || (item.IsProjectile && !LOSINFO.ObjectIntersection.HasValue) || !LOSINFO.NavCellProjectile.HasValue)
                        {
                            if (!LOSINFO.LOSTest(Bot.Character.Data.Position, true, false, NavCellFlags.AllowProjectile))
                            {
                                //Raycast failed.. reset LOS Check -- for valid checking.
                                if (!LOSINFO.RayCast.Value)
                                {
                                    Bot.Targeting.Cache.CurrentTarget.RequiresLOSCheck = true;
                                }
                                continue;
                            }
                        }
                        else if (!LOSINFO.NavCellProjectile.Value)
                        {
                            continue;
                        }
                    }

                    if (item.CheckPreCastConditionMethod())
                    {
                        returnAbility = item;
                        Skill.SetupAbilityForUse(ref returnAbility, true);
                        return(returnAbility);
                    }
                }
                else if (item.ExecutionType.HasFlag(AbilityExecuteFlags.Target) || item.ExecutionType.HasFlag(AbilityExecuteFlags.Location))
                {
                    //Check LOS -- Projectiles
                    if (item.IsRanged && !Bot.Targeting.Cache.CurrentTarget.IgnoresLOSCheck)
                    {
                        LOSInfo LOSINFO = Bot.Targeting.Cache.CurrentTarget.LineOfSight;
                        if (LOSINFO.LastLOSCheckMS > 3000 || (item.IsProjectile && !LOSINFO.ObjectIntersection.HasValue) || !LOSINFO.NavCellProjectile.HasValue)
                        {
                            if (!LOSINFO.LOSTest(Bot.Character.Data.Position, true, item.IsProjectile, NavCellFlags.AllowProjectile))
                            {
                                //Raycast failed.. reset LOS Check -- for valid checking.
                                if (!LOSINFO.RayCast.Value)
                                {
                                    Bot.Targeting.Cache.CurrentTarget.RequiresLOSCheck = true;
                                }
                                continue;
                            }
                        }
                        else if ((item.IsProjectile && LOSINFO.ObjectIntersection.Value) || !LOSINFO.NavCellProjectile.Value)
                        {
                            continue;
                        }
                    }

                    //Add this Ability to our list.. incase we cant find an offical Ability to use.
                    if (item.CheckPreCastConditionMethod())
                    {
                        nonDestructibleAbilities.Add(item);
                    }
                }
            }

            //Use non-destructible Ability..
            if (nonDestructibleAbilities.Count > 0)
            {
                returnAbility = nonDestructibleAbilities[0];
            }

            Skill.SetupAbilityForUse(ref returnAbility, true);
            return(returnAbility);
        }