Client LuaCsForBarotrauma
CharacterAbilityAtmosMachine.cs
1
using
System;
2
using
System.Linq;
3
4
namespace
Barotrauma.Abilities
5
{
6
class
CharacterAbilityAtmosMachine
:
CharacterAbility
7
{
8
private
readonly
float
addedValue;
9
private
readonly Identifier[] tags;
10
private
readonly
int
maxMultiplyCount;
11
12
public
CharacterAbilityAtmosMachine
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
13
{
14
addedValue = abilityElement.
GetAttributeFloat
(
"addedvalue"
, 0f);
15
tags = abilityElement.
GetAttributeIdentifierArray
(
"tags"
, Array.Empty<Identifier>());
16
maxMultiplyCount = abilityElement.
GetAttributeInt
(
"maxmultiplycount"
,
int
.MaxValue);
17
}
18
19
protected
override
void
ApplyEffect
(
AbilityObject
abilityObject)
20
{
21
if
(abilityObject is
IAbilityValue
abilityValue)
22
{
23
int
multiplyCount = 0;
24
25
foreach
(
Item
item
in
Item
.
ItemList
)
26
{
27
if
(item.
Prefab
.
Tags
.Any(t => tags.Contains(t)))
28
{
29
multiplyCount++;
30
if
(multiplyCount == maxMultiplyCount)
31
{
32
break
;
33
}
34
}
35
}
36
abilityValue.Value += addedValue * multiplyCount;
37
}
38
}
39
}
40
}
Barotrauma.Abilities.AbilityObject
Definition:
AbilityObjects.cs:6
Barotrauma.Abilities.CharacterAbilityAtmosMachine
Definition:
CharacterAbilityAtmosMachine.cs:7
Barotrauma.Abilities.CharacterAbilityAtmosMachine.CharacterAbilityAtmosMachine
CharacterAbilityAtmosMachine(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityAtmosMachine.cs:12
Barotrauma.Abilities.CharacterAbilityAtmosMachine.ApplyEffect
override void ApplyEffect(AbilityObject abilityObject)
Definition:
CharacterAbilityAtmosMachine.cs:19
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbility
Definition:
CharacterAbility.cs:7
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeIdentifierArray
Identifier[] GetAttributeIdentifierArray(Identifier[] def, params string[] keys)
Barotrauma.ContentXElement.GetAttributeFloat
float GetAttributeFloat(string key, float def)
Barotrauma.ContentXElement.GetAttributeInt
int GetAttributeInt(string key, int def)
Barotrauma.Item
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:26
Barotrauma.Item.ItemList
static readonly List< Item > ItemList
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:27
Barotrauma.Item.Prefab
new ItemPrefab Prefab
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:61
Barotrauma.ItemPrefab.Tags
override ImmutableHashSet< Identifier > Tags
Definition:
BarotraumaShared/SharedSource/Items/ItemPrefab.cs:678
Barotrauma.Abilities.IAbilityValue
Definition:
AbilityInterfaces.cs:14
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CustomAbilities
CharacterAbilityAtmosMachine.cs
Generated by
1.9.1