Client LuaCsForBarotrauma
CharacterAbilityAlienHoarder.cs
1
using
System;
2
using
System.Linq;
3
4
namespace
Barotrauma.Abilities
5
{
6
class
CharacterAbilityAlienHoarder
:
CharacterAbility
7
{
8
private
readonly
float
addedDamageMultiplierPerItem;
9
private
readonly
float
maxAddedDamageMultiplier;
10
private
readonly
string
[] tags;
11
12
public
CharacterAbilityAlienHoarder
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
13
{
14
addedDamageMultiplierPerItem = abilityElement.
GetAttributeFloat
(
"addeddamagemultiplierperitem"
, 0f);
15
maxAddedDamageMultiplier = abilityElement.
GetAttributeFloat
(
"maxaddedddamagemultiplier"
,
float
.MaxValue);
16
tags = abilityElement.
GetAttributeStringArray
(
"tags"
, Array.Empty<
string
>(), convertToLowerInvariant:
true
);
17
}
18
19
protected
override
void
ApplyEffect
(
AbilityObject
abilityObject)
20
{
21
if
(abilityObject is
AbilityAttackData
attackData)
22
{
23
float
totalAddedDamageMultiplier = 0f;
24
foreach
(
Item
item
in
Character
.
Inventory
.
AllItems
)
25
{
26
if
(tags.Any(t => item.
Prefab
.
Tags
.Any(p => t == p)))
27
{
28
totalAddedDamageMultiplier += addedDamageMultiplierPerItem;
29
}
30
}
31
attackData.DamageMultiplier += Math.Min(totalAddedDamageMultiplier, maxAddedDamageMultiplier);
32
}
33
else
34
{
35
LogAbilityObjectMismatch
();
36
}
37
}
38
}
39
}
Barotrauma.Abilities.AbilityObject
Definition:
AbilityObjects.cs:6
Barotrauma.Abilities.CharacterAbilityAlienHoarder
Definition:
CharacterAbilityAlienHoarder.cs:7
Barotrauma.Abilities.CharacterAbilityAlienHoarder.ApplyEffect
override void ApplyEffect(AbilityObject abilityObject)
Definition:
CharacterAbilityAlienHoarder.cs:19
Barotrauma.Abilities.CharacterAbilityAlienHoarder.CharacterAbilityAlienHoarder
CharacterAbilityAlienHoarder(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityAlienHoarder.cs:12
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbility
Definition:
CharacterAbility.cs:7
Barotrauma.Abilities.CharacterAbility.LogAbilityObjectMismatch
void LogAbilityObjectMismatch()
Definition:
CharacterAbility.cs:90
Barotrauma.AbilityAttackData
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:6067
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.Character.Inventory
CharacterInventory Inventory
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:648
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeFloat
float GetAttributeFloat(string key, float def)
Barotrauma.ContentXElement.GetAttributeStringArray
string?[] GetAttributeStringArray(string key, string[]? def, bool convertToLowerInvariant=false)
Barotrauma.Inventory.AllItems
virtual IEnumerable< Item > AllItems
All items contained in the inventory. Stacked items are returned as individual instances....
Definition:
BarotraumaShared/SharedSource/Items/Inventory.cs:253
Barotrauma.Item
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:26
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
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CustomAbilities
CharacterAbilityAlienHoarder.cs
Generated by
1.9.1