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

◆ BeHurtByOtherNPC()

void Terraria.NPC.BeHurtByOtherNPC ( int npcIndex,
NPC thatNPC )
inlineprivate

Definition at line 109535 of file NPC.cs.

109536 {
109537 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
109538 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
109539 int num = 30;
109540 if (type == 548)
109541 {
109542 num = 20;
109543 }
109544 int num3 = 6;
109545 int num4 = ((!(thatNPC.Center.X > base.Center.X)) ? 1 : (-1));
109548 HitInfo strike = modifiers.ToHitInfo(thatNPC.damage, crit: false, num3, damageVariation: true);
109550 if (Main.netMode != 0)
109551 {
109552 NetMessage.SendStrikeNPC(this, in strike);
109553 }
109554 netUpdate = true;
109555 immune[255] = num;
109557 int num2 = strike.SourceDamage;
109558 if (dryadWard)
109559 {
109560 num2 = (int)num5 / 3;
109561 num3 = 6;
109562 num4 *= -1;
109563 thatNPC.StrikeNPCNoInteraction(num2, num3, num4);
109564 if (Main.netMode != 0)
109565 {
109566 NetMessage.SendData(28, -1, -1, null, npcIndex, num2, num3, num4);
109567 }
109568 thatNPC.netUpdate = true;
109569 thatNPC.immune[255] = num;
109570 }
109571 if (NPCID.Sets.HurtingBees[thatNPC.type])
109572 {
109573 num2 = damage;
109574 num3 = 6;
109575 num4 *= -1;
109576 thatNPC.StrikeNPCNoInteraction(num2, num3, num4);
109577 if (Main.netMode != 0)
109578 {
109579 NetMessage.SendData(28, -1, -1, null, npcIndex, num2, num3, num4);
109580 }
109581 thatNPC.netUpdate = true;
109582 thatNPC.immune[255] = num;
109583 }
109584 }
static bool[] HurtingBees
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is a bee that will hurt other non-b...
Definition NPCID.cs:331
static DamageClass Default
Default damage class for non-classed weapons and items, does not benefit from Generic bonuses.
T:Terraria.ModLoader.DamageClass is used to determine the application of item effects,...
static void ModifyHitNPC(NPC npc, NPC target, ref NPC.HitModifiers modifiers)
Definition NPCLoader.cs:953
static void OnHitNPC(NPC npc, NPC target, in NPC.HitInfo hit)
Definition NPCLoader.cs:963
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26
int[] immune
This determines if an NPC can be hit by a item or projectile owned by a particular player (it is an a...
Definition NPC.cs:981
int damage
The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done...
Definition NPC.cs:1027
bool dryadWard
Definition NPC.cs:698
int StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit=false, bool fromNet=false, bool noPlayerInteraction=false)
Definition NPC.cs:91679
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
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
bool netUpdate
Definition NPC.cs:1130

References Terraria.ModLoader.DamageClass.Default, Terraria.ID.NPCID.Sets.HurtingBees, Terraria.ModLoader.NPCLoader.ModifyHitNPC(), Terraria.Main.netMode, Terraria.ModLoader.NPCLoader.OnHitNPC(), Terraria.NetMessage.SendData(), and Terraria.NetMessage.SendStrikeNPC().

+ Here is the call graph for this function: