Client LuaCsForBarotrauma
AbilityConditionData.cs
1 using System;
2 
3 namespace Barotrauma.Abilities
4 {
6  {
16  public AbilityConditionData(CharacterTalent characterTalent, ContentXElement conditionElement) : base(characterTalent, conditionElement) { }
17 
18  protected void LogAbilityConditionError(AbilityObject abilityObject, Type expectedData)
19  {
20  DebugConsole.ThrowError($"Used data-reliant ability condition when data is incompatible! Expected {expectedData}, but received {abilityObject} in talent {characterTalent.DebugIdentifier}",
21  contentPackage: characterTalent.Prefab.ContentPackage);
22  }
23 
24  protected abstract bool MatchesConditionSpecific(AbilityObject abilityObject);
25  public override bool MatchesCondition()
26  {
27  DebugConsole.ThrowError($"Used data-reliant ability condition in a state-based ability in talent {characterTalent.DebugIdentifier}! This is not allowed.",
28  contentPackage: characterTalent.Prefab.ContentPackage);
29  return false;
30  }
31  public override bool MatchesCondition(AbilityObject abilityObject)
32  {
33  if (abilityObject is null) { return invert; }
34  return invert ? !MatchesConditionSpecific(abilityObject) : MatchesConditionSpecific(abilityObject);
35  }
36  }
37 }
void LogAbilityConditionError(AbilityObject abilityObject, Type expectedData)
abstract bool MatchesConditionSpecific(AbilityObject abilityObject)
override bool MatchesCondition(AbilityObject abilityObject)
AbilityConditionData(CharacterTalent characterTalent, ContentXElement conditionElement)
Some conditions rely on specific ability data that is integrally connected to the AbilityEffectType....
readonly TalentPrefab Prefab
ContentPackage? ContentPackage
Definition: Prefab.cs:37