Barotrauma Server
Loading...
Searching...
No Matches
Barotrauma.CharacterHealth Class Reference

Classes

class  LimbHealth
 

Public Member Functions

 CharacterHealth (Character character)
 
 CharacterHealth (ContentXElement element, Character character, ContentXElement limbHealthElement=null)
 
IReadOnlyCollection< AfflictionGetAllAfflictions ()
 
IEnumerable< AfflictionGetAllAfflictions (Func< Affliction, bool > limbHealthFilter)
 
Affliction GetAffliction (string identifier, bool allowLimbAfflictions=true)
 
Affliction GetAffliction (Identifier identifier, bool allowLimbAfflictions=true)
 
Affliction GetAfflictionOfType (Identifier afflictionType, bool allowLimbAfflictions=true)
 
GetAffliction< T > (Identifier identifier, bool allowLimbAfflictions=true)
 
Affliction GetAffliction (Identifier identifier, Limb limb)
 
Limb GetAfflictionLimb (Affliction affliction)
 
float GetAfflictionStrength (Identifier afflictionType, Limb limb, bool requireLimbSpecific)
 Get the total strength of the afflictions of a specific type attached to a specific limb.
 
float GetAfflictionStrengthByType (Identifier afflictionType, bool allowLimbAfflictions=true)
 
float GetAfflictionStrengthByIdentifier (Identifier afflictionIdentifier, bool allowLimbAfflictions=true)
 
float GetAfflictionStrength (Identifier afflictionType, Identifier afflictionidentifier, bool allowLimbAfflictions=true)
 
void ApplyAffliction (Limb targetLimb, Affliction affliction, bool allowStacking=true, bool ignoreUnkillability=false)
 
float GetResistance (AfflictionPrefab afflictionPrefab)
 
float GetStatValue (StatTypes statType)
 
bool HasFlag (AbilityFlags flagType)
 
void ReduceAllAfflictionsOnAllLimbs (float amount, ActionType? treatmentAction=null)
 
void ReduceAfflictionOnAllLimbs (Identifier afflictionIdOrType, float amount, ActionType? treatmentAction=null, Character attacker=null)
 
void ReduceAllAfflictionsOnLimb (Limb targetLimb, float amount, ActionType? treatmentAction=null)
 
void ReduceAfflictionOnLimb (Limb targetLimb, Identifier afflictionIdOrType, float amount, ActionType? treatmentAction=null, Character attacker=null)
 
void ApplyDamage (Limb hitLimb, AttackResult attackResult, bool allowStacking=true)
 
void SetAllDamage (float damageAmount, float bleedingDamageAmount, float burnDamageAmount)
 
float GetLimbDamage (Limb limb, Identifier afflictionType)
 
void RemoveAllAfflictions ()
 
void RemoveNegativeAfflictions ()
 
void Update (float deltaTime)
 
void ForceUpdateVisuals ()
 
void SetVitality (float newVitality)
 
void CalculateVitality ()
 
void ApplyAfflictionStatusEffects (ActionType type)
 
CauseOfDeathType Affliction affliction GetCauseOfDeath ()
 
void GetSuitableTreatments (Dictionary< Identifier, float > treatmentSuitability, Character user, Limb limb=null, bool ignoreHiddenAfflictions=false, float predictFutureDuration=0.0f)
 Get the identifiers of the items that can be used to treat the character. Takes into account all the afflictions the character has, and negative treatment suitabilities (e.g. a medicine that causes oxygen loss may not be suitable if the character is already suffocating)
 
float GetTotalAdjustedAfflictionStrength (Affliction affliction, float otherAfflictionMultiplier=0.3f, bool includeSameAffliction=true)
 Returns the total strength of instances of the same affliction on all the characters limbs, with a smaller weight given to the other afflictions on other limbs.
 
IEnumerable< Identifier > GetActiveAfflictionTags ()
 
float GetPredictedStrength (Affliction affliction, float predictFutureDuration, Limb limb=null)
 
void ServerWrite (IWriteMessage msg)
 
void Remove ()
 
void Save (XElement healthElement)
 
void Load (XElement element, Func< AfflictionPrefab, bool > afflictionPredicate=null)
 

Static Public Member Functions

static IEnumerable< AfflictionSortAfflictionsBySeverity (IEnumerable< Affliction > afflictions, bool excludeBuffs=true)
 Automatically filters out buffs.
 

