예제 #1
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                Scientist self = playerTargetContext.Self as Scientist;
                if (Object.op_Implicit((Object)self))
                {
                    Memory.ExtendedInfo extendedInfo = self.AiContext.Memory.GetExtendedInfo((BaseEntity)option);
                    if (Object.op_Inequality((Object)extendedInfo.Entity, (Object)null))
                    {
                        if ((double)Time.get_time() < (double)extendedInfo.LastHurtUsTime + (double)this.Timeout || self.HostilityConsideration(option))
                        {
                            return(this.score);
                        }
                        return(0.0f);
                    }
                    if (!self.HostilityConsideration(option))
                    {
                        return(0.0f);
                    }
                    return(this.score);
                }
            }
            return(0.0f);
        }
        public override float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                Scientist self = playerTargetContext.Self as Scientist;
                if (self)
                {
                    Memory.ExtendedInfo extendedInfo = self.AiContext.Memory.GetExtendedInfo(option);
                    if (extendedInfo.Entity == null)
                    {
                        if (!self.HostilityConsideration(option))
                        {
                            return(0f);
                        }
                        return(this.score);
                    }
                    if (Time.time < extendedInfo.LastHurtUsTime + this.Timeout)
                    {
                        return(this.score);
                    }
                    if (!self.HostilityConsideration(option))
                    {
                        return(0f);
                    }
                    return(this.score);
                }
            }
            return(0f);
        }
예제 #3
0
        public override void Execute(IAIContext context)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                TargetSelectorPlayer.Evaluate(playerTargetContext, base.scorers, playerTargetContext.Players, playerTargetContext.PlayerCount, this.allScorersMustScoreAboveZero, out playerTargetContext.Target, out playerTargetContext.Score, out playerTargetContext.Index, out playerTargetContext.LastKnownPosition);
            }
        }
예제 #4
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null && PlayerDetectionChance.Evaluate(playerTargetContext.Self, playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex], option))
            {
                return(this.score);
            }
            return(0.0f);
        }
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null && option.Family != playerTargetContext.Self.GetStats.Family)
            {
                return(this.score);
            }
            return(0.0f);
        }
        public virtual void Execute(IAIContext context)
        {
            PlayerTargetContext context1 = context as PlayerTargetContext;

            if (context1 == null)
            {
                return;
            }
            TargetSelectorPlayer.Evaluate(context1, this.get_scorers(), context1.Players, context1.PlayerCount, this.allScorersMustScoreAboveZero, out context1.Target, out context1.Score, out context1.Index, out context1.LastKnownPosition);
        }
 public static bool Evaluate(
     PlayerTargetContext context,
     IList <IOptionScorer <BasePlayer> > scorers,
     BasePlayer[] options,
     int numOptions,
     bool allScorersMustScoreAboveZero,
     out BasePlayer best,
     out float bestScore,
     out int bestIndex,
     out Vector3 bestLastKnownPosition)
 {
     bestScore             = float.MinValue;
     best                  = (BasePlayer)null;
     bestIndex             = -1;
     bestLastKnownPosition = Vector3.get_zero();
     for (int index1 = 0; index1 < numOptions; ++index1)
     {
         context.CurrentOptionsIndex = index1;
         float score = 0.0f;
         bool  flag  = true;
         for (int index2 = 0; index2 < ((ICollection <IOptionScorer <BasePlayer> >)scorers).Count; ++index2)
         {
             if (!((ICanBeDisabled)scorers[index2]).get_isDisabled())
             {
                 float num = scorers[index2].Score((IAIContext)context, options[index1]);
                 if (allScorersMustScoreAboveZero && (double)num <= 0.0)
                 {
                     flag = false;
                     break;
                 }
                 score += num;
             }
         }
         if (flag)
         {
             Vector3     vector3  = Vector3.get_zero();
             BaseContext context1 = context.Self.GetContext(Guid.Empty) as BaseContext;
             if (context1 != null)
             {
                 NPCPlayerApex       self = context.Self as NPCPlayerApex;
                 Memory.ExtendedInfo extendedInfo;
                 vector3 = context1.Memory.Update((BaseEntity)options[index1], score, context.Direction[index1], context.Dot[index1], context.DistanceSqr[index1], context.LineOfSight[index1], Object.op_Inequality((Object)self, (Object)null) && Object.op_Equality((Object)self.lastAttacker, (Object)options[index1]), Object.op_Inequality((Object)self, (Object)null) ? self.lastAttackedTime : 0.0f, out extendedInfo).Position;
             }
             if ((double)score > (double)bestScore)
             {
                 bestScore             = score;
                 best                  = options[index1];
                 bestIndex             = index1;
                 bestLastKnownPosition = vector3;
             }
         }
     }
     return(Object.op_Inequality((Object)best, (Object)null));
 }
예제 #8
0
        public override float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext == null)
            {
                return(0f);
            }
            if (option.Family == playerTargetContext.Self.GetStats.Family)
            {
                return(0f);
            }
            return(this.score);
        }
예제 #9
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                NPCPlayerApex self = playerTargetContext.Self as NPCPlayerApex;
                if (Object.op_Implicit((Object)self) && self.HostilityConsideration(option))
                {
                    return(this.score);
                }
            }
            return(0.0f);
        }
예제 #10
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                float distanceSqr;
                float aggroRangeSqr;
                BestPlayerDistance.Evaluate(playerTargetContext.Self, option.ServerPosition, out distanceSqr, out aggroRangeSqr);
                playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = distanceSqr;
                return((float)(1.0 - (double)distanceSqr / (double)aggroRangeSqr) * this.score);
            }
            playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = -1f;
            return(0.0f);
        }
예제 #11
0
        public override float Score(IAIContext context, BasePlayer option)
        {
            float single;
            float single1;
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext == null)
            {
                playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = -1f;
                return(0f);
            }
            BestPlayerDistance.Evaluate(playerTargetContext.Self, option.ServerPosition, out single, out single1);
            playerTargetContext.DistanceSqr[playerTargetContext.CurrentOptionsIndex] = single;
            return((1f - single / single1) * this.score);
        }
예제 #12
0
 public static bool Evaluate(PlayerTargetContext context, IList <IOptionScorer <BasePlayer> > scorers, BasePlayer[] options, int numOptions, bool allScorersMustScoreAboveZero, out BasePlayer best, out float bestScore, out int bestIndex, out Vector3 bestLastKnownPosition)
 {
     Memory.ExtendedInfo extendedInfo;
     bestScore             = Single.MinValue;
     best                  = null;
     bestIndex             = -1;
     bestLastKnownPosition = Vector3.zero;
     for (int i = 0; i < numOptions; i++)
     {
         context.CurrentOptionsIndex = i;
         float single = 0f;
         bool  flag   = true;
         for (int j = 0; j < scorers.Count; j++)
         {
             if (!scorers[j].isDisabled)
             {
                 float single1 = scorers[j].Score(context, options[i]);
                 if (!allScorersMustScoreAboveZero || single1 > 0f)
                 {
                     single += single1;
                 }
                 else
                 {
                     flag = false;
                     break;
                 }
             }
         }
         if (flag)
         {
             Vector3     position    = Vector3.zero;
             BaseContext baseContext = context.Self.GetContext(Guid.Empty) as BaseContext;
             if (baseContext != null)
             {
                 NPCPlayerApex self = context.Self as NPCPlayerApex;
                 position = baseContext.Memory.Update(options[i], single, context.Direction[i], context.Dot[i], context.DistanceSqr[i], context.LineOfSight[i], (self == null ? false : self.lastAttacker == options[i]), (self != null ? self.lastAttackedTime : 0f), out extendedInfo).Position;
             }
             if (single > bestScore)
             {
                 bestScore             = single;
                 best                  = options[i];
                 bestIndex             = i;
                 bestLastKnownPosition = position;
             }
         }
     }
     return(best != null);
 }
