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

◆ GetIncomingStrikeModifiers()

HitModifiers Terraria.NPC.GetIncomingStrikeModifiers ( DamageClass damageType,
int hitDirection,
bool ignoreArmorDebuffs = false )
inline

Initializes a T:Terraria.NPC.HitModifiers calculation with the properties of this NPC, including calling M:Terraria.ModLoader.NPCLoader.ModifyIncomingHit(Terraria.NPC,Terraria.NPC.HitModifiers@)

Parameters
damageTypeThe DamageType of the hit.
hitDirectionThe direction to apply knockback. If 0, no knockback will be applied.
ignoreArmorDebuffsIgnores F:Terraria.NPC.ichor and F:Terraria.NPC.betsysCurse. Only used for legacy vanilla codepaths.
Returns

Definition at line 91711 of file NPC.cs.

91712 {
91713 HitModifiers hitModifiers = new HitModifiers();
91714 hitModifiers.DamageType = damageType;
91715 hitModifiers.HitDirection = hitDirection;
91716 hitModifiers.SuperArmor = SuperArmor;
91717 HitModifiers modifiers = hitModifiers;
91718 modifiers.FinalDamage *= takenDamageMultiplier;
91719 if (defense >= 0)
91720 {
91721 modifiers.Defense.Base += defense;
91722 }
91723 else
91724 {
91725 modifiers.FlatBonusDamage += (float)(-defense);
91726 }
91727 if (!ignoreArmorDebuffs)
91728 {
91729 if (ichor)
91730 {
91731 modifiers.Defense.Flat -= 15f;
91732 }
91733 if (betsysCurse)
91734 {
91735 modifiers.Defense.Flat -= 40f;
91736 }
91737 }
91738 if (onFire2)
91739 {
91740 modifiers.Knockback += 0.1f;
91741 }
91742 modifiers.Knockback *= knockBackResist;
91744 return modifiers;
91745 }
static void ModifyIncomingHit(NPC npc, ref NPC.HitModifiers modifiers)
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26
int defense
How resistant to damage this NPC is. The List of NPCs wiki pagecan be useful for finding appropriat...
Definition NPC.cs:1033
bool onFire2
Definition NPC.cs:666
bool ichor
Definition NPC.cs:662
float takenDamageMultiplier
Definition NPC.cs:538
float knockBackResist
How much of the knockback it receives will actually apply. 1f: full knockback; 0f: no knockback....
Definition NPC.cs:1110
bool betsysCurse
Definition NPC.cs:720
bool SuperArmor
Helper property for defense >= 9999. Extremely high defense is interpreted as 'super armor' where att...
Definition NPC.cs:1590

References Terraria.ModLoader.NPCLoader.ModifyIncomingHit().

Referenced by Terraria.Player.ApplyDamageToNPC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: