Barotrauma Client Doc
Barotrauma.Attack Class Reference

Attacks are used to deal damage to characters, structures and items. They can be defined in the weapon components of the items or the limb definitions of the characters. The limb attacks can also be used by the player, when they control a monster or have some appendage, like a husk stinger. More...

Inheritance diagram for Barotrauma.Attack:
Barotrauma.ISerializableEntity

Public Member Functions

void SetUser (Character user)
 
List< AfflictionGetMultipliedAfflictions (float multiplier)
 
float GetStructureDamage (float deltaTime)
 
float GetLevelWallDamage (float deltaTime)
 
float GetItemDamage (float deltaTime, float multiplier=1)
 
float GetTotalDamage (bool includeStructureDamage=false)
 
 Attack (float damage, float bleedingDamage, float burnDamage, float structureDamage, float itemDamage, float range=0.0f)
 
 Attack (ContentXElement element, string parentDebugName, Item sourceItem)
 
 Attack (ContentXElement element, string parentDebugName)
 
void ReloadAfflictions (ContentXElement element, string parentDebugName)
 
void Serialize (ContentXElement element)
 
void Deserialize (ContentXElement element, string parentDebugName)
 
AttackResult DoDamage (Character attacker, IDamageable target, Vector2 worldPosition, float deltaTime, bool playSound=true, PhysicsBody sourceBody=null, Limb sourceLimb=null)
 
AttackResult DoDamageToLimb (Character attacker, Limb targetLimb, Vector2 worldPosition, float deltaTime, bool playSound=true, PhysicsBody sourceBody=null, Limb sourceLimb=null)
 
void UpdateCoolDown (float deltaTime)
 
void UpdateAttackTimer (float deltaTime, Character character)
 
void ResetAttackTimer ()
 
void SetCoolDown (bool applyRandom)
 
void ResetCoolDown ()
 
bool IsValidContext (AttackContext context)
 
bool IsValidContext (IEnumerable< AttackContext > contexts)
 
bool IsValidTarget (AttackTarget targetType)
 
bool IsValidTarget (Entity target)
 
Vector2 CalculateAttackPhase (TransitionMode easing=TransitionMode.Linear)
 

Public Attributes

readonly List< int > ForceOnLimbIndices = new List<int>()
 
readonly Dictionary< Affliction, XElement > Afflictions = new Dictionary<Affliction, XElement>()
 

Properties

AttackContext Context [get]
 
AttackTarget TargetType [get]
 
LimbType TargetLimbType [get]
 
HitDetection HitDetectionType [get]
 
AIBehaviorAfterAttack AfterAttack [get, set]
 
float AfterAttackDelay [get, set]
 
bool Reverse [get]
 
bool SnapRopeOnNewAttack [get]
 
bool Retreat [get]
 
float Range [get, set]
 
float DamageRange [get, set]
 
float MinRange [get]
 
float Duration [get]
 
float CoolDown = 5 [get, set]
 
float SecondaryCoolDown = 0 [get, set]
 
float CoolDownRandomFactor = 0 [get]
 
bool FullSpeedAfterAttack [get]
 
float StructureDamage [get, set]
 
bool EmitStructureDamageParticles [get]
 
float ItemDamage [get, set]
 
float Penetration [get]
 
float DamageMultiplier = 1 [get, set]
 Used for multiplying all the damage. More...
 
float RangeMultiplier = 1 [get, set]
 Used for multiplying all the ranges. More...
 
float ImpactMultiplier = 1 [get, set]
 Used for multiplying the physics forces. More...
 
float LevelWallDamage [get, set]
 
bool Ranged [get, set]
 
bool AvoidFriendlyFire [get, set]
 
float RequiredAngle [get, set]
 
float RequiredAngleToShoot [get, set]
 
float AimRotationTorque [get, set]
 
int RotationLimbIndex [get, set]
 
float SwayAmount [get, set]
 
float SwayFrequency [get, set]
 
float Stun [get, set]
 
bool OnlyHumans [get, set]
 
string ApplyForceOnLimbs [get, set]
 
