From 3e96c291f1c867fbe427d0ce6ddbb28438ae287a Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 11 Oct 2021 16:28:16 -0500 Subject: [PATCH] 1 - Artemis and Apollo laser and fireball projectile resprites. --- NPCs/ExoMechs/Apollo/Apollo.cs | 6 +- NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 2 +- NPCs/ExoMechs/Artemis/Artemis.cs | 6 +- Projectiles/Boss/ApolloFireball.cs | 229 +++++++++++++++++++ Projectiles/Boss/ApolloFireball.png | Bin 0 -> 5148 bytes Projectiles/Boss/AresLaserBeamStart.cs | 2 +- Projectiles/Boss/AresPlasmaFireball.cs | 20 +- Projectiles/Boss/ArtemisLaser.cs | 226 ++++++++++++++++++ Projectiles/Boss/ArtemisLaser.png | Bin 0 -> 767 bytes Projectiles/Boss/ThanatosBeamStart.cs | 2 +- Projectiles/Boss/ThanatosLaser.cs | 17 +- Utilities/NPCStats.cs | 4 +- 12 files changed, 475 insertions(+), 39 deletions(-) create mode 100644 Projectiles/Boss/ApolloFireball.cs create mode 100644 Projectiles/Boss/ApolloFireball.png create mode 100644 Projectiles/Boss/ArtemisLaser.cs create mode 100644 Projectiles/Boss/ArtemisLaser.png diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index e4e601bf5a..56f4fa820a 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -735,12 +735,12 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo pickNewLocation = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f; - Projectile.NewProjectile(npc.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, -1f); + Projectile.NewProjectile(npc.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } @@ -931,7 +931,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int totalProjectiles = CalamityWorld.malice ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = (int)(npc.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); + int damage = (int)(npc.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); float velocity = 12f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index e84f9c48d0..b7a9372071 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -367,7 +367,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; if (boltsSplitLess) - Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -2f); + Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); else Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 8c1fc03470..ea3d1a5d3b 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -735,7 +735,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fire a spread of projectiles in the direction of the charge if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Vector2 laserVelocity = chargeVelocityNormalized * 10f; int numLasersPerSpread = 6; @@ -782,7 +782,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis pickNewLocation = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); Vector2 laserVelocity = Vector2.Normalize(aimedVector); @@ -903,7 +903,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis pickNewLocation = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs new file mode 100644 index 0000000000..0a50e14ca0 --- /dev/null +++ b/Projectiles/Boss/ApolloFireball.cs @@ -0,0 +1,229 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ApolloFireball : ModProjectile + { + private const int timeLeft = 60; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Volatile Plasma Blast"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 48; + projectile.height = 48; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.Opacity = 0f; + cooldownSlot = 1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + 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() + { + Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); + if (Vector2.Distance(targetLocation, projectile.Center) < 80f) + projectile.tileCollide = true; + + int fadeInTime = 3; + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); + + Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + projectile.frame = 0; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; + + for (int num53 = 0; num53 < 40; num53++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + Main.dust[num54].noGravity = true; + + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + + dust = Main.dust[num54]; + dust.velocity *= 2f; + + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Green * 0.5f; + + dust = Main.dust[num54]; + } + for (int num55 = 0; num55 < 20; num55++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + Main.dust[num56].noGravity = true; + + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + } + } + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.CursedInferno, 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void Kill(int timeLeft) + { + int height = 90; + projectile.position = projectile.Center; + projectile.width = projectile.height = height; + projectile.Center = projectile.position; + projectile.Damage(); + + Main.PlaySound(SoundID.Item93, projectile.Center); + + if (Main.myPlayer == projectile.owner) + { + // Plasma bolts + int totalProjectiles = CalamityWorld.malice ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = projectile.velocity.Length(); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(projectile.Center, velocity2, type, (int)(projectile.damage * 0.8), 0f, Main.myPlayer); + } + } + + for (int num640 = 0; num640 < 200; num640++) + { + float num641 = 16f; + if (num640 < 150) + num641 = 12f; + if (num640 < 100) + num641 = 8f; + if (num640 < 50) + num641 = 4f; + + int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + float num644 = Main.dust[num643].velocity.X; + float num645 = Main.dust[num643].velocity.Y; + + if (num644 == 0f && num645 == 0f) + num644 = 1f; + + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); + num646 = num641 / num646; + num644 *= num646; + num645 *= num646; + + float scale = 1f; + switch ((int)num641) + { + case 4: + scale = 1.2f; + break; + case 8: + scale = 1.1f; + break; + case 12: + scale = 1f; + break; + case 16: + scale = 0.9f; + break; + default: + break; + } + + Dust dust = Main.dust[num643]; + dust.velocity *= 0.5f; + dust.velocity.X = dust.velocity.X + num644; + dust.velocity.Y = dust.velocity.Y + num645; + dust.scale = scale; + dust.noGravity = true; + } + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/ApolloFireball.png b/Projectiles/Boss/ApolloFireball.png new file mode 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ha97sR0D%lNs>4tL` zJ8BHXBVKG&>Ds$cG`;N?gmpfAKSZ2gn(eaNvBGv?QFKA=V=*%Bv1cYVxqV;nfHfNc zd+AT?nJhpL6cy7;->?{j>s4qb$KUVw<)76>v^Vyc=WSgQEq}DH__+yMpOc2JTJ$_f zU5Qx~R^_G-XCipXr-4?XJ* projectile.ai[0]; + set => projectile.ai[0] = value; + } + + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + + public Vector2 Destination; + public Vector2 Velocity; + public const float TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; + public const float LaserVelocity = 10f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Pulse Laser"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 22; + projectile.height = 22; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(Destination); + writer.WriteVector2(Velocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Destination = reader.ReadVector2(); + Velocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) + { + if (projectile.alpha > 0) + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + + // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (Velocity != Vector2.Zero) + { + projectile.extraUpdates = 3; + projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); + Velocity = Vector2.Zero; + projectile.netUpdate = true; + } + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + } + else if (Destination == Vector2.Zero) + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + // Set destination of the laser, the target's center. + Destination = projectile.velocity; + + projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; + + // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. + Vector2 projectileDestination = Destination - ThingToAttachTo.Center; + Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + + // Set velocity to zero. + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + else + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; + + // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. + Vector2 projectileDestination = Destination - ThingToAttachTo.Center; + Velocity = Vector2.Normalize(projectileDestination) * LaserVelocity; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)Velocity.Y, (double)-(double)Velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)Velocity.Y, (double)Velocity.X); + } + } + + TelegraphDelay++; + } + + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (TelegraphDelay > TelegraphTotalTime) + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + + float yScale = 2f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + + Color colorOuter = Color.Lerp(Color.Orange, Color.OrangeRed, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through orange and dark orange once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.6f; + colorInner *= 0.6f; + + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, Velocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, Velocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Boss/ArtemisLaser.png b/Projectiles/Boss/ArtemisLaser.png new file mode 100644 index 0000000000000000000000000000000000000000..8c5f8b4299313a89d6d39baf308337b55fd30cdc GIT binary patch literal 767 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0+dNaK~#8N?b|VH z6hRcg@rwksI7mRSvQsQlDuL8C`2+?lzlBY(6dS*VRWO}hn$&4xX%UjnN)Qsb!XjW` zGf(g(Z)bLP@9oUq|JTfxm&86R$c z`|mxbaA*JCeLV-qRslnmomy0Bbm6}?-!$Ws%fn`*@Iu@vJav7WTe$Ze9m5+7Flg?jI-fW~{~5&LUj3 zi|r!Lci)ApTY6udy%cAi3y+=jly;(%%KCeTJ^`X|XKPaIvd=P0GxV+nid zUF$N*ose6)E?ZEzGYXH8()ITNYqj&|;%77JvIT`Zqwq|*t2hb=03gxiRw-8pFO&94 zVsf8ZVwF;u>I>KF;n>q>efPaB@+{Bd>+NWjPT|hX!gV=g?}J<4?5v`fRdTA!Pam35 zzi$-o>`t{-Nu@~LwOe-K))}Ut@IoXPKK2|gy3XaodrqhDLKIQ$5On!cyjR(*!wWT; x!Zp38lKPuNIg=Erdn&1)aTE>!0D#$Sb_26h1)9yad<*~p002ovPDHLkV1i;5b!-3t literal 0 HcmV?d00001 diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index 00e13f39d4..ef76aa9a51 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Boss Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd"); float drawLength = LengthOfLaser; - Color color = new Color(250, 100, 100, 0); + Color color = new Color(250, 250, 250, 100); if (Time % 5 == 0) { diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index bc148f16fe..393479f0d6 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -149,9 +148,6 @@ namespace CalamityMod.Projectiles.Boss // If the Ares Laser Cannon is the owner. bool aresLaserIsOwner = ThingToAttachTo.type == ModContent.NPCType(); - // If Artemis is the owner. - bool artemisIsOwner = ThingToAttachTo.type == ModContent.NPCType(); - // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) { @@ -191,8 +187,6 @@ namespace CalamityMod.Projectiles.Boss if (aresLaserIsOwner) projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f; - else if (artemisIsOwner) - projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; @@ -221,8 +215,6 @@ namespace CalamityMod.Projectiles.Boss if (aresLaserIsOwner) projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f + Vector2.UnitY * 16f; - else if (artemisIsOwner) - projectile.Center += Vector2.Normalize(Destination - ThingToAttachTo.Center) * 70f; // Calculate and store the velocity that will be used for laser telegraph rotation and beam firing. Vector2 projectileDestination = Destination - ThingToAttachTo.Center; @@ -259,14 +251,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - // If Artemis is the owner. - bool artemisIsOwner = projectile.ai[1] == -1f ? false : ThingToAttachTo.type == ModContent.NPCType(); - if (TelegraphDelay >= TelegraphTotalTime) { lightColor.R = (byte)(255 * projectile.Opacity); - lightColor.G = (byte)((artemisIsOwner ? 180 : 255) * projectile.Opacity); - lightColor.B = (byte)((artemisIsOwner ? 100 : 255) * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -283,7 +272,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); - Color colorOuter = Color.Lerp(artemisIsOwner ? Color.Orange : Color.Red, artemisIsOwner ? Color.OrangeRed : Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. + Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); colorOuter *= 0.6f; diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 56e32d5c35..01981d44e5 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -807,8 +807,8 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } },