public static void HitEffectHook(On.Terraria.NPC.orig_VanillaHitEffect orig, NPC self, int hitDirection, double dmg) { NewXXXState = "NPC"; NewXXXSource = self.whoAmI; orig.Invoke(self, hitDirection, dmg); NewXXXState = ""; NewXXXSource = -1; }
private void NPC_VanillaHitEffect(On.Terraria.NPC.orig_VanillaHitEffect orig, NPC self, int hitDirection, double dmg) { if (!TimeStopped || TimeStopStockOwner(self)) { orig.Invoke(self, hitDirection, dmg); } else { TBARGlobalNPC.Get(self).AccumulatedDamage += (int)dmg; self.life += (int)dmg; } }
public static void HitEffectHook2(On.Terraria.NPC.orig_VanillaHitEffect orig, NPC self, int direction, double dmg) { orig.Invoke(self, direction, dmg); if (self.HasBuff(ModContent.BuffType <RIPBuff>())) { if (self.life <= 0 && self.lifeMax > 10) { foreach (Gore gore in Main.gore) { if (gore.active && self.Hitbox.Contains(new Point((int)gore.position.X, (int)gore.position.Y))) { gore.active = false; } } for (int i = 0; i < 20; i++) { Vector2 GorePos = new Vector2(self.position.X + Main.rand.Next(self.width), self.position.Y + Main.rand.Next(self.height)); Gore.NewGore(GorePos, Vector2.Zero, Instance.GetGoreSlot("Gores/ButterflyGore"), 0.5f); } } } }