Client LuaCsForBarotrauma
CharacterAbilityGiveResistance.cs
1
namespace
Barotrauma.Abilities
2
{
3
class
CharacterAbilityGiveResistance
:
CharacterAbility
4
{
5
private
readonly Identifier resistanceId;
6
private
readonly
float
multiplier;
7
8
public
CharacterAbilityGiveResistance
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
9
{
10
resistanceId = abilityElement.
GetAttributeIdentifier
(
"resistanceid"
, abilityElement.
GetAttributeIdentifier
(
"resistance"
, Identifier.Empty));
11
multiplier = abilityElement.
GetAttributeFloat
(
"multiplier"
, 1f);
12
13
if
(resistanceId.IsEmpty)
14
{
15
DebugConsole.ThrowError(
"Error in CharacterAbilityGiveResistance - resistance identifier not set."
,
16
contentPackage: abilityElement.
ContentPackage
);
17
}
18
19
// NOTE: The resistance value is a multiplier here, so 1.0 == 0% resistance
20
if
(MathUtils.NearlyEqual(multiplier, 1))
21
{
22
DebugConsole.AddWarning($
"Possible error in talent {CharacterTalent.DebugIdentifier} - multiplier set to 1, which will do nothing."
,
23
contentPackage: abilityElement.
ContentPackage
);
24
}
25
}
26
27
public
override
void
InitializeAbility
(
bool
addingFirstTime)
28
{
29
TalentResistanceIdentifier
identifier =
new
(resistanceId,
CharacterTalent
.
Prefab
.
Identifier
);
30
Character
.
ChangeAbilityResistance
(identifier, multiplier);
31
}
32
}
33
}
Barotrauma.Abilities.CharacterAbilityGiveResistance
Definition:
CharacterAbilityGiveResistance.cs:4
Barotrauma.Abilities.CharacterAbilityGiveResistance.CharacterAbilityGiveResistance
CharacterAbilityGiveResistance(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityGiveResistance.cs:8
Barotrauma.Abilities.CharacterAbilityGiveResistance.InitializeAbility
override void InitializeAbility(bool addingFirstTime)
Definition:
CharacterAbilityGiveResistance.cs:27
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbility
Definition:
CharacterAbility.cs:7
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.Character.ChangeAbilityResistance
void ChangeAbilityResistance(TalentResistanceIdentifier identifier, float value)
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:5966
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.CharacterTalent.Prefab
readonly TalentPrefab Prefab
Definition:
CharacterTalent.cs:12
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeFloat
float GetAttributeFloat(string key, float def)
Barotrauma.ContentXElement.ContentPackage
ContentPackage? ContentPackage
Definition:
ContentXElement.cs:14
Barotrauma.ContentXElement.GetAttributeIdentifier
Identifier GetAttributeIdentifier(string key, string def)
Barotrauma.Prefab.Identifier
readonly Identifier Identifier
Definition:
Prefab.cs:34
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma.TalentResistanceIdentifier
readonly record struct TalentResistanceIdentifier(Identifier ResistanceIdentifier, Identifier TalentIdentifier)
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CharacterAbilityGiveResistance.cs
Generated by
1.9.1