Client LuaCsForBarotrauma
AbilityConditionLocation.cs
1
using
System;
2
using
System.Linq;
3
using
System.Xml.Linq;
4
5
namespace
Barotrauma.Abilities
6
{
7
class
AbilityConditionLocation
:
AbilityConditionData
8
{
9
private
readonly
bool
? hasOutpost;
10
private
readonly Identifier[] locationIdentifiers;
11
private
readonly
bool
isPositiveReputation;
12
13
public
AbilityConditionLocation
(
CharacterTalent
characterTalent
,
ContentXElement
conditionElement) : base(
characterTalent
, conditionElement)
14
{
15
if
(conditionElement.
GetAttribute
(
"hasoutpost"
) !=
null
)
16
{
17
hasOutpost = conditionElement.
GetAttributeBool
(
"hasoutpost"
,
false
);
18
}
19
locationIdentifiers = conditionElement.
GetAttributeIdentifierArray
(
"locationtype"
, Array.Empty<Identifier>());
20
21
isPositiveReputation = conditionElement.
GetAttributeBool
(
"ispositivereputation"
,
false
);
22
}
23
24
protected
override
bool
MatchesConditionSpecific
(
AbilityObject
abilityObject)
25
{
26
if
(abilityObject is
IAbilityLocation
abilityLocation)
27
{
28
if
(isPositiveReputation)
29
{
30
if
(abilityLocation.Location?.Reputation is not { } reputation) {
return
false
; }
31
if
(reputation.Value <= 0) {
return
false
; }
32
}
33
34
if
(locationIdentifiers.Any())
35
{
36
if
(!locationIdentifiers.Contains(abilityLocation.Location.Type.Identifier)) {
return
false
; }
37
}
38
if
(hasOutpost.HasValue)
39
{
40
if
(hasOutpost.Value != abilityLocation.Location.HasOutpost()) {
return
false
; }
41
}
42
return
true
;
43
}
44
else
45
{
46
LogAbilityConditionError
(abilityObject, typeof(
IAbilityItemPrefab
));
47
return
false
;
48
}
49
}
50
}
51
}
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.AbilityConditionLocation
Definition:
AbilityConditionLocation.cs:8
Barotrauma.Abilities.AbilityConditionLocation.AbilityConditionLocation
AbilityConditionLocation(CharacterTalent characterTalent, ContentXElement conditionElement)
Definition:
AbilityConditionLocation.cs:13
Barotrauma.Abilities.AbilityConditionLocation.MatchesConditionSpecific
override bool MatchesConditionSpecific(AbilityObject abilityObject)
Definition:
AbilityConditionLocation.cs:24
Barotrauma.Abilities.AbilityObject
Definition:
AbilityObjects.cs:6
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeIdentifierArray
Identifier[] GetAttributeIdentifierArray(Identifier[] def, params string[] keys)
Barotrauma.ContentXElement.GetAttributeBool
bool GetAttributeBool(string key, bool def)
Barotrauma.ContentXElement.GetAttribute
XAttribute? GetAttribute(string name)
Barotrauma.Abilities.IAbilityItemPrefab
Definition:
AbilityInterfaces.cs:4
Barotrauma.Abilities.IAbilityLocation
Definition:
AbilityInterfaces.cs:24
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
AbilityConditionals
AbilityConditionData
AbilityConditionLocation.cs
Generated by
1.9.1