Public Attributes

bool Unkillable
 
readonly Character Character
 
CauseOfDeathType type
 

Static Public Attributes

const float InsufficientOxygenThreshold = 30.0f
 
const float LowOxygenThreshold = 50.0f
 
static readonly Color DefaultFaceTint = Color.TransparentBlack
 

Protected Attributes

float minVitality
 

Properties

float UnmodifiedMaxVitality [get, set]
 Maximum vitality without talent- or job-based modifiers.
 
bool DoesBleed [get]
 
bool UseHealthWindow [get, set]
 
float CrushDepth [get]
 
Affliction BloodlossAffliction [get]
 
bool IsUnconscious [get]
 
float PressureKillDelay = 5.0f [get]
 
float Vitality [get]
 
float VitalityDisregardingDeath [get]
 How much vitality the character would have if it was alive? E.g. a character killed by disconnection or with console commands may not have any vitality-reducing afflictions despite being dead.
 
float HealthPercentage [get]
 
float MaxVitality [get]
 
float MinVitality [get]
 
Color FaceTint [get]
 
Color BodyTint [get]
 
float OxygenAmount [get, set]
 
float BloodlossAmount [get, set]
 
float Stun [get, set]
 
bool IsParalyzed [get]
 
float StunTimer [get]
 
bool WasInFullHealth [get]
 Was the character in full health at the beginning of the frame?
 
Affliction PressureAffliction [get]
 
float OxygenLowResistance [get]
 0-1.
 

Constructor & Destructor Documentation

◆ CharacterHealth() [1/2]

Barotrauma.CharacterHealth.CharacterHealth ( Character character)

◆ CharacterHealth() [2/2]

Barotrauma.CharacterHealth.CharacterHealth ( ContentXElement element,
Character character,
ContentXElement limbHealthElement = null )

Member Function Documentation

◆ ApplyAffliction()

void Barotrauma.CharacterHealth.ApplyAffliction ( Limb targetLimb,
Affliction affliction,
bool allowStacking = true,
bool ignoreUnkillability = false )

◆ ApplyAfflictionStatusEffects()

void Barotrauma.CharacterHealth.ApplyAfflictionStatusEffects ( ActionType type)

◆ ApplyDamage()

void Barotrauma.CharacterHealth.ApplyDamage ( Limb hitLimb,
AttackResult attackResult,
bool allowStacking = true )

◆ CalculateVitality()

void Barotrauma.CharacterHealth.CalculateVitality ( )

◆ ForceUpdateVisuals()

void Barotrauma.CharacterHealth.ForceUpdateVisuals ( )

◆ GetActiveAfflictionTags()

IEnumerable< Identifier > Barotrauma.CharacterHealth.GetActiveAfflictionTags ( )

◆ GetAffliction() [1/3]

Affliction Barotrauma.CharacterHealth.GetAffliction ( Identifier identifier,
bool allowLimbAfflictions = true )

◆ GetAffliction() [2/3]

Affliction Barotrauma.CharacterHealth.GetAffliction ( Identifier identifier,
Limb limb )

◆ GetAffliction() [3/3]

Affliction Barotrauma.CharacterHealth.GetAffliction ( string identifier,
bool allowLimbAfflictions = true )

◆ GetAffliction< T >()

T Barotrauma.CharacterHealth.GetAffliction< T > ( Identifier identifier,
bool allowLimbAfflictions = true )
Type Constraints
T :Affliction 

◆ GetAfflictionLimb()

Limb Barotrauma.CharacterHealth.GetAfflictionLimb ( Affliction affliction)

◆ GetAfflictionOfType()

Affliction Barotrauma.CharacterHealth.GetAfflictionOfType ( Identifier afflictionType,
bool allowLimbAfflictions = true )

◆ GetAfflictionStrength() [1/2]

float Barotrauma.CharacterHealth.GetAfflictionStrength ( Identifier afflictionType,
Identifier afflictionidentifier,
bool allowLimbAfflictions = true )

◆ GetAfflictionStrength() [2/2]

float Barotrauma.CharacterHealth.GetAfflictionStrength ( Identifier afflictionType,
Limb limb,
bool requireLimbSpecific )

Get the total strength of the afflictions of a specific type attached to a specific limb.

Parameters
afflictionTypeType of the affliction
limbThe limb the affliction is attached to
requireLimbSpecificDoes the affliction have to be attached to only the specific limb. Most monsters for example don't have separate healths for different limbs, essentially meaning that every affliction is applied to every limb.

◆ GetAfflictionStrengthByIdentifier()

float Barotrauma.CharacterHealth.GetAfflictionStrengthByIdentifier ( Identifier afflictionIdentifier,
bool allowLimbAfflictions = true )

◆ GetAfflictionStrengthByType()

float Barotrauma.CharacterHealth.GetAfflictionStrengthByType ( Identifier afflictionType,
bool allowLimbAfflictions = true )

◆ GetAllAfflictions() [1/2]

IReadOnlyCollection< Affliction > Barotrauma.CharacterHealth.GetAllAfflictions ( )

◆ GetAllAfflictions() [2/2]

IEnumerable< Affliction > Barotrauma.CharacterHealth.GetAllAfflictions ( Func< Affliction, bool > limbHealthFilter)

◆ GetCauseOfDeath()

CauseOfDeathType Affliction affliction Barotrauma.CharacterHealth.GetCauseOfDeath ( )

◆ GetLimbDamage()

float Barotrauma.CharacterHealth.GetLimbDamage ( Limb limb,
Identifier afflictionType )

◆ GetPredictedStrength()

float Barotrauma.CharacterHealth.GetPredictedStrength ( Affliction affliction,
float predictFutureDuration,
Limb limb = null )

◆ GetResistance()

float Barotrauma.CharacterHealth.GetResistance ( AfflictionPrefab afflictionPrefab)

◆ GetStatValue()

float Barotrauma.CharacterHealth.GetStatValue ( StatTypes statType)

◆ GetSuitableTreatments()

void Barotrauma.CharacterHealth.GetSuitableTreatments ( Dictionary< Identifier, float > treatmentSuitability,
Character user,
Limb limb = null,
bool ignoreHiddenAfflictions = false,
float predictFutureDuration = 0::0f )

Get the identifiers of the items that can be used to treat the character. Takes into account all the afflictions the character has, and negative treatment suitabilities (e.g. a medicine that causes oxygen loss may not be suitable if the character is already suffocating)

Parameters
treatmentSuitabilityA dictionary where the key is the identifier of the item and the value the suitability
predictFutureDurationIf above 0, the method will take into account how much currently active status effects while affect the afflictions in the next x seconds.


◆ GetTotalAdjustedAfflictionStrength()

float Barotrauma.CharacterHealth.GetTotalAdjustedAfflictionStrength ( Affliction affliction,
float otherAfflictionMultiplier = 0::3f,
bool includeSameAffliction = true )

Returns the total strength of instances of the same affliction on all the characters limbs, with a smaller weight given to the other afflictions on other limbs.

Parameters
otherAfflictionMultiplierMultiplier on the strengths of the afflictions on other limbs.
includeSameAfflictionShould the strength of the provided affliction be included too?

◆ HasFlag()

bool Barotrauma.CharacterHealth.HasFlag ( AbilityFlags flagType)

◆ Load()

void Barotrauma.CharacterHealth.Load ( XElement element,
Func< AfflictionPrefab, bool > afflictionPredicate = null )

◆ ReduceAfflictionOnAllLimbs()

void Barotrauma.CharacterHealth.ReduceAfflictionOnAllLimbs ( Identifier afflictionIdOrType,
float amount,
ActionType? treatmentAction = null,
Character attacker = null )

◆ ReduceAfflictionOnLimb()

void Barotrauma.CharacterHealth.ReduceAfflictionOnLimb ( Limb targetLimb,
Identifier afflictionIdOrType,
float amount,
ActionType? treatmentAction = null,
Character attacker = null )

◆ ReduceAllAfflictionsOnAllLimbs()

void Barotrauma.CharacterHealth.ReduceAllAfflictionsOnAllLimbs ( float amount,
ActionType? treatmentAction = null )

◆ ReduceAllAfflictionsOnLimb()

void Barotrauma.CharacterHealth.ReduceAllAfflictionsOnLimb ( Limb targetLimb,
float amount,
ActionType? treatmentAction = null )

◆ Remove()

void Barotrauma.CharacterHealth.Remove ( )

◆ RemoveAllAfflictions()

void Barotrauma.CharacterHealth.RemoveAllAfflictions ( )

◆ RemoveNegativeAfflictions()

void Barotrauma.CharacterHealth.RemoveNegativeAfflictions ( )

◆ Save()

void Barotrauma.CharacterHealth.Save ( XElement healthElement)

◆ ServerWrite()

void Barotrauma.CharacterHealth.ServerWrite ( IWriteMessage msg)

◆ SetAllDamage()

void Barotrauma.CharacterHealth.SetAllDamage ( float damageAmount,
float bleedingDamageAmount,
float burnDamageAmount )

◆ SetVitality()

void Barotrauma.CharacterHealth.SetVitality ( float newVitality)

◆ SortAfflictionsBySeverity()

static IEnumerable< Affliction > Barotrauma.CharacterHealth.SortAfflictionsBySeverity ( IEnumerable< Affliction > afflictions,
bool excludeBuffs = true )
static

Automatically filters out buffs.

◆ Update()

void Barotrauma.CharacterHealth.Update ( float deltaTime)

Member Data Documentation

◆ Character

readonly Character Barotrauma.CharacterHealth.Character

◆ DefaultFaceTint

readonly Color Barotrauma.CharacterHealth.DefaultFaceTint = Color.TransparentBlack
static

◆ InsufficientOxygenThreshold

const float Barotrauma.CharacterHealth.InsufficientOxygenThreshold = 30.0f
static

◆ LowOxygenThreshold

const float Barotrauma.CharacterHealth.LowOxygenThreshold = 50.0f
static

◆ minVitality

float Barotrauma.CharacterHealth.minVitality
protected

◆ type

CauseOfDeathType Barotrauma.CharacterHealth.type

◆ Unkillable

bool Barotrauma.CharacterHealth.Unkillable

Property Documentation

◆ BloodlossAffliction

Affliction Barotrauma.CharacterHealth.BloodlossAffliction
get

◆ BloodlossAmount

float Barotrauma.CharacterHealth.BloodlossAmount
getset

◆ BodyTint

Color Barotrauma.CharacterHealth.BodyTint
get

◆ CrushDepth

float Barotrauma.CharacterHealth.CrushDepth
get

◆ DoesBleed

bool Barotrauma.CharacterHealth.DoesBleed
get

◆ FaceTint

Color Barotrauma.CharacterHealth.FaceTint
get

◆ HealthPercentage

float Barotrauma.CharacterHealth.HealthPercentage
get

◆ IsParalyzed

bool Barotrauma.CharacterHealth.IsParalyzed
get

◆ IsUnconscious

bool Barotrauma.CharacterHealth.IsUnconscious
get

◆ MaxVitality

float Barotrauma.CharacterHealth.MaxVitality
get

◆ MinVitality

float Barotrauma.CharacterHealth.MinVitality
get

◆ OxygenAmount

float Barotrauma.CharacterHealth.OxygenAmount
getset

◆ OxygenLowResistance

float Barotrauma.CharacterHealth.OxygenLowResistance
get

0-1.

◆ PressureAffliction

Affliction Barotrauma.CharacterHealth.PressureAffliction
get

◆ PressureKillDelay

float Barotrauma.CharacterHealth.PressureKillDelay = 5.0f
get

◆ Stun

float Barotrauma.CharacterHealth.Stun
getset

◆ StunTimer

float Barotrauma.CharacterHealth.StunTimer
get

◆ UnmodifiedMaxVitality

float Barotrauma.CharacterHealth.UnmodifiedMaxVitality
getsetprotected

Maximum vitality without talent- or job-based modifiers.

◆ UseHealthWindow

bool Barotrauma.CharacterHealth.UseHealthWindow
getset

◆ Vitality

float Barotrauma.CharacterHealth.Vitality
get

◆ VitalityDisregardingDeath

float Barotrauma.CharacterHealth.VitalityDisregardingDeath
get

How much vitality the character would have if it was alive? E.g. a character killed by disconnection or with console commands may not have any vitality-reducing afflictions despite being dead.

◆ WasInFullHealth

bool Barotrauma.CharacterHealth.WasInFullHealth
get

Was the character in full health at the beginning of the frame?


The documentation for this class was generated from the following file: