protected override bool Filter(Item item)
 {
     if (!IsValidTarget(item, character))
     {
         return(false);
     }
     if (item.CurrentHull.FireSources.Count > 0)
     {
         return(false);
     }
     // Don't repair items in rooms that have enemies inside.
     if (Character.CharacterList.Any(c => c.CurrentHull == item.CurrentHull && !HumanAIController.IsFriendly(c) && HumanAIController.IsActive(c)))
     {
         return(false);
     }
     if (!Objectives.ContainsKey(item))
     {
         if (item != character.SelectedConstruction)
         {
             float condition = item.ConditionPercentage;
             if (item.Repairables.All(r => condition >= r.RepairThreshold))
             {
                 return(false);
             }
         }
     }
     if (!string.IsNullOrWhiteSpace(RelevantSkill))
     {
         if (item.Repairables.None(r => r.requiredSkills.Any(s => s.Identifier.Equals(RelevantSkill, StringComparison.OrdinalIgnoreCase))))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #2
0
 protected override bool Filter(Item item)
 {
     if (!IsValidTarget(item, character))
     {
         return(false);
     }
     if (item.CurrentHull.FireSources.Count > 0)
     {
         return(false);
     }
     // Don't repair items in rooms that have enemies inside.
     if (Character.CharacterList.Any(c => c.CurrentHull == item.CurrentHull && !HumanAIController.IsFriendly(c) && HumanAIController.IsActive(c)))
     {
         return(false);
     }
     if (!Objectives.ContainsKey(item))
     {
         if (item.Repairables.All(r => item.ConditionPercentage > r.ShowRepairUIThreshold))
         {
             return(false);
         }
     }
     if (RequireAdequateSkills)
     {
         if (item.Repairables.Any(r => !r.HasRequiredSkills(character)))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #3
0
 public int GetNextObjectiveID()
 {
     for (int i = 0; i < Objectives.Count; i++)
     {
         if (!Objectives.ContainsKey(i))
         {
             return(i);
         }
     }
     return(Objectives.Count);
 }
 protected override bool Filter(Item target)
 {
     // If the target was selected as a valid target, we'll have to accept it so that the objective can be completed.
     // The validity changes when a character picks the item up.
     if (!IsValidTarget(target, character, checkInventory: true))
     {
         return(Objectives.ContainsKey(target) && IsItemInsideValidSubmarine(target, character));
     }
     if (target.CurrentHull.FireSources.Count > 0)
     {
         return(false);
     }
     // Don't repair items in rooms that have enemies inside.
     if (Character.CharacterList.Any(c => c.CurrentHull == target.CurrentHull && !HumanAIController.IsFriendly(c) && HumanAIController.IsActive(c)))
     {
         return(false);
     }
     return(true);
 }