From df6db119fcc1f4946ef93ebb72092bb904a9561b Mon Sep 17 00:00:00 2001 From: AquaSG Date: Sun, 24 Sep 2023 01:11:53 -0400 Subject: [PATCH] no more extra proj for aqua's scepter drawing also pressed ctrl + k, ctrl e in the file --- .../Mods.CalamityMod.Projectiles.Summon.hjson | 1 - Projectiles/Summon/AquasScepterCloud.cs | 110 ++++++++++-------- Projectiles/Summon/AquasScepterCloudFlash.cs | 30 ----- 3 files changed, 64 insertions(+), 77 deletions(-) delete mode 100644 Projectiles/Summon/AquasScepterCloudFlash.cs diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index ab181ad64a..e14524390e 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -8,7 +8,6 @@ AngelRay.DisplayName: Angelic Ray ApexShark.DisplayName: Ancient Mineral Shark ApparatusExplosion.DisplayName: Explosion AquasScepterCloud.DisplayName: Storm Cloud -AquasScepterCloudFlash.DisplayName: Storm Cloud Flash AquasScepterRaindrop.DisplayName: Rain Droplet AquasScepterTeslaAura.DisplayName: Tesla Aura AquaticStarMinion.DisplayName: Aquatic Star diff --git a/Projectiles/Summon/AquasScepterCloud.cs b/Projectiles/Summon/AquasScepterCloud.cs index 0a52967c94..02950e2294 100644 --- a/Projectiles/Summon/AquasScepterCloud.cs +++ b/Projectiles/Summon/AquasScepterCloud.cs @@ -1,35 +1,38 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class AquasScepterCloud : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; + public class AquasScepterCloud : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; public ref float LightningTimer => ref Projectile.ai[0]; public ref float RainTimer => ref Projectile.ai[1]; + public int DrawFlashTimer = 0; - public override void SetStaticDefaults() { - // Sets the amount of frames this minion has on its spritesheet - Main.projFrames[Projectile.type] = 5; - } + public override void SetStaticDefaults() + { + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 5; + } - public sealed override void SetDefaults() { - Projectile.width = 252; - Projectile.height = 78; + public sealed override void SetDefaults() + { + Projectile.width = 252; + Projectile.height = 78; Projectile.hide = true; Projectile.tileCollide = false; - Projectile.timeLeft = Projectile.SentryLifeTime; - Projectile.friendly = true; - Projectile.sentry = true; - Projectile.DamageType = DamageClass.Summon; - Projectile.penetrate = -1; - Projectile.light = 1f; - } + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.friendly = true; + Projectile.sentry = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = -1; + Projectile.light = 1f; + } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { @@ -40,17 +43,18 @@ namespace CalamityMod.Projectiles.Summon public override bool? CanDamage() => false; public override Color? GetAlpha(Color drawColor) - { - return Color.White; - } + { + return Color.White; + } - public override void AI() { - float distanceFromTarget = 700f; - var targetCenter = Projectile.position; - bool foundTarget = false; + public override void AI() + { + float distanceFromTarget = 700f; + var targetCenter = Projectile.position; + bool foundTarget = false; - LightningTimer++; - RainTimer++; + LightningTimer++; + RainTimer++; Projectile.frameCounter++; if (Projectile.frameCounter >= 6) @@ -61,12 +65,12 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - if (RainTimer >= 3f) // Spawns a raindrop every 3 frames, displaced down and randomly along the length of the cloud - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (Projectile.Center.X + Main.rand.Next(-110, 111)), (Projectile.Center.Y + 57f), 0f, 15f, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + if (RainTimer >= 3f) // Spawns a raindrop every 3 frames, displaced down and randomly along the length of the cloud + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (Projectile.Center.X + Main.rand.Next(-110, 111)), (Projectile.Center.Y + 57f), 0f, 15f, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); - RainTimer = 0f; - } + RainTimer = 0f; + } for (int i = 0; i < Main.maxNPCs; i++) @@ -87,16 +91,30 @@ namespace CalamityMod.Projectiles.Summon } } } - if (foundTarget) { - if (distanceFromTarget < 300) { - if (LightningTimer >= 60f) { //Every 60 AI cycles, plays the lightning sound and spawns 2 projectiles: the tesla aura for dealing damage in an aoe, and the cloud flash to simulate the brightness of the main cloud changing. - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura")); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage*7.2f), 16, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Projectile.owner); - LightningTimer = 0f; - } - } - } - } - } + if (foundTarget) + { + if (distanceFromTarget < 300) + { + if (LightningTimer >= 60f) //Every 60 AI cycles, plays the lightning sound and spawns 2 projectiles: the tesla aura for dealing damage in an aoe, and the cloud flash to simulate the brightness of the main cloud changing. + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura")); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 7.2f), 16, Projectile.owner); + LightningTimer = 0f; + DrawFlashTimer = 27; + } + } + } + } + public override void PostDraw(Color lightColor) + { + if (DrawFlashTimer > 0) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/AquasScepterCloudFlash").Value; + lightColor *= 1f - ((27 - DrawFlashTimer) / 27f); + Vector2 drawPosition = Projectile.position - Main.screenPosition + (texture.Size() * 0.5f); + Main.EntitySpriteDraw(texture, drawPosition, null, lightColor, 0f, texture.Size() * 0.5f, 1f, SpriteEffects.None); + DrawFlashTimer--; + } + } + } } diff --git a/Projectiles/Summon/AquasScepterCloudFlash.cs b/Projectiles/Summon/AquasScepterCloudFlash.cs deleted file mode 100644 index 98093a2064..0000000000 --- a/Projectiles/Summon/AquasScepterCloudFlash.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class AquasScepterCloudFlash : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() { - // Sets the amount of frames this minion has on its spritesheet - Main.projFrames[Projectile.type] = 1; - } - - public sealed override void SetDefaults() { - Projectile.width = 252; - Projectile.height = 78; - Projectile.tileCollide = false; - Projectile.timeLeft = 27; - Projectile.penetrate = -1; - Projectile.alpha = 125; - } - - public override bool? CanDamage() => false; - - public override void AI() { - Projectile.alpha += 5; - } - } -}