diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png b/ExtraTextures/Lasers/ThanatosBeamEnd.png similarity index 100% rename from ExtraTextures/Lasers/ExoDestroyerBeamEnd.png rename to ExtraTextures/Lasers/ThanatosBeamEnd.png diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png b/ExtraTextures/Lasers/ThanatosBeamMiddle.png similarity index 100% rename from ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png rename to ExtraTextures/Lasers/ThanatosBeamMiddle.png diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 27b4773da0..ec52b985e5 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -372,7 +372,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { 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(player.Center - npc.Center); diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index a0d7ae8695..efeb7df1ea 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -752,7 +752,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); @@ -872,7 +872,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/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 661f88bf7b..bf559c7f49 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -272,7 +272,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos for (int i = 0; i < numProjectiles; i++) { // Normal laser - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -332,7 +332,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); for (int i = 0; i < numProjectiles; i++) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 50326c7786..b824754f13 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -272,7 +272,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos for (int i = 0; i < numProjectiles; i++) { // Normal laser - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -332,7 +332,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); for (int i = 0; i < numProjectiles; i++) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 1d607f2026..942553df20 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -744,7 +744,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); for (int b = 0; b < 6; b++) { int beam = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, 0, 0f, 255, npc.whoAmI); @@ -771,7 +771,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI); if (Main.projectile.IndexInRange(laser)) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 5eb2bbbe83..93bc5603a2 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -271,7 +271,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos for (int i = 0; i < numProjectiles; i++) { // Normal laser - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } @@ -331,7 +331,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); for (int i = 0; i < numProjectiles; i++) diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index ced7be7850..3087d39aa8 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -10,9 +10,9 @@ namespace CalamityMod.Projectiles.Boss public class ApolloChargeTelegraph : ModProjectile { public Vector2[] ChargePositions = new Vector2[1]; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; public PrimitiveTrail TelegraphDrawer = null; public const float TelegraphTotalTime = 30f; @@ -21,12 +21,12 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Charge Telegraph"); + DisplayName.SetDefault("Apollo Charge Telegraph"); } public override void SetDefaults() { - projectile.width = 10; + projectile.width = 10; projectile.height = 10; projectile.hostile = true; projectile.ignoreWater = true; @@ -34,37 +34,37 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 30; - } + } - public override void SendExtraAI(BinaryWriter writer) - { + public override void SendExtraAI(BinaryWriter writer) + { writer.Write(ChargePositions.Length); for (int i = 0; i < ChargePositions.Length; i++) writer.WriteVector2(ChargePositions[i]); - } + } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { ChargePositions = new Vector2[reader.ReadInt32()]; for (int i = 0; i < ChargePositions.Length; i++) ChargePositions[i] = reader.ReadVector2(); } - public override void AI() + public override void AI() { - // Determine the relative opacities for each player based on their distance. - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - projectile.netUpdate = true; - } + // Determine the relative opacities for each player based on their distance. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } - // Die if the thing to attach to disappears. - if (ThingToAttachTo is null || !ThingToAttachTo.active) - { - projectile.Kill(); - return; - } + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } // Determine opacity projectile.Opacity = Utils.InverseLerp(0f, 6f, projectile.timeLeft, true) * Utils.InverseLerp(30f, 24f, projectile.timeLeft, true); diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 84fdacd1af..1eb1be92e8 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Projectiles.Boss { public class ApolloRocket : ModProjectile { - private const int timeLeft = 180; + private const int timeLeft = 180; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { - DisplayName.SetDefault("Plasma Rocket"); + DisplayName.SetDefault("High Explosive Plasma Rocket"); Main.projFrames[projectile.type] = 5; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; @@ -23,35 +23,35 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 28; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 28; projectile.height = 28; projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - cooldownSlot = 1; - projectile.timeLeft = timeLeft; - projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; - } + 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() + public override void SendExtraAI(BinaryWriter writer) { - if (projectile.position.Y > projectile.ai[1]) - projectile.tileCollide = true; + writer.Write(projectile.localAI[0]); + } - // Animation - projectile.frameCounter++; + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; + + // Animation + projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; @@ -60,155 +60,155 @@ namespace CalamityMod.Projectiles.Boss if (projectile.frame > 4) projectile.frame = 0; - // Rotation - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + // Rotation + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - // Spawn effects - 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 < 20; 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 < 10; 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]; - } - } - - // Light - Lighting.AddLight(projectile.Center, 0f, 0.6f, 0f); - - // Get a target and calculate distance from it - int target = Player.FindClosest(projectile.Center, 1, 1); - Vector2 distanceFromTarget = Main.player[target].Center - projectile.Center; - - // Set AI to stop homing, start accelerating - float stopHomingDistance = 200f; - if (distanceFromTarget.Length() < stopHomingDistance || projectile.ai[0] == 1f) + // Spawn effects + if (projectile.localAI[0] == 0f) { - projectile.ai[0] = 1f; + projectile.localAI[0] = 1f; - if (projectile.velocity.Length() < 24f) - projectile.velocity *= 1.05f; + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; - return; + for (int num53 = 0; num53 < 20; 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 < 10; 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]; + } } - // Home in on target - float scaleFactor = projectile.velocity.Length(); - float inertia = 10f; - distanceFromTarget.Normalize(); - distanceFromTarget *= scaleFactor; - projectile.velocity = (projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor; - } + // Light + Lighting.AddLight(projectile.Center, 0f, 0.6f, 0f); - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 360); - target.AddBuff(BuffID.CursedInferno, 180); - } + // Get a target and calculate distance from it + int target = Player.FindClosest(projectile.Center, 1, 1); + Vector2 distanceFromTarget = Main.player[target].Center - projectile.Center; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); - return false; + // Set AI to stop homing, start accelerating + float stopHomingDistance = 200f; + if (distanceFromTarget.Length() < stopHomingDistance || projectile.ai[0] == 1f) + { + projectile.ai[0] = 1f; + + if (projectile.velocity.Length() < 24f) + projectile.velocity *= 1.05f; + + return; + } + + // Home in on target + float scaleFactor = projectile.velocity.Length(); + float inertia = 10f; + distanceFromTarget.Normalize(); + distanceFromTarget *= scaleFactor; + projectile.velocity = (projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = Main.projectileTexture[projectile.type]; - int height = texture.Height / Main.projFrames[projectile.type]; - int drawStart = height * projectile.frame; - Vector2 origin = projectile.Size / 2; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/ApolloRocketGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); - } - - public override void Kill(int timeLeft) + public override void OnHitPlayer(Player target, int damage, bool crit) { - // Rocket explosion - int height = 90; - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.Damage(); + target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.CursedInferno, 180); + } - Main.PlaySound(SoundID.Item14, projectile.Center); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } - for (int num621 = 0; num621 < 12; num621++) - { - int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int randomDustType = Main.rand.NextBool(2) ? 107 : 110; - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 2f; - } - CalamityUtils.ExplosionGores(projectile.Center, 3); - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = projectile; - } - } + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/ApolloRocketGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + + public override void Kill(int timeLeft) + { + // Rocket explosion + int height = 90; + projectile.position = projectile.Center; + projectile.width = projectile.height = height; + projectile.Center = projectile.position; + projectile.Damage(); + + Main.PlaySound(SoundID.Item14, projectile.Center); + + for (int num621 = 0; num621 < 12; num621++) + { + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int randomDustType = Main.rand.NextBool(2) ? 107 : 110; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } + CalamityUtils.ExplosionGores(projectile.Center, 3); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } } diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 384861305e..933485a0a5 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -11,66 +11,67 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class AresDeathBeamStart : ModProjectile + public class AresDeathBeamStart : ModProjectile { - private const int maxFrames = 5; - private int frameDrawn = 0; + private const int maxFrames = 5; + private int frameDrawn = 0; public override void SetStaticDefaults() { - DisplayName.SetDefault("Death Beam"); - } + // Ares' eight-pointed-star laser beams + DisplayName.SetDefault("Exo Overload Beam"); + } public override void SetDefaults() { - projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 600; - cooldownSlot = 1; + cooldownSlot = 1; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(frameDrawn); + writer.Write(frameDrawn); writer.Write(projectile.localAI[0]); writer.Write(projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { - frameDrawn = reader.ReadInt32(); + frameDrawn = reader.ReadInt32(); projectile.localAI[0] = reader.ReadSingle(); projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - // Difficulty modes - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || malice; - bool revenge = CalamityWorld.revenge || malice; - bool expertMode = Main.expertMode || malice; + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; - Vector2? vector78 = null; + Vector2? vector78 = null; - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) projectile.velocity = -Vector2.UnitY; if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) { - Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - 1f, Main.npc[(int)projectile.ai[1]].Center.Y + 23f) + Vector2.Normalize(projectile.velocity) * 35f; + Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - 1f, Main.npc[(int)projectile.ai[1]].Center.Y + 23f) + Vector2.Normalize(projectile.velocity) * 35f; projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; } - else - projectile.Kill(); + else + projectile.Kill(); - float num801 = 1f; - float duration = 600f; + float num801 = 1f; + float duration = 600f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= duration) { @@ -78,130 +79,130 @@ namespace CalamityMod.Projectiles.Boss return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / duration) * 10f * num801; + projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / duration) * 10f * num801; if (projectile.scale > num801) projectile.scale = num801; - float num804 = projectile.velocity.ToRotation(); - float divisor = malice ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; - float rotationAmt = MathHelper.Lerp(0f, MathHelper.TwoPi / divisor, projectile.localAI[0] / duration); - num804 += rotationAmt; - projectile.rotation = num804 - MathHelper.PiOver2; - projectile.velocity = num804.ToRotationVector2(); + float num804 = projectile.velocity.ToRotation(); + float divisor = malice ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; + float rotationAmt = MathHelper.Lerp(0f, MathHelper.TwoPi / divisor, projectile.localAI[0] / duration); + num804 += rotationAmt; + projectile.rotation = num804 - MathHelper.PiOver2; + projectile.velocity = num804.ToRotationVector2(); - float num805 = 3f; //3f - float num806 = projectile.width; + float num805 = 3f; //3f + float num806 = projectile.width; - Vector2 samplingPoint = projectile.Center; - if (vector78.HasValue) - samplingPoint = vector78.Value; + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + samplingPoint = vector78.Value; - float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 4800f, array3); - float num807 = 0f; - for (int num808 = 0; num808 < array3.Length; num808++) - { - num807 += array3[num808]; - } - num807 /= num805; + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 4800f, array3); + float num807 = 0f; + for (int num808 = 0; num808 < array3.Length; num808++) + { + num807 += array3[num808]; + } + num807 /= num805; - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) - { - num807 = 4800f; - } + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + { + num807 = 4800f; + } - float amount = 0.5f; + float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); // Length of laser, linear interpolation - // Spawn dust at the end of the beam - int dustType = 107; - Vector2 dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int i = 0; i < 2; i++) - { - float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); - int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, new Color(0, 255, 255), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.7f; - } + // Spawn dust at the end of the beam + int dustType = 107; + Vector2 dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); + for (int i = 0; i < 2; i++) + { + float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); + int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, new Color(0, 255, 255), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } - if (Main.rand.NextBool(5)) - { - Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); - } + if (Main.rand.NextBool(5)) + { + Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); + } - DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); + DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - return false; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; - Texture2D beamStart = Main.projectileTexture[projectile.type]; - Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); - Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); + Texture2D beamStart = Main.projectileTexture[projectile.type]; + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); - float drawLength = projectile.localAI[1]; - Color color = new Color(250, 250, 250, 100); + float drawLength = projectile.localAI[1]; + Color color = new Color(250, 250, 250, 100); - if (projectile.localAI[0] % 5f == 0f) - { - frameDrawn++; - if (frameDrawn >= maxFrames) - frameDrawn = 0; - } + if (projectile.localAI[0] % 5f == 0f) + { + frameDrawn++; + if (frameDrawn >= maxFrames) + frameDrawn = 0; + } - // Draw start of beam - Vector2 vector = projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); - spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); + // Draw start of beam + Vector2 vector = projectile.Center - Main.screenPosition; + Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); + spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); - // Draw middle of beam - drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; - Vector2 center = projectile.Center; - center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; - if (drawLength > 0f) - { - float i = 0f; - int middleFrameDrawn = frameDrawn; - while (i + 1f < drawLength) - { - Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); + // Draw middle of beam + drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; + Vector2 center = projectile.Center; + center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; + if (drawLength > 0f) + { + float i = 0f; + int middleFrameDrawn = frameDrawn; + while (i + 1f < drawLength) + { + Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); - if (drawLength - i < rectangle.Height) - rectangle.Height = (int)(drawLength - i); + if (drawLength - i < rectangle.Height) + rectangle.Height = (int)(drawLength - i); - spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); - middleFrameDrawn++; - if (middleFrameDrawn >= maxFrames) - middleFrameDrawn = 0; + middleFrameDrawn++; + if (middleFrameDrawn >= maxFrames) + middleFrameDrawn = 0; - i += rectangle.Height * projectile.scale; - center += projectile.velocity * rectangle.Height * projectile.scale; + i += rectangle.Height * projectile.scale; + center += projectile.velocity * rectangle.Height * projectile.scale; - rectangle.Y += beamMiddle.Height / maxFrames; - if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) - rectangle.Y = 0; - } - } + rectangle.Y += beamMiddle.Height / maxFrames; + if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) + rectangle.Y = 0; + } + } - // Draw end of beam - Vector2 vector2 = center - Main.screenPosition; - sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); - spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); + // Draw end of beam + Vector2 vector2 = center - Main.screenPosition; + sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); + spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + return false; + } - public override void CutTiles() + public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; Vector2 unit = projectile.velocity; @@ -224,7 +225,7 @@ namespace CalamityMod.Projectiles.Boss public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - target.Calamity().lastProjectileHit = projectile; - } + target.Calamity().lastProjectileHit = projectile; + } } } diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index 169f679782..8652c8a36a 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -8,29 +8,30 @@ namespace CalamityMod.Projectiles.Boss { public class AresDeathBeamTelegraph : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public float TelegraphDelay + public float TelegraphDelay { get => 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 NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[1]) ? Main.npc[(int)projectile.ai[1]] : null; - public Vector2 OldVelocity; + public Vector2 OldVelocity; public const float TelegraphTotalTime = 240f; public const float TelegraphFadeTime = 15f; public const float TelegraphWidth = 4800f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Death Beam Telegraph"); + // Telegraph for Ares' eight-pointed-star laser beams + DisplayName.SetDefault("Exo Overload Telegraph"); } public override void SetDefaults() { - projectile.width = 10; + projectile.width = 10; projectile.height = 10; projectile.hostile = true; projectile.ignoreWater = true; @@ -38,19 +39,19 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 240; - } + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(OldVelocity); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - OldVelocity = reader.ReadVector2(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } - public override void AI() + public override void AI() { // Determine the relative opacities for each player based on their distance. if (projectile.localAI[0] == 0f) @@ -59,18 +60,18 @@ namespace CalamityMod.Projectiles.Boss projectile.netUpdate = true; } - // Die if the thing to attach to disappears. - if (ThingToAttachTo is null || !ThingToAttachTo.active) - { - projectile.Kill(); - return; - } + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } - // Set start of telegraph to the npc center. - projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f); + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center + new Vector2(-1f, 23f) + (Vector2.Normalize(OldVelocity) * 17f); - // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. - if (OldVelocity == Vector2.Zero) + // Be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. + if (OldVelocity == Vector2.Zero) { OldVelocity = projectile.velocity; projectile.velocity = Vector2.Zero; diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index 2592d4d098..53c47d777e 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -12,70 +12,70 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class AresLaserBeamStart : ModProjectile - { + { private const int maxFrames = 5; private int frameDrawn = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser Beam"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exothermal Laser"); } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; cooldownSlot = 1; - } + } - public override void SendExtraAI(BinaryWriter writer) - { + public override void SendExtraAI(BinaryWriter writer) + { writer.Write(frameDrawn); - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { frameDrawn = reader.ReadInt32(); - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } - public override void AI() - { + public override void AI() + { Vector2? vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - projectile.velocity = -Vector2.UnitY; + projectile.velocity = -Vector2.UnitY; - if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) - { + if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + { float offset = 84f; float offset2 = 16f; Vector2 fireFrom = Main.npc[(int)projectile.ai[1]].Calamity().newAI[3] == 0f ? new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - offset2 * Main.npc[(int)projectile.ai[1]].direction, Main.npc[(int)projectile.ai[1]].Center.Y + offset) : new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + offset * Main.npc[(int)projectile.ai[1]].direction, Main.npc[(int)projectile.ai[1]].Center.Y + offset2); - projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; - } + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + } else projectile.Kill(); float num801 = 1f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) - { - projectile.Kill(); - return; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.Kill(); + return; + } projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801; - if (projectile.scale > num801) - projectile.scale = num801; + if (projectile.scale > num801) + projectile.scale = num801; float num804 = projectile.velocity.ToRotation(); projectile.rotation = num804 - MathHelper.PiOver2; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss } float amount = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation // Spawn dust at the end of the beam int dustType = (int)CalamityDusts.Brimstone; @@ -128,8 +128,8 @@ namespace CalamityMod.Projectiles.Boss } DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -194,34 +194,34 @@ namespace CalamityMod.Projectiles.Boss } public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - { - return true; - } - float num6 = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6)) - { - return true; - } - return false; - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 30f * projectile.scale, ref num6)) + { + return true; + } + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - } + } } diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index c3c6fea203..6b5dbdb2b1 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -7,35 +7,35 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class AresPlasmaBolt : ModProjectile - { + public class AresPlasmaBolt : ModProjectile + { private const int timeLeft = 360; public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plasma Bolt"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + { + DisplayName.SetDefault("Exoplasma Bolt"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 18; - projectile.height = 18; - projectile.hostile = true; - projectile.ignoreWater = true; + projectile.height = 18; + projectile.hostile = true; + projectile.ignoreWater = true; projectile.tileCollide = false; projectile.Opacity = 0f; cooldownSlot = 1; projectile.penetrate = -1; - projectile.timeLeft = timeLeft; + projectile.timeLeft = timeLeft; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } - public override void AI() - { + public override void AI() + { int fadeOutTime = 15; int fadeInTime = 3; if (projectile.timeLeft < fadeOutTime) @@ -46,16 +46,16 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, 0f, 0.4f * projectile.Opacity, 0f); projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - projectile.frame = 0; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; - } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + } public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; @@ -68,14 +68,14 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.CursedInferno, 90); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + 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; - } + return false; + } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index f697f577e1..6b062c20a5 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -9,27 +9,27 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class AresPlasmaFireball : ModProjectile - { + public class AresPlasmaFireball : ModProjectile + { private const int timeLeft = 120; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plasma Fireball"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + 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() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 36; - projectile.height = 36; - projectile.hostile = true; - projectile.ignoreWater = true; + projectile.height = 36; + projectile.hostile = true; + projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.penetrate = -1; + projectile.penetrate = -1; projectile.Opacity = 0f; cooldownSlot = 1; projectile.timeLeft = timeLeft; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss } public override void AI() - { + { if (projectile.ai[0] != -1f) { Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); @@ -66,15 +66,15 @@ namespace CalamityMod.Projectiles.Boss 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; + 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; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss dust = Main.dust[num56]; } } - } + } public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; @@ -142,14 +142,14 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.CursedInferno, 180); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + 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; - } + return false; + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index e989a46b0e..bb0d5beceb 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Tesla Orb"); + DisplayName.SetDefault("Tesla Sphere"); Main.projFrames[projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; @@ -231,8 +231,8 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { if (projHitbox.Intersects(targetHitbox)) return true; @@ -242,9 +242,9 @@ namespace CalamityMod.Projectiles.Boss return true; return false; - } + } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/ArtemisChargeTelegraph.cs b/Projectiles/Boss/ArtemisChargeTelegraph.cs index 7f5c90c801..ec5479a874 100644 --- a/Projectiles/Boss/ArtemisChargeTelegraph.cs +++ b/Projectiles/Boss/ArtemisChargeTelegraph.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Charge Telegraph"); + DisplayName.SetDefault("Artemis Charge Telegraph"); } public override void SetDefaults() diff --git a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs index 84786d9d37..323293a018 100644 --- a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs +++ b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Deathray Telegraph"); + DisplayName.SetDefault("Exothermal Artemis Beam Telegraph"); } public override void SetDefaults() diff --git a/Projectiles/Boss/ArtemisLaserBeamStart.cs b/Projectiles/Boss/ArtemisLaserBeamStart.cs index 459c3f45de..031f20ada3 100644 --- a/Projectiles/Boss/ArtemisLaserBeamStart.cs +++ b/Projectiles/Boss/ArtemisLaserBeamStart.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Artemis Deathray"); + DisplayName.SetDefault("Exothermal Artemis Beam"); } public override void SetDefaults() diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs similarity index 51% rename from Projectiles/Boss/ExoDestroyerBeamStart.cs rename to Projectiles/Boss/ThanatosBeamStart.cs index cc56ab2301..84cddb40e0 100644 --- a/Projectiles/Boss/ExoDestroyerBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -13,8 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ExoDestroyerBeamStart : ModProjectile - { + public class ThanatosBeamStart : ModProjectile + { public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; public ref float Time => ref projectile.localAI[0]; public ref float LengthOfLaser => ref projectile.localAI[1]; @@ -24,39 +24,40 @@ namespace CalamityMod.Projectiles.Boss private int frameDrawn = 0; public override void SetStaticDefaults() - { - DisplayName.SetDefault("T Hanos Deathray"); + { + // Thanatos' mouth laser + DisplayName.SetDefault("Gamma Disintegration Beam"); } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.Calamity().canBreakPlayerDefense = true; projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft = 600; - cooldownSlot = 1; - } + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { + public override void SendExtraAI(BinaryWriter writer) + { writer.Write(frameDrawn); writer.Write(Time); writer.Write(LengthOfLaser); - } + } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { frameDrawn = reader.ReadInt32(); Time = reader.ReadSingle(); LengthOfLaser = reader.ReadSingle(); - } + } - public override void AI() - { + public override void AI() + { // Difficulty modes bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; @@ -83,17 +84,17 @@ namespace CalamityMod.Projectiles.Boss // Add the forwards offset, measured in pixels. projectile.position += hostNPCDirection * beamStartForwardsOffset; - Time++; - if (Time >= Lifetime) - { - projectile.Kill(); - return; - } + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } float scale = 2f; projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; - if (projectile.scale > scale) - projectile.scale = scale; + if (projectile.scale > scale) + projectile.scale = scale; projectile.rotation = ThingToAttachTo.velocity.ToRotation(); projectile.velocity = projectile.rotation.ToRotationVector2(); @@ -101,19 +102,19 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation = ThingToAttachTo.velocity.ToRotation() - MathHelper.PiOver2; float arraySize = 3f; - Vector2 samplingPoint = projectile.Center; - float[] samples = new float[(int)arraySize]; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 3600f, samples); - float laserLength = 0f; - for (int i = 0; i < samples.Length; i++) - { - laserLength += samples[i]; - } - laserLength /= arraySize; + Vector2 samplingPoint = projectile.Center; + float[] samples = new float[(int)arraySize]; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 3600f, samples); + float laserLength = 0f; + for (int i = 0; i < samples.Length; i++) + { + laserLength += samples[i]; + } + laserLength /= arraySize; - // Fire laser through walls at max length if target cannot be seen - if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) - laserLength = 3600f; + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) + laserLength = 3600f; float amount = 0.5f; LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f; Vector2 fireFrom = ThingToAttachTo.Center + velocity * distanceBetweenProjectiles; int projectileAmt = (int)(LengthOfLaser / distanceBetweenProjectiles); - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = projectile.GetProjectileDamage(ThingToAttachTo.type); for (int i = 0; i < projectileAmt; i++) { @@ -147,38 +148,38 @@ namespace CalamityMod.Projectiles.Boss int dustType = (int)CalamityDusts.Brimstone; Vector2 dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f); for (int i = 0; i < 2; i++) - { - float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; - float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); - int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.7f; - } + { + float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult); + int dust = Dust.NewDust(dustPos, 0, 0, dustType, dustVel.X, dustVel.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } - if (Main.rand.NextBool(5)) - { - Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); + if (Main.rand.NextBool(5)) + { + Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f); Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); - } + Main.dust[dust].velocity.Y = -Math.Abs(Main.dust[dust].velocity.Y); + } - DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - } + DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.velocity == Vector2.Zero) - return false; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; Texture2D beamStart = Main.projectileTexture[projectile.type]; - Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamMiddle"); - Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamEnd"); + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd"); float drawLength = LengthOfLaser; - Color color = new Color(250, 100, 100, 0); + Color color = new Color(250, 100, 100, 0); if (Time % 5 == 0) { @@ -189,25 +190,25 @@ namespace CalamityMod.Projectiles.Boss // Draw start of beam Vector2 vector = projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); + Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames); spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); // Draw middle of beam drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale; - Vector2 center = projectile.Center; + Vector2 center = projectile.Center; center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f; - if (drawLength > 0f) - { - float i = 0f; + if (drawLength > 0f) + { + float i = 0f; int middleFrameDrawn = frameDrawn; while (i + 1f < drawLength) - { + { Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); if (drawLength - i < rectangle.Height) - rectangle.Height = (int)(drawLength - i); + rectangle.Height = (int)(drawLength - i); - spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); middleFrameDrawn++; if (middleFrameDrawn >= maxFrames) @@ -216,47 +217,47 @@ namespace CalamityMod.Projectiles.Boss i += rectangle.Height * projectile.scale; center += projectile.velocity * rectangle.Height * projectile.scale; - rectangle.Y += beamMiddle.Height / maxFrames; - if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) - rectangle.Y = 0; - } - } + rectangle.Y += beamMiddle.Height / maxFrames; + if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames) + rectangle.Y = 0; + } + } // Draw end of beam - Vector2 vector2 = center - Main.screenPosition; + Vector2 vector2 = center - Main.screenPosition; sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames); spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + return false; + } - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); - } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (projHitbox.Intersects(targetHitbox)) - return true; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; - float collisionPoint = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint)) - return true; + float collisionPoint = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint)) + return true; - return false; - } + return false; + } - public override void OnHitPlayer(Player target, int damage, bool crit) - { + public override void OnHitPlayer(Player target, int damage, bool crit) + { target.AddBuff(ModContent.BuffType(), 360); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - } + } } diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.png b/Projectiles/Boss/ThanatosBeamStart.png similarity index 100% rename from Projectiles/Boss/ExoDestroyerBeamStart.png rename to Projectiles/Boss/ThanatosBeamStart.png diff --git a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs b/Projectiles/Boss/ThanatosBeamTelegraph.cs similarity index 97% rename from Projectiles/Boss/ExoDestroyerBeamTelegraph.cs rename to Projectiles/Boss/ThanatosBeamTelegraph.cs index 1a120d317a..8740b4e632 100644 --- a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs +++ b/Projectiles/Boss/ThanatosBeamTelegraph.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ExoDestroyerBeamTelegraph : ModProjectile + public class ThanatosBeamTelegraph : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public const int Lifetime = 180; public const float TelegraphWidth = 3600f; public const float BeamPosOffset = 16f; - public override void SetStaticDefaults() => DisplayName.SetDefault("Telegraph"); + public override void SetStaticDefaults() => DisplayName.SetDefault("Gamma Disintegration Beam Telegraph"); public override void SetDefaults() { diff --git a/Projectiles/Boss/ExoDestroyerLaser.cs b/Projectiles/Boss/ThanatosLaser.cs similarity index 66% rename from Projectiles/Boss/ExoDestroyerLaser.cs rename to Projectiles/Boss/ThanatosLaser.cs index 7b2f176d9a..cb06c05a64 100644 --- a/Projectiles/Boss/ExoDestroyerLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -12,58 +12,58 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ExoDestroyerLaser : ModProjectile - { - public float TelegraphDelay - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } + public class ThanatosLaser : ModProjectile + { + public float TelegraphDelay + { + get => 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 TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; public const float LaserVelocity = 10f; public override void SetStaticDefaults() - { - DisplayName.SetDefault("T Hanos Beam"); + { + DisplayName.SetDefault("Exo Pulse Laser"); Main.projFrames[projectile.type] = 4; } - public override void SetDefaults() - { + 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; + 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); + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(Destination); writer.WriteVector2(Velocity); } - public override void ReceiveExtraAI(BinaryReader reader) - { + public override void ReceiveExtraAI(BinaryReader reader) + { Destination = reader.ReadVector2(); Velocity = reader.ReadVector2(); } - public override void AI() - { + 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) @@ -154,20 +154,20 @@ namespace CalamityMod.Projectiles.Boss // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) - { - if (projectile.alpha > 0) - projectile.alpha -= 25; - if (projectile.alpha < 0) - projectile.alpha = 0; + { + 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) - { + // 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; - } + projectile.netUpdate = true; + } // Direction and rotation. if (projectile.velocity.X < 0f) @@ -181,8 +181,8 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); } } - else if (Destination == Vector2.Zero) - { + else if (Destination == Vector2.Zero) + { // Set start of telegraph to the npc center. projectile.Center = ThingToAttachTo.Center; @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Boss // Set velocity to zero. projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; + projectile.netUpdate = true; // Direction and rotation. if (projectile.velocity.X < 0f) @@ -241,24 +241,24 @@ namespace CalamityMod.Projectiles.Boss } } - TelegraphDelay++; - } + TelegraphDelay++; + } - public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; - public override void OnHitPlayer(Player target, int damage, bool crit) - { + 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) - { + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { // If Artemis is the owner. bool artemisIsOwner = ThingToAttachTo.type == ModContent.NPCType(); @@ -271,27 +271,27 @@ namespace CalamityMod.Projectiles.Boss return false; } - Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + 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); + 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); + 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(artemisIsOwner ? Color.Orange : Color.Red, artemisIsOwner ? Color.OrangeRed : Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. - Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + 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 colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); - colorOuter *= 0.6f; - colorInner *= 0.6f; + 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; - } - } + 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/ExoDestroyerLaser.png b/Projectiles/Boss/ThanatosLaser.png similarity index 100% rename from Projectiles/Boss/ExoDestroyerLaser.png rename to Projectiles/Boss/ThanatosLaser.png diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 84439115a3..56e32d5c35 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -807,19 +807,19 @@ 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[] { 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 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, { 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[] { 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[] { 500, 752, 788, 808, 1182 } },