float Force [get]
 
Vector2 RootForceWorldStart [get]
 
Vector2 RootForceWorldMiddle [get]
 
Vector2 RootForceWorldEnd [get]
 
TransitionMode RootTransitionEasing [get]
 
float Torque [get]
 
bool ApplyForcesOnlyOnce [get]
 
float TargetImpulse [get]
 
Vector2 TargetImpulseWorld [get]
 
float TargetForce [get]
 
Vector2 TargetForceWorld [get]
 
float SubmarineImpactMultiplier [get]
 
float SeverLimbsProbability [get, set]
 
float StickChance [get]
 
float Priority [get]
 
bool Blink [get]
 
IEnumerable< StatusEffectStatusEffects [get]
 
string Name [get]
 
Dictionary< Identifier, SerializablePropertySerializableProperties = new Dictionary<Identifier, SerializableProperty>() [get]
 
List< PropertyConditionalConditionals = new List<PropertyConditional>() [get]
 Only affects ai decision making. All the conditionals has to be met in order to select the attack. TODO: allow to define conditionals using any (implemented in StatusEffect -> move from there to PropertyConditional?) More...
 
Item SourceItem [get, set]
 
float AttackTimer [get]
 
float CoolDownTimer [get, set]
 
float CurrentRandomCoolDown [get]
 
float SecondaryCoolDownTimer [get, set]
 
bool IsRunning [get]
 
string StructureSoundType [get]
 
- Properties inherited from Barotrauma.ISerializableEntity
string Name [get]
 
Dictionary< Identifier, SerializablePropertySerializableProperties [get]
 

Detailed Description

Attacks are used to deal damage to characters, structures and items. They can be defined in the weapon components of the items or the limb definitions of the characters. The limb attacks can also be used by the player, when they control a monster or have some appendage, like a husk stinger.

Definition at line 87 of file BarotraumaShared/SharedSource/Characters/Attack.cs.

Constructor & Destructor Documentation

◆ Attack() [1/3]

Barotrauma.Attack.Attack ( float  damage,
float  bleedingDamage,
float  burnDamage,
float  structureDamage,
float  itemDamage,
float  range = 0.0f 
)

◆ Attack() [2/3]

Barotrauma.Attack.Attack ( ContentXElement  element,
string  parentDebugName,
Item  sourceItem 
)

◆ Attack() [3/3]

Barotrauma.Attack.Attack ( ContentXElement  element,
string  parentDebugName 
)

Member Function Documentation

◆ CalculateAttackPhase()

Vector2 Barotrauma.Attack.CalculateAttackPhase ( TransitionMode  easing = TransitionMode.Linear)

◆ Deserialize()

void Barotrauma.Attack.Deserialize ( ContentXElement  element,
string  parentDebugName 
)

◆ DoDamage()

AttackResult Barotrauma.Attack.DoDamage ( Character  attacker,
IDamageable  target,
Vector2  worldPosition,
float  deltaTime,
bool  playSound = true,
PhysicsBody  sourceBody = null,
Limb  sourceLimb = null 
)

◆ DoDamageToLimb()

AttackResult Barotrauma.Attack.DoDamageToLimb ( Character  attacker,
Limb  targetLimb,
Vector2  worldPosition,
float  deltaTime,
bool  playSound = true,
PhysicsBody  sourceBody = null,
Limb  sourceLimb = null 
)

◆ GetItemDamage()

float Barotrauma.Attack.GetItemDamage ( float  deltaTime,
float  multiplier = 1 
)

◆ GetLevelWallDamage()

float Barotrauma.Attack.GetLevelWallDamage ( float  deltaTime)

◆ GetMultipliedAfflictions()

List<Affliction> Barotrauma.Attack.GetMultipliedAfflictions ( float  multiplier)

◆ GetStructureDamage()

float Barotrauma.Attack.GetStructureDamage ( float  deltaTime)

◆ GetTotalDamage()

float Barotrauma.Attack.GetTotalDamage ( bool  includeStructureDamage = false)

◆ IsValidContext() [1/2]

bool Barotrauma.Attack.IsValidContext ( AttackContext  context)

◆ IsValidContext() [2/2]

bool Barotrauma.Attack.IsValidContext ( IEnumerable< AttackContext contexts)

◆ IsValidTarget() [1/2]

bool Barotrauma.Attack.IsValidTarget ( AttackTarget  targetType)

◆ IsValidTarget() [2/2]

bool Barotrauma.Attack.IsValidTarget ( Entity  target)

◆ ReloadAfflictions()

void Barotrauma.Attack.ReloadAfflictions ( ContentXElement  element,
string  parentDebugName 
)

◆ ResetAttackTimer()

void Barotrauma.Attack.ResetAttackTimer ( )

◆ ResetCoolDown()

void Barotrauma.Attack.ResetCoolDown ( )

◆ Serialize()

void Barotrauma.Attack.Serialize ( ContentXElement  element)

◆ SetCoolDown()

void Barotrauma.Attack.SetCoolDown ( bool  applyRandom)

◆ SetUser()

void Barotrauma.Attack.SetUser ( Character  user)

◆ UpdateAttackTimer()

void Barotrauma.Attack.UpdateAttackTimer ( float  deltaTime,
Character  character 
)

◆ UpdateCoolDown()

void Barotrauma.Attack.UpdateCoolDown ( float  deltaTime)

Member Data Documentation

◆ Afflictions

readonly Dictionary<Affliction, XElement> Barotrauma.Attack.Afflictions = new Dictionary<Affliction, XElement>()

◆ ForceOnLimbIndices

readonly List<int> Barotrauma.Attack.ForceOnLimbIndices = new List<int>()

Property Documentation

◆ AfterAttack

AIBehaviorAfterAttack Barotrauma.Attack.AfterAttack
getset

◆ AfterAttackDelay

float Barotrauma.Attack.AfterAttackDelay
getset

◆ AimRotationTorque

float Barotrauma.Attack.AimRotationTorque
getset

◆ ApplyForceOnLimbs

string Barotrauma.Attack.ApplyForceOnLimbs
getset

◆ ApplyForcesOnlyOnce

bool Barotrauma.Attack.ApplyForcesOnlyOnce
get

◆ AttackTimer

float Barotrauma.Attack.AttackTimer
get

◆ AvoidFriendlyFire

bool Barotrauma.Attack.AvoidFriendlyFire
getset

◆ Blink

bool Barotrauma.Attack.Blink
get

◆ Conditionals

List<PropertyConditional> Barotrauma.Attack.Conditionals = new List<PropertyConditional>()
get

Only affects ai decision making. All the conditionals has to be met in order to select the attack. TODO: allow to define conditionals using any (implemented in StatusEffect -> move from there to PropertyConditional?)

Definition at line 313 of file BarotraumaShared/SharedSource/Characters/Attack.cs.

◆ Context

AttackContext Barotrauma.Attack.Context
get

◆ CoolDown

float Barotrauma.Attack.CoolDown = 5
getset

◆ CoolDownRandomFactor

float Barotrauma.Attack.CoolDownRandomFactor = 0
get

◆ CoolDownTimer

float Barotrauma.Attack.CoolDownTimer
getset

◆ CurrentRandomCoolDown

float Barotrauma.Attack.CurrentRandomCoolDown
get

◆ DamageMultiplier

float Barotrauma.Attack.DamageMultiplier = 1
getset

Used for multiplying all the damage.

Definition at line 175 of file BarotraumaShared/SharedSource/Characters/Attack.cs.

◆ DamageRange

float Barotrauma.Attack.DamageRange
getset

◆ Duration

float Barotrauma.Attack.Duration
get

◆ EmitStructureDamageParticles

bool Barotrauma.Attack.EmitStructureDamageParticles
get

◆ Force

float Barotrauma.Attack.Force
get

◆ FullSpeedAfterAttack

bool Barotrauma.Attack.FullSpeedAfterAttack
get

◆ HitDetectionType

HitDetection Barotrauma.Attack.HitDetectionType
get

