diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 13bbdbaa26..68f38c70f9 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -3545,7 +3545,7 @@ namespace CalamityMod.NPCs // Float above target if (npc.ai[1] == 0f) { - npc.damage = npc.defDamage; + npc.damage = lifeRatio > 0.99f ? 0 : npc.defDamage; calamityGlobalNPC.newAI[1] += 1f; float phaseChangeRateBoost = death ? 3f : 3f * (1f - lifeRatio); @@ -3721,6 +3721,15 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] != 0f) yMultiplier = calamityGlobalNPC.newAI[0]; + // Inflict 0 damage for 3 seconds after spawning + if (calamityGlobalNPC.newAI[1] < 180f) + { + calamityGlobalNPC.newAI[1] += 1f; + npc.damage = 0; + } + else + npc.damage = npc.defDamage; + npc.spriteDirection = -(int)npc.ai[0]; if (Main.npc[(int)npc.ai[1]].ai[3] == -60f) @@ -4563,7 +4572,7 @@ namespace CalamityMod.NPCs } // Fire lasers - if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 80f && !flyAtTarget) + if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 160f && !flyAtTarget) { // Laser rate of fire int shootTime = 4 + (death ? 2 : (int)Math.Ceiling(2f * (1f - lifeRatio))); @@ -4581,19 +4590,8 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - // Base laser speed on player movement speed - float laserSpeedBoost = Math.Abs(player.velocity.X); - if (Math.Abs(player.velocity.X) < Math.Abs(player.velocity.Y)) - laserSpeedBoost = Math.Abs(player.velocity.Y); - - // Put limits on laser speed - float projectileSpeed = 2f + laserSpeedBoost; - if (projectileSpeed < 7f) - projectileSpeed = 7f; - if (projectileSpeed > 10f) - projectileSpeed = 10f; - - // Increase laser speed as health drops + // Laser speed + float projectileSpeed = 4f; if (phase2) projectileSpeed += 0.25f; if (phase3) @@ -4601,63 +4599,53 @@ namespace CalamityMod.NPCs if (CalamityWorld.bossRushActive) projectileSpeed *= 1.25f; - // Count homing lasers - int homingLaserLimit = death ? 3 : 2; - int homingLasersActive = 0; - bool shouldFireHomingLaser = true; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].type == ModContent.ProjectileType()) - homingLasersActive++; - - if (homingLasersActive >= homingLaserLimit) - { - shouldFireHomingLaser = false; - break; - } - } - // Set projectile damage and type, set projectile to saucer scrap if probe has been launched - int damage = 23; + int damage = death ? 25 : 23; int projectileType = ProjectileID.DeathLaser; + float laserSpawnDistance = 5f; if (npc.ai[2] == 0f || Main.rand.NextBool(2)) { - if ((phase3 && shouldFireHomingLaser) || calamityGlobalNPC.newAI[2] > 0f) + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) + { + case 0: + case 1: + break; + case 2: + damage += 2; + projectileType = ModContent.ProjectileType(); + break; + case 3: + damage += 4; + projectileType = ModContent.ProjectileType(); + break; + } + + if (calamityGlobalNPC.newAI[2] > 0f) { damage += 4; - projectileType = ModContent.ProjectileType(); + projectileType = ModContent.ProjectileType(); + laserSpawnDistance = 10f; } } else projectileType = ProjectileID.SaucerScrap; - if (death) - damage += 2; - // Get target vector - Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); - float num6 = player.position.X + player.width * 0.5f - vector.X; - float num7 = player.position.Y + player.height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt(num6 * num6 + num7 * num7); - num8 = projectileSpeed / num8; - num6 *= num8; - num7 *= num8; - vector.X += num6 * 5f; - vector.Y += num7 * 5f; + Vector2 projectileVelocity = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * projectileSpeed; if (projectileType == ProjectileID.SaucerScrap) - { - num6 *= 0.5f; - num7 *= 0.5f; - } + projectileVelocity *= 0.5f; + + Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; // Shoot projectile and set timeLeft if not a homing laser/metal scrap so lasers don't last for too long - int proj = Projectile.NewProjectile(vector.X, vector.Y, num6, num7, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.Center, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); if (projectileType == ProjectileID.SaucerScrap) Main.projectile[proj].timeLeft = 480; - else if (projectileType != ModContent.ProjectileType()) - Main.projectile[proj].timeLeft = 300; + else + Main.projectile[proj].timeLeft = 600; npc.netUpdate = true; } @@ -6832,6 +6820,13 @@ namespace CalamityMod.NPCs bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; npc.chaseable = allArmsDead; + // Inflict 0 damage for 3 seconds after spawning + if (calamityGlobalNPC.newAI[2] < 180f) + { + calamityGlobalNPC.newAI[2] += 1f; + npc.damage = 0; + } + // Set stats if (npc.ai[1] == 5f) npc.damage = 0; @@ -7398,8 +7393,18 @@ namespace CalamityMod.NPCs sawAlive = true; } - // Phase 1 - if (npc.ai[2] == 0f) + // Inflict 0 damage for 3 seconds after spawning + bool dontAttack = npc.Calamity().newAI[2] < 180f; + if (dontAttack) + { + npc.Calamity().newAI[2] += 1f; + npc.damage = 0; + } + else + npc.damage = npc.defDamage; + + // Phase 1 + if (npc.ai[2] == 0f) { // Despawn if head is despawning if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) @@ -7471,7 +7476,7 @@ namespace CalamityMod.NPCs float num508 = (float)Math.Sqrt(num506 * num506 + num507 * num507); npc.rotation = (float)Math.Atan2(num507, num506) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) npc.localAI[0] += 1f; @@ -7563,7 +7568,7 @@ namespace CalamityMod.NPCs num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); npc.rotation = (float)Math.Atan2(num514, num513) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { // Fire laser every 1.5 seconds (change this as each arm dies to fire more aggressively) npc.localAI[0] += 1f; @@ -7634,7 +7639,17 @@ namespace CalamityMod.NPCs sawAlive = true; } - bool fireSlower = false; + // Inflict 0 damage for 3 seconds after spawning + bool dontAttack = npc.Calamity().newAI[2] < 180f; + if (dontAttack) + { + npc.Calamity().newAI[2] += 1f; + npc.damage = 0; + } + else + npc.damage = npc.defDamage; + + bool fireSlower = false; if (laserAlive) { // If laser is firing ring of lasers @@ -7743,7 +7758,7 @@ namespace CalamityMod.NPCs float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); npc.rotation = (float)Math.Atan2(num493, num492) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { // Fire rocket every 2 seconds (change this as each arm dies to fire more aggressively) npc.localAI[0] += 1f; @@ -7815,7 +7830,7 @@ namespace CalamityMod.NPCs num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); npc.rotation = (float)Math.Atan2(num500, num499) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) { // Fire rockets every 2 seconds (change this as each arm dies to fire more aggressively) npc.localAI[0] += 1f; @@ -7905,8 +7920,17 @@ namespace CalamityMod.NPCs sawAlive = true; } - // Return to the head - if (npc.ai[2] == 99f) + // Inflict 0 damage for 3 seconds after spawning + if (npc.Calamity().newAI[2] < 180f) + { + npc.Calamity().newAI[2] += 1f; + npc.damage = 0; + } + else + npc.damage = npc.defDamage; + + // Return to the head + if (npc.ai[2] == 99f) { if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { @@ -8210,7 +8234,16 @@ namespace CalamityMod.NPCs viceAlive = true; } - if (npc.ai[2] == 99f) + // Inflict 0 damage for 3 seconds after spawning + if (npc.Calamity().newAI[2] < 180f) + { + npc.Calamity().newAI[2] += 1f; + npc.damage = 0; + } + else + npc.damage = npc.defDamage; + + if (npc.ai[2] == 99f) { if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 31b4e442f1..6b9221df82 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -727,10 +727,19 @@ namespace CalamityMod.NPCs.Leviathan public override void FindFrame(int frameHeight) { + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) + { + texture = Main.npcTexture[npc.type]; + } + else + { + texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); + } int horizontalFrameCount = 2; int verticalFrameCount = 3; - int width = 2022 / horizontalFrameCount; - int height = 1458 / verticalFrameCount; + int width = texture.Width / horizontalFrameCount; + int height = texture.Height / verticalFrameCount; int timeBetweenFrames = 8; if (!initialised) diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index df7745a0f4..87ce3740b5 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -101,14 +101,16 @@ namespace CalamityMod.NPCs.SlimeGod if (Vector2.Distance(player.Center, vector) > 5400f) { - npc.position.X = (float)(player.Center.X / 16) * 16f - (float)(npc.width / 2); - npc.position.Y = (float)(player.Center.Y / 16) * 16f - (float)(npc.height / 2) - 150f; + npc.position.X = player.Center.X / 16 * 16f - (npc.width / 2); + npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + + if (npc.life <= npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { Main.PlaySound(SoundID.NPCDeath1, npc.position); - Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); npc.active = false; @@ -226,12 +228,12 @@ namespace CalamityMod.NPCs.SlimeGod float num1880 = CalamityWorld.bossRushActive ? 12f : 3f; if (revenge) { - float moveBoost = death ? 20f : 40f * (1f - (float)npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 4f * (1f - (float)npc.life / (float)npc.lifeMax); + float moveBoost = death ? 20f : 40f * (1f - npc.life / (float)npc.lifeMax); + float speedBoost = death ? 2f : 4f * (1f - npc.life / (float)npc.lifeMax); num1879 -= moveBoost; num1880 += speedBoost; } - float num1881 = 7f; + float num1881 = 5f; if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { num1881 += 2f; @@ -247,7 +249,7 @@ namespace CalamityMod.NPCs.SlimeGod } npc.ai[1] = 0f; npc.velocity.Y -= num1881; - npc.velocity.X = num1880 * (float)npc.direction; + npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; } } else @@ -265,7 +267,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += (death ? 1f : 2f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.ai[2] += death ? 1f : 2f * (1f - npc.life / (float)npc.lifeMax); } if (npc.ai[2] >= 420f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -342,13 +344,13 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 18f : 12f; + vector272 *= (CalamityWorld.bossRushActive ? 18f : 10f) + distanceSpeedBoost; npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } else if (npc.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + (float)npc.height >= player.position.Y; + bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[2] = 1f; @@ -374,9 +376,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) + float velocityLimit = CalamityWorld.bossRushActive ? 20f : 14f; + if (npc.velocity.Y > velocityLimit) { - npc.velocity.Y = 16f; + npc.velocity.Y = velocityLimit; } } else @@ -395,18 +398,18 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.noGravity = true; Vector2 value74 = player.Center - vector; - value74.Y -= 4f; - if (value74.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + value74.Y -= 40f; + if (value74.Length() < 320f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; } - if (value74.Length() > 20f) + if (value74.Length() > 100f) { value74.Normalize(); - value74 *= CalamityWorld.bossRushActive ? 22f : 14f; + value74 *= (CalamityWorld.bossRushActive ? 20f : 10f) + distanceSpeedBoost; } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; @@ -421,52 +424,53 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.ai[1] > 5f) { npc.ai[1] = 0f; - npc.velocity.Y -= 4f; - if (player.position.Y + (float)player.height < vector.Y) + npc.velocity.Y -= 3f; + if (player.position.Y + player.height < vector.Y) { - npc.velocity.Y -= 1.25f; + npc.velocity.Y -= 1.2f; } - if (player.position.Y + (float)player.height < vector.Y - 40f) + if (player.position.Y + player.height < vector.Y - 40f) { - npc.velocity.Y -= 1.5f; + npc.velocity.Y -= 1.4f; } - if (player.position.Y + (float)player.height < vector.Y - 80f) + if (player.position.Y + player.height < vector.Y - 80f) { - npc.velocity.Y -= 1.75f; + npc.velocity.Y -= 1.7f; } - if (player.position.Y + (float)player.height < vector.Y - 120f) + if (player.position.Y + player.height < vector.Y - 120f) { npc.velocity.Y -= 2f; } - if (player.position.Y + (float)player.height < vector.Y - 160f) + if (player.position.Y + player.height < vector.Y - 160f) { - npc.velocity.Y -= 2.25f; + npc.velocity.Y -= 2.2f; } - if (player.position.Y + (float)player.height < vector.Y - 200f) + if (player.position.Y + player.height < vector.Y - 200f) { - npc.velocity.Y -= 2.5f; + npc.velocity.Y -= 2.4f; } if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { npc.velocity.Y -= 2f; } - npc.velocity.X = (float)((CalamityWorld.bossRushActive ? 22 : 14) * npc.direction); + npc.velocity.X = ((CalamityWorld.bossRushActive ? 20f : 10f) + distanceSpeedBoost) * npc.direction; npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) + float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { - npc.velocity.X = -8f; + npc.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < 8f) + if (npc.direction > 0 && npc.velocity.X < velocityLimit) { - npc.velocity.X = 8f; + npc.velocity.X = velocityLimit; } } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + if (npc.ai[2] >= 2f && npc.velocity.Y == 0f) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 6c101f0ada..71bda48871 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -744,7 +744,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.VortexDebuff, 240, true); + player.AddBuff(BuffID.VortexDebuff, 180, true); if (CalamityWorld.revenge) { player.AddBuff(ModContent.BuffType(), 120, true); diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index aac5ad87ca..db2eef5a5c 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -104,14 +104,16 @@ namespace CalamityMod.NPCs.SlimeGod if (Vector2.Distance(player.Center, vector) > 5400f) { - npc.position.X = (float)(player.Center.X / 16) * 16f - (float)(npc.width / 2); - npc.position.Y = (float)(player.Center.Y / 16) * 16f - (float)(npc.height / 2) - 150f; + npc.position.X = player.Center.X / 16 * 16f - (npc.width / 2); + npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + + if (npc.life <= npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { Main.PlaySound(SoundID.NPCDeath1, npc.position); - Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); NPC.NewNPC((int)spawnAt.X - 30, (int)spawnAt.Y, ModContent.NPCType()); NPC.NewNPC((int)spawnAt.X + 30, (int)spawnAt.Y, ModContent.NPCType()); npc.active = false; @@ -239,12 +241,12 @@ namespace CalamityMod.NPCs.SlimeGod float num1880 = CalamityWorld.bossRushActive ? 16f : 4f; if (revenge) { - float moveBoost = death ? 15f : 30f * (1f - (float)npc.life / (float)npc.lifeMax); - float speedBoost = death ? 3f : 6f * (1f - (float)npc.life / (float)npc.lifeMax); + float moveBoost = death ? 15f : 30f * (1f - npc.life / (float)npc.lifeMax); + float speedBoost = death ? 2f : 4f * (1f - npc.life / (float)npc.lifeMax); num1879 -= moveBoost; num1880 += speedBoost; } - float num1881 = 5f; + float num1881 = 4f; if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { num1881 += 2f; @@ -260,7 +262,7 @@ namespace CalamityMod.NPCs.SlimeGod } npc.ai[1] = 0f; npc.velocity.Y -= num1881; - npc.velocity.X = num1880 * (float)npc.direction; + npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; } } else @@ -278,7 +280,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += (death ? 1f : 2f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.ai[2] += death ? 1f : 2f * (1f - npc.life / (float)npc.lifeMax); } if (npc.ai[2] >= 360f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -354,13 +356,13 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 19f : 13f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + vector272 *= (CalamityWorld.bossRushActive ? 20f : 11f) + distanceSpeedBoost; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } else if (npc.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + (float)npc.height >= player.position.Y; + bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[2] = 1f; @@ -386,9 +388,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) + float velocityLimit = CalamityWorld.bossRushActive ? 20f : 14f; + if (npc.velocity.Y > velocityLimit) { - npc.velocity.Y = 16f; + npc.velocity.Y = velocityLimit; } } else @@ -407,19 +410,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.noGravity = true; Vector2 value74 = player.Center - vector; - value74.Y -= 4f; - if (value74.Length() < 300f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + value74.Y -= 40f; + if (value74.Length() < 320f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; } - if (value74.Length() > 20f) + if (value74.Length() > 100f) { value74.Normalize(); - value74 *= CalamityWorld.bossRushActive ? 23f : 15f; - } + value74 *= (CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost; + } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; } @@ -434,27 +437,27 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[1] = 0f; npc.velocity.Y -= 4f; - if (player.position.Y + (float)player.height < vector.Y) + if (player.position.Y + player.height < vector.Y) { npc.velocity.Y -= 1.25f; } - if (player.position.Y + (float)player.height < vector.Y - 40f) + if (player.position.Y + player.height < vector.Y - 40f) { npc.velocity.Y -= 1.5f; } - if (player.position.Y + (float)player.height < vector.Y - 80f) + if (player.position.Y + player.height < vector.Y - 80f) { npc.velocity.Y -= 1.75f; } - if (player.position.Y + (float)player.height < vector.Y - 120f) + if (player.position.Y + player.height < vector.Y - 120f) { npc.velocity.Y -= 2f; } - if (player.position.Y + (float)player.height < vector.Y - 160f) + if (player.position.Y + player.height < vector.Y - 160f) { npc.velocity.Y -= 2.25f; } - if (player.position.Y + (float)player.height < vector.Y - 200f) + if (player.position.Y + player.height < vector.Y - 200f) { npc.velocity.Y -= 2.5f; } @@ -462,20 +465,21 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity.Y -= 2f; } - npc.velocity.X = (float)((CalamityWorld.bossRushActive ? 23 : 15) * npc.direction); - npc.ai[2] += 1f; + npc.velocity.X = ((CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost) * npc.direction; + npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) + float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { - npc.velocity.X = -8f; + npc.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < 8f) + if (npc.direction > 0 && npc.velocity.X < velocityLimit) { - npc.velocity.X = 8f; + npc.velocity.X = velocityLimit; } } if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index f254feef31..d2d5223df3 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -106,6 +106,8 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + bool flag100 = false; bool hyperMode = npc.localAI[1] == 1f; if (CalamityGlobalNPC.slimeGodPurple != -1) @@ -217,15 +219,15 @@ namespace CalamityMod.NPCs.SlimeGod npc.velocity.X *= 0.8f; npc.ai[1] += 1f; float num1879 = 35f; - float num1880 = CalamityWorld.bossRushActive ? 21f : 7f; + float num1880 = CalamityWorld.bossRushActive ? 20f : 6f; if (revenge) { - float moveBoost = death ? 7f : 7f * (1f - (float)npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 2f * (1f - (float)npc.life / (float)npc.lifeMax); + float moveBoost = death ? 7f : 7f * (1f - npc.life / (float)npc.lifeMax); + float speedBoost = death ? 2f : 2f * (1f - npc.life / (float)npc.lifeMax); num1879 -= moveBoost; num1880 += speedBoost; } - float num1881 = 5f; + float num1881 = 4f; if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { num1881 += 2f; @@ -236,8 +238,8 @@ namespace CalamityMod.NPCs.SlimeGod num1880 *= 1.25f; npc.ai[1] = 0f; npc.velocity.Y -= num1881; - npc.velocity.X = num1880 * (float)npc.direction; - } + npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; + } } else { @@ -254,7 +256,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += (death ? 0.5f : 0.5f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.ai[2] += (death ? 0.5f : 0.5f * (1f - npc.life / (float)npc.lifeMax)); } if (npc.ai[2] >= 180f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -330,13 +332,13 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 20f : 14f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + vector272 *= (CalamityWorld.bossRushActive ? 22f : 12f) + distanceSpeedBoost; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } else if (npc.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + (float)npc.height >= player.position.Y; + bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[2] = 1f; @@ -362,9 +364,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) + float velocityLimit = CalamityWorld.bossRushActive ? 22f : 16f; + if (npc.velocity.Y > velocityLimit) { - npc.velocity.Y = 16f; + npc.velocity.Y = velocityLimit; } } else @@ -383,19 +386,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.noGravity = true; Vector2 value74 = player.Center - vector; - value74.Y -= 4f; - if (value74.Length() < 250f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + value74.Y -= 40f; + if (value74.Length() < 280f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; } - if (value74.Length() > 10f) + if (value74.Length() > 50f) { value74.Normalize(); - value74 *= CalamityWorld.bossRushActive ? 24f : 16f; - } + value74 *= (CalamityWorld.bossRushActive ? 24f : 12f) + distanceSpeedBoost; + } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; } @@ -410,27 +413,27 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[1] = 0f; npc.velocity.Y -= 4f; - if (player.position.Y + (float)player.height < vector.Y) + if (player.position.Y + player.height < vector.Y) { npc.velocity.Y -= 1.25f; } - if (player.position.Y + (float)player.height < vector.Y - 40f) + if (player.position.Y + player.height < vector.Y - 40f) { npc.velocity.Y -= 1.5f; } - if (player.position.Y + (float)player.height < vector.Y - 80f) + if (player.position.Y + player.height < vector.Y - 80f) { npc.velocity.Y -= 1.75f; } - if (player.position.Y + (float)player.height < vector.Y - 120f) + if (player.position.Y + player.height < vector.Y - 120f) { npc.velocity.Y -= 2f; } - if (player.position.Y + (float)player.height < vector.Y - 160f) + if (player.position.Y + player.height < vector.Y - 160f) { npc.velocity.Y -= 2.25f; } - if (player.position.Y + (float)player.height < vector.Y - 200f) + if (player.position.Y + player.height < vector.Y - 200f) { npc.velocity.Y -= 2.5f; } @@ -438,20 +441,21 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity.Y -= 2f; } - npc.velocity.X = (float)((CalamityWorld.bossRushActive ? 24 : 16) * npc.direction); - npc.ai[2] += 1f; + npc.velocity.X = ((CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost) * npc.direction; + npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) + float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { - npc.velocity.X = -8f; + npc.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < 8f) + if (npc.direction > 0 && npc.velocity.X < velocityLimit) { - npc.velocity.X = 8f; + npc.velocity.X = velocityLimit; } } if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 862e2d942c..bdadee4bc3 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -106,6 +106,8 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + bool flag100 = false; bool hyperMode = npc.localAI[1] == 1f; if (CalamityGlobalNPC.slimeGodRed != -1) @@ -213,12 +215,12 @@ namespace CalamityMod.NPCs.SlimeGod float num1880 = CalamityWorld.bossRushActive ? 16f : 5f; if (revenge) { - float moveBoost = death ? 10f : 10f * (1f - (float)npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 2f * (1f - (float)npc.life / (float)npc.lifeMax); + float moveBoost = death ? 10f : 10f * (1f - npc.life / (float)npc.lifeMax); + float speedBoost = death ? 2f : 2f * (1f - npc.life / (float)npc.lifeMax); num1879 -= moveBoost; num1880 += speedBoost; } - float num1881 = 7f; + float num1881 = 5f; if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) { num1881 += 2f; @@ -229,8 +231,8 @@ namespace CalamityMod.NPCs.SlimeGod num1880 *= 0.75f; npc.ai[1] = 0f; npc.velocity.Y -= num1881; - npc.velocity.X = num1880 * (float)npc.direction; - } + npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; + } } else { @@ -247,7 +249,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += (death ? 0.5f : 0.5f * (1f - (float)npc.life / (float)npc.lifeMax)); + npc.ai[2] += death ? 0.5f : 0.5f * (1f - npc.life / (float)npc.lifeMax); } if (npc.ai[2] >= 210f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -324,13 +326,13 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 19f : 13f; - npc.velocity = (npc.velocity * 5f + vector272) / 6f; + vector272 *= (CalamityWorld.bossRushActive ? 19f : 11f) + distanceSpeedBoost; + npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } else if (npc.ai[0] == 3.1f) { - bool atTargetPosition = npc.position.Y + (float)npc.height >= player.position.Y; + bool atTargetPosition = npc.position.Y + npc.height >= player.position.Y; if (npc.ai[2] == 0f && (atTargetPosition || npc.localAI[1] == 0f) && Collision.CanHit(vector, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[2] = 1f; @@ -356,9 +358,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 16f) + float velocityLimit = CalamityWorld.bossRushActive ? 22f : 16f; + if (npc.velocity.Y > velocityLimit) { - npc.velocity.Y = 16f; + npc.velocity.Y = velocityLimit; } } else @@ -377,19 +380,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.noGravity = true; Vector2 value74 = player.Center - vector; - value74.Y -= 4f; - if (value74.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + value74.Y -= 40f; + if (value74.Length() < 280f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; } - if (value74.Length() > 10f) + if (value74.Length() > 50f) { value74.Normalize(); - value74 *= CalamityWorld.bossRushActive ? 23f : 15f; - } + value74 *= (CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost; + } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; } @@ -403,52 +406,53 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.ai[1] > 5f) { npc.ai[1] = 0f; - npc.velocity.Y -= 4f; - if (player.position.Y + (float)player.height < vector.Y) - { - npc.velocity.Y -= 1.25f; - } - if (player.position.Y + (float)player.height < vector.Y - 40f) - { - npc.velocity.Y -= 1.5f; - } - if (player.position.Y + (float)player.height < vector.Y - 80f) - { - npc.velocity.Y -= 1.75f; - } - if (player.position.Y + (float)player.height < vector.Y - 120f) - { - npc.velocity.Y -= 2f; - } - if (player.position.Y + (float)player.height < vector.Y - 160f) - { - npc.velocity.Y -= 2.25f; - } - if (player.position.Y + (float)player.height < vector.Y - 200f) - { - npc.velocity.Y -= 2.5f; - } - if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) - { - npc.velocity.Y -= 2f; - } - npc.velocity.X = (float)((CalamityWorld.bossRushActive ? 23 : 15) * npc.direction); - npc.ai[2] += 1f; + npc.velocity.Y -= 3f; + if (player.position.Y + player.height < vector.Y) + { + npc.velocity.Y -= 1.2f; + } + if (player.position.Y + player.height < vector.Y - 40f) + { + npc.velocity.Y -= 1.4f; + } + if (player.position.Y + player.height < vector.Y - 80f) + { + npc.velocity.Y -= 1.7f; + } + if (player.position.Y + player.height < vector.Y - 120f) + { + npc.velocity.Y -= 2f; + } + if (player.position.Y + player.height < vector.Y - 160f) + { + npc.velocity.Y -= 2.2f; + } + if (player.position.Y + player.height < vector.Y - 200f) + { + npc.velocity.Y -= 2.4f; + } + if (!Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) + { + npc.velocity.Y -= 2f; + } + npc.velocity.X = ((CalamityWorld.bossRushActive ? 20f : 10f) + distanceSpeedBoost) * npc.direction; + npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - if (npc.direction < 0 && npc.velocity.X > -8f) + float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { - npc.velocity.X = -8f; + npc.velocity.X = -velocityLimit; } - if (npc.direction > 0 && npc.velocity.X < 8f) + if (npc.direction > 0 && npc.velocity.X < velocityLimit) { - npc.velocity.X = 8f; + npc.velocity.X = velocityLimit; } } - if (npc.ai[2] >= 3f && npc.velocity.Y == 0f) + if (npc.ai[2] >= 2f && npc.velocity.Y == 0f) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index a03037bcec..ce420fabfb 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Boss if (projectile.frame > 3) projectile.frame = 0; - if (projectile.timeLeft < 60) - projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + if (projectile.timeLeft < 30) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1140) / 60f), 0f, 1f); + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1170) / 30f), 0f, 1f); Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs new file mode 100644 index 0000000000..a547eebef0 --- /dev/null +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Boss +{ + public class DestroyerCursedLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cursed Laser"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.scale = 1.8f; + projectile.extraUpdates = 2; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); + if (projectile.alpha > 0) + { + projectile.alpha -= 125; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[1] = 1f; + } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.0025f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha < 200) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + return Color.Transparent; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Boss/DestroyerHomingLaser.png b/Projectiles/Boss/DestroyerCursedLaser.png similarity index 100% rename from Projectiles/Boss/DestroyerHomingLaser.png rename to Projectiles/Boss/DestroyerCursedLaser.png diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs new file mode 100644 index 0000000000..e8bc47ef58 --- /dev/null +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Boss +{ + public class DestroyerElectricLaser : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electric Laser"); + } + + public override void SetDefaults() + { + projectile.ignoreWater = true; + projectile.width = 4; + projectile.height = 4; + projectile.hostile = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.scale = 1.2f; + projectile.timeLeft = 600; + projectile.extraUpdates = 2; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + if (projectile.alpha > 0) + { + projectile.alpha -= 125; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[1] = 1f; + } + if (projectile.velocity.Length() < 18f) + { + projectile.velocity *= 1.0025f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha < 200) + { + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + return Color.Transparent; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Electrified, 60); + } + } +} diff --git a/Projectiles/Boss/DestroyerFrostLaser.png b/Projectiles/Boss/DestroyerElectricLaser.png similarity index 100% rename from Projectiles/Boss/DestroyerFrostLaser.png rename to Projectiles/Boss/DestroyerElectricLaser.png diff --git a/Projectiles/Boss/DestroyerFrostLaser.cs b/Projectiles/Boss/DestroyerFrostLaser.cs deleted file mode 100644 index 8e3e06ec70..0000000000 --- a/Projectiles/Boss/DestroyerFrostLaser.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -namespace CalamityMod.Projectiles.Boss -{ - public class DestroyerFrostLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frost Laser"); - } - - public override void SetDefaults() - { - projectile.ignoreWater = true; - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - aiType = ProjectileID.FrostBeam; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.light = 0.75f; - projectile.alpha = 255; - projectile.scale = 1.2f; - projectile.timeLeft = 600; - projectile.magic = true; - projectile.coldDamage = true; - projectile.extraUpdates = 1; - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.alpha < 200) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - return Color.Transparent; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (Main.rand.NextBool(5) && !target.Calamity().gState && !target.frozen && target.chilled) - target.AddBuff(ModContent.BuffType(), 20); - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(BuffID.Chilled, 120); - } - } -} diff --git a/Projectiles/Boss/DestroyerHomingLaser.cs b/Projectiles/Boss/DestroyerHomingLaser.cs deleted file mode 100644 index b1fa30dc76..0000000000 --- a/Projectiles/Boss/DestroyerHomingLaser.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class DestroyerHomingLaser : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 600; - projectile.scale = 1.8f; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (projectile.alpha > 0) - { - projectile.alpha -= 125; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.localAI[1] == 0f) - { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 180f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[0] += 1f; - if (projectile.ai[0] < 270f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.alpha < 200) - { - return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); - } - return Color.Transparent; - } - } -} diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 6b0ab9cac2..19c517dd69 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -29,42 +29,41 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D value = Main.projectileTexture[projectile.type]; - Vector2 origin = value.Size() / 2f; - float num = Main.GlobalTime % 10f / 10f; - Vector2 value2 = projectile.Center - Main.screenPosition; - float[] array = new float[15]; - float[] array2 = new float[15]; - float[] array3 = new float[15]; - float[] array4 = new float[15]; - float num2 = 0.5f; - int num3 = 210; - num2 = CalamityUtils.GetLerpValue(0f, 60f, projectile.timeLeft, clamped: true) * CalamityUtils.GetLerpValue(num3, num3 - 60, projectile.timeLeft, clamped: true); - float amount = CalamityUtils.GetLerpValue(0f, 60f, projectile.timeLeft, clamped: true) * CalamityUtils.GetLerpValue(num3, 90f, projectile.timeLeft, clamped: true); - amount = CalamityUtils.GetLerpValue(0.2f, 0.5f, amount, clamped: true); - float num4 = 800f / value.Width; - float num5 = num4 * 0.8f; - float num6 = (num4 - num5) / 15f; - float num7 = 30f; - float num8 = 300f; - Vector2 value3 = new Vector2(6f, 6f); + Texture2D texture = Main.projectileTexture[projectile.type]; + Vector2 origin = texture.Size() / 2f; + float time = Main.GlobalTime % 10f / 10f; + Vector2 drawPosition = projectile.Center - Main.screenPosition; + int drawnAmt = 30; + float[] posX = new float[drawnAmt]; + float[] posY = new float[drawnAmt]; + float[] hue = new float[drawnAmt]; + float[] size = new float[drawnAmt]; + int totalTime = 210; + float colorChangeAmt = CalamityUtils.GetLerpValue(0f, 60f, projectile.timeLeft, true) * CalamityUtils.GetLerpValue(totalTime, totalTime - 60, projectile.timeLeft, true); + float colorChangeAmt2 = CalamityUtils.GetLerpValue(0f, 60f, projectile.timeLeft, true) * CalamityUtils.GetLerpValue(totalTime, 90f, projectile.timeLeft, true); + colorChangeAmt2 = CalamityUtils.GetLerpValue(0.2f, 0.5f, colorChangeAmt2, true); + float sizeScale = 0.8f; + float sizeScalar = (1f - sizeScale) / drawnAmt; + float yPosOffset = 60f; + float xPosOffset = 400f; + Vector2 scale = new Vector2(6f, 6f); - for (int i = 0; i < 15; i++) + for (int i = 0; i < drawnAmt; i++) { - float num9 = (float)Math.Sin(num * ((float)Math.PI * 2f) + (float)Math.PI / 2f + i / 2f); + float timeScalar = (float)Math.Sin(time * MathHelper.TwoPi + (float)Math.PI / 2f + i / 2f); - array[i] = num9 * (num8 - i * 3f); + posX[i] = timeScalar * (xPosOffset - i * 3f); - array2[i] = (float)Math.Sin(num * ((float)Math.PI * 2f) * 2f + (float)Math.PI / 3f + i) * num7; - array2[i] -= i * 3f; + posY[i] = (float)Math.Sin(time * MathHelper.TwoPi * 2f + (float)Math.PI / 3f + i) * yPosOffset; + posY[i] -= i * 3f; - array3[i] = i / 15f * 2f + num; - array3[i] = (num9 * 0.5f + 0.5f) * 0.6f + num; + hue[i] = i / (float)drawnAmt * 2f + time; + hue[i] = (timeScalar * 0.5f + 0.5f) * 0.6f + time; - array4[i] = num5 + (i + 1) * num6; - array4[i] *= 0.3f; + size[i] = sizeScale + (i + 1) * sizeScalar; + size[i] *= 0.3f; - Color color = Main.hslToRgb(array3[i] % 1f, 1f, 0.5f) * num2 * amount; + Color color = Main.hslToRgb(hue[i] % 1f, 1f, 0.5f) * colorChangeAmt * colorChangeAmt2; bool underworld = projectile.ai[0] == 2f; if (Main.dayTime) @@ -99,9 +98,9 @@ namespace CalamityMod.Projectiles.Boss color.A = (byte)MathHelper.Lerp(0, color.A, amount2); } - float rotation = (float)Math.PI / 2f + num9 * ((float)Math.PI / 4f) * -0.3f + (float)Math.PI * i; + float rotation = MathHelper.PiOver2 + timeScalar * MathHelper.PiOver4 * -0.3f + (float)Math.PI * i; - spriteBatch.Draw(value, value2 + new Vector2(array[i], array2[i]), null, color, rotation, origin, new Vector2(array4[i], array4[i]) * value3, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPosition + new Vector2(posX[i], posY[i]), null, color, rotation, origin, new Vector2(size[i], size[i]) * scale, SpriteEffects.None, 0); } return false; diff --git a/Projectiles/Boss/HolyAura.png b/Projectiles/Boss/HolyAura.png index 4254c6a1d5..bec16a6412 100644 Binary files a/Projectiles/Boss/HolyAura.png and b/Projectiles/Boss/HolyAura.png differ diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index a913902aa2..e6e69c59f7 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.dayTime ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFire2"); + Texture2D texture2D13 = Main.dayTime ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFire2Night"); int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y6 = num214 * projectile.frame; Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index fa151dc770..c277a0d33f 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -43,7 +43,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override void Kill(int timeLeft) + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) { int num497 = 10; Main.PlaySound(SoundID.Item27, projectile.position); diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index bab1c3acbd..27a712eebd 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -27,9 +28,14 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity *= 0.99f; } - public override void Kill(int timeLeft) + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); + Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); Main.PlaySound(SoundID.Item27, projectile.position); float spread = 60f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 3aa809f122..a1e388dafc 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); + Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0f, 0.25f, 0.25f); if (projectile.ai[0] != 2f) projectile.aiStyle = 1; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.velocity.Y += 0.1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; if (projectile.velocity.Y > 6f) projectile.velocity.Y = 6f; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(200, 200, 200, projectile.alpha); + return new Color(255, 255, 255, projectile.alpha); } public override void Kill(int timeLeft) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 217d251a3c..5f8ee8092f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -171,7 +171,30 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { - if (projectile.type == ProjectileID.PoisonSeedPlantera) + if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) + { + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); + + if (projectile.alpha > 0) + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[1] = 1f; + } + + if (projectile.velocity.Length() < 18f) + projectile.velocity *= 1.0025f; + + return false; + } + + else if (projectile.type == ProjectileID.PoisonSeedPlantera) { projectile.frameCounter++; if (projectile.frameCounter > 1)