Client LuaCsForBarotrauma
AbilityConditionHasItem.cs
1
using
Barotrauma
.
Extensions
;
2
using
System;
3
4
namespace
Barotrauma.Abilities
5
{
6
class
AbilityConditionHasItem
:
AbilityConditionDataless
7
{
8
private
readonly Identifier[] tags;
9
readonly
bool
requireAll;
10
11
public
AbilityConditionHasItem
(
CharacterTalent
characterTalent
,
ContentXElement
conditionElement) : base(
characterTalent
, conditionElement)
12
{
13
tags = conditionElement.
GetAttributeIdentifierArray
(
"tags"
, Array.Empty<Identifier>());
14
requireAll = conditionElement.
GetAttributeBool
(
"requireall"
,
false
);
15
}
16
17
protected
override
bool
MatchesConditionSpecific
()
18
{
19
if
(tags.None())
20
{
21
return
character
.
GetEquippedItem
(Identifier.Empty) !=
null
;
22
}
23
24
if
(requireAll)
25
{
26
foreach
(Identifier tag
in
tags)
27
{
28
if
(
character
.
GetEquippedItem
(tag) ==
null
) {
return
false
; }
29
}
30
return
true
;
31
}
32
else
33
{
34
foreach
(Identifier tag
in
tags)
35
{
36
if
(
character
.
GetEquippedItem
(tag) !=
null
) {
return
true
; }
37
}
38
return
false
;
39
}
40
}
41
}
42
}
Barotrauma.Abilities.AbilityConditionDataless
Definition:
AbilityConditionDataless.cs:4
Barotrauma.Abilities.AbilityConditionHasItem
Definition:
AbilityConditionHasItem.cs:7
Barotrauma.Abilities.AbilityConditionHasItem.AbilityConditionHasItem
AbilityConditionHasItem(CharacterTalent characterTalent, ContentXElement conditionElement)
Definition:
AbilityConditionHasItem.cs:11
Barotrauma.Abilities.AbilityConditionHasItem.MatchesConditionSpecific
override bool MatchesConditionSpecific()
Definition:
AbilityConditionHasItem.cs:17
Barotrauma.Abilities.AbilityCondition.character
Character character
Definition:
AbilityCondition.cs:9
Barotrauma.Abilities.AbilityCondition.characterTalent
CharacterTalent characterTalent
Definition:
AbilityCondition.cs:8
Barotrauma.Character.GetEquippedItem
Item GetEquippedItem(Identifier tagOrIdentifier=default, InvSlotType? slotType=null)
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:2649
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.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma.Extensions
Definition:
IEnumerableExtensions.cs:9
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
AbilityConditionals
AbilityConditionDataless
AbilityConditionHasItem.cs
Generated by
1.9.1