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

◆ SimpleStrikeNPC()

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

Calls M:Terraria.NPC.CalculateHitInfo(System.Int32,System.Int32,System.Boolean,System.Single,Terraria.ModLoader.DamageClass,System.Boolean,System.Single), M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean) and then M:Terraria.NetMessage.SendStrikeNPC(Terraria.NPC,Terraria.NPC.HitInfo@,System.Int32) (in multiplayer)

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
noPlayerInteractionPrevents M:Terraria.NPC.PlayerInteraction(System.Int32) from being called in single player. In multiplayer, player interaction is handled by the server.
Returns
The actual health lost by the NPC. Normally this is P:Terraria.NPC.HitInfo.Damage but it is capped at the current health of the NPC, and represents the actual damage dealt in the case of F:Terraria.NPC.HitInfo.InstantKill

Definition at line 91776 of file NPC.cs.

91777 {
91778 HitInfo hit = CalculateHitInfo(damage, hitDirection, crit, knockBack, damageType, damageVariation, luck);
91780 if (Main.netMode != 0)
91781 {
91782 NetMessage.SendStrikeNPC(this, in hit);
91783 }
91784 return result;
91785 }
int damage
The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done...
Definition NPC.cs:1027
int StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit=false, bool fromNet=false, bool noPlayerInteraction=false)
Definition NPC.cs:91679
HitInfo CalculateHitInfo(int damage, int hitDirection, bool crit=false, float knockBack=0f, DamageClass damageType=null, bool damageVariation=false, float luck=0f)
Runs M:Terraria.ModLoader.NPCLoader.ModifyIncomingHit(Terraria.NPC,Terraria.NPC.HitModifiers@) hooks ...
Definition NPC.cs:91759

References Terraria.Main.netMode, and Terraria.NetMessage.SendStrikeNPC().

+ Here is the call graph for this function: