diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index a4da641254..006f1ce5c0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -72,6 +72,8 @@ HolyFire2.DisplayName: Holy Fire HolyFlare.DisplayName: Holy Flare HolyLight.DisplayName: Holy Light HolySpear.DisplayName: Holy Spear +HomingGasBulb.DisplayName: Homing Gas Bulb +HomingGasBulbSporeGas.DisplayName: Homing Gas Bulb Spore Gas IceBlast.DisplayName: Ice Blast IceBomb.DisplayName: Ice Bomb IceRain.DisplayName: Ice Rain @@ -138,6 +140,7 @@ SwirlingFire.DisplayName: Fire ThanatosBeamStart.DisplayName: T Hanos Beam ThanatosBeamTelegraph.DisplayName: Gamma Disintegration Beam Telegraph ThanatosLaser.DisplayName: Exo Pulse Laser +ThornBallSpike.DisplayName: Thorn Ball Spike ToxicCloud.DisplayName: Toxic Cloud UnstableCrimulanGlob.DisplayName: Unstable Crimulan Glob UnstableEbonianGlob.DisplayName: Unstable Ebonian Glob diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 4145809591..cccac1cd7e 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1278,6 +1278,9 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + // Variables for increasing difficulty bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; @@ -1978,6 +1981,9 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.cataclysm = npc.whoAmI; + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -2282,6 +2288,9 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.catastrophe = npc.whoAmI; + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -2747,6 +2756,10 @@ namespace CalamityMod.NPCs npc.noGravity = true; } + // Emit light when not Idle + if (npc.ai[0] != 1f) + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); + // Fire projectiles while walking, teleporting, or falling if (npc.ai[0] == 2f || npc.ai[0] >= 5f) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index a83f13189a..265757628c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -237,6 +237,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { float shootBulbGateValue = death ? 60f : 120f; + if (lifeRatio < 0.75f) + shootBulbGateValue *= 0.5f; + if (absValueOfTimer % shootBulbGateValue == 0f) { float projectileSpeed = 12f; @@ -319,6 +322,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 1 if (!phase2) { + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.8f, 0.2f, 0.4f); + // Adjust stats calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; @@ -367,6 +373,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 2 else { + // Spore dust + if (Main.rand.NextBool(10)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.4f); + dust.fadeIn = 0.7f; + } + // Adjust stats calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; @@ -390,12 +403,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].aiStyle == 52) + if (Main.npc[i].active && Main.npc[i].aiStyle == NPCAIStyleID.PlanteraHook) { for (int j = 0; j < totalTentacles / 2 - 1; j++) { - int num800 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - Main.npc[num800].ai[3] = i + 1; + int hookIndex = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); + Main.npc[hookIndex].ai[3] = i + 1; } } } @@ -740,6 +753,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Spore dust + if (Main.rand.NextBool(10)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.2f); + dust.fadeIn = 0.7f; + } + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Main.getGoodWorld) diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs index 8d3edde9a6..d3855edbb7 100644 --- a/Projectiles/Boss/HomingGasBulb.cs +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -60,11 +60,14 @@ namespace CalamityMod.Projectiles.Boss } } - if (Projectile.owner == Main.myPlayer) + if (Projectile.ai[0] % 30f == 0f) { - if (Projectile.ai[0] % 30f == 0f) + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + if (Projectile.owner == Main.myPlayer) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + int type = ModContent.ProjectileType(); + float ai0 = Main.rand.Next(3); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Normalize(Projectile.velocity) * 0.25f, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer, ai0); } } } diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.cs b/Projectiles/Boss/HomingGasBulbSporeGas.cs new file mode 100644 index 0000000000..2c074a0199 --- /dev/null +++ b/Projectiles/Boss/HomingGasBulbSporeGas.cs @@ -0,0 +1,108 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HomingGasBulbSporeGas : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 1800f)) + { + Projectile.localAI[0] += 10f; + Projectile.damage = 0; + } + + if (Projectile.localAI[0] > 255f) + { + Projectile.Kill(); + Projectile.localAI[0] = 255f; + } + + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.12f / 255f, (255 - Projectile.alpha) * 0.06f / 255f, (255 - Projectile.alpha) * 0.12f / 255f); + + Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.rotation += Projectile.direction * 0.002f; + + if (Projectile.velocity.Length() > (CalamityWorld.LegendaryMode ? 2f : 0.5f)) + Projectile.velocity *= 0.99f; + } + + public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 1800f) && Projectile.ai[1] > 120f; + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 1800f)) + { + byte b2 = (byte)((26f - (Projectile.ai[1] - (CalamityWorld.LegendaryMode ? 600f : 1800f))) * 10f); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); + } + return new Color(255, 255, 255, Projectile.alpha); + } + + public override bool PreDraw(ref Color lightColor) + { + // Changes the texture of the projectile + Texture2D texture = ModContent.Request(Texture).Value; + switch ((int)Projectile.ai[0]) + { + case 0: + break; + case 1: + texture = ModContent.Request("CalamityMod/Projectiles/Boss/HomingGasBulbSporeGas2").Value; + break; + case 2: + texture = ModContent.Request("CalamityMod/Projectiles/Boss/HomingGasBulbSporeGas3").Value; + break; + default: + break; + } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); + return false; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + if (Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 1800f) && Projectile.ai[1] > 120f) + target.AddBuff(BuffID.Poisoned, 240); + } + } +} diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.png b/Projectiles/Boss/HomingGasBulbSporeGas.png new file mode 100644 index 0000000000..3fb53db305 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulbSporeGas.png differ diff --git a/Projectiles/Boss/HomingGasBulbSporeGas2.png b/Projectiles/Boss/HomingGasBulbSporeGas2.png new file mode 100644 index 0000000000..1cbbe626e1 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulbSporeGas2.png differ diff --git a/Projectiles/Boss/HomingGasBulbSporeGas3.png b/Projectiles/Boss/HomingGasBulbSporeGas3.png new file mode 100644 index 0000000000..3e01bd6413 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulbSporeGas3.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 52905baebc..aa10e84feb 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1339,7 +1339,7 @@ namespace CalamityMod.Projectiles SoundEngine.PlaySound(SoundID.Item17, projectile.position); - for (int num621 = 0; num621 < 8; num621++) + for (int i = 0; i < 8; i++) { int randomDustType = Main.rand.NextBool(2) ? 125 : 148; int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 0, default, 2f); @@ -1350,7 +1350,7 @@ namespace CalamityMod.Projectiles Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int i = 0; i < 10; i++) { int randomDustType = Main.rand.NextBool(2) ? 125 : 148; int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 0, default, 3f);