Client LuaCsForBarotrauma
CharacterAbilityModifyValue.cs
1
namespace
Barotrauma.Abilities
2
{
3
class
CharacterAbilityModifyValue
:
CharacterAbility
4
{
5
private
readonly
float
addedValue;
6
private
readonly
float
multiplyValue;
7
8
public
override
bool
AllowClientSimulation
=>
true
;
9
10
public
CharacterAbilityModifyValue
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
11
{
12
addedValue = abilityElement.
GetAttributeFloat
(
"addedvalue"
, 0f);
13
multiplyValue = abilityElement.
GetAttributeFloat
(
"multiplyvalue"
, 1f);
14
if
(MathUtils.NearlyEqual(addedValue, 0.0f) && MathUtils.NearlyEqual(multiplyValue, 1.0f))
15
{
16
DebugConsole.ThrowError($
"Error in talent {CharacterTalent.DebugIdentifier}, {nameof(CharacterAbilityModifyValue)} - added value is 0 and multiplier is 1, the ability will do nothing."
,
17
contentPackage: abilityElement.
ContentPackage
);
18
}
19
}
20
21
protected
override
void
ApplyEffect
(
AbilityObject
abilityObject)
22
{
23
if
(abilityObject is
IAbilityValue
abilityValue)
24
{
25
abilityValue.Value += addedValue;
26
abilityValue.Value *= multiplyValue;
27
}
28
}
29
}
30
}
Barotrauma.Abilities.AbilityObject
Definition:
AbilityObjects.cs:6
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbility
Definition:
CharacterAbility.cs:7
Barotrauma.Abilities.CharacterAbilityModifyValue
Definition:
CharacterAbilityModifyValue.cs:4
Barotrauma.Abilities.CharacterAbilityModifyValue.ApplyEffect
override void ApplyEffect(AbilityObject abilityObject)
Definition:
CharacterAbilityModifyValue.cs:21
Barotrauma.Abilities.CharacterAbilityModifyValue.CharacterAbilityModifyValue
CharacterAbilityModifyValue(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityModifyValue.cs:10
Barotrauma.Abilities.CharacterAbilityModifyValue.AllowClientSimulation
override bool AllowClientSimulation
Definition:
CharacterAbilityModifyValue.cs:8
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.Abilities.IAbilityValue
Definition:
AbilityInterfaces.cs:14
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CharacterAbilityModifyValue.cs
Generated by
1.9.1