Client LuaCsForBarotrauma
AbilityConditionReduceAffliction.cs
1
using
System;
2
3
namespace
Barotrauma.Abilities
4
{
5
class
AbilityConditionReduceAffliction
:
AbilityConditionData
6
{
7
private
readonly
string
[] allowedTypes;
8
private
readonly
string
identifier;
9
10
public
AbilityConditionReduceAffliction
(
CharacterTalent
characterTalent
,
ContentXElement
conditionElement) : base(
characterTalent
, conditionElement)
11
{
12
allowedTypes = conditionElement.
GetAttributeStringArray
(
"allowedtypes"
, Array.Empty<
string
>(), convertToLowerInvariant:
true
);
13
identifier = conditionElement.
GetAttributeString
(
"identifier"
,
""
);
14
}
15
16
protected
override
bool
MatchesConditionSpecific
(
AbilityObject
abilityObject)
17
{
18
if
((abilityObject as
IAbilityAffliction
)?.
Affliction
is
Affliction
affliction)
19
{
20
if
(allowedTypes.Find(c => c == affliction.Prefab.AfflictionType) ==
null
) {
return
false
; }
21
22
if
(!
string
.IsNullOrEmpty(identifier) && affliction.Prefab.Identifier != identifier) {
return
false
; }
23
24
return
true
;
25
}
26
else
27
{
28
LogAbilityConditionError
(abilityObject, typeof(
IAbilityAffliction
));
29
return
false
;
30
}
31
}
32
}
33
}
Barotrauma.Abilities.AbilityConditionData
Definition:
AbilityConditionData.cs:6
Barotrauma.Abilities.AbilityConditionData.LogAbilityConditionError
void LogAbilityConditionError(AbilityObject abilityObject, Type expectedData)
Definition:
AbilityConditionData.cs:18
Barotrauma.Abilities.AbilityCondition.characterTalent
CharacterTalent characterTalent
Definition:
AbilityCondition.cs:8
Barotrauma.Abilities.AbilityConditionReduceAffliction
Definition:
AbilityConditionReduceAffliction.cs:6
Barotrauma.Abilities.AbilityConditionReduceAffliction.AbilityConditionReduceAffliction
AbilityConditionReduceAffliction(CharacterTalent characterTalent, ContentXElement conditionElement)
Definition:
AbilityConditionReduceAffliction.cs:10
Barotrauma.Abilities.AbilityConditionReduceAffliction.MatchesConditionSpecific
override bool MatchesConditionSpecific(AbilityObject abilityObject)
Definition:
AbilityConditionReduceAffliction.cs:16
Barotrauma.Abilities.AbilityObject
Definition:
AbilityObjects.cs:6
Barotrauma.Affliction
Definition:
Affliction.cs:11
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeString
string? GetAttributeString(string key, string? def)
Barotrauma.ContentXElement.GetAttributeStringArray
string?[] GetAttributeStringArray(string key, string[]? def, bool convertToLowerInvariant=false)
Barotrauma.Abilities.IAbilityAffliction
Definition:
AbilityInterfaces.cs:39
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
AbilityConditionals
AbilityConditionData
AbilityConditionReduceAffliction.cs
Generated by
1.9.1