From 7a416ff2fe0f409b8cd569adaaf871bb17787424 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:18:49 +0700 Subject: [PATCH] Tainted and Hellbound fixes hopefully - Changed Hellbound's check to minions to allow multi-part minions like Entropy's Vigil to all be explodable - Damage scaling should now work properly on both enchants --- ILEditing/MechanicILChanges.cs | 14 +++++++++++--- Projectiles/CalamityGlobalProjectile.cs | 5 ++++- Projectiles/Melee/TaintedBladeSlasher.cs | 1 + UI/CalamitasEnchantments/EnchantmentManager.cs | 18 +++++++++++------- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 3802c9688b..cd01b18c88 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -553,15 +553,23 @@ namespace CalamityMod.ILEditing if (Main.gameMenu || !player.active) return proj; - // Do not apply Hellbound effects to minions not spawned by the item itself, if it came out of an item - // This prevent minions like Luxor's Gift getting it, but minions spawned out of minions such as Temporal Umbrella will work fine - if (spawnSource is EntitySource_ItemUse && player.ActiveItem().shoot != projectile.type) + // Do not apply Hellbound effects to minions not spawned by weapons + // This prevent minions like Luxor's Gift getting it + if (spawnSource is EntitySource_ItemUse trueSource && trueSource.Item is Item weapon && weapon.damage <= 0) return proj; CalamityPlayer.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); if (player.Calamity().explosiveMinionsEnchant) projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime; } + // Minion shots inherit the "explode countdown" from the parent minion + // This is only to inherit the damage scaling of the minion and does NOT mean the shot will explode too + else if (ProjectileID.Sets.MinionShot[projectile.type]) + { + // Going down the chain + if (spawnSource is EntitySource_Parent trueSource && trueSource.Entity is Projectile parent) + projectile.Calamity().ExplosiveEnchantCountdown = parent.Calamity().ExplosiveEnchantCountdown; + } return proj; } #endregion diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 7015c1a515..06d923374f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -302,7 +302,6 @@ namespace CalamityMod.Projectiles if (projectile.minion && ExplosiveEnchantCountdown > 0) { ExplosiveEnchantCountdown--; - projectile.damage = (int)(projectile.originalDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime)); // Make fizzle sounds and fire dust to indicate the impending explosion. if (ExplosiveEnchantCountdown <= 300) @@ -4307,6 +4306,10 @@ namespace CalamityMod.Projectiles if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); + // This can apply to minions or minion shots + if (ExplosiveEnchantCountdown > 0) + modifiers.SourceDamage *= MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime); + if (modPlayer.farProximityRewardEnchant) { float proximityDamageInterpolant = Utils.GetLerpValue(250f, 2400f, target.Distance(player.Center), true); diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index eadf582a05..c17cd585cf 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -120,6 +120,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 90000; Projectile.usesLocalNPCImmunity = true; Projectile.noEnchantmentVisuals = true; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 86de4cc8d0..391c334539 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -235,14 +235,18 @@ namespace CalamityMod.UI.CalamitasEnchants // Yes, this is a LOT of damage but given the limited range of this thing it needs to be extremely powerful when it does actually hit. var source = player.GetSource_ItemUse(player.ActiveItem()); float taintedRatio = 5f; - int damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem().damage * taintedRatio); - int blade = Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, player.ActiveItem().type); - if (Main.projectile.IndexInRange(blade)) - Main.projectile[blade].localAI[0] = 0f; + int damage = (int)(player.ActiveItem().damage * taintedRatio); + Projectile blade = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, player.ActiveItem().type); + blade.localAI[0] = 0f; + blade.originalDamage = damage; + blade.OriginalArmorPenetration = player.ActiveItem().ArmorPenetration; + blade.OriginalCritChance = player.ActiveItem().crit; - blade = Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, player.ActiveItem().type); - if (Main.projectile.IndexInRange(blade)) - Main.projectile[blade].localAI[0] = -80f; + blade = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, player.ActiveItem().type); + blade.localAI[0] = -80f; + blade.originalDamage = damage; + blade.OriginalArmorPenetration = player.ActiveItem().ArmorPenetration; + blade.OriginalCritChance = player.ActiveItem().crit; } }, item => item.IsEnchantable() && item.damage > 0 && item.CountsAsClass() && !item.noUseGraphic && item.shoot > ProjectileID.None),