TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ CalculateHitInfo()

HitInfo Terraria.NPC.CalculateHitInfo ( int damage,
int hitDirection,
bool crit = false,
float knockBack = 0f,
DamageClass damageType = null,
bool damageVariation = false,
float luck = 0f )
inline

Runs M:Terraria.ModLoader.NPCLoader.ModifyIncomingHit(Terraria.NPC,Terraria.NPC.HitModifiers@) hooks and and does the full damage calculations.
The result P:Terraria.NPC.HitInfo.Damage will contain the health the NPC will lose when applied.

Parameters
damageThe damage to deal to the NPC, before modifications, defense, resistances etc
hitDirectionThe hit direction of the resulting strike (1 or -1)
critDefaults to false
knockBackDefaults to 0
damageTypeDefaults to P:Terraria.ModLoader.DamageClass.Default
damageVariationWhether to apply damage variation. Defaults to false.
luckLuck modifier to produce weight damageVariation towards higher (positive) or lower (negative) values. Defaults to 0
Returns
A T:Terraria.NPC.HitInfo for use with M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean) and M:Terraria.NetMessage.SendStrikeNPC(Terraria.NPC,Terraria.NPC.HitInfo@,System.Int32)

Definition at line 91759 of file NPC.cs.

91760 {
91762 }
int damage
The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done...
Definition NPC.cs:1027
HitModifiers GetIncomingStrikeModifiers(DamageClass damageType, int hitDirection, bool ignoreArmorDebuffs=false)
Initializes a T:Terraria.NPC.HitModifiers calculation with the properties of this NPC,...
Definition NPC.cs:91711
HitInfo ToHitInfo(float baseDamage, bool crit, float baseKnockback, bool damageVariation=false, float luck=0f)
Definition NPC.cs:319