Client LuaCsForBarotrauma
CharacterAbilityModifyStatToLevel.cs
1
using
Microsoft.Xna.Framework;
2
3
namespace
Barotrauma.Abilities
4
{
5
class
CharacterAbilityModifyStatToLevel
:
CharacterAbility
6
{
7
private
readonly
StatTypes
statType;
8
private
readonly
float
statPerLevel;
9
private
readonly
int
maxLevel;
10
private
float
lastValue = 0f;
11
public
override
bool
AllowClientSimulation
=>
true
;
12
13
public
CharacterAbilityModifyStatToLevel
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
14
{
15
statType =
CharacterAbilityGroup
.
ParseStatType
(abilityElement.
GetAttributeString
(
"stattype"
,
""
),
CharacterTalent
.
DebugIdentifier
);
16
statPerLevel = abilityElement.
GetAttributeFloat
(
"statperlevel"
, 0f);
17
maxLevel = abilityElement.
GetAttributeInt
(
"maxlevel"
,
int
.MaxValue);
18
}
19
20
protected
override
void
VerifyState
(
bool
conditionsMatched,
float
timeSinceLastUpdate)
21
{
22
Character
.
ChangeStat
(statType, -lastValue);
23
if
(conditionsMatched)
24
{
25
int
level = MathHelper.Min(
Character
?.Info.GetCurrentLevel() ?? 0, maxLevel);
26
lastValue = statPerLevel * level;
27
Character
.
ChangeStat
(statType, lastValue);
28
}
29
else
30
{
31
lastValue = 0f;
32
}
33
}
34
}
35
}
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.CharacterAbilityModifyStatToLevel
Definition:
CharacterAbilityModifyStatToLevel.cs:6
Barotrauma.Abilities.CharacterAbilityModifyStatToLevel.CharacterAbilityModifyStatToLevel
CharacterAbilityModifyStatToLevel(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityModifyStatToLevel.cs:13
Barotrauma.Abilities.CharacterAbilityModifyStatToLevel.VerifyState
override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
Definition:
CharacterAbilityModifyStatToLevel.cs:20
Barotrauma.Abilities.CharacterAbilityModifyStatToLevel.AllowClientSimulation
override bool AllowClientSimulation
Definition:
CharacterAbilityModifyStatToLevel.cs:11
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.ContentXElement.GetAttributeInt
int GetAttributeInt(string key, int 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
CharacterAbilityModifyStatToLevel.cs
Generated by
1.9.1