Client LuaCsForBarotrauma
AbilityConditionAffliction.cs
1 using System.Linq;
2 
3 namespace Barotrauma.Abilities
4 {
6  {
7  private readonly string[] afflictions;
8  public AbilityConditionAffliction(CharacterTalent characterTalent, ContentXElement conditionElement) : base(characterTalent, conditionElement)
9  {
10  afflictions = conditionElement.GetAttributeStringArray("afflictions", new string[0], convertToLowerInvariant: true);
11  }
12 
13  protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
14  {
15  if (abilityObject is IAbilityAffliction { Affliction: Affliction affliction })
16  {
17  return afflictions.Any(a => a == affliction.Identifier || a == affliction.Prefab.AfflictionType);
18  }
19  else
20  {
21  LogAbilityConditionError(abilityObject, typeof(IAbilityAttackResult));
22  return false;
23  }
24  }
25  }
26 }
override bool MatchesConditionSpecific(AbilityObject abilityObject)
AbilityConditionAffliction(CharacterTalent characterTalent, ContentXElement conditionElement)
void LogAbilityConditionError(AbilityObject abilityObject, Type expectedData)
string?[] GetAttributeStringArray(string key, string[]? def, bool convertToLowerInvariant=false)