diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 31b519bd89..fa0bffc179 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -768,7 +768,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 400, 440, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, diff --git a/Gores/OldDuke/OldDukeToothBallGore.png b/Gores/OldDuke/OldDukeToothBallGore.png new file mode 100644 index 0000000000..3eea41f8a3 Binary files /dev/null and b/Gores/OldDuke/OldDukeToothBallGore.png differ diff --git a/Gores/OldDuke/OldDukeToothBallGore2.png b/Gores/OldDuke/OldDukeToothBallGore2.png new file mode 100644 index 0000000000..4ab294eb25 Binary files /dev/null and b/Gores/OldDuke/OldDukeToothBallGore2.png differ diff --git a/Gores/OldDuke/SulphurousSharkronGore.png b/Gores/OldDuke/SulphurousSharkronGore.png new file mode 100644 index 0000000000..47affdc9e2 Binary files /dev/null and b/Gores/OldDuke/SulphurousSharkronGore.png differ diff --git a/Gores/OldDuke/SulphurousSharkronGore2.png b/Gores/OldDuke/SulphurousSharkronGore2.png new file mode 100644 index 0000000000..d99a8b88bf Binary files /dev/null and b/Gores/OldDuke/SulphurousSharkronGore2.png differ diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 56d388a1cb..83ac5ece17 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - Projectile p = Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, player.whoAmI, l); + Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, player.whoAmI, l); } } } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 8cc1c43848..d6a3f53a1f 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -12,6 +12,8 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; namespace CalamityMod.NPCs.AstrumAureus { @@ -33,10 +35,11 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.GetNPCDamage(); NPC.width = 90; NPC.height = 60; - NPC.alpha = 255; + NPC.Opacity = 0f; NPC.defense = 10; - NPC.lifeMax = 3000; + NPC.lifeMax = 5000; NPC.knockBackResist = 0f; + NPC.dontTakeDamage = true; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; @@ -58,217 +61,157 @@ namespace CalamityMod.NPCs.AstrumAureus public override void AI() { - NPC.damage = 0; + // Force despawn if Ceaseless Void isn't active + if (CalamityGlobalNPC.astrumAureus < 0 || !Main.npc[CalamityGlobalNPC.astrumAureus].active) + { + NPC.active = false; + NPC.netUpdate = true; + return; + } - Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.6f, 0.25f, 0f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.6f * NPC.Opacity * NPC.scale, 0.25f * NPC.Opacity * NPC.scale, 0f); - NPC.rotation = Math.Abs(NPC.velocity.X) * (float)NPC.direction * 0.04f; + NPC.rotation = Math.Abs(NPC.velocity.X) * NPC.direction * 0.04f; NPC.spriteDirection = NPC.direction; - if (NPC.alpha > 0) + if (NPC.Opacity < 1f) { - NPC.alpha -= 5; - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) + NPC.Opacity += 0.01f; + + if (NPC.Opacity > 0.33f) + NPC.velocity *= 0.95f; + + if (NPC.Opacity >= 1f) { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 0.8f); + NPC.Opacity = 1f; + NPC.dontTakeDamage = false; + } + + for (int i = 0; i < 8; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; - num = num245; - } - } - - NPC.TargetClosest(); - - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - - if (lifeRatio <= 0.5f || Main.dayTime) - { - NPC.ai[1] += 1f; - NPC.dontTakeDamage = true; - Vector2 vector = Main.player[NPC.target].Center - NPC.Center; - Point point15 = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; - if (NPC.ai[1] > ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 600f : 300f)) - { - NPC.Calamity().newAI[0] += 1f; - NPC.scale = MathHelper.Lerp(1f, 2f, NPC.Calamity().newAI[0] / 45f); - } - if (vector.Length() < 60f || flag121 || NPC.Calamity().newAI[0] >= 45f) - { - NPC.dontTakeDamage = false; - CheckDead(); - NPC.life = 0; - return; - } - float num1372 = 18f; - Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); - float num1373 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector167.X; - float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; - - if (CalamityWorld.death || BossRushEvent.BossRushActive) - { - float pushVelocity = 0.5f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) - { - if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 320f) - { - if (NPC.position.X < Main.npc[i].position.X) - NPC.velocity.X = NPC.velocity.X - pushVelocity; - else - NPC.velocity.X = NPC.velocity.X + pushVelocity; - - if (NPC.position.Y < Main.npc[i].position.Y) - NPC.velocity.Y = NPC.velocity.Y - pushVelocity; - else - NPC.velocity.Y = NPC.velocity.Y + pushVelocity; - } - } - } - } } return; } - float num1446 = 7f; - int num1447 = 480; - if (NPC.localAI[1] == 1f) - { - NPC.localAI[1] = 0f; - if (Main.rand.NextBool(4)) - { - NPC.ai[0] = num1447; - } - } + NPC.TargetClosest(); - if (CalamityWorld.death || BossRushEvent.BossRushActive) + // Push away from each other + float pushVelocity = 0.5f; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 180f) + if (Main.npc[i].active) { - NPC.localAI[0] = 0f; - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) { - SoundEngine.PlaySound(SoundID.Item109, NPC.position); - float speed = 6f; - Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); - float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X; - float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, num6, num7, type, damage, 0f, Main.myPlayer); + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 160f) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X = NPC.velocity.X - pushVelocity; + else + NPC.velocity.X = NPC.velocity.X + pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y = NPC.velocity.Y - pushVelocity; + else + NPC.velocity.Y = NPC.velocity.Y + pushVelocity; + } } } } - Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); - Vector2 vector251 = Main.player[NPC.target].Center - value53; - bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - NPC.velocity = (NPC.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - NPC.velocity *= 0.98f; - } + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; - if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) - { - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); - NPC.velocity = Vector2.Zero; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } + // Phase 2 check + bool phase2 = lifeRatio <= 0.5f || Main.dayTime; - NPC.ai[0] += 1f; - if (NPC.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) + // Charge towards the target and explode after some time + int inertia = 30; + Vector2 vector = Main.player[NPC.target].Center - NPC.Center; + Vector2 vector2 = Main.npc[CalamityGlobalNPC.astrumAureus].Center - NPC.Center; + float distanceFromAureus = vector2.Length(); + float distanceFromTarget = vector.Length(); + float chargeVelocity = 8f; + if (phase2) { - NPC.ai[0] = 0f; - Point point12 = NPC.Center.ToTileCoordinates(); - Point point13 = Main.player[NPC.target].Center.ToTileCoordinates(); - int num1453 = 25; - int num1454 = 3; - int num1455 = 20; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 1000f) + inertia = 50; + chargeVelocity = 16f; + float engagePhase2GateValue = 60f; + float enlargeGateValue = engagePhase2GateValue + 300f; + + // Pause when phase 2 is triggered + NPC.ai[0] += 1f; + if (NPC.ai[0] < engagePhase2GateValue) { - flag106 = true; + NPC.velocity *= 0.95f; + return; } - while (!flag106 && num1457 < 100) + + // Emit dust and sound when phase 2 charging begins + if (NPC.ai[0] == engagePhase2GateValue) { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].HasUnactuatedTile) + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaExplosionSound, NPC.Center); + + for (int j = 0; j < 10; j++) { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].LiquidType == LiquidID.Lava) + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 1.66f; + if (Main.rand.NextBool(2)) { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - NPC.ai[2] = (float)num1458; - NPC.ai[3] = (float)num1459; - break; + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } + Main.dust[dust].noGravity = true; + } + + for (int k = 0; k < 20; k++) + { + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; + dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 1.33f; + Main.dust[dust].noGravity = true; } } - NPC.netUpdate = true; + + // Grow in size + float enlargeDuration = 180f; + if (NPC.ai[0] >= enlargeGateValue) + { + NPC.Calamity().newAI[0] += 1f; + NPC.scale = MathHelper.Lerp(1f, 2f, NPC.Calamity().newAI[0] / enlargeDuration); + NPC.width = (int)(90f * NPC.scale); + NPC.height = (int)(60f * NPC.scale); + } + + // Check if it can explode + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool explodeOnCollision = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; + bool explodeOnAureus = distanceFromAureus < 180f && !Main.dayTime; + if (vector.Length() < 60f || explodeOnCollision || explodeOnAureus || NPC.Calamity().newAI[0] >= enlargeDuration) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + return; + } } + + // Move towards the target + chargeVelocity += distanceFromTarget / 200f; + if (distanceFromTarget > chargeVelocity) + { + vector.Normalize(); + vector *= chargeVelocity; + } + NPC.velocity = (NPC.velocity * (inertia - 1) + vector) / inertia; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -278,15 +221,18 @@ namespace CalamityMod.NPCs.AstrumAureus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - if (NPC.Calamity().newAI[0] >= 45f) + if (NPC.Calamity().newAI[0] >= 180f) return false; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; + if (NPC.ai[0] >= 60f) + NPC.DrawBackglow(Color.Cyan with { A = 0 }, 2f + 8f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * (float)Math.PI * 2f) + 1f), spriteEffects, NPC.frame, screenPos); + Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 10; @@ -298,21 +244,21 @@ namespace CalamityMod.NPCs.AstrumAureus Color color38 = drawColor; color38 = Color.Lerp(color38, color36, amount9); color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) { @@ -320,9 +266,9 @@ namespace CalamityMod.NPCs.AstrumAureus { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } @@ -344,37 +290,11 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.frame.Y = frame * frameHeight; } - public override void HitEffect(int hitDirection, double damage) + public override void OnKill() { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - int debuffType = Main.getGoodWorld ? ModContent.BuffType() : ModContent.BuffType(); // move to zenith seed later - if (damage > 0) - player.AddBuff(debuffType, 180, true); - } - - public override bool CheckDead() - { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.damage = NPC.defDamage; - NPC.width = NPC.height = 432; - NPC.position.X = NPC.position.X - (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); // Split into a halo of projectiles in death mode if (CalamityWorld.death || BossRushEvent.BossRushActive) @@ -393,33 +313,63 @@ namespace CalamityMod.NPCs.AstrumAureus for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage2, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 200; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage2, 0f, Main.myPlayer); } } } - for (int num621 = 0; num621 < 30; num621++) + // Damage Aureus for a percentage of its HP if the spawn explodes on or near it + if (Main.netMode != NetmodeID.MultiplayerClient && (Main.npc[CalamityGlobalNPC.astrumAureus].Center - NPC.Center).Length() < 200f && !Main.dayTime) + Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), Main.npc[CalamityGlobalNPC.astrumAureus].Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Main.npc[CalamityGlobalNPC.astrumAureus].lifeMax / 200 * NPC.scale), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.astrumAureus].whoAmI); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); + + if (NPC.life <= 0) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) + SoundEngine.PlaySound(SoundID.Item14, NPC.position); + + NPC.position.X = NPC.position.X + NPC.width / 2; + NPC.position.Y = NPC.position.Y + NPC.height / 2; + NPC.damage = (int)(NPC.defDamage / 2 * NPC.scale); + NPC.width = NPC.height = (int)(216 * NPC.scale); + NPC.position.X = NPC.position.X - NPC.width / 2; + NPC.position.Y = NPC.position.Y - NPC.height / 2; + + for (int num621 = 0; num621 < 30; num621++) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; } - Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => NPC.Opacity == 1f; + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + int debuffType = Main.getGoodWorld ? ModContent.BuffType() : ModContent.BuffType(); // move to zenith seed later + if (damage > 0) + player.AddBuff(debuffType, 180, true); } } } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 9fc43e27d6..3ff32a7d79 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2434,6 +2434,8 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.astrumAureus = npc.whoAmI; + // Variables bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; @@ -2502,7 +2504,7 @@ namespace CalamityMod.NPCs if (Main.getGoodWorld) walkingVelocity *= 1.15f; - float walkingProjectileVelocity = walkingVelocity - (1.5f * enrageScale); + float walkingProjectileVelocity = walkingVelocity * 0.8f; // Direction npc.spriteDirection = (npc.direction > 0) ? 1 : -1; @@ -2879,17 +2881,18 @@ namespace CalamityMod.NPCs // The limit for how much Aureus can multiply its jump velocity float speedMultLimit = 1f; + // Maxes out when the player is a full 2000 pixels away from or above Aureus + float multiplier = 1f / 2000f; + // Increase Aureus jump velocity X if it's far enough away from the player float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); float distanceGateValue = 400f; bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; if (increaseJumpVelocityX) { - // Maxes out when the player is a full 1920 pixels away from Aureus - float multiplier = 1f / 1920f; - calamityGlobalNPC.newAI[1] = (distanceAwayFromTarget - distanceGateValue) * multiplier; - if (calamityGlobalNPC.newAI[1] > speedMultLimit) - calamityGlobalNPC.newAI[1] = speedMultLimit; + calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; + if (calamityGlobalNPC.newAI[0] > speedMultLimit) + calamityGlobalNPC.newAI[0] = speedMultLimit; } // Increase Aureus jump velocity Y if it's far enough above the player @@ -2897,17 +2900,15 @@ namespace CalamityMod.NPCs bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; if (increaseJumpVelocityY) { - // Maxes out when the player is a full 1080 pixels above Aureus - float multiplier = 1f / 1080f; - calamityGlobalNPC.newAI[0] = distanceBelowTarget * multiplier; - if (calamityGlobalNPC.newAI[0] > speedMultLimit) - calamityGlobalNPC.newAI[0] = speedMultLimit; + calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; + if (calamityGlobalNPC.newAI[1] > speedMultLimit) + calamityGlobalNPC.newAI[1] = speedMultLimit; } - float velocity = 24f; + float velocity = 20f; velocity += 6f * enrageScale; if (expertMode) - velocity += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); + velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); if (Main.getGoodWorld) velocity *= 1.15f; @@ -3022,7 +3023,7 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[2] = 0f; - float laserVelocity = death ? 7f : 6f; + float laserVelocity = death ? 6f : 5f; int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); @@ -3069,12 +3070,12 @@ namespace CalamityMod.NPCs npc.velocity.Y = -3f; float fallSpeed = 1.2f; - fallSpeed += 0.8f * enrageScale; + fallSpeed += 0.36f * enrageScale; if (expertMode) - fallSpeed += death ? 0.6f * (1f - lifeRatio) : 0.4f * (1f - lifeRatio); + fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); - if (calamityGlobalNPC.newAI[0] > 0f) - fallSpeed *= calamityGlobalNPC.newAI[0] + 1f; + if (calamityGlobalNPC.newAI[1] > 0f) + fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; npc.velocity.Y += fallSpeed; } @@ -3085,8 +3086,8 @@ namespace CalamityMod.NPCs float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; velocityXChange += 0.1f * enrageScale; - if (calamityGlobalNPC.newAI[1] > 0f) - velocityXChange *= calamityGlobalNPC.newAI[1] + 1f; + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; if (npc.direction < 0) npc.velocity.X -= velocityXChange; @@ -3094,12 +3095,12 @@ namespace CalamityMod.NPCs npc.velocity.X += velocityXChange; float velocityXCap = 12f; - velocityXCap += 8f * enrageScale; + velocityXCap += 3.6f * enrageScale; if (expertMode) - velocityXCap += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - if (calamityGlobalNPC.newAI[1] > 0f) - velocityXCap *= calamityGlobalNPC.newAI[1] + 1f; + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; float playerLocation = npc.Center.X - player.Center.X; int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; @@ -3127,7 +3128,7 @@ namespace CalamityMod.NPCs // Slow down npc.velocity.X *= 0.8f; - // Spawn slimes and start teleport + // Start teleport if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; @@ -3143,26 +3144,6 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) { - // Spawn slimes - bool spawnFlag = revenge; - if (NPC.CountNPCS(ModContent.NPCType()) > 1) - spawnFlag = false; - - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - - if (death) - { - int damageAmt = npc.lifeMax / 100; - npc.life -= damageAmt; - if (npc.life < 1) - npc.life = 1; - - npc.HealEffect(-damageAmt, true); - } - } - // Reset localAI and find a teleport destination npc.TargetClosest(); npc.localAI[1] = 0f; @@ -3260,17 +3241,25 @@ namespace CalamityMod.NPCs if (npc.alpha <= 0) { // Spawn slimes - bool spawnFlag = phase4; - if (NPC.CountNPCS(ModContent.NPCType()) > 1) + bool spawnFlag = expertMode; + if (NPC.CountNPCS(ModContent.NPCType()) >= 2) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + int slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[slime].velocity.Y = -10f; + Main.npc[slime].netUpdate = true; + if (revenge) + { + slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[slime].velocity.Y = -15f; + Main.npc[slime].netUpdate = true; + } if (death) { - int damageAmt = npc.lifeMax / 100; + int damageAmt = npc.lifeMax / 50; npc.life -= damageAmt; if (npc.life < 1) npc.life = 1; @@ -3315,8 +3304,8 @@ namespace CalamityMod.NPCs float gravity = 0.36f + 0.12f * enrageScale; float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; - if (calamityGlobalNPC.newAI[0] > 0f && !reduceFallSpeed) - maxFallSpeed *= calamityGlobalNPC.newAI[0] + 1f; + if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) + maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; if (Main.getGoodWorld && !reduceFallSpeed) { @@ -5701,6 +5690,11 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) calamityGlobalNPC.newAI[1] = 1f; + float alphaScale = (255 - npc.alpha) / 255f; + float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; + float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); + // Adjust stats calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; npc.defense = exhausted ? 0 : npc.defDefense; @@ -5775,19 +5769,21 @@ namespace CalamityMod.NPCs idlePhaseVelocity *= 0.25f; // Variables - int toothBallBelchPhaseTimer = bossRush ? 35 : death ? 90 : 120; - int toothBallBelchPhaseDivisor = bossRush ? 7 : death ? 18 : 24; + int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; + int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; + int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; + float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; int num9 = 120; int num10 = 180; int num12 = 30; - int num13 = bossRush ? 35 : death ? 90 : 120; - int toothBallSpinPhaseDivisor = bossRush ? 7 : death ? 18 : 24; - float spinTime = num13 / 2; + int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; + int num13 = maxToothBallBelches * toothBallSpinPhaseDivisor; + float spinTime = num13 / 2f; float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; float scaleFactor4 = Main.getGoodWorld ? 44f : 22f; // move to zenith seed later float num15 = MathHelper.TwoPi / spinTime; @@ -5901,8 +5897,8 @@ namespace CalamityMod.NPCs // Enrage if (biomeEnraged) { - toothBallBelchPhaseTimer = 30; - toothBallBelchPhaseDivisor = 6; + toothBallBelchPhaseTimer = 60; + toothBallBelchPhaseDivisor = 20; toothBallBelchPhaseAcceleration = 1f; toothBallBelchPhaseVelocity = 15f; goreVelocityX = 12f; @@ -5913,7 +5909,7 @@ namespace CalamityMod.NPCs idlePhaseVelocity = 20f; chargeTime = 25; chargeVelocity += 8f; - toothBallSpinPhaseDivisor = 6; + toothBallSpinPhaseDivisor = 24; toothBallSpinToothBallVelocity = 15f; npc.damage = npc.defDamage * 2; npc.defense = npc.defDefense * 3; @@ -6237,13 +6233,46 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) { - if (npc.ai[2] % 40f == 0f && npc.ai[2] != 0f) + if (npc.ai[2] != 0f) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; + Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; + Vector2 toothBallSpawnPos = new Vector2(vector6.X, vector6.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType()); + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * npc.velocity.Length(); + Main.npc[toothBall].netUpdate = true; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + dustID = (int)CalamityDusts.SulfurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } } @@ -6522,17 +6551,48 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) { - if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) + if (npc.ai[2] != 0f) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; + Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(vector10.X, vector10.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = Main.rand.Next(30, 181); + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = npc.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 30f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + dustID = (int)CalamityDusts.SulfurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } } @@ -6964,22 +7024,53 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) { - if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) + if (npc.ai[2] != 0f) SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; + Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(vector10.X, vector10.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = Main.rand.Next(30, 361); + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = npc.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 60f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + dustID = (int)CalamityDusts.SulfurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); + npc.velocity = npc.velocity.RotatedBy(-(double)num15 * npc.direction); npc.rotation -= num15 * npc.direction; npc.ai[2] += 1f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 597d0829f4..228dd51440 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -266,6 +266,7 @@ namespace CalamityMod.NPCs public static int calamitas = -1; public static int leviathan = -1; public static int siren = -1; + public static int astrumAureus = -1; public static int scavenger = -1; public static int energyFlame = -1; public static int doughnutBoss = -1; @@ -504,6 +505,7 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref catastrophe, NPCType()); ResetSavedIndex(ref calamitas, NPCType()); ResetSavedIndex(ref leviathan, NPCType()); + ResetSavedIndex(ref astrumAureus, NPCType()); ResetSavedIndex(ref siren, NPCType()); ResetSavedIndex(ref scavenger, NPCType()); ResetSavedIndex(ref energyFlame, NPCType()); diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index e1fa6609f6..56f9d198b7 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -1,23 +1,18 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using System; -using System.IO; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Events; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.NPCs.OldDuke { public class OldDukeToothBall : ModNPC { - bool spawnedProjectiles = false; public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -33,12 +28,11 @@ namespace CalamityMod.NPCs.OldDuke NPC.width = 40; NPC.height = 40; NPC.defense = 0; - NPC.lifeMax = 3750; + NPC.lifeMax = 8000; if (BossRushEvent.BossRushActive) { - NPC.lifeMax = 7500; + NPC.lifeMax = 16000; } - NPC.alpha = 255; NPC.knockBackResist = 0f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath11; @@ -50,20 +44,10 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToWater = false; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.dontTakeDamage); - writer.Write(spawnedProjectiles); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.dontTakeDamage = reader.ReadBoolean(); - spawnedProjectiles = reader.ReadBoolean(); - } - public override void AI() { + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.65f, 0.55f, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -71,9 +55,6 @@ namespace CalamityMod.NPCs.OldDuke NPC.rotation += NPC.velocity.X * 0.05f; - if (NPC.alpha > 0) - NPC.alpha -= 15; - NPC.TargetClosest(false); Player player = Main.player[NPC.target]; if (!player.active || player.dead) @@ -92,68 +73,72 @@ namespace CalamityMod.NPCs.OldDuke NPC.timeLeft = 600; Vector2 vector = player.Center - NPC.Center; - if (vector.Length() < 40f || NPC.ai[3] >= 900f) - { - NPC.dontTakeDamage = false; - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - return; - } - + float cannonballMovementGateValue = 120f; + float slowDownGateValue = cannonballMovementGateValue + 300f; + float dieGateValue = slowDownGateValue + 60f; NPC.ai[3] += 1f; - NPC.dontTakeDamage = NPC.ai[3] >= 600f ? false : true; - if (NPC.ai[3] >= 480f) + if (vector.Length() < 40f || NPC.ai[3] >= dieGateValue) { - NPC.velocity *= 0.985f; + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); return; } - float num1372 = death ? 14f : revenge ? 13f : 12f; + if (NPC.ai[3] < cannonballMovementGateValue) + { + Vector2 finalCannonballVelocity = new Vector2(NPC.ai[0], NPC.ai[1]); + if (NPC.velocity.Length() < finalCannonballVelocity.Length()) + { + NPC.velocity *= 1.01f; + if (NPC.velocity.Length() > finalCannonballVelocity.Length()) + { + NPC.velocity.Normalize(); + NPC.velocity *= finalCannonballVelocity.Length(); + } + } + + return; + } + + if (NPC.ai[3] > slowDownGateValue) + { + NPC.velocity *= 0.95f; + return; + } + + float velocity = death ? 14f : revenge ? 13f : 12f; if (expertMode) { - float speedUpMult = bossRush ? 0.015f : 0.01f; - num1372 += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; + float speedUpMult = bossRush ? 0.01f : 0.005f; + velocity += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; } Vector2 vector167 = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); - float num1376 = num1372 / num1375; + float num1376 = velocity / num1375; num1373 *= num1376; num1374 *= num1376; - NPC.ai[0] -= Main.rand.Next(6); - if (num1375 < 300f || NPC.ai[0] > 0f) + + NPC.ai[2] -= Main.rand.Next(6); + if (num1375 < 300f || NPC.ai[2] > 0f) { if (num1375 < 300f) - { - NPC.ai[0] = 100f; - } + NPC.ai[2] = 100f; + if (NPC.velocity.X < 0f) - { NPC.direction = -1; - } else - { NPC.direction = 1; - } + return; } - NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; - NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; - NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; - } + float inertia = 50f; + NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); float num1247 = bossRush ? 0.65f : 0.5f; for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++) @@ -185,6 +170,31 @@ namespace CalamityMod.NPCs.OldDuke if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = CalamityWorld.death ? 5 : CalamityWorld.revenge ? 4 : 3; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float velocity = 10f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255 * 0.1f, type, damage, 0f, Main.myPlayer, vector255.X, vector255.Y); + } + + if (Main.expertMode) + { + type = ModContent.ProjectileType(); + damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + } + } + if (Main.getGoodWorld) // move to zenith seed later { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -206,7 +216,7 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = ImmunityCooldownID.Bosses; - return NPC.alpha == 0; + return true; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -215,85 +225,48 @@ namespace CalamityMod.NPCs.OldDuke player.AddBuff(ModContent.BuffType(), 240); } - public override bool CheckDead() - { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); - - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = NPC.height = 96; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - Main.dust[num622].noGravity = true; - } - - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) - { - spawnedProjectiles = true; - int totalProjectiles = CalamityWorld.death ? 5 : CalamityWorld.revenge ? 4 : 3; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - float velocity = 10f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255 * 0.1f, type, damage, 0f, Main.myPlayer, vector255.X, vector255.Y); - } - - if (Main.expertMode) - { - type = ModContent.ProjectileType(); - damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); - } - } - - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - NPC.Opacity = 1f; - return true; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + + NPC.position.X = NPC.position.X + NPC.width / 2; + NPC.position.Y = NPC.position.Y + NPC.height / 2; + NPC.width = NPC.height = 96; + NPC.position.X = NPC.position.X - NPC.width / 2; + NPC.position.Y = NPC.position.Y - NPC.height / 2; + + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore2").Type, NPC.scale); } } } diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index 57cfc28d15..f6e07047e3 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -19,7 +19,6 @@ namespace CalamityMod.NPCs.OldDuke { public class SulphurousSharkron : ModNPC { - bool spawnedProjectiles = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Sharkron"); @@ -49,7 +48,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0f; - NPC.alpha = 255; + NPC.Opacity = 0f; NPC.noGravity = true; NPC.dontTakeDamage = true; NPC.noTileCollide = true; @@ -76,18 +75,18 @@ namespace CalamityMod.NPCs.OldDuke { writer.Write(NPC.dontTakeDamage); writer.Write(NPC.noGravity); - writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { NPC.dontTakeDamage = reader.ReadBoolean(); NPC.noGravity = reader.ReadBoolean(); - spawnedProjectiles = reader.ReadBoolean(); } public override void AI() { + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.7f * NPC.Opacity, 0.9f * NPC.Opacity, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -110,9 +109,9 @@ namespace CalamityMod.NPCs.OldDuke NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } - NPC.alpha -= 6; - if (NPC.alpha < 0) - NPC.alpha = 0; + NPC.Opacity += 0.025f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; // Fly towards Old Duke bool normalAI = NPC.ai[3] == 0f; @@ -121,12 +120,10 @@ namespace CalamityMod.NPCs.OldDuke bool upwardAI = NPC.ai[3] < 0f; float flyTowardTargetGateValue = bossRush ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; - float extraTime = bossRush ? 90f : death ? 100f : revenge ? 105f : expertMode ? 110f : 120f; + float extraTime = bossRush ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; float aiGateValue = flyTowardTargetGateValue + extraTime; - if (!normalAI) - aiGateValue -= extraTime * 0.3f; - float dieGateValue = aiGateValue + extraTime; - float fallDownGateValue = aiGateValue + extraTime * 0.5f; + float dieGateValue = aiGateValue + extraTime * 2f; + float fallDownGateValue = aiGateValue + extraTime; float maxVelocity = bossRush ? 26f : death ? 24f : revenge ? 23f : expertMode ? 22f : 20f; if (NPC.ai[0] == 0f) @@ -162,7 +159,7 @@ namespace CalamityMod.NPCs.OldDuke Vector2 vector17 = Main.player[NPC.target].Center - NPC.Center; vector17.Normalize(); vector17 *= scaleFactor2; - float inertia = bossRush ? 10f : death ? 13f : revenge ? 15f : expertMode ? 17f : 20f; + float inertia = bossRush ? 20f : death ? 23f : revenge ? 25f : expertMode ? 27f : 30f; NPC.velocity = (NPC.velocity * (inertia - 1f) + vector17) / inertia; NPC.velocity.Normalize(); NPC.velocity *= scaleFactor2; @@ -188,9 +185,8 @@ namespace CalamityMod.NPCs.OldDuke SoundEngine.PlaySound(NPC.DeathSound.GetValueOrDefault(), NPC.position); NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.checkDead(); - NPC.active = false; return; } @@ -231,6 +227,18 @@ namespace CalamityMod.NPCs.OldDuke int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + { + int spawnX = NPC.width / 2; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < 10; i++) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, + Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, damage, 0f, Main.myPlayer); + } + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -279,7 +287,7 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = ImmunityCooldownID.Bosses; - return NPC.alpha == 0; + return NPC.Opacity == 1f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -288,62 +296,49 @@ namespace CalamityMod.NPCs.OldDuke player.AddBuff(ModContent.BuffType(), 240); } - public override bool CheckDead() - { - SoundEngine.PlaySound(SoundID.NPCDeath12, NPC.position); - - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = NPC.height = 96; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity.X *= 2f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles && Main.getGoodWorld) - { - spawnedProjectiles = true; - int spawnX = NPC.width / 2; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - for (int i = 0; i < 10; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, damage, 0f, Main.myPlayer); - } - - return true; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.NPCDeath12, NPC.position); + + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = NPC.height = 96; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity.Y *= 6f; + Main.dust[num622].velocity.X *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity.Y *= 10f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity.X *= 2f; + } + + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore2").Type, NPC.scale); } } } diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index f44f153520..c6eae17e7a 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -58,12 +58,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - for (int num322 = 0; num322 < 2; num322++) + for (int i = 0; i < 2; i++) { - int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num323].noGravity = true; - Dust dust = Main.dust[num323]; - dust.velocity *= 0.3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; } } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index 5d3d053249..d0786f270e 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -24,29 +24,27 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 420; Projectile.alpha = 255; CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() { + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0.5f, 0.4f, 0f); + Projectile.alpha -= 50; if (Projectile.alpha < 0) Projectile.alpha = 0; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 15f) - { Projectile.velocity.Y += 0.1f; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } + if (Projectile.velocity.Y > 12f) + Projectile.velocity.Y = 12f; - Projectile.tileCollide = Projectile.timeLeft < 240; + Projectile.tileCollide = Projectile.timeLeft < 300; Projectile.rotation += Projectile.velocity.X * 0.1f; diff --git a/Projectiles/Boss/OldDukeToothBallSpike.cs b/Projectiles/Boss/OldDukeToothBallSpike.cs new file mode 100644 index 0000000000..06be773635 --- /dev/null +++ b/Projectiles/Boss/OldDukeToothBallSpike.cs @@ -0,0 +1,66 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class OldDukeToothBallSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void AI() + { + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0.45f, 0.35f, 0f); + + float finalVelocity = new Vector2(Projectile.ai[0], Projectile.ai[1]).Length(); + if (Projectile.velocity.Length() < finalVelocity) + Projectile.velocity *= 1.025f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Boss/OldDukeToothBallSpike.png b/Projectiles/Boss/OldDukeToothBallSpike.png new file mode 100644 index 0000000000..0e5a123113 Binary files /dev/null and b/Projectiles/Boss/OldDukeToothBallSpike.png differ diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs index a9f90bb186..6acad8257d 100644 --- a/Projectiles/Enemy/TrilobiteSpike.cs +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -1,9 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -26,14 +24,7 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - // Old Duke Tooth Ball spikes - if (Projectile.ai[0] != 0f && Projectile.ai[1] != 0f) - { - float finalVelocity = new Vector2(Projectile.ai[0], Projectile.ai[1]).Length(); - if (Projectile.velocity.Length() < finalVelocity) - Projectile.velocity *= 1.025f; - } - else if (Projectile.velocity.Y < 10f) + if (Projectile.velocity.Y < 10f) Projectile.velocity.Y += 0.1f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; @@ -47,12 +38,6 @@ namespace CalamityMod.Projectiles.Enemy target.AddBuff(ModContent.BuffType(), 120); } - public override bool PreDraw(ref Color lightColor) - { - Projectile.DrawProjectileWithBackglow(Color.White with { A = 0 }, lightColor, 4f); - return false; - } - public override void Kill(int timeLeft) { for (int i = 0; i <= 2; i++) diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index 84e7cadfb3..3790965fb1 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -26,6 +26,7 @@ namespace CalamityMod CalamityGlobalNPC.voidBoss = -1; CalamityGlobalNPC.energyFlame = -1; CalamityGlobalNPC.hiveMind = -1; + CalamityGlobalNPC.astrumAureus = -1; CalamityGlobalNPC.scavenger = -1; for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index ff2c89b83e..7bf9bf89ef 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -13,8 +13,10 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Chat; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -433,6 +435,19 @@ namespace CalamityMod return null; } + public static void DrawBackglow(this NPC npc, Color backglowColor, float backglowArea, SpriteEffects spriteEffects, Rectangle frame, Vector2 screenPos) + { + Texture2D texture = TextureAssets.Npc[npc.type].Value; + Vector2 drawPosition = npc.Center - screenPos; + Vector2 origin = frame.Size() * 0.5f; + Color backAfterimageColor = backglowColor * npc.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + } + /// /// Spawns Old Duke on a player. Only works server side, and only works if the player owns a fishing bobber.
/// Old Duke will spawn above the fishing bobber if one is found. diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index bd576e304d..092f203a32 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -1176,7 +1176,7 @@ namespace CalamityMod // Disable vanilla trying to merge these tiles automtaically. Main.tileMerge[myType][mergeType] = false; - // these all get null checked in the GetSimilarity and GetMerge functions + // These all get null checked in the GetSimilarity and GetMerge functions Tile tileLeft = Main.tile[x - 1, y]; Tile tileRight = Main.tile[x + 1, y]; Tile tileUp = Main.tile[x, y - 1]; @@ -1722,7 +1722,6 @@ namespace CalamityMod if (y < 0 || y >= Main.maxTilesY) return; - Tile tile = Main.tile[x, y]; bool forceSameUp = false; bool forceSameDown = false; bool forceSameLeft = false;