public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (!ClickerSystem.IsClickerProj(projectile)) { return; } Player player = Main.player[projectile.owner]; hitDirection = target.Center.X < player.Center.X ? -1 : 1; //Cannot use item/projectile.ArmorPenetration here because it's technically "infinite", and also conditional if (target.type != NPCID.DungeonGuardian && target.defense < 999) { int defenseIgnore = target.defense / 2; if (defenseIgnore <= 0) { defenseIgnore = 0; } damage += defenseIgnore; } }
public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (!ClickerSystem.IsClickerProj(projectile)) { return; } Player player = Main.player[projectile.owner]; Item heldItem = player.HeldItem; // Prevent crash when held item is nonexistant if (heldItem.IsAir) { return; } // Vanilla crit chance calculations. Crit chance of the currently held weapon matters, regardless of the damage type of the weapon. int critChance = heldItem.crit; ItemLoader.GetWeaponCrit(heldItem, player, ref critChance); PlayerHooks.GetWeaponCrit(player, heldItem, ref critChance); if (!crit) { crit = critChance >= 100 || Main.rand.Next(1, 101) <= critChance; } int defenseIgnore = target.defense / 2; if (defenseIgnore <= 0) { defenseIgnore = 0; } damage += defenseIgnore; hitDirection = target.Center.X < player.Center.X ? -1 : 1; }