TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
Terraria.NPC.HitInfo Struct Reference

Represents a finalized damage calculation for damage about to be applied to an NPC. This is the result of the all modifications done previously in a T:Terraria.NPC.HitModifiers. More...

+ Collaboration diagram for Terraria.NPC.HitInfo:

Public Member Functions

 HitInfo ()
 

Public Attributes

DamageClass DamageType
 The DamageType of the hit.
 
bool Crit
 Whether or not the hit is a crit.
 
int HitDirection
 The direction to apply knockback in.
 
float Knockback
 The amount of knockback to apply. Should always be >= 0.
Note that M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean) has a staggered knockback falloff, and that critical strikes automatically get extra 40% knockback in excess of this value.
 
bool InstantKill
 If true, as much damage as necessary will be dealt, and damage number popups will not be shown for this hit.
Has no effect if the NPC is F:Terraria.NPC.immortal
 
bool HideCombatText
 If true, damage number popups will not be shown for this hit.
 

Properties

int SourceDamage [get, set]
 The amount of damage 'dealt' to the NPC, before incoming damage multipliers, armor, critical strikes etc.
Use this to trigger effects which scale based on damage dealt, and also deal damage.
Cannot be set to less than 1.

Using this instead of P:Terraria.NPC.HitInfo.Damage can prevent diminishing returns from NPC defense, double crits, or excessively strong effects if the NPC has a vulnerability to the weapon/projectile (like vampires and stakes).
Used by vanilla for dryad ward retaliation, and many sword on-hit projectiles like volcano and beekeeper.
 
int Damage [get, set]
 The amount of damage received by the NPC. How much life the NPC will lose.
Is NOT capped at the NPC's current life.
Will be 1 if F:Terraria.NPC.HitInfo.InstantKill is set.
Cannot be set to less than 1.
 

Private Attributes

int _sourceDamage
 
int _damage
 

Detailed Description

Represents a finalized damage calculation for damage about to be applied to an NPC. This is the result of the all modifications done previously in a T:Terraria.NPC.HitModifiers.

Definition at line 340 of file NPC.cs.


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