예제 #13
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;
            Vector3             dir;
            float dot;

            if (playerTargetContext != null && BestPlayerDirection.Evaluate(playerTargetContext.Self, option.ServerPosition, out dir, out dot))
            {
                playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = dir;
                playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = dot;
                return((float)(((double)dot + 1.0) * 0.5) * this.score);
            }
            playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = Vector3.get_zero();
            playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = -1f;
            return(0.0f);
        }
        public override float Score(IAIContext context, BasePlayer option)
        {
            Vector3             vector3;
            float               single;
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext == null || !BestPlayerDirection.Evaluate(playerTargetContext.Self, option.ServerPosition, out vector3, out single))
            {
                playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = Vector3.zero;
                playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = -1f;
                return(0f);
            }
            playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = vector3;
            playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = single;
            return((single + 1f) * 0.5f * this.score);
        }
예제 #15
0
        public override float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                NPCPlayerApex self = playerTargetContext.Self as NPCPlayerApex;
                if (self)
                {
                    byte num = BestMountedLineOfSight.Evaluate(self, option);
                    playerTargetContext.LineOfSight[playerTargetContext.CurrentOptionsIndex] = num;
                    return((float)num * this.score);
                }
            }
            playerTargetContext.LineOfSight[playerTargetContext.CurrentOptionsIndex] = 0;
            return(0f);
        }
        public override float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                NPCPlayerApex self = playerTargetContext.Self as NPCPlayerApex;
                if (self)
                {
                    if (!self.HostilityConsideration(option))
                    {
                        return(0f);
                    }
                    return(this.score);
                }
            }
            return(0f);
        }
예제 #17
0
        public override float Score(IAIContext context, BasePlayer option)
        {
            int num;
            int num1;
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                NPCPlayerApex self = playerTargetContext.Self as NPCPlayerApex;
                if (self)
                {
                    playerTargetContext.LineOfSight[playerTargetContext.CurrentOptionsIndex] = BestLineOfSight.Evaluate(self, option, out num, out num1);
                    return((float)(num + num1) * 0.5f * this.score);
                }
            }
            playerTargetContext.LineOfSight[playerTargetContext.CurrentOptionsIndex] = 0;
            return(0f);
        }
예제 #18
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                NPCPlayerApex self = playerTargetContext.Self as NPCPlayerApex;
                if (Object.op_Implicit((Object)self))
                {
                    int standing;
                    int crouched;
                    playerTargetContext.LineOfSight[playerTargetContext.CurrentOptionsIndex] = BestLineOfSight.Evaluate(self, option, out standing, out crouched);
                    return((float)(standing + crouched) * 0.5f * this.score);
                }
            }
            playerTargetContext.LineOfSight[playerTargetContext.CurrentOptionsIndex] = (byte)0;
            return(0.0f);
        }
예제 #19
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                BasePlayer self = playerTargetContext.Self as BasePlayer;
                Vector3    dir;
                float      dot;
                if (Object.op_Implicit((Object)self) && self.isMounted && BestMountedPlayerDirection.Evaluate(self, option.ServerPosition, out dir, out dot))
                {
                    playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = dir;
                    playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = dot;
                    return((float)(((double)dot + 1.0) * 0.5) * this.score);
                }
            }
            playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = Vector3.get_zero();
            playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = 0.0f;
            return(0.0f);
        }
        public override float Score(IAIContext context, BasePlayer option)
        {
            Vector3             vector3;
            float               single;
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext != null)
            {
                BasePlayer self = playerTargetContext.Self as BasePlayer;
                if (self && self.isMounted && BestMountedPlayerDirection.Evaluate(self, option.ServerPosition, out vector3, out single))
                {
                    playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = vector3;
                    playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = single;
                    return((single + 1f) * 0.5f * this.score);
                }
            }
            playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = Vector3.zero;
            playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = 0f;
            return(0f);
        }