Client LuaCsForBarotrauma
CharacterAbilityModifyStatToFlooding.cs
1
namespace
Barotrauma.Abilities
2
{
3
class
CharacterAbilityModifyStatToFlooding
:
CharacterAbility
4
{
5
private
readonly
StatTypes
statType;
6
private
readonly
float
maxValue;
7
private
float
lastValue = 0f;
8
public
override
bool
AllowClientSimulation
=>
true
;
9
10
public
CharacterAbilityModifyStatToFlooding
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
11
{
12
statType =
CharacterAbilityGroup
.
ParseStatType
(abilityElement.
GetAttributeString
(
"stattype"
,
""
),
CharacterTalent
.
DebugIdentifier
);
13
maxValue = abilityElement.
GetAttributeFloat
(
"maxvalue"
, 0f);
14
}
15
16
protected
override
void
VerifyState
(
bool
conditionsMatched,
float
timeSinceLastUpdate)
17
{
18
Character
.
ChangeStat
(statType, -lastValue);
19
20
if
(conditionsMatched &&
Character
.
IsInFriendlySub
)
21
{
22
float
waterVolume = 0.0f, totalVolume = 0.0f;
23
foreach
(
Hull
hull
in
Hull
.
HullList
)
24
{
25
if
(hull.
Submarine
!=
Character
.
Submarine
) {
continue
; }
26
waterVolume += hull.
WaterVolume
;
27
totalVolume += hull.
Volume
;
28
}
29
lastValue = (totalVolume == 0.0f ? 1.0f : waterVolume / totalVolume) * maxValue;
30
Character
.
ChangeStat
(statType, lastValue);
31
}
32
else
33
{
34
lastValue = 0f;
35
}
36
}
37
}
38
}
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.CharacterAbilityModifyStatToFlooding
Definition:
CharacterAbilityModifyStatToFlooding.cs:4
Barotrauma.Abilities.CharacterAbilityModifyStatToFlooding.VerifyState
override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
Definition:
CharacterAbilityModifyStatToFlooding.cs:16
Barotrauma.Abilities.CharacterAbilityModifyStatToFlooding.CharacterAbilityModifyStatToFlooding
CharacterAbilityModifyStatToFlooding(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityModifyStatToFlooding.cs:10
Barotrauma.Abilities.CharacterAbilityModifyStatToFlooding.AllowClientSimulation
override bool AllowClientSimulation
Definition:
CharacterAbilityModifyStatToFlooding.cs:8
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.Character.IsInFriendlySub
bool IsInFriendlySub
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:1266
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.Entity.Submarine
Submarine Submarine
Definition:
Entity.cs:53
Barotrauma.Hull
Definition:
BarotraumaShared/SharedSource/Map/Hull.cs:115
Barotrauma.Hull.HullList
static readonly List< Hull > HullList
Definition:
BarotraumaShared/SharedSource/Map/Hull.cs:116
Barotrauma.Hull.Volume
float Volume
Definition:
BarotraumaShared/SharedSource/Map/Hull.cs:373
Barotrauma.Hull.WaterVolume
float WaterVolume
Definition:
BarotraumaShared/SharedSource/Map/Hull.cs:300
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
CharacterAbilityModifyStatToFlooding.cs
Generated by
1.9.1