Exemplo n.º 1
0
 protected override float GetPriority()
 {
     if (!IsAllowed)
     {
         Priority = 0;
         Abandon  = true;
         return(Priority);
     }
     if (character.LockHands || targetCharacter == null || targetCharacter.CurrentHull == null || targetCharacter.Removed || targetCharacter.IsDead)
     {
         Priority = 0;
         Abandon  = true;
     }
     else
     {
         // Vertical distance matters more than horizontal (climbing up/down is harder than moving horizontally)
         float dist           = Math.Abs(character.WorldPosition.X - targetCharacter.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - targetCharacter.WorldPosition.Y) * 2.0f;
         float distanceFactor = MathHelper.Lerp(1, 0.1f, MathUtils.InverseLerp(0, 5000, dist));
         if (targetCharacter.CurrentHull == character.CurrentHull)
         {
             distanceFactor = 1;
         }
         float vitalityFactor = 1 - AIObjectiveRescueAll.GetVitalityFactor(targetCharacter) / 100;
         float devotion       = CumulatedDevotion / 100;
         Priority = MathHelper.Lerp(0, 100, MathHelper.Clamp(devotion + (vitalityFactor * distanceFactor * PriorityModifier), 0, 1));
     }
     return(Priority);
 }
Exemplo n.º 2
0
        public override float GetPriority()
        {
            if (targetCharacter == null)
            {
                return(0);
            }
            if (targetCharacter.CurrentHull == null || targetCharacter.Removed || targetCharacter.IsDead)
            {
                abandon = true;
                return(0);
            }
            // Don't go into rooms that have enemies
            if (Character.CharacterList.Any(c => c.CurrentHull == targetCharacter.CurrentHull && !HumanAIController.IsFriendly(c)))
            {
                abandon = true;
                return(0);
            }
            // Vertical distance matters more than horizontal (climbing up/down is harder than moving horizontally)
            float dist           = Math.Abs(character.WorldPosition.X - targetCharacter.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - targetCharacter.WorldPosition.Y) * 2.0f;
            float distanceFactor = MathHelper.Lerp(1, 0.5f, MathUtils.InverseLerp(0, 10000, dist));
            float vitalityFactor = AIObjectiveRescueAll.GetVitalityFactor(targetCharacter);
            float devotion       = Math.Min(Priority, 10) / 100;

            return(MathHelper.Lerp(0, 100, MathHelper.Clamp(devotion + vitalityFactor * distanceFactor, 0, 1)));
        }
Exemplo n.º 3
0
        public override float GetPriority()
        {
            if (targetCharacter == null || targetCharacter.CurrentHull == null || targetCharacter.Removed || targetCharacter.IsDead)
            {
                return(0);
            }
            // Vertical distance matters more than horizontal (climbing up/down is harder than moving horizontally)
            float dist           = Math.Abs(character.WorldPosition.X - targetCharacter.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - targetCharacter.WorldPosition.Y) * 2.0f;
            float distanceFactor = MathHelper.Lerp(1, 0.1f, MathUtils.InverseLerp(0, 5000, dist));

            if (targetCharacter.CurrentHull == character.CurrentHull)
            {
                distanceFactor = 1;
            }
            float vitalityFactor = AIObjectiveRescueAll.GetVitalityFactor(targetCharacter);
            float devotion       = Math.Min(Priority, 10) / 100;

            return(MathHelper.Lerp(0, 100, MathHelper.Clamp(devotion + vitalityFactor * distanceFactor, 0, 1)));
        }
        protected override bool Check()
        {
            if (character.LockHands || targetCharacter == null || targetCharacter.CurrentHull == null || targetCharacter.Removed || targetCharacter.IsDead)
            {
                Abandon = true;
                return(false);
            }
            // Don't go into rooms that have enemies
            if (Character.CharacterList.Any(c => c.CurrentHull == targetCharacter.CurrentHull && !HumanAIController.IsFriendly(character, c) && HumanAIController.IsActive(c)))
            {
                Abandon = true;
                return(false);
            }
            bool isCompleted = AIObjectiveRescueAll.GetVitalityFactor(targetCharacter) >= AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager, character, targetCharacter);

            if (isCompleted && targetCharacter != character)
            {
                character.Speak(TextManager.GetWithVariable("DialogTargetHealed", "[targetname]", targetCharacter.Name),
                                null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f);
            }
            return(isCompleted);
        }
Exemplo n.º 5
0
        protected override bool CheckObjectiveSpecific()
        {
            if (character.LockHands || targetCharacter == null || targetCharacter.CurrentHull == null || targetCharacter.Removed || targetCharacter.IsDead)
            {
                Abandon = true;
                return(false);
            }
            // Don't go into rooms that have enemies
            if (Character.CharacterList.Any(c => c.CurrentHull == targetCharacter.CurrentHull && !HumanAIController.IsFriendly(character, c) && HumanAIController.IsActive(c)))
            {
                Abandon = true;
                return(false);
            }
            bool isCompleted =
                AIObjectiveRescueAll.GetVitalityFactor(targetCharacter) >= AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager, character, targetCharacter) ||
                targetCharacter.CharacterHealth.GetAllAfflictions().All(a => a.Prefab.IsBuff || a.Strength <= a.Prefab.TreatmentThreshold);

            if (isCompleted && targetCharacter != character && character.IsOnPlayerTeam)
            {
                character.Speak(TextManager.GetWithVariable("DialogTargetHealed", "[targetname]", targetCharacter.Name),
                                null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f);
            }
            return(isCompleted);
        }