From 4c01abaeb5e865166e79f08c28f27caeaec1dc85 Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 15 Nov 2024 22:41:44 -0800 Subject: [PATCH] Frigidflash Balancing --- Items/Weapons/Magic/FrigidflashBolt.cs | 6 +- ...Mods.CalamityMod.Items.Weapons.Magic.hjson | 12 +- .../Mods.CalamityMod.Projectiles.Magic.hjson | 2 +- Projectiles/Magic/FireImplosion.cs | 61 +++++---- .../Magic/FrigidflashBoltProjectile.cs | 117 ++++++++++-------- Projectiles/Magic/FrostBoltProjectile.cs | 5 +- 6 files changed, 118 insertions(+), 85 deletions(-) diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index eb762683c3..5320497da6 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 38; Item.height = 42; - Item.damage = 80; + Item.damage = 72; Item.DamageType = DamageClass.Magic; Item.mana = 13; Item.useTime = 20; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic public override float UseSpeedMultiplier(Player player) { if (player.altFunctionUse == 2) - return 0.28f; + return 0.25f; return 1f; } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) // Right Click { - Projectile bigMagic = Projectile.NewProjectileDirect(source, position, velocity, type, (int)(damage * 4.5f), knockback, player.whoAmI, 0, 5); + Projectile bigMagic = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 5); bigMagic.extraUpdates = 4; bigMagic.timeLeft = 370; bigMagic.penetrate = -1; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index c6508c4b38..5496cf5080 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -359,12 +359,12 @@ ForbiddenSun: { FrigidflashBolt: { DisplayName: Frigidflash Bolt Tooltip: - ''' - Casts a fast ball of flash-freezing magma that bounces off tiles - When hitting a tile, a flarefrost burst is produced - Press to cast a stronger version that upon expiration creates a collapsing vortex of frost and flame - the vortex will explode after fully collapsing - ''' + ''' + Casts a fast ball of flash-freezing magma that bounces off tiles + When hitting a tile, a flarefrost burst is produced + Press to cast a stronger version that upon expiration creates a collapsing vortex of frost and flame + the vortex will explode after fully collapsing + ''' } FrostBolt: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 57c8c3d178..9a70b43f75 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -70,6 +70,7 @@ ExoVortex2.DisplayName: Subsuming Vortex FabBolt.DisplayName: Fab Bolt FabRay.DisplayName: Fab Ray FatesRevealFlame.DisplayName: Fate's Reveal +FireImplosion.DisplayName: Flame Vortex FlareBoltProjectile.DisplayName: Flare Bolt ForbiddenAxeBlade.DisplayName: Ruin Blade ForbiddenSunburst.DisplayName: Sunburst @@ -263,4 +264,3 @@ WyvernProjectile.DisplayName: Wyvern YharimsCrystalBeam.DisplayName: Yharim's Beam YharimsCrystalPrism.DisplayName: Yermes Christal VehemenceBolt.DisplayName: Vehemence Bolt -FireImplosion.DisplayName: Fire Implosion diff --git a/Projectiles/Magic/FireImplosion.cs b/Projectiles/Magic/FireImplosion.cs index 3003d404c2..e8200abfb0 100644 --- a/Projectiles/Magic/FireImplosion.cs +++ b/Projectiles/Magic/FireImplosion.cs @@ -13,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class FireImplosion : ModProjectile, ILocalizedModType + public class FireImplosion : ModProjectile, ILocalizedModType // Used by both Flare bolt and Frigidflash Bolt { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic } public override void AI() { - if (customKnockback == 0) + if (customKnockback == 0) // On spawn effects { Projectile.scale = 0; Projectile.alpha = 0; @@ -65,12 +65,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.scale = 0.95f * Utils.GetLerpValue(42, 0, time, true) * Utils.GetLerpValue(40, 25, time, true); time++; } - else + else // When the vortex is expanding out before it starts shrinking { Projectile.scale = 0.95f * Utils.GetLerpValue(0, 15, boomTime, true); boomTime++; } - if (Projectile.timeLeft <= 20) + if (Projectile.timeLeft <= 20) // Fizzles out at the end { if ((frigidFlash && Projectile.timeLeft % 3 == 0) || !frigidFlash) { @@ -97,7 +97,30 @@ namespace CalamityMod.Projectiles.Magic } Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3() * 2 * Projectile.scale); Projectile.rotation += 0.4f; - if (frigidFlash && Projectile.timeLeft == 1) + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (frigidFlash) + { + target.AddBuff(BuffID.OnFire3, 30); + target.AddBuff(BuffID.Frostburn2, 30); + } + else + target.AddBuff(BuffID.OnFire, 180); + pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; + float minMult = 0.4f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (frigidFlash ? 0.5f : 1); // Frigidflash explosion are spawned at full power, so their damage is reduced here + + if (target.CanBeMoved(false)) // The vortex sucks in enemies + { + target.velocity = (-pushVelocity); + } + } + public override void OnKill(int timeLeft) + { + if (frigidFlash) { SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash") with { Volume = 1, Pitch = -0.2f }, Projectile.Center); SoundEngine.PlaySound(SoundID.DeerclopsIceAttack with { Volume = 0.85f, Pitch = 0.1f }, Projectile.Center); @@ -105,9 +128,15 @@ namespace CalamityMod.Projectiles.Magic // Create Blast float blastSize = 160; float minMultiplier = 0.25f; - int hitsToMinMult = 6; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.timeLeft = 15; + int hitsToMinMult = 8; + int debuff1 = BuffID.Frostburn2; + int debuff2 = BuffID.OnFire3; + int debuffTime = 230; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 4f), customKnockback * 2, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + //blast.localAI[3] = debuffTime; blast.DamageType = DamageClass.Magic; // BIGGER "Snowflake" visual effect @@ -139,22 +168,6 @@ namespace CalamityMod.Projectiles.Magic } } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.AddBuff((frigidFlash ? BuffID.OnFire3 : BuffID.OnFire), 180); - if (frigidFlash) - target.AddBuff(BuffID.Frostburn2, 180); - pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback; - float minMult = 0.4f; - int hitsToMinMult = 15; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; - - if (target.CanBeMoved(false)) - { - target.velocity = (-pushVelocity); - } - } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { return CalamityUtils.CircularHitboxCollision(Projectile.Center, (110 * Projectile.scale) + 15, targetHitbox); diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index e9d1c018ed..d0ca0946ab 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -34,12 +34,14 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; } public override void AI() { Player Owner = Main.player[Projectile.owner]; - Lighting.AddLight(Projectile.Center, iceColor.ToVector3()); + Color lightColor = Color.Lerp(fireColor, iceColor, Utils.GetLerpValue(300, 0, Projectile.timeLeft, true)); + Lighting.AddLight(Projectile.Center, lightColor.ToVector3()); Vector2 mouse = Owner.Calamity().mouseWorld; fadeIn = launch ? Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true) : 1; Vector2 velocity = Utils.DirectionTo(Owner.Center, mouse) * Owner.HeldItem.shootSpeed; @@ -68,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic if (launch) // On launch, spawns some effects and launch the projectile at the mouse { Projectile.tileCollide = true; - Vector2 staticSpeed = Utils.DirectionTo(Owner.Center, mouse) * Utils.Distance(Owner.Center, mouse) * 0.007f; + Vector2 staticSpeed = Utils.DirectionTo(Owner.Center, mouse) * Utils.Distance(Owner.Center, mouse) * 0.01f; Projectile.velocity = (bigMagic ? staticSpeed : velocity); SoundEngine.PlaySound(FrigidflashBolt.UseSound with { Volume = 1f, Pitch = (bigMagic ? -0.15f : 0.15f) }, Projectile.Center); @@ -111,7 +113,7 @@ namespace CalamityMod.Projectiles.Magic } if (bigMagic) { - if (Projectile.timeLeft < 120) + if (Projectile.timeLeft < 145) { Projectile.velocity *= 0.98f; } @@ -143,6 +145,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); return false; } + // Allow bounced bolts to hit enemies already hit before the bounce for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; @@ -157,24 +160,80 @@ namespace CalamityMod.Projectiles.Magic } SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); + smallMagicExplosion(); + + if (wallBounces >= 2) + { + Projectile.Kill(); + } + wallBounces++; + + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(BuffID.OnFire3, 60); + target.AddBuff(BuffID.Frostburn2, 60); + + float minMult = 0.2f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnKill(int timeLeft) + { + if (bigMagic) // Collapsing explosion for the big attack + { + // This explosion gets full damage because it spawns another itself, it actually only deals a portion of the projectile damage + Projectile bigBlast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner, 0, 0, 5); + bigBlast.ArmorPenetration = 20; // Hits rapidly enough that it needs some + float rot = Main.rand.NextFloat(-2, 2); + for (int i = 0; i < 6; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot - MathHelper.ToRadians(90)) * 8f; + Particle trail = new VelChangingSpark(Projectile.Center + velocity * 20, -velocity * 0.2f, -velocity * 5f, "CalamityMod/Particles/IceTypeParticle", 55, 1.8f, Color.Lerp(iceColor, Color.White, 0.5f), new Vector2(1.1f, 1f), true, false, shrinkSpeed: 0.15f, lerpRate: 0.01f); + GeneralParticleHandler.SpawnParticle(trail); + } + for (int n = 0; n < 15; n++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 15); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 14, ModContent.DustType(), -vel); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.7f); + dust.color = iceColor; + dust.noLightEmittence = true; + } + } + else + { + if (wallBounces < 2) + { + smallMagicExplosion(); + } + SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); + } + } + public void smallMagicExplosion() + { // Create Blast float blastSize = 80; float minMultiplier = 0.25f; int hitsToMinMult = 4; int debuff1 = BuffID.Frostburn2; int debuff2 = BuffID.OnFire3; - int debuffTime = 120; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + int debuffTime = 90; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.localAI[0] = debuff1; blast.localAI[2] = debuff2; - blast.localAI[1] = blast.localAI[3] = debuffTime; + blast.localAI[1] = debuffTime; + //blast.localAI[3] = debuffTime; blast.timeLeft = 15; blast.DamageType = DamageClass.Magic; SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center); SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.5f, Pitch = -0.3f, MaxInstances = -1 }, Projectile.Center); - // "Snowflake" visual effect + // "Snowflake" visual effect, but now with fire too float rot = Main.rand.NextFloat(-2, 2); for (int i = 0; i < 6; i++) { @@ -201,48 +260,6 @@ namespace CalamityMod.Projectiles.Magic dust.noLightEmittence = true; } - if (wallBounces >= 2) - { - Projectile.Kill(); - } - wallBounces++; - - return false; - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.AddBuff(BuffID.OnFire3, 90); - target.AddBuff(BuffID.Frostburn2, 90); - - float minMult = 0.1f; - int hitsToMinMult = 5; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; - } - public override void OnKill(int timeLeft) - { - if (bigMagic) // Collapsing explosion for the big attack - { - Projectile bigBlast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner, 0, 0, 5); - float rot = Main.rand.NextFloat(-2, 2); - for (int i = 0; i < 6; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 6f).ToRotationVector2().RotatedBy(rot - MathHelper.ToRadians(90)) * 8f; - Particle trail = new VelChangingSpark(Projectile.Center + velocity * 20, -velocity * 0.2f, -velocity * 5f, "CalamityMod/Particles/IceTypeParticle", 55, 1.8f, Color.Lerp(iceColor, Color.White, 0.5f), new Vector2(1.1f, 1f), true, false, shrinkSpeed: 0.15f, lerpRate: 0.01f); - GeneralParticleHandler.SpawnParticle(trail); - } - for (int n = 0; n < 15; n++) - { - Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 15); - Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 14, ModContent.DustType(), -vel); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(1.2f, 1.7f); - dust.color = iceColor; - dust.noLightEmittence = true; - } - } - else - SoundEngine.PlaySound(FrigidflashBolt.ProjDeathSound, Projectile.Center); } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index c6b77601f0..dae2d9f8c1 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic { Player Owner = Main.player[Projectile.owner]; Lighting.AddLight(Projectile.Center, bColor.ToVector3()); - fadeIn = Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f, time, true); + fadeIn = Utils.GetLerpValue(0, Owner.itemAnimationMax * 0.5f * Projectile.MaxUpdates, time, true); Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * Owner.HeldItem.shootSpeed; Projectile.scale = fadeIn; if (fadeIn < 1) // Hold the projectile in front of the player while they case the spell @@ -143,6 +143,9 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn, 60); + // Since this reduces the damage of the projectile directly, the damage of its explosions is also decreased + // This is intedned for Frost Bolt, but is not kept for the upgrades + // Feel free to change this to use the same pierce reduction as its upgrades if this doesn't work out if (Projectile.damage > 1) Projectile.damage = (int)(Projectile.damage * 0.85f); }