Client LuaCsForBarotrauma
CharacterAbilityPsychoClown.cs
1
namespace
Barotrauma.Abilities
2
{
3
class
CharacterAbilityPsychoClown
:
CharacterAbility
4
{
5
private
readonly
StatTypes
statType;
6
private
readonly
float
maxValue;
7
private
readonly
string
afflictionIdentifier;
8
private
float
lastValue = 0f;
9
public
override
bool
AllowClientSimulation
=>
true
;
10
11
public
CharacterAbilityPsychoClown
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
12
{
13
statType =
CharacterAbilityGroup
.
ParseStatType
(abilityElement.
GetAttributeString
(
"stattype"
,
""
),
CharacterTalent
.
DebugIdentifier
);
14
maxValue = abilityElement.
GetAttributeFloat
(
"maxvalue"
, 0f);
15
afflictionIdentifier = abilityElement.
GetAttributeString
(
"afflictionidentifier"
,
""
);
16
}
17
18
protected
override
void
VerifyState
(
bool
conditionsMatched,
float
timeSinceLastUpdate)
19
{
20
// managing state this way seems liable to cause bugs, maybe instead create abstraction to reset these values more safely
21
// talents cannot be removed while in active play because of the lack of this, for example
22
Character
.
ChangeStat
(statType, -lastValue);
23
24
if
(conditionsMatched)
25
{
26
var affliction =
Character
.
CharacterHealth
.
GetAffliction
(afflictionIdentifier);
27
28
float
afflictionStrength = 0f;
29
if
(affliction !=
null
)
30
{
31
afflictionStrength = affliction.
Strength
/ affliction.Prefab.MaxStrength;
32
}
33
34
lastValue = afflictionStrength * maxValue;
35
Character
.
ChangeStat
(statType, lastValue);
36
}
37
else
38
{
39
lastValue = 0f;
40
}
41
}
42
}
43
}
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.CharacterAbilityPsychoClown
Definition:
CharacterAbilityPsychoClown.cs:4
Barotrauma.Abilities.CharacterAbilityPsychoClown.CharacterAbilityPsychoClown
CharacterAbilityPsychoClown(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityPsychoClown.cs:11
Barotrauma.Abilities.CharacterAbilityPsychoClown.VerifyState
override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
Definition:
CharacterAbilityPsychoClown.cs:18
Barotrauma.Abilities.CharacterAbilityPsychoClown.AllowClientSimulation
override bool AllowClientSimulation
Definition:
CharacterAbilityPsychoClown.cs:9
Barotrauma.Affliction.Strength
virtual float Strength
Definition:
Affliction.cs:31
Barotrauma.CharacterHealth.GetAffliction
Affliction GetAffliction(string identifier, bool allowLimbAfflictions=true)
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.Character.CharacterHealth
CharacterHealth CharacterHealth
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:962
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
CustomAbilities
CharacterAbilityPsychoClown.cs
Generated by
1.9.1