Client LuaCsForBarotrauma
CharacterAbilityGroupEffect.cs
1 using System.Collections.Generic;
2 
3 namespace Barotrauma.Abilities
4 {
6  {
7  public CharacterAbilityGroupEffect(AbilityEffectType abilityEffectType, CharacterTalent characterTalent, ContentXElement abilityElementGroup) :
8  base(abilityEffectType, characterTalent, abilityElementGroup) { }
9 
10  public void CheckAbilityGroup(AbilityObject abilityObject)
11  {
12  if (!IsActive) { return; }
13 
14  if (IsOverTriggerCount) { return; }
15 
16  List<CharacterAbility> abilities = IsApplicable(abilityObject) ? characterAbilities : fallbackAbilities;
17 
18  foreach (CharacterAbility characterAbility in abilities)
19  {
20  if (characterAbility.IsViable())
21  {
22  characterAbility.ApplyAbilityEffect(abilityObject);
23  }
24  }
25 
26  if (abilities.Count > 0)
27  {
29  }
30  }
31 
32  private bool IsOverTriggerCount => timesTriggered >= maxTriggerCount;
33 
34  private bool IsApplicable(AbilityObject abilityObject)
35  {
36  foreach (var abilityCondition in abilityConditions)
37  {
38  if (!abilityCondition.MatchesCondition(abilityObject))
39  {
40  return false;
41  }
42  }
43 
44  return true;
45  }
46  }
47 }
CharacterAbilityGroupEffect(AbilityEffectType abilityEffectType, CharacterTalent characterTalent, ContentXElement abilityElementGroup)
readonly List< AbilityCondition > abilityConditions
readonly List< CharacterAbility > characterAbilities
List of abilities that are triggered by this group. Fallback abilities are triggered if the condition...
void ApplyAbilityEffect(AbilityObject abilityObject)
AbilityEffectType
Definition: Enums.cs:140