diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 1bce02f9cd..bb5ac445c0 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Events // A partially bright pale-ish cyan with a hint of yellow. public static readonly Color TextColor = new Color(115, 194, 147); - // Not readonly so that if anyone else wants to add stuff in here with their own mod, they can. + // Not a readonly collection so that if anyone else wants to add stuff in here with their own mod, they can. // The first value is the NPC type, the second is the value they're worth in the event. // The third value is whether the enemy can only spawn in water public static List<(int, int, bool)> PossibleEnemiesPreHM = new List<(int, int, bool)>() @@ -70,9 +70,12 @@ namespace CalamityMod.Events public static List PossibleMinibossesPolter = new List() { - ModContent.NPCType() + ModContent.NPCType(), + ModContent.NPCType() }; + public static readonly List AllMinibosses = PossibleMinibossesAS.Concat(PossibleMinibossesPolter).Distinct().ToList(); + public static bool AnyRainMinibosses { get diff --git a/Gores/AcidRain/CragmawMireP2Gore.png b/Gores/AcidRain/CragmawMireP2Gore.png new file mode 100644 index 0000000000..466a0e02e0 Binary files /dev/null and b/Gores/AcidRain/CragmawMireP2Gore.png differ diff --git a/Gores/AcidRain/CragmawMireP2Gore2.png b/Gores/AcidRain/CragmawMireP2Gore2.png new file mode 100644 index 0000000000..eac3fad97c Binary files /dev/null and b/Gores/AcidRain/CragmawMireP2Gore2.png differ diff --git a/Gores/AcidRain/CragmawMireP2Gore3.png b/Gores/AcidRain/CragmawMireP2Gore3.png new file mode 100644 index 0000000000..86ca2edba6 Binary files /dev/null and b/Gores/AcidRain/CragmawMireP2Gore3.png differ diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index b84ce9213d..21486d3c96 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Gun"); - Tooltip.SetDefault("Releases a stream of acid"); + Tooltip.SetDefault("Releases three streams of acid"); } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; item.UseSound = SoundID.Item13; item.autoReuse = true; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index ddecc972ae..38e2634ac8 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.useTurn = true; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; } diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index bf93870452..ee6d94767b 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; item.UseSound = SoundID.Item5; item.autoReuse = true; diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index a8bc644e8b..2febdbe250 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 0f; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; item.UseSound = SoundID.Item44; item.autoReuse = true; diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 29c6410dda..494f0ad7d2 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -101,7 +101,10 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 2 * (CalamityWorld.downedAquaticScourge ? 6 : 1), 1, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 1f / 20f); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge); + } } public override void FindFrame(int frameHeight) { diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 561c5138a1..25fc4f3028 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.AcidRain { npc.Calamity().DR = 0.5f; if (!player.wet) - npc.Calamity().DR = 0.9f; + npc.Calamity().DR = 0.8f; npc.HitSound = SoundID.NPCHit42; if (npc.ai[0] % 420f < 240f) { @@ -214,7 +214,7 @@ namespace CalamityMod.NPCs.AcidRain { if (npc.ai[0] % 600f == 20f) { - Projectile.NewProjectile(npc.Center, Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, 0, npc.whoAmI, npc.target); + Projectile.NewProjectile(npc.Center, Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.whoAmI, npc.target); } if (npc.ai[0] % 600f == 240f) { @@ -259,6 +259,12 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); } + if (npc.life <= 0) + { + Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore"), npc.scale); + Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore2"), npc.scale); + Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore3"), npc.scale); + } } public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index e286726d54..4859c7e6c1 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - npc.width = 58; + npc.width = 28; npc.height = 70; npc.damage = 0; diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs new file mode 100644 index 0000000000..e74be6b84f --- /dev/null +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -0,0 +1,418 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; + +namespace CalamityMod.NPCs.AcidRain +{ + public class NuclearTerror : ModNPC + { + public bool Walking = false; + public int AttackIndex = 0; + public int DelayTime = 0; + public float JumpTimer = 0f; + public Vector2 ShootPosition; + public static readonly int[] PhaseArray = new int[] + { + 2, 0, 1, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 1, 0, 2, 1 + }; + public const int AttackCycleTime = 520; + public const int SpecialAttackTime = 240; + public const float TeleportTime = 60f; + public const float TeleportFadeinTime = 10f; + public const float TeleportCooldown = 60f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Terror"); + Main.npcFrameCount[npc.type] = 14; + } + + public override void SetDefaults() + { + npc.width = 176; + npc.height = 138; + npc.aiStyle = aiType = -1; + + npc.lifeMax = 145720; + npc.defense = 50; + + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 20, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.Calamity().DR = 0.4f; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit56; + npc.DeathSound = SoundID.NPCDeath60; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(Walking); + writer.Write(AttackIndex); + writer.Write(DelayTime); + writer.Write(JumpTimer); + writer.WriteVector2(ShootPosition); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + Walking = reader.ReadBoolean(); + AttackIndex = reader.ReadInt32(); + DelayTime = reader.ReadInt32(); + JumpTimer = reader.ReadSingle(); + ShootPosition = reader.ReadVector2(); + } + public override void AI() + { + Lighting.AddLight(npc.Center, (npc.dontTakeDamage ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); + if (npc.dontTakeDamage) + return; + bool phase2 = npc.life / (float)npc.lifeMax < 0.5f; + if (DelayTime > 0) + { + DelayTime--; + npc.velocity.X *= 0.9f; + if (npc.velocity.Y < 18f) + { + npc.velocity.Y += 0.35f; + } + return; + } + if (npc.target < 0 || npc.target >= 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(false); + npc.netUpdate = true; + } + if (npc.ai[1] > -TeleportCooldown) + { + TeleportEffects(); + } + Player player = Main.player[npc.target]; + npc.defDamage = 170; + npc.damage = npc.dontTakeDamage ? 0 : npc.defDamage; + TeleportCheck(player); + npc.ai[0]++; + Walking = false; + // For teleporting if constantly spam-colliding + if (npc.collideX) + { + if (npc.localAI[0] > 0) + { + npc.localAI[1]++; + } + npc.localAI[0] = 20f; + } + if (npc.localAI[0] > 0) + { + npc.localAI[0]--; + } + if (npc.ai[0] % AttackCycleTime < 240f) + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X *= 0.8f; + if (JumpTimer++ >= 70f || !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.velocity.Y -= MathHelper.Clamp(Math.Abs(player.Center.Y - npc.Center.Y) / 12.5f, 8f, 18f); + npc.velocity.X = npc.DirectionTo(player.Center).X * 18f; + JumpTimer = 0f; + npc.netUpdate = true; + } + else + { + bool wasWalking = Walking; + if (wasWalking != Math.Abs(npc.velocity.X) > 4f) + { + Walking = Math.Abs(npc.velocity.X) > 4f; + npc.netUpdate = true; + } + if (npc.collideX) + { + JumpTimer = 50; // Force a jump the next frame to overcome the obstacle + npc.netUpdate = true; + } + else if (Math.Abs(player.Center.X - npc.Center.X) > 125f) + { + npc.velocity.X += Math.Sign(npc.DirectionTo(player.Center).X) * 3f; + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -28f, 28f); + } + else + { + npc.velocity.X *= 0.99f; + } + } + } + npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + } + else + { + if (npc.ai[0] % AttackCycleTime == 255f) + { + ShootPosition = player.Center; + npc.netUpdate = true; + npc.spriteDirection = (ShootPosition.X - npc.Center.X > 0).ToDirectionInt(); + } + switch (PhaseArray[AttackIndex]) + { + // Tightly packed, diverging bullets + case 0: + npc.velocity.X *= 0.9f; + if (((npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 20f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 32f) || + (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 50f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 62f) || + (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 80f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 92f) || + (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 110f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 122f) || + (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 140f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 152f)) && npc.ai[0] % 3f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float angle = (npc.ai[0] % AttackCycleTime - (AttackCycleTime - SpecialAttackTime + 20f)) % 12f / 12f * MathHelper.ToRadians(15f) - MathHelper.ToRadians(7.5f); + int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(ShootPosition).RotatedBy(angle) * 14f, ModContent.ProjectileType(), 48, 4f); + Main.projectile[idx].localAI[0] = angle; + } + Main.PlaySound(SoundID.NPCDeath13, npc.Center); + } + if (npc.ai[0] % AttackCycleTime >= (AttackCycleTime - SpecialAttackTime + 35f) && npc.ai[0] % 10f == 9f) + { + Projectile.NewProjectile(npc.Center, npc.DirectionTo(player.Center) * 12f, ModContent.ProjectileType(), 45, 3f); + } + break; + // Cone of bullets + case 1: + npc.velocity.X *= 0.9f; + if (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 35f && npc.ai[0] % 4f == 3f) + { + float angle = MathHelper.Lerp(MathHelper.ToRadians(35f), MathHelper.ToRadians(5f), (npc.ai[0] % AttackCycleTime - (AttackCycleTime - SpecialAttackTime + 35f)) / (SpecialAttackTime + 35f)); + Projectile.NewProjectile(npc.Center, npc.DirectionTo(player.Center).RotatedBy(angle) * 16f, ModContent.ProjectileType(), 50, 4.5f); + Projectile.NewProjectile(npc.Center, npc.DirectionTo(player.Center).RotatedBy(-angle) * 16f, ModContent.ProjectileType(), 50, 4.5f); + } + break; + // Shotgun bursts of bullets + case 2: + npc.velocity.X *= 0.9f; + if (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 35f && npc.ai[0] % 20f == 19f) + { + for (int i = 0; i < 3; i++) + { + float angle = MathHelper.Lerp(-0.5f, 0.5f, i / 3f); + Projectile.NewProjectile(npc.Center, npc.DirectionTo(ShootPosition).RotatedBy(angle) * 13f, ModContent.ProjectileType(), 47, 4f); + } + } + break; + } + if (npc.ai[0] % AttackCycleTime == AttackCycleTime - 1f) + { + DelayTime = phase2 ? 45 : 75; + AttackIndex++; + AttackIndex %= PhaseArray.Length; + } + } + } + public void TeleportCheck(Player player) + { + if (npc.ai[1] <= -TeleportCooldown) + { + if (npc.Distance(player.Center) > 2700f || + (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && npc.Distance(player.Center) > 900f) || + StuckOnPlatform(player) || + npc.wet || + npc.localAI[1] > 5f) + { + Point playerPositionTileCoords = player.position.ToTileCoordinates(); + Point npcPositionTileCoords = npc.position.ToTileCoordinates(); + int tries = 0; + int maxTeleportDistance = 20; + bool cannotTeleport = false; + while (!cannotTeleport && tries < 250) + { + tries++; + int x = Main.rand.Next(playerPositionTileCoords.X - maxTeleportDistance, playerPositionTileCoords.X + maxTeleportDistance); + int yStart = Main.rand.Next(playerPositionTileCoords.Y - maxTeleportDistance, playerPositionTileCoords.Y + maxTeleportDistance); + if (StuckOnPlatform(player)) + { + yStart = Main.rand.Next(playerPositionTileCoords.Y, playerPositionTileCoords.Y + 4 * maxTeleportDistance); + } + for (int y = yStart; y < playerPositionTileCoords.Y + maxTeleportDistance; y++) + { + if ((y < playerPositionTileCoords.Y - 12 || y > playerPositionTileCoords.Y + 12 || x < playerPositionTileCoords.X - 12 || x > playerPositionTileCoords.X + 12) + && (y < npcPositionTileCoords.Y - 8 || y > npcPositionTileCoords.Y + 8 || x < npcPositionTileCoords.X - 7 || x > npcPositionTileCoords.X + 7) + && CalamityUtils.ParanoidTileRetrieval(x, y).nactive()) + { + bool canTeleport = true; + if (CalamityUtils.ParanoidTileRetrieval(x, y - 1).lava()) + { + canTeleport = false; + } + if (canTeleport && + Main.tileSolid[CalamityUtils.ParanoidTileRetrieval(x, y).type] && + !Collision.SolidTiles(x - 12, x + 12, y - 7, y - 7)) + { + for (int dy = y - 5; dy <= y; dy++) + { + if (CalamityUtils.ParanoidTileRetrieval(x, dy).liquid > 0) + { + continue; + } + } + npc.ai[1] = TeleportTime; + npc.ai[2] = x; + npc.ai[3] = y - 3; + cannotTeleport = true; + npc.localAI[1] = 0f; + break; + } + } + } + } + npc.netUpdate = true; + } + } + } + public void TeleportEffects() + { + if (npc.ai[1] > TeleportTime) + npc.ai[1] = TeleportTime; + npc.ai[1]--; + if (npc.ai[1] >= 0f) + { + if (npc.ai[1] == 0f && npc.ai[2] != 0f && npc.ai[3] != 0f) + { + npc.position.X = npc.ai[2] * 16f - npc.width / 2 + 8f; + npc.position.Y = npc.ai[3] * 16f - npc.height; + npc.netUpdate = true; + npc.velocity = Vector2.Zero; + } + else + { + npc.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - npc.ai[1] / TeleportTime); + int totalDust = (int)(30 * npc.alpha / 255f); + for (int i = 0; i < totalDust; i++) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid); + dust.noGravity = true; + dust.velocity = npc.DirectionFrom(dust.position) * 2f; + dust.scale = 1.6f; + } + npc.velocity.X *= 0.95f; + if (npc.velocity.Y < 18f) + { + npc.velocity.Y += 0.35f; + } + } + return; + } + else if (npc.ai[1] >= -TeleportFadeinTime) + { + npc.alpha = (int)MathHelper.Lerp(255f, 0f, npc.ai[1] / -TeleportFadeinTime); + if (npc.ai[1] == -TeleportFadeinTime) + { + for (int i = 0; i < 48; i++) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid); + dust.noGravity = true; + dust.velocity = npc.DirectionFrom(dust.position) * Main.rand.NextFloat(2f, 3.6f); + dust.scale = 1.8f; + } + } + } + } + public bool StuckOnPlatform(Player player) + { + for (int i = 0; i < 18; i++) + { + Point bottom = (npc.Bottom + Vector2.UnitY * i).ToTileCoordinates(); + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).type] && player.Top.Y > npc.Bottom.Y + 48) + return true; + } + return false; + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.85f); + } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + int framesNeeded = npc.dontTakeDamage ? 7 : 6; + if (Walking) + { + framesNeeded = 8 - (int)Math.Ceiling(Math.Abs(npc.velocity.X) / 5f); // Walk faster the faster we're moving + } + if (npc.frameCounter >= framesNeeded) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0; + } + if (npc.dontTakeDamage) + { + if (npc.frame.Y < frameHeight * 8) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 16; i++) + { + int type = Main.rand.NextBool(4) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + float angle = MathHelper.TwoPi / 16f * i; + Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 11f), type, 48, 3f); + } + } + for (int i = 0; i < 60; i++) + { + Dust dust = Dust.NewDustDirect(npc.Center, 45, 45, (int)CalamityDusts.SulfurousSeaAcid); + dust.velocity = Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(4f, 15f); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(2f, 3f); + } + npc.frame.Y = frameHeight * 8; + } + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + { + npc.StrikeNPCNoInteraction(9999, 0f, 0); + } + } + else if (npc.frame.Y >= (Walking ? 8 : 4) * frameHeight) + { + npc.frame.Y = Walking ? 4 * frameHeight : 0; + } + } + public override bool CheckDead() + { + if (!npc.dontTakeDamage) + { + npc.active = true; + npc.life = 1; + npc.dontTakeDamage = true; + npc.velocity = Vector2.Zero; + npc.netUpdate = true; + return false; + } + return true; + } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } +} diff --git a/NPCs/AcidRain/NuclearTerror.png b/NPCs/AcidRain/NuclearTerror.png new file mode 100644 index 0000000000..1e815f2429 Binary files /dev/null and b/NPCs/AcidRain/NuclearTerror.png differ diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index b65e3837f0..593e0e6da1 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -114,6 +114,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles float originalVelocityDirection = projectile.velocity.ToRotation(); float originalVelocitySpeed = projectile.velocity.Length(); + // The motion moves in an imaginary circle, but the cane does not because it relies on + // its ai[0] X multiplier, giving it the "swiping" motion. Vector2 flatVelocity = Vector2.UnitX.RotatedBy(MathHelper.Pi + inverseAnimationCompletion * MathHelper.TwoPi) * new Vector2(originalVelocitySpeed, projectile.ai[0]); diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs index ed86848db2..baba926e2c 100644 --- a/Projectiles/Enemy/CragmawBeam.cs +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -54,9 +54,11 @@ namespace CalamityMod.Projectiles.Enemy if (!body.active) projectile.Kill(); - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + // Sometimes the beam would readjust to some other, weird angle. This fixes that. + if (projectile.velocity != -Vector2.UnitY) { projectile.velocity = -Vector2.UnitY; + projectile.netUpdate = true; } if (Main.npc[(int)projectile.ai[1]].active) @@ -64,11 +66,6 @@ namespace CalamityMod.Projectiles.Enemy projectile.Center = Main.npc[(int)projectile.ai[1]].Top + new Vector2(0f, 4f); } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - // How fat the laser is float laserSize = 1.6f; diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index 630a7e8b5b..ab1efa67da 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Enemy projectile.width = projectile.height = 12; projectile.alpha = 255; projectile.timeLeft = 420; + projectile.tileCollide = false; projectile.ignoreWater = true; } public override void SendExtraAI(BinaryWriter writer) @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Enemy projectile.Kill(); return; } - projectile.rotation = (Main.npc[(int)projectile.ai[0]].Top - Main.player[toTarget].Center + offsetDrawVector).ToRotation() + MathHelper.PiOver2; + projectile.rotation = (Main.npc[(int)projectile.ai[0]].Top - projectile.Center + offsetDrawVector).ToRotation() + MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { projectile.velocity = (projectile.velocity * 10f + projectile.DirectionTo(Main.player[toTarget].Center) * 9f) / 11f; diff --git a/Projectiles/Enemy/NuclearBulletLarge.cs b/Projectiles/Enemy/NuclearBulletLarge.cs new file mode 100644 index 0000000000..b5eb3a5dd5 --- /dev/null +++ b/Projectiles/Enemy/NuclearBulletLarge.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class NuclearBulletLarge : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 18; + projectile.hostile = true; + projectile.timeLeft = 240; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.25f); + projectile.rotation = projectile.velocity.ToRotation(); + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 0); + } + 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/Enemy/NuclearBulletLarge.png b/Projectiles/Enemy/NuclearBulletLarge.png new file mode 100644 index 0000000000..b2c3d24e61 Binary files /dev/null and b/Projectiles/Enemy/NuclearBulletLarge.png differ diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs new file mode 100644 index 0000000000..14b354b27f --- /dev/null +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class NuclearBulletMedium : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nuclear Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 12; + projectile.hostile = true; + projectile.timeLeft = 360; + projectile.tileCollide = true; + projectile.ignoreWater = true; + } + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.25f); + projectile.rotation = projectile.velocity.ToRotation(); + projectile.ai[0]++; + if (projectile.ai[0] < 85f) + { + projectile.velocity.Y += Math.Sign(projectile.localAI[0]) * 0.1f; + } + if (projectile.ai[0] == 160f) + { + projectile.ai[1] = Player.FindClosest(projectile.Center, 1, 1); + } + if (projectile.ai[0] >= 160f && projectile.ai[0] <= 200f) + { + Player player = Main.player[(int)projectile.ai[1]]; + float inertia = 10f; + if (projectile.Distance(player.Center) > 70f) + { + projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(player.Center) * 18.5f) / (inertia + 1f); + } + projectile.tileCollide = true; + } + else + { + projectile.tileCollide = false; + } + } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + 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/Enemy/NuclearBulletMedium.png b/Projectiles/Enemy/NuclearBulletMedium.png new file mode 100644 index 0000000000..942ef43445 Binary files /dev/null and b/Projectiles/Enemy/NuclearBulletMedium.png differ diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 67c3b8eac4..a992f9ff6c 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,5 +1,5 @@ -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AcidRain; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.Calamitas; @@ -245,7 +245,6 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType(), //Clone's brothers ModContent.NPCType(), - ModContent.NPCType(), //Abyss ModContent.NPCType(), @@ -257,6 +256,7 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType() }; + MinibossHPBarList.AddRange(AcidRainEvent.AllMinibosses); } public static void Unload()