Client LuaCsForBarotrauma
AbilityConditionNoCrewDied.cs
1 namespace Barotrauma.Abilities
2 {
4  {
5  public bool assistantsDontCount;
6 
7  public AbilityConditionNoCrewDied(CharacterTalent characterTalent, ContentXElement conditionElement) : base(characterTalent, conditionElement)
8  {
9  assistantsDontCount = conditionElement.GetAttributeBool(nameof(assistantsDontCount), true);
10  }
11 
12  protected override bool MatchesConditionSpecific()
13  {
14  if (GameMain.GameSession == null) { return false; }
15 
16  foreach (Character deadCharacter in GameMain.GameSession.Casualties)
17  {
18  if (deadCharacter.TeamID != character.TeamID) { continue; }
19 
20  if (assistantsDontCount && deadCharacter.Info?.Job?.Prefab.Identifier == "assistant")
21  {
22  continue;
23  }
24  if (deadCharacter.CauseOfDeath != null && deadCharacter.CauseOfDeath.Type != CauseOfDeathType.Disconnected)
25  {
26  return false;
27  }
28  }
29  return true;
30  }
31  }
32 }
AbilityConditionNoCrewDied(CharacterTalent characterTalent, ContentXElement conditionElement)
readonly CauseOfDeathType Type
Definition: CauseOfDeath.cs:12
bool GetAttributeBool(string key, bool def)
static GameSession?? GameSession
Definition: GameMain.cs:88
JobPrefab Prefab
Definition: Job.cs:18
readonly Identifier Identifier
Definition: Prefab.cs:34