◆ ImpactMultiplier

float Barotrauma.Attack.ImpactMultiplier = 1
getset

Used for multiplying the physics forces.

Definition at line 185 of file BarotraumaShared/SharedSource/Characters/Attack.cs.

◆ IsRunning

bool Barotrauma.Attack.IsRunning
get

◆ ItemDamage

float Barotrauma.Attack.ItemDamage
getset

◆ LevelWallDamage

float Barotrauma.Attack.LevelWallDamage
getset

◆ MinRange

float Barotrauma.Attack.MinRange
get

◆ Name

string Barotrauma.Attack.Name
get

◆ OnlyHumans

bool Barotrauma.Attack.OnlyHumans
getset

◆ Penetration

float Barotrauma.Attack.Penetration
get

◆ Priority

float Barotrauma.Attack.Priority
get

◆ Range

float Barotrauma.Attack.Range
getset

◆ Ranged

bool Barotrauma.Attack.Ranged
getset

◆ RangeMultiplier

float Barotrauma.Attack.RangeMultiplier = 1
getset

Used for multiplying all the ranges.

Definition at line 180 of file BarotraumaShared/SharedSource/Characters/Attack.cs.

◆ RequiredAngle

float Barotrauma.Attack.RequiredAngle
getset

◆ RequiredAngleToShoot

float Barotrauma.Attack.RequiredAngleToShoot
getset

◆ Retreat

bool Barotrauma.Attack.Retreat
get

◆ Reverse

bool Barotrauma.Attack.Reverse
get

◆ RootForceWorldEnd

Vector2 Barotrauma.Attack.RootForceWorldEnd
get

◆ RootForceWorldMiddle

Vector2 Barotrauma.Attack.RootForceWorldMiddle
get

◆ RootForceWorldStart

Vector2 Barotrauma.Attack.RootForceWorldStart
get

◆ RootTransitionEasing

TransitionMode Barotrauma.Attack.RootTransitionEasing
get

◆ RotationLimbIndex

int Barotrauma.Attack.RotationLimbIndex
getset

◆ SecondaryCoolDown

float Barotrauma.Attack.SecondaryCoolDown = 0
getset

◆ SecondaryCoolDownTimer

float Barotrauma.Attack.SecondaryCoolDownTimer
getset

◆ SerializableProperties

Dictionary<Identifier, SerializableProperty> Barotrauma.Attack.SerializableProperties = new Dictionary<Identifier, SerializableProperty>()
get

◆ SeverLimbsProbability

float Barotrauma.Attack.SeverLimbsProbability
getset

◆ SnapRopeOnNewAttack

bool Barotrauma.Attack.SnapRopeOnNewAttack
get

◆ SourceItem

Item Barotrauma.Attack.SourceItem
getset

◆ StatusEffects

IEnumerable<StatusEffect> Barotrauma.Attack.StatusEffects
get

◆ StickChance

float Barotrauma.Attack.StickChance
get

◆ StructureDamage

float Barotrauma.Attack.StructureDamage
getset

◆ StructureSoundType

string Barotrauma.Attack.StructureSoundType
get

◆ Stun

float Barotrauma.Attack.Stun
getset

◆ SubmarineImpactMultiplier

float Barotrauma.Attack.SubmarineImpactMultiplier
get

◆ SwayAmount

float Barotrauma.Attack.SwayAmount
getset

◆ SwayFrequency

float Barotrauma.Attack.SwayFrequency
getset

◆ TargetForce

float Barotrauma.Attack.TargetForce
get

◆ TargetForceWorld

Vector2 Barotrauma.Attack.TargetForceWorld
get

◆ TargetImpulse

float Barotrauma.Attack.TargetImpulse
get

◆ TargetImpulseWorld

Vector2 Barotrauma.Attack.TargetImpulseWorld
get

◆ TargetLimbType

LimbType Barotrauma.Attack.TargetLimbType
get

◆ TargetType

AttackTarget Barotrauma.Attack.TargetType
get

◆ Torque

float Barotrauma.Attack.Torque
get