From f253573ddd202ef31dae52857d92506a9571737e Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Mon, 17 Jul 2023 17:46:13 -0500 Subject: [PATCH 1/2] Rev+ Plantera homing gas bulb gas. --- .../Mods.CalamityMod.Projectiles.Boss.hjson | 3 + NPCs/CalamityAI.cs | 13 +++ NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs | 6 +- Projectiles/Boss/HomingGasBulb.cs | 9 +- Projectiles/Boss/HomingGasBulbSporeGas.cs | 108 ++++++++++++++++++ Projectiles/Boss/HomingGasBulbSporeGas.png | Bin 0 -> 561 bytes Projectiles/Boss/HomingGasBulbSporeGas2.png | Bin 0 -> 384 bytes Projectiles/Boss/HomingGasBulbSporeGas3.png | Bin 0 -> 403 bytes Projectiles/CalamityGlobalProjectile.cs | 4 +- 9 files changed, 135 insertions(+), 8 deletions(-) create mode 100644 Projectiles/Boss/HomingGasBulbSporeGas.cs create mode 100644 Projectiles/Boss/HomingGasBulbSporeGas.png create mode 100644 Projectiles/Boss/HomingGasBulbSporeGas2.png create mode 100644 Projectiles/Boss/HomingGasBulbSporeGas3.png diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 01e95cce7f..799683ec95 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..9755d79e73 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -390,12 +390,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; } } } 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 0000000000000000000000000000000000000000..3fb53db305441c2b45c66a4f9a4c926d8a1cea40 GIT binary patch literal 561 zcmV-10?z%3P)Px$(Md!>R7i=vmd|d}KoG`%<2Z>Gholifr6*9I00~}!BPZU2cj5^+aIE?WmAG(h zlv7nHt?K-7u@l?NVRl{CP3ZyRxp?i}nf<mNL~!M|GQ2Il7t0L9(bTj1Uu^5|5NUe6+9m&o5XI5-1w$O$cw!We*TwowE_ zohS+=yUKsu{YVTzksAT%bT$I8 zxDxYcpm^F<2^L!~H|VJ3!S2L}G zvD46M?&`f}WG$&lTZWeD+iDF!`XCC>27^V?Rm5Zh(4W|uQMlLP^=YPql|F9I5&+7P zDiE)B?N^a@s%^mZ(p8TlbGc|Ta#c4EUI1{+4uD)l;Gv@re-^pH^6Si-*xgkI;N?f# z(H60@X1`pVmycpX8##FD#tJ5p0NkD>-kIYV)mG=Gq+uH8f1=%Ib!j|xV|C(60J`JA z`#yaWHA3ah*zNRzxEz$R{vE8-fij6p0m#yh=TPc}$MyW)%gy*zPXLw+t^W^Sj)4{! z{05Nsw4Cwk>hAym01jnXNoGw=04e|g00;m8000000Mb*F00000NkvXXu0mjfU8nm4 literal 0 HcmV?d00001 diff --git a/Projectiles/Boss/HomingGasBulbSporeGas2.png b/Projectiles/Boss/HomingGasBulbSporeGas2.png new file mode 100644 index 0000000000000000000000000000000000000000..1cbbe626e1d96a9705e2e0043942b44e32a75d7d GIT binary patch literal 384 zcmeAS@N?(olHy`uVBq!ia0vp^5*AYbhU#b*!_Ob~V45)5WscTWv4T0|p#lYJ_K+ buP=iZkj(+aAaE&oGKlhY^>bP0l+XkK`A(VR literal 0 HcmV?d00001 diff --git a/Projectiles/Boss/HomingGasBulbSporeGas3.png b/Projectiles/Boss/HomingGasBulbSporeGas3.png new file mode 100644 index 0000000000000000000000000000000000000000..3e01bd6413be37b73d56d094bbf2eb163ffc1d64 GIT binary patch literal 403 zcmV;E0c`$>P)Px$Gf6~2R5*>jl+8-RKoo_)(FiG)QZZm$DXlv3|#tDRKj52dp( zJ<`rxKieI=UQU4~Q{fln1c`?tNkOt_pV3y8mMT5-@r&&@mWq$j)Bwan>g8ET#rt&K z_1srDkH1OX6D5SAo2xkh$7egW_w}Nm0 Date: Mon, 17 Jul 2023 19:05:27 -0500 Subject: [PATCH 2/2] Plantera light in phase 1 and spores in phase 2. --- NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index 9755d79e73..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; @@ -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)