Client LuaCsForBarotrauma
CharacterAbilityModifyStat.cs
1
namespace
Barotrauma.Abilities
2
{
3
class
CharacterAbilityModifyStat
:
CharacterAbility
4
{
5
private
readonly
StatTypes
statType;
6
private
readonly
float
value;
7
bool
lastState;
8
public
override
bool
AllowClientSimulation
=>
true
;
9
10
public
CharacterAbilityModifyStat
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
11
{
12
statType =
CharacterAbilityGroup
.
ParseStatType
(abilityElement.
GetAttributeString
(
"stattype"
,
""
),
CharacterTalent
.
DebugIdentifier
);
13
value = abilityElement.
GetAttributeFloat
(
"value"
, 0f);
14
}
15
16
public
override
void
InitializeAbility
(
bool
addingFirstTime)
17
{
18
VerifyState
(conditionsMatched:
true
, timeSinceLastUpdate: 0.0f);
19
}
20
21
protected
override
void
VerifyState
(
bool
conditionsMatched,
float
timeSinceLastUpdate)
22
{
23
if
(conditionsMatched != lastState)
24
{
25
Character
.
ChangeStat
(statType, conditionsMatched ? value : -value);
26
lastState = conditionsMatched;
27
}
28
}
29
}
30
}
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbilityGroup.ParseStatType
static StatTypes ParseStatType(string statTypeString, string debugIdentifier)
Definition:
CharacterAbilityGroup.cs:238
Barotrauma.Abilities.CharacterAbility
Definition:
CharacterAbility.cs:7
Barotrauma.Abilities.CharacterAbilityModifyStat
Definition:
CharacterAbilityModifyStat.cs:4
Barotrauma.Abilities.CharacterAbilityModifyStat.InitializeAbility
override void InitializeAbility(bool addingFirstTime)
Definition:
CharacterAbilityModifyStat.cs:16
Barotrauma.Abilities.CharacterAbilityModifyStat.AllowClientSimulation
override bool AllowClientSimulation
Definition:
CharacterAbilityModifyStat.cs:8
Barotrauma.Abilities.CharacterAbilityModifyStat.CharacterAbilityModifyStat
CharacterAbilityModifyStat(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityModifyStat.cs:10
Barotrauma.Abilities.CharacterAbilityModifyStat.VerifyState
override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
Definition:
CharacterAbilityModifyStat.cs:21
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.Character.ChangeStat
void ChangeStat(StatTypes statType, float value)
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:5878
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.CharacterTalent.DebugIdentifier
string DebugIdentifier
Definition:
CharacterTalent.cs:10
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeString
string? GetAttributeString(string key, string? def)
Barotrauma.ContentXElement.GetAttributeFloat
float GetAttributeFloat(string key, float def)
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma.StatTypes
StatTypes
StatTypes are used to alter several traits of a character. They are mostly used by talents.
Definition:
Enums.cs:195
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CharacterAbilityModifyStat.cs
Generated by
1.9.1