From bfe71df651fb0ed6194349c2fe6d9eabd033f673 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 24 Mar 2024 08:00:35 -0500 Subject: [PATCH] 1 - Reduced Giant Shell defense from 10 to 6 because it giving 10 so early is crazy. 2 - Made Exalted Oathblade useable. 3 - Reduced Rev+ Empress of Light post-charge slow down and wait time. 4 - Made Rev+ Golem inferno fireballs and explosions have yellow fire instead of orange so that they can be distinguished from Inferno Fork projectiles. 5 - Removed some leftover code in Darklight Greatsword's projectiles. --- Items/Accessories/GiantShell.cs | 2 +- Items/Weapons/Melee/ExaltedOathblade.cs | 7 +- .../Bosses/EmpressofLightAI.cs | 6 +- NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs | 7 +- Projectiles/CalamityGlobalProjectile.cs | 100 +++++++++++++++++- Projectiles/Melee/DarkBeam.cs | 1 - .../Melee/ForbiddenOathbladeProjectile.cs | 56 ++++++++-- Projectiles/Melee/LightBeam.cs | 1 - 8 files changed, 158 insertions(+), 22 deletions(-) diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 9212793e68..897a547e0c 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 28; - Item.defense = 10; + Item.defense = 6; Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index e89b2d8a86..5f5732f244 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -15,6 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee public class ExaltedOathblade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + internal const float ShootSpeed = 3f; + public override void SetDefaults() { Item.width = 88; @@ -31,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 3f; + Item.shootSpeed = ShootSpeed; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -40,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(source, position, perturbedSpeed, type, damage / 2, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage / 2, knockback, player.whoAmI); } return false; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 9e994d0e04..6124306f68 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -866,6 +866,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float chargeGateValue = 40f; float playChargeSoundTime = 20f; float chargeDuration = phase3 ? 40f : 50f; + float slowDownTime = 30f; + float totalPhaseTime = chargeGateValue + chargeDuration + slowDownTime; float chargeStartDistance = phase3 ? 1000f : 800f; float chargeVelocity = phase3 ? 100f : 70f; float chargeAcceleration = phase3 ? 0.1f : 0.07f; @@ -947,8 +949,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - extraPhaseTime = (dayTimeEnrage ? 48f : 96f) * lessTimeSpentPerPhaseMultiplier; - if (npc.ai[1] >= 150f + extraPhaseTime) + extraPhaseTime = (dayTimeEnrage ? 24f : 48f) * lessTimeSpentPerPhaseMultiplier; + if (npc.ai[1] >= totalPhaseTime + extraPhaseTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index aaeb710781..e8bf57f8e3 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -1217,12 +1217,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int projectileType = (phase3 || masterMode) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; int damage = npc.GetProjectileDamage(projectileType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer); + float ai0 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.X : 0f; + float ai1 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.Y : 0f; + float ai2 = projectileType == ProjectileID.InfernoHostileBolt ? 1f : 0f; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer, ai0, ai1, ai2); if (projectileType == ProjectileID.InfernoHostileBolt) { Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; - Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; Main.projectile[proj].netUpdate = true; } else diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index d17474650f..d21dd73e78 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2589,6 +2589,91 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f) + { + if (projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Item20, projectile.position); + projectile.localAI[0] += 1f; + } + + bool killX = false; + bool killY = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + killX = true; + + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + killX = true; + + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + killY = true; + + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + killY = true; + + if (killX && killY) + projectile.Kill(); + + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].velocity += projectile.velocity * 0.1f; + if (Main.getGoodWorld) + Main.dust[dust].noLight = true; + } + + return false; + } + + else if (projectile.type == ProjectileID.InfernoHostileBlast && projectile.ai[2] > 0f) + { + if (projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Item74, projectile.position); + projectile.localAI[0] += 1f; + } + + projectile.ai[0] += 1f; + + float totalDust = 25f; + if (projectile.ai[0] > 540f) + totalDust -= (projectile.ai[0] - 180f) / 2f; + + if (totalDust <= 0f) + { + totalDust = 0f; + projectile.Kill(); + } + + float maxDustVelocityX = 10f; + float maxDustVelocityY = 10f; + float minDustSpeed = 3f; + float maxDustSpeed = 8f; + + for (int i = 0; i < (int)totalDust; i++) + { + float dustVelocityX = Main.rand.NextFloat(-maxDustVelocityX, maxDustVelocityX); + float dustVelocityY = Main.rand.NextFloat(-maxDustVelocityY, maxDustVelocityY); + float randomDustSpeed = Main.rand.NextFloat(minDustSpeed, maxDustSpeed); + float velocityLength = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + velocityLength = randomDustSpeed / velocityLength; + dustVelocityX *= velocityLength; + dustVelocityY *= velocityLength; + Vector2 dustVelocity = new Vector2(dustVelocityX, dustVelocityY); + Vector2 dustPosition = projectile.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)); + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, 0f, 0f, 100, default, 1.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position = dustPosition; + Main.dust[dust].velocity = dustVelocity; + if (Main.getGoodWorld) + Main.dust[dust].noLight = true; + } + + return false; + } + else if (projectile.type == ProjectileID.AncientDoomProjectile) { if (projectile.velocity.Length() < 8f) @@ -3139,8 +3224,8 @@ namespace CalamityMod.Projectiles // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] > 0f; - // These projectiles will not be buffed if Golem is alive - bool isGolemBossProjectile = NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast); + // These projectiles will not be buffed if Golem fires them + bool isGolemBossProjectile = (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast) && projectile.ai[2] > 0f; if (!isSkeletronBossProjectile && !isGolemBossProjectile) projectile.damage += 30; @@ -4168,6 +4253,7 @@ namespace CalamityMod.Projectiles { bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (Main.masterMode || BossRushEvent.BossRushActive); bool revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death) && projectile.wet; + bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f; if (revQueenBeeBeeHive) { @@ -4296,9 +4382,17 @@ namespace CalamityMod.Projectiles if (Main.netMode != NetmodeID.SinglePlayer) NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); } + + else if (revGolemInferno) + { + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileID.InfernoHostileBlast, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f, projectile.ai[2]); + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); + } } - if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive) + if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive || revGolemInferno) { projectile.active = false; return false; diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 2fbff0e895..892b90beb5 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 36; Projectile.height = 36; - AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 65bd2a9e57..638be16b0c 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,15 @@ namespace CalamityMod.Projectiles.Melee public class ForbiddenOathbladeProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + private const float MaxVelocity = ExaltedOathblade.ShootSpeed * 4f; + + private const int FadeOutTime = 85; + + private const int TimeLeft = 435 + FadeOutTime; + + private const int Alpha = 100; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -18,23 +28,51 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 46; Projectile.height = 46; - Projectile.aiStyle = ProjAIStyleID.Sickle; - Projectile.alpha = 100; + Projectile.alpha = Alpha; + Projectile.timeLeft = TimeLeft; + Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = true; Projectile.penetrate = 3; + Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - AIType = ProjectileID.DemonScythe; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.35f, 0f, 0.35f); + float alphaLightScale = Projectile.alpha / (float)Alpha; + Lighting.AddLight(Projectile.Center, 0.5f * alphaLightScale, 0f, 0.5f * alphaLightScale); - if (Main.rand.NextBool(3)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); + if (Projectile.timeLeft > FadeOutTime) + { + if (Projectile.velocity.Length() < MaxVelocity) + Projectile.velocity *= 1.03f; + } + else + Projectile.velocity *= 0.95f; + + if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = -1; + + Projectile.rotation += Projectile.direction * 0.025f; + if (Projectile.timeLeft > FadeOutTime) + Projectile.rotation += Projectile.direction * 0.25f; + else + Projectile.rotation += Projectile.direction * 0.25f * (Projectile.timeLeft / (float)FadeOutTime); + } + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.timeLeft < FadeOutTime) + { + byte b2 = (byte)(Projectile.timeLeft * 3); + byte a2 = (byte)(Alpha * ((float)b2 / byte.MaxValue)); + Projectile.alpha = a2; + return new Color(b2, b2, b2, Projectile.alpha); + } + Projectile.alpha = Alpha; + return new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, Projectile.alpha); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index 5275b6a665..7cda4ee00d 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = 36; Projectile.height = 36; - AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee;