From bb5d5cb9dac9da0658b332deca913b60d042d9f7 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:19:28 +0700 Subject: [PATCH] npcs dont count --- ILEditing/MechanicILChanges.cs | 4 ++++ NPCs/Abyss/SlabCrab.cs | 6 +++++- Projectiles/CalamityGlobalProjectile.cs | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index be29dc5baa..effedbbe04 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -563,6 +563,10 @@ namespace CalamityMod.ILEditing if (item.type != ModContent.ItemType()) projectile.Calamity().buffedByOldFashioned = false; } + // Projectiles spawned by NPCs do not count + // It will neither be buffed nor debuffed + else if (parentSource.Entity is NPC parentNPC) + projectile.Calamity().buffedByOldFashioned = null; // Projectiles spawned by other projectiles is determined by the state of the parent projectile else if (parentSource.Entity is Projectile parentProj) projectile.Calamity().buffedByOldFashioned = parentProj.Calamity().buffedByOldFashioned; diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index d1d6862d54..3be7c33f83 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -5,6 +5,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Packets; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -405,7 +406,10 @@ namespace CalamityMod.NPCs.Abyss if (player.ItemAnimationActive) { // ouch! - player.ApplyDamageToNPC(NPC, (int)player.GetDamage(DamageClass.MeleeNoSpeed).ApplyTo(player.HeldItem.damage), 0, player.direction); + Item pick = player.HeldItem; + int pickDamage = (int)player.GetDamage(pick.DamageType).ApplyTo(pick.damage); + Projectile hit = Projectile.NewProjectileDirect(pick.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), pickDamage, 0f, player.whoAmI, NPC.whoAmI); + hit.DamageType = pick.DamageType; SoundEngine.PlaySound(SoundID.Dig, NPC.Center); // this is the dig sound that shale piles use if (CurrentPhase < (int)AIState.Enraged) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 624aee4016..62b0005675 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles public bool DealsDefenseDamage = false; // Old Fashioned buff. This is true by default but does not have effect unless the player has the buff consumed. - public bool buffedByOldFashioned = true; + public bool? buffedByOldFashioned = true; // Nihility Quiver public bool nihilicArrow = false; @@ -4186,8 +4186,8 @@ namespace CalamityMod.Projectiles CalamityPlayer modPlayer = player.Calamity(); // Old Fashioned buffs (or debuffs) apply if the player has Old Fashioned - if (modPlayer.oldFashioned) - modifiers.SourceDamage *= buffedByOldFashioned ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; + if (modPlayer.oldFashioned && buffedByOldFashioned.HasValue) + modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) {