public CacheObject(int sno, int raguid, int acdguid, Vector3 position, string Name = null) : base(sno) { RAGUID = raguid; NeedsUpdate = true; removal_ = false; BlacklistFlag = BlacklistType.None; AcdGuid = acdguid; radius_ = 0f; position_ = position; RequiresLOSCheck = !(base.IgnoresLOSCheck); //require a LOS check initally on a new object! lineofsight = new LOSInfo(this); LosSearchRetryMilliseconds_ = 1000; PrioritizedDate = DateTime.Today; PriorityCounter = 0; losv3_ = Vector3.Zero; HandleAsAvoidanceObject = false; Properties = TargetProperties.None; //Keep track of each unique RaGuid that is created and uses this SNO during each level. //if (!UsedByRaGuids.Contains(RAGUID)) UsedByRaGuids.Add(RAGUID); }
private static void CreateLineOfSightTargetCheck(ref Func <bool> CombatCriteria, Skill ability) { if (ability.IsRanged) { CombatCriteria += () => { if (!Bot.Targeting.Cache.CurrentUnitTarget.IgnoresLOSCheck && Bot.Targeting.Cache.CurrentUnitTarget.IsTargetableAndAttackable) { LOSInfo LOSINFO = Bot.Targeting.Cache.CurrentTarget.LineOfSight; if (LOSINFO.LastLOSCheckMS > 2000 || !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; } else if (!LOSINFO.NavCellProjectile.Value) //NavCellFlag Walk Failed { bool MovementException = ((Bot.Targeting.Cache.CurrentUnitTarget.MonsterTeleport || Bot.Targeting.Cache.CurrentTarget.IsTransformUnit) && Bot.Targeting.Cache.CurrentUnitTarget.AnimState == AnimationState.Transform); if (!MovementException) { return(false); } //else //LOSINFO.NavCellProjectile=true; } } } else if (LOSINFO.NavCellProjectile.HasValue && !LOSINFO.NavCellProjectile.Value) { return(false); } } return(true); }; } else if (ability.Range > 0) { //Melee CombatCriteria += () => { if (!Bot.Targeting.Cache.CurrentUnitTarget.IgnoresLOSCheck && Bot.Targeting.Cache.CurrentUnitTarget.IsTargetableAndAttackable) { float radiusDistance = Bot.Targeting.Cache.CurrentTarget.RadiusDistance; //Check if within interaction range.. if (radiusDistance > ability.Range) { //Verify LOS walk LOSInfo LOSINFO = Bot.Targeting.Cache.CurrentTarget.LineOfSight; if (LOSINFO.LastLOSCheckMS > 2000) //||!LOSINFO.NavCellWalk.HasValue) { if (!LOSINFO.LOSTest(Bot.Character.Data.Position, true, false)) { //bool MovementException=((Bot.Targeting.Cache.CurrentUnitTarget.MonsterTeleport||Bot.Targeting.Cache.CurrentTarget.IsTransformUnit)&&Bot.Targeting.Cache.CurrentUnitTarget.AnimState==Zeta.Internals.Actors.AnimationState.Transform); //Raycast failed.. reset LOS Check -- for valid checking. if (!LOSINFO.RayCast.Value) { Bot.Targeting.Cache.CurrentTarget.RequiresLOSCheck = true; } //else if (!LOSINFO.NavCellWalk.Value) //NavCellFlag Walk Failed //{ // bool MovementException = ((Bot.Targeting.Cache.CurrentUnitTarget.MonsterTeleport || Bot.Targeting.Cache.CurrentTarget.IsTransformUnit) && Bot.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); }; } }
///<summary> ///Used to recreate from temp into obstacle object. ///</summary> public CacheObject(CacheObject parent) : base(parent) { AcdGuid = parent.AcdGuid; BlacklistFlag = parent.BlacklistFlag; BlacklistLoops_ = parent.BlacklistLoops_; gprect_ = parent.gprect_; InteractionAttempts = parent.InteractionAttempts; lineofsight = new LOSInfo(this); LoopsUnseen_ = parent.LoopsUnseen_; losv3_ = parent.losv3_; LosSearchRetryMilliseconds_ = parent.LosSearchRetryMilliseconds_; NeedsRemoved = parent.NeedsRemoved; NeedsUpdate = parent.NeedsUpdate; PrioritizedDate = parent.PrioritizedDate; PriorityCounter = parent.PriorityCounter; position_ = parent.Position; radius_ = parent.Radius; RAGUID = parent.RAGUID; ref_DiaObject = parent.ref_DiaObject; removal_ = parent.removal_; RequiresLOSCheck = parent.RequiresLOSCheck; SummonerID = parent.SummonerID; weight_ = parent.Weight; HandleAsAvoidanceObject = parent.HandleAsAvoidanceObject; Properties = parent.Properties; }