From 29770110f1d041fc31926f937713bf6aba400bd8 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 10:47:45 -0400 Subject: [PATCH 01/41] cosmic shiv nerf --- Projectiles/Melee/CosmicShivBall.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs index 09fca156bb..2b95193726 100644 --- a/Projectiles/Melee/CosmicShivBall.cs +++ b/Projectiles/Melee/CosmicShivBall.cs @@ -78,15 +78,15 @@ namespace CalamityMod.Projectiles.Melee int directionSign = Main.rand.NextBool(2).ToDirectionInt(); Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, projectile.Center.Y + Main.rand.Next(-500, 501)); Vector2 velocity = Vector2.Normalize(target.Center - spawnPos) * 30f; - Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), projectile.damage, 1.4f, projectile.owner); + Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack * 0.1f, projectile.owner); } - int starMax = Main.rand.Next(4, 11); // 4 to 10 stars + int starMax = Main.rand.Next(6, 11); // 6 to 10 stars for (int i = -starMax / 2; i < starMax / 2; i++) { int ySpawnAdditive = Main.rand.Next(-40, 41); Vector2 toSpawn = target.Center - new Vector2(0f, 800f + ySpawnAdditive).RotatedBy(MathHelper.ToRadians(i * 11f / starMax)); Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f; - Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); } target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(ModContent.BuffType(), 360); From b4cb8e4000c79c64c06835b2b3e497b7c108ee5a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 10:57:27 -0400 Subject: [PATCH 02/41] buffed butcher, moved it later in progression, nerfed clamor rifle and polaris parrotfish --- .../AstralCatches/PolarisParrotfish.cs | 8 +- Items/Weapons/Ranged/Butcher.cs | 103 ++++++++---------- Items/Weapons/Ranged/ClamorRifle.cs | 69 ++++++------ Projectiles/Ranged/ButcherGun.cs | 18 +-- 4 files changed, 93 insertions(+), 105 deletions(-) diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Fishing/AstralCatches/PolarisParrotfish.cs index e44f282be1..b46a3996b3 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Fishing/AstralCatches/PolarisParrotfish.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.damage = 55; + item.damage = 50; item.ranged = true; item.width = 38; item.height = 34; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 21; + item.useAnimation = 21; item.useStyle = 5; item.noMelee = true; item.knockBack = 2.25f; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches } else if (modPlayer.polarisBoostTwo) //Splits on enemy or tile hits { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 1.25), knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * 1.25), knockBack, player.whoAmI, 0f, 1f); return false; } return true; diff --git a/Items/Weapons/Ranged/Butcher.cs b/Items/Weapons/Ranged/Butcher.cs index 1827f2bd1d..95006a28b1 100644 --- a/Items/Weapons/Ranged/Butcher.cs +++ b/Items/Weapons/Ranged/Butcher.cs @@ -7,65 +7,54 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class Butcher : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Butcher"); - Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger"); - } + public class Butcher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Butcher"); + Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger"); + } - public override void SetDefaults() - { - item.damage = 17; - item.width = 20; - item.height = 12; - item.useTime = 40; - item.useAnimation = 40; - item.useStyle = 5; - item.rare = 5; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = SoundID.Item38; - item.noMelee = true; - item.noUseGraphic = true; - item.ranged = true; - item.channel = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = 97; - } + public override void SetDefaults() + { + item.damage = 18; + item.width = 20; + item.height = 12; + item.useTime = 40; + item.useAnimation = 40; + item.useStyle = ItemUseStyleID.HoldingOut; + item.rare = 5; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = SoundID.Item38; + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Shotgun); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ItemID.IllegalGunParts); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Shotgun); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.IllegalGunParts); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index c014be74a2..2495212021 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -4,43 +4,40 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class ClamorRifle : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Clamor Rifle"); - Tooltip.SetDefault("Shoots homing energy bolts"); - } + public class ClamorRifle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clamor Rifle"); + Tooltip.SetDefault("Shoots homing energy bolts"); + } - public override void SetDefaults() - { - item.damage = 27; - item.ranged = true; - item.width = 64; - item.height = 30; - item.useTime = 13; - item.useAnimation = 13; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); - item.autoReuse = true; - item.rare = 5; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.useAmmo = 97; - } + public override void SetDefaults() + { + item.damage = 23; + item.ranged = true; + item.width = 64; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + item.autoReuse = true; + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 15f; + item.useAmmo = AmmoID.Bullet; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index a52885e739..8c103ce8f3 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -30,40 +30,42 @@ namespace CalamityMod.Projectiles.Ranged projectile.ai[0] += 1f; int incrementAmt = 0; float spreadMult = 0.15f; - if (projectile.ai[0] >= 90f) + if (projectile.ai[0] >= 80f) { incrementAmt++; spreadMult = 0.13f; } - if (projectile.ai[0] >= 180f) + if (projectile.ai[0] >= 160f) { incrementAmt++; spreadMult = 0.11f; } - if (projectile.ai[0] >= 270f) + if (projectile.ai[0] >= 240f) { incrementAmt++; spreadMult = 0.09f; } - if (projectile.ai[0] >= 360f) + if (projectile.ai[0] >= 320f) { incrementAmt++; spreadMult = 0.07f; } - if (projectile.ai[0] >= 450f) + if (projectile.ai[0] >= 400f) { + incrementAmt++; spreadMult = 0.05f; } - if (projectile.ai[0] >= 540f) + if (projectile.ai[0] >= 480f) { incrementAmt++; spreadMult = 0.04f; } - if (projectile.ai[0] >= 630f) + if (projectile.ai[0] >= 560f) { + incrementAmt++; spreadMult = 0.03f; } - if (projectile.ai[0] >= 720f) //8 + if (projectile.ai[0] >= 640f) //8 { incrementAmt++; spreadMult = 0.02f; From 0080d869115856a6f6c895a43e260ebe5166644e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 10:58:51 -0400 Subject: [PATCH 03/41] buffed apoctolith --- Items/Weapons/Rogue/Apoctolith.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 11507f71d8..aa832fd900 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 108; + item.damage = 120; item.shootSpeed = 15f; item.shoot = ModContent.ProjectileType(); item.width = 66; item.height = 64; - item.useTime = 25; - item.useAnimation = 25; + item.useTime = 24; + item.useAnimation = 24; item.useStyle = 1; item.knockBack = 10f; item.crit = 20; From 36d4a56ddaaadc13993f365bc772f3ccf26887c2 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:00:43 -0400 Subject: [PATCH 04/41] nerfed hematemesis --- Items/Weapons/Magic/Hematemesis.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index d9bebc5370..4c50c511d9 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 90; + item.damage = 75; item.magic = true; item.mana = 14; item.rare = 8; item.width = 48; item.height = 54; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 22; + item.useAnimation = 22; item.useStyle = 5; item.noMelee = true; item.knockBack = 3.75f; @@ -35,17 +35,14 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 10f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { position = Main.MouseWorld; for (int x = 0; x < 10; x++) { - Projectile.NewProjectile(position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockBack, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } From 7d47ee7b220fec886e8637f5b750dc8bf5da9e9a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:02:53 -0400 Subject: [PATCH 05/41] plague staff i frame nerf --- Projectiles/Magic/PlagueFang.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 901e4eb0f2..f32743a699 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.penetrate = 9; projectile.timeLeft = 300; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -78,7 +80,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - target.immune[projectile.owner] = 2; } } } From fca8dc5019d9916411e665e18fac9c4bfad601b0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:04:12 -0400 Subject: [PATCH 06/41] slightly buffed laser machinegun --- Items/CalamityGlobalItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 97b52f456c..7855b0114d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Items else if (item.type == ItemID.BlizzardStaff) item.damage = (int)(item.damage * 0.7); else if (item.type == ItemID.LaserMachinegun) - item.damage = (int)(item.damage * 0.6); + item.damage = (int)(item.damage * 0.65); else if (item.type == ItemID.StardustDragonStaff) item.damage = (int)(item.damage * 0.5); From 2bb3d247fff9cab427c79687b87256df2399e475 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:05:41 -0400 Subject: [PATCH 07/41] buffed astral scythe --- Items/Weapons/Melee/AstralScythe.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 90852c6093..3b9ebd53ce 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 56; item.height = 60; - item.damage = 95; + item.damage = 120; item.melee = true; item.useTurn = true; item.useAnimation = 20; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f); return false; } From ffb307a141bd2e01e14a0dce2827362b36904101 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:06:26 -0400 Subject: [PATCH 08/41] buffed brimblade stealth strike --- Items/Weapons/Rogue/Brimblade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 3c0f1faf82..925ede4fed 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = -6; i <= 6; i += 4) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 2, knockBack * 0.5f, player.whoAmI, 0f, 0f); + int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI, 0f, 0f); Main.projectile[dart].Calamity().forceRogue = true; } return false; From 682af60b8868f0b9c012f79adbd2045da1137015 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:11:25 -0400 Subject: [PATCH 09/41] nerfed storm spray and waywasher --- Items/Weapons/Magic/StormSpray.cs | 2 +- Items/Weapons/Magic/Waywasher.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Magic/StormSpray.cs b/Items/Weapons/Magic/StormSpray.cs index 1d39ed22ff..b6684f7faa 100644 --- a/Items/Weapons/Magic/StormSpray.cs +++ b/Items/Weapons/Magic/StormSpray.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 18; + item.damage = 14; item.magic = true; item.mana = 8; item.width = 42; diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index 6ff0f3baab..4dcf8ded4b 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 20; + item.damage = 15; item.magic = true; item.mana = 4; item.width = 30; From 7ad94d80b120181ebc6a34926048b15ece73eafd Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:12:06 -0400 Subject: [PATCH 10/41] buffed brittle & aquatic star charge speed --- Projectiles/Summon/AquaticStarMinion.cs | 2 +- Projectiles/Summon/BrittleStarMinion.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 67f2fb93cc..9a03d452d6 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.rotation += projectile.velocity.X * 0.04f; - CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false); + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 9.5f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index c8c761d021..ef5959d9dd 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.rotation += projectile.velocity.X * 0.04f; - CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false); + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 9.5f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; From 92225e60119e264c5d5aa8a6641a19c5a78b2092 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:14:39 -0400 Subject: [PATCH 11/41] nerf to halley's --- Items/Weapons/Ranged/HalleysInferno.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 9520c9fdc6..a4e2e46752 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1750; + item.damage = 1666; item.crit += 20; item.ranged = true; item.width = 84; @@ -41,17 +41,9 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 23; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50; public override void AddRecipes() { From 39db984a7d4329beb14d3a79f227226c499ce261 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:16:20 -0400 Subject: [PATCH 12/41] buffed dodu's handcannon --- Items/Weapons/Ranged/DodusHandcannon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index 439445107c..04de349700 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { item.width = 70; item.height = 42; - item.damage = 450; + item.damage = 485; item.crit += 16; item.ranged = true; item.useTime = 30; From db2896c7f5a321bac6cad8b1274b675140853083 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:18:29 -0400 Subject: [PATCH 13/41] relic of ruin nerf --- Items/Weapons/Magic/RelicofRuin.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index a6f315c111..62d827ae77 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 26; + item.damage = 20; item.magic = true; item.mana = 16; item.width = 28; @@ -37,12 +37,11 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float spread = 22.5f * 0.0174f; + float spread = 22.5f * 0.01 * MathHelper.PiOver2; double startAngle = Math.Atan2(speedX, speedY) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(position.X, position.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); From 272de98be35ce5654a029f4c98af6b9fed0b8c08 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 11:33:24 -0400 Subject: [PATCH 14/41] error fixes --- Items/Fishing/AstralCatches/PolarisParrotfish.cs | 3 ++- Items/Weapons/Magic/RelicofRuin.cs | 2 +- Items/Weapons/Ranged/ClamorRifle.cs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Fishing/AstralCatches/PolarisParrotfish.cs index b46a3996b3..47c23f02f7 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Fishing/AstralCatches/PolarisParrotfish.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.height = 34; item.useTime = 21; item.useAnimation = 21; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index 62d827ae77..d7386c80c4 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float spread = 22.5f * 0.01 * MathHelper.PiOver2; + float spread = 22.5f * 0.01f * MathHelper.PiOver2; double startAngle = Math.Atan2(speedX, speedY) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 2495212021..f936fd41f1 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { From 1f32bbc00c7ac356dd6883dac5982a4f2599692e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 14:01:01 -0400 Subject: [PATCH 15/41] fixed accessory reforge memes --- Items/CalamityGlobalItem.cs | 6 ++++++ Items/Weapons/Rogue/RogueWeapon.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 7855b0114d..250089c1c5 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -82,6 +82,12 @@ namespace CalamityMod.Items myClone.StealthGenBonus = StealthGenBonus; return myClone; } + + public override bool NewPreReforge(Item item) + { + StealthGenBonus = 1f; + return true; + } #endregion #region SetDefaults diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index 286aefb989..e0bcb51f9a 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -52,6 +52,12 @@ namespace CalamityMod.Items.Weapons.Rogue return mod.GetPrefix(newPrefix).Type; } + public override bool NewPreReforge() + { + StealthStrikeDamage = 1f; + return true; + } + public sealed override void SetDefaults() { SafeSetDefaults(); From 05939c30101366dc8f23055d6f53f7796f4f2ddd Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 19:55:15 -0400 Subject: [PATCH 16/41] nerfed photo alt, gastric belcher, and fixed brimstone sword using the wrong explosion --- Items/Weapons/Ranged/Photoviscerator.cs | 2 +- Items/Weapons/Summon/GastricBelcherStaff.cs | 4 ++-- Projectiles/Melee/ProfanedSwordProj.cs | 2 +- Projectiles/Ranged/ExoLight.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index f01934d293..09bcc37c8e 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 velocity = new Vector2(speedX, speedY); position += velocity.ToRotation().ToRotationVector2() * 80f; - Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * 17f, ModContent.ProjectileType(), damage * 3, knockBack, player.whoAmI); + Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * 17f, ModContent.ProjectileType(), (int)(damage * 2.3), knockBack, player.whoAmI); } else { diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 4e5b46bd14..380aac1b23 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 70; + item.damage = 60; item.mana = 10; item.width = 66; item.height = 70; item.useTime = item.useAnimation = 20; - item.useStyle = 1; + item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 1f; item.value = CalamityGlobalItem.Rarity7BuyPrice; diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index 8fc208f640..2563dbef25 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee { if (explosionCount < 3) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), knockback, projectile.owner); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), knockback, projectile.owner); explosionCount++; } } diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index b86913a0af..a87ba62638 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 8; projectile.timeLeft = 180; } public override void AI() From 4518f0c2bfa83b6f6509c30df71d0e3039c67f9a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 19:56:51 -0400 Subject: [PATCH 17/41] increased sandnado aggro range --- Projectiles/Summon/SandnadoMinion.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 97a1517504..90bec14af3 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Summon } } Vector2 vector = projectile.position; - float num10 = 900f; + float num10 = 1200f; bool flag = false; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -157,12 +157,12 @@ namespace CalamityMod.Projectiles.Summon } } } - int num16 = 750; + float num16 = 1000f; if (flag) { - num16 = 2000; + num16 = 2500f; } - if (Vector2.Distance(player.Center, projectile.Center) > (float)num16) + if (Vector2.Distance(player.Center, projectile.Center) > num16) { projectile.ai[0] = 1f; projectile.netUpdate = true; From bd1d5a4abcafec9d976d8ed390c99cd20718320c Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 19:59:25 -0400 Subject: [PATCH 18/41] nerfed shellfish staff --- NPCs/CalamityGlobalNPC.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 0e545b50c3..b6f5f277aa 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -516,11 +516,11 @@ namespace CalamityMod.NPCs } } - npc.lifeRegen -= projectileCount * 350; + npc.lifeRegen -= projectileCount * 250; - if (damage < projectileCount * 70) + if (damage < projectileCount * 50) { - damage = projectileCount * 70; + damage = projectileCount * 50; } } From 6ea5f364664968a7bbba1d69a54dd34c627158b0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 20:00:02 -0400 Subject: [PATCH 19/41] slight black hawk nerf --- Items/Weapons/Summon/BlackHawkRemote.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 48f63765ad..121e537e48 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 36; + item.damage = 32; item.mana = 10; item.width = 46; item.height = 28; From 695db6506ace97b6f6a5a35f58cf525cf2e3295e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 20:29:40 -0400 Subject: [PATCH 20/41] fixed auric toilet being unplacable --- Tiles/Furniture/AuricToiletTile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tiles/Furniture/AuricToiletTile.cs b/Tiles/Furniture/AuricToiletTile.cs index dfadd9a8e3..648cd8eab0 100644 --- a/Tiles/Furniture/AuricToiletTile.cs +++ b/Tiles/Furniture/AuricToiletTile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.Origin = new Point16(1, 1); TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); TileObjectData.newTile.LavaDeath = false; TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; From f38406f18886137117c55189c94dde41ca405681 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 30 May 2020 20:47:23 -0400 Subject: [PATCH 21/41] fixed stupid scepter name --- Items/Weapons/Magic/ParasiticSceptor.cs | 70 ++++++++++++------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index 9b48e1101c..b184d297b1 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Parasitic Sceptor"); + DisplayName.SetDefault("Parasitic Scepter"); Tooltip.SetDefault("Fires a spread of water leeches that latch onto enemies, dealing a stacking damage over time"); Item.staff[item.type] = true; } @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = item.height = 52; item.UseSound = SoundID.Item46; item.noMelee = true; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.rare = 2; item.value = CalamityGlobalItem.Rarity2BuyPrice; } @@ -39,28 +39,28 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float speed = item.shootSpeed; - Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; - float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; - if (player.gravDir == -1f) - { - yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; - } + float speed = item.shootSpeed; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; + float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; + if (player.gravDir == -1f) + { + yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; + } Vector2 vector = new Vector2(xDist, yDist); float speedMult = vector.Length(); - if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) - { - xDist = player.direction; - yDist = 0f; - speedMult = speed; - } - else - { - speedMult = speed / speedMult; - } - xDist *= speedMult; - yDist *= speedMult; + if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) + { + xDist = player.direction; + yDist = 0f; + speedMult = speed; + } + else + { + speedMult = speed / speedMult; + } + xDist *= speedMult; + yDist *= speedMult; int leechAmt = 2; if (Main.rand.NextBool(3)) { @@ -74,21 +74,21 @@ namespace CalamityMod.Items.Weapons.Magic { leechAmt ++; } - for (int i = 0; i < leechAmt; i++) - { - float xVec = xDist; - float yVec = yDist; - float spreadMult = 0.05f * i; - xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; - yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + for (int i = 0; i < leechAmt; i++) + { + float xVec = xDist; + float yVec = yDist; + float spreadMult = 0.05f * i; + xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; Vector2 directionToShoot = new Vector2(xVec, yVec); speedMult = directionToShoot.Length(); - speedMult = speed / speedMult; - xVec *= speedMult; - yVec *= speedMult; - directionToShoot = new Vector2(xVec, yVec); - Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f); - } + speedMult = speed / speedMult; + xVec *= speedMult; + yVec *= speedMult; + directionToShoot = new Vector2(xVec, yVec); + Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f); + } return false; } } From 52ffc8cb19c022e3453837d17c0d6e9faa1459ea Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 30 May 2020 20:00:16 -0500 Subject: [PATCH 22/41] Couple of sulph sea adjustments (see description) - Made the acid rain depend on whether the rain is active. - Made the acid rain go away after 4 minutes if no enemies are killed in that time period. - Prevented natural tiles from forming a clump above the sulph sea during worldgen - Cut a good amount of of lag from the sulph sea generation process. - Changed the 98% completion to 99% when Old Duke appears. --- CalamityMod.cs | 1 + Events/AcidRainEvent.cs | 12 +++-- Items/Tools/ClimateChange/TorrentialTear.cs | 14 +---- NPCs/CalamityGlobalNPCLoot.cs | 7 ++- World/Abyss.cs | 45 +++++++++++++--- World/CalamityWorld.cs | 60 ++++++++++++++++----- 6 files changed, 97 insertions(+), 42 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 5ef3fbafb4..f93d0441d5 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -3743,6 +3743,7 @@ namespace CalamityMod case CalamityModMessageType.AcidRainSync: CalamityWorld.rainingAcid = reader.ReadBoolean(); CalamityWorld.acidRainPoints = reader.ReadInt32(); + CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32(); break; case CalamityModMessageType.AcidRainUIDrawFadeSync: CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32(); diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 0b32c27cb6..58bdc882ab 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Events // A partially bright pale-ish cyan with a hint of yellow. public static readonly Color TextColor = new Color(115, 194, 147); + public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed. + public const float BloodwormSpawnRate = 0.1f; // Not a readonly collection so that if anyone else wants to add stuff in here with their own mod, they can. @@ -168,17 +170,16 @@ namespace CalamityMod.Events Main.numClouds = Main.numCloudsTemp; Main.windSpeedTemp = 0.72f; Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; Main.maxRaining = 0.89f; CalamityWorld.forcedDownpourWithTear = true; CalamityMod.UpdateServerBoolean(); } - if (CalamityWorld.startAcidicDownpour) - { - Main.raining = true; - } CalamityWorld.triedToSummonOldDuke = false; + CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case. } + UpdateInvasion(); BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas! } @@ -223,6 +224,7 @@ namespace CalamityMod.Events netMessage.Write((byte)CalamityModMessageType.AcidRainSync); netMessage.Write(CalamityWorld.rainingAcid); netMessage.Write(CalamityWorld.acidRainPoints); + netMessage.Write(CalamityWorld.timeSinceAcidRainKill); netMessage.Send(); } if (Main.netMode == NetmodeID.Server) diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index 3f664889a9..8342d2ba68 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining); + return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining || CalamityWorld.rainingAcid); } public override bool UseItem(Player player) @@ -48,22 +48,10 @@ namespace CalamityMod.Items.Tools.ClimateChange Main.rainTime = 3600; AdjustRainSeverity(true); } - if (CalamityWorld.rainingAcid) - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } } else { Main.raining = false; - if (CalamityWorld.rainingAcid) - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } } CalamityMod.UpdateServerBoolean(); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 3b773eccd8..a44ade281f 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1623,16 +1623,18 @@ namespace CalamityMod.NPCs private void AcidRainProgression(NPC npc) { Dictionary possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; + if (CalamityWorld.downedAquaticScourge) possibleEnemies = AcidRainEvent.PossibleEnemiesAS; if (CalamityWorld.downedPolterghast) possibleEnemies = AcidRainEvent.PossibleEnemiesPolter; + if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type) && CalamityWorld.rainingAcid) { CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints; if (CalamityWorld.downedPolterghast) { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } } Dictionary possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS; @@ -1641,7 +1643,7 @@ namespace CalamityMod.NPCs CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints; if (CalamityWorld.downedPolterghast) { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } } @@ -1654,6 +1656,7 @@ namespace CalamityMod.NPCs CalamityWorld.triedToSummonOldDuke = false; CalamityWorld.acidRainPoints = 0; } + CalamityWorld.timeSinceAcidRainKill = 0; AcidRainEvent.UpdateInvasion(); } #endregion diff --git a/World/Abyss.cs b/World/Abyss.cs index e63c4a6171..ba826d1a67 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -72,6 +72,7 @@ namespace CalamityMod.World GenerateUpperSea(); CreateWater(); GenerateHardenedSandstone(); + RemoveStupidTilesAboveSea(); SettleWater(); // The island Y spawn position calculations are relative to water. Settling the water before doing these calculations is ideal. GenerateIslands(); GenerateVentsAndFossils(); @@ -326,13 +327,6 @@ namespace CalamityMod.World } } } - else if (WorldGen.genRand.NextBool(10)) - { - for (int i = 0; i < 20; i++) - { - TileLoader.RandomUpdate(trueX, y, Main.tile[trueX, y].type); - } - } } } } @@ -758,9 +752,30 @@ namespace CalamityMod.World } #endregion + #region Removal of stupid Tiles above the Sea + public static void RemoveStupidTilesAboveSea() + { + for (int x = 0; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart - 100; y < YStart + 60; y++) + { + if (YStartWhitelist.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type)) + { + if (Main.tile[trueX, y] == null) + Main.tile[trueX, y] = new Tile(); + Main.tile[trueX, y].active(false); + } + } + } + } + #endregion + #region Misc Functions public static List YStartWhitelist = new List() { + TileID.Stone, + TileID.Dirt, TileID.Sand, TileID.Ebonsand, TileID.Crimsand, @@ -777,12 +792,26 @@ namespace CalamityMod.World TileID.Tungsten, TileID.Crimstone, TileID.Ebonstone, + TileID.HardenedSand, + TileID.CorruptHardenedSand, + TileID.CrimsonHardenedSand, + TileID.Coral, + TileID.BeachPiles, + TileID.Plants, + TileID.Plants2, + TileID.SmallPiles, + TileID.LargePiles, + TileID.LargePiles2, + TileID.Trees, + TileID.Vines, + TileID.CrimsonVines, + TileID.Containers, TileID.JungleGrass // Yes, this can happen on rare occasion }; public static void DetermineYStart() { int maxHeight = 0; - for (int i = 0; i < BiomeWidth; i++) + for (int i = 0; i < BiomeWidth - 18; i++) { int xCheck = CalamityWorld.abyssSide ? BiomeWidth - i : diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 0241a79a34..73ad082a3e 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -111,6 +111,8 @@ namespace CalamityMod.World public static bool forcedRainAlready = false; public static bool forcedDownpourWithTear = false; public static int forceRainTimer = 0; + public static int timeSinceAcidRainKill = 0; + public static int timeSinceAcidStarted = 0; public static float AcidRainCompletionRatio { get @@ -967,6 +969,17 @@ namespace CalamityMod.World if (rainingAcid) { + timeSinceAcidRainKill++; + timeSinceAcidStarted++; + + // If enough time has passed, and no enemy has been killed, end the invasion early. + // The player almost certainly does not want to deal with it. + if (timeSinceAcidRainKill >= AcidRainEvent.InvasionNoKillPersistTime) + { + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } if (!startAcidicDownpour) { int sulphSeaWidth = Abyss.BiomeWidth; @@ -984,6 +997,8 @@ namespace CalamityMod.World (player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !abyssSide)) && player2.Calamity().ZoneSulphur) { + // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) + // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! startAcidicDownpour = true; CalamityMod.UpdateServerBoolean(); break; @@ -992,22 +1007,37 @@ namespace CalamityMod.World } } - // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) - // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! - if ((startAcidicDownpour || forcedDownpourWithTear) && !NPC.AnyNPCs(ModContent.NPCType())) + // Stop the rain if the Old Duke is present for visibility during the fight. + if (Main.raining && NPC.AnyNPCs(ModContent.NPCType())) { - Main.raining = true; - Main.cloudBGActive = 1f; - Main.numCloudsTemp = Main.cloudLimit; - Main.numClouds = Main.numCloudsTemp; - Main.windSpeedTemp = 0.72f; - Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; - Main.maxRaining = 0.89f; - } + Main.raining = false; + CalamityMod.UpdateServerBoolean(); + } + + // If the rain stops for whatever reason, end the invasion. + // This is primarily done for compatibility, so that if another mod wants to manipulate the weather, + // they can without having to deal with endless rain. + if (!Main.raining && !NPC.AnyNPCs(ModContent.NPCType()) && timeSinceAcidStarted > 20) + { + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + else if (timeSinceAcidStarted < 20) + { + Main.raining = true; + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = 0.72f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; + Main.maxRaining = 0.89f; + } // Summon Old Duke tornado post-Polter as needed - if (downedPolterghast && acidRainPoints == 2) + if (downedPolterghast && acidRainPoints == 1) { if (!NPC.AnyNPCs(ModContent.NPCType()) && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) @@ -1033,7 +1063,9 @@ namespace CalamityMod.World } else { - startAcidicDownpour = false; + if (timeSinceAcidStarted != 0) + timeSinceAcidStarted = 0; + startAcidicDownpour = false; } // Lumenyl crystal, tenebris spread and sea prism crystal spawn rates From 3826395b25aba254c2ef12ec9970bf2b58bf30a9 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sun, 31 May 2020 02:34:54 -0500 Subject: [PATCH 23/41] Removed locked rusty chest variants and lockpicks --- Items/Accessories/BrokenWaterFilter.cs | 1 - Items/Accessories/RustyMedallion.cs | 1 - Items/Placeables/Furniture/EffigyOfDecay.cs | 1 - Items/Placeables/Furniture/RustyChest.cs | 2 +- Items/RustyLockpick.cs | 30 ----- Items/RustyLockpick.png | Bin 383 -> 0 bytes Items/Weapons/Summon/RustyBeaconPrototype.cs | 3 +- Projectiles/Summon/RustyDrone.cs | 7 +- Tiles/Abyss/RustyChestLocked.cs | 124 ------------------- Tiles/Abyss/RustyChestLocked.png | Bin 1539 -> 0 bytes Tiles/Abyss/RustyChestLocked_Highlight.png | Bin 845 -> 0 bytes Tiles/Abyss/RustyChestTile.cs | 81 ++++++++++++ Tiles/Abyss/RustyChestTile.png | Bin 0 -> 995 bytes Tiles/Abyss/RustyChestTile_Highlight.png | Bin 0 -> 632 bytes World/Abyss.cs | 2 +- World/WorldGenerationMethods.cs | 2 +- 16 files changed, 88 insertions(+), 166 deletions(-) delete mode 100644 Items/RustyLockpick.cs delete mode 100644 Items/RustyLockpick.png delete mode 100644 Tiles/Abyss/RustyChestLocked.cs delete mode 100644 Tiles/Abyss/RustyChestLocked.png delete mode 100644 Tiles/Abyss/RustyChestLocked_Highlight.png create mode 100644 Tiles/Abyss/RustyChestTile.cs create mode 100644 Tiles/Abyss/RustyChestTile.png create mode 100644 Tiles/Abyss/RustyChestTile_Highlight.png diff --git a/Items/Accessories/BrokenWaterFilter.cs b/Items/Accessories/BrokenWaterFilter.cs index 83401f1c0f..6778deaeec 100644 --- a/Items/Accessories/BrokenWaterFilter.cs +++ b/Items/Accessories/BrokenWaterFilter.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 9d29b47034..df33a26427 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 50eb4a6b11..1121f4a65e 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs index 0230fb4cbc..4a01ba73f0 100644 --- a/Items/Placeables/Furniture/RustyChest.cs +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = 1; item.consumable = true; item.value = 500; - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); } public override void AddRecipes() { diff --git a/Items/RustyLockpick.cs b/Items/RustyLockpick.cs deleted file mode 100644 index 3598f8959a..0000000000 --- a/Items/RustyLockpick.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items -{ - public class RustyLockpick : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Opens locked rusty chests"); - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.rare = 1; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/RustyLockpick.png b/Items/RustyLockpick.png deleted file mode 100644 index 428130670976701b49c3a639a8fe24008b57ef8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 383 zcmV-_0f7FAP)Px$IY~r8R5*>ble6%&HNxFnJti_NUen&4$Oe>Zc^&&Rn5CTM+S2Y{aMsd4elB;!vK@sE17 z27sKM2Ov;Y1#o;Y0O0)MCK)js|0v`o0A4Gs?P#w8!0A~NfYrJy(jkgm830T904%s$ zqsW_KxV>+ah!}NM69ENqvbzaD=^)h{g1JUnxqD=$%sO4 zO5U;n@P|WVHy@rmQEn>4s76iNU#=MmjW431e-pnM9ckl8`|rlzDw`3ZH&6ip&ATE1 z8i4S@Fh;)r|+fGiaSfY%MLB)vImxz3aEj+3;~o8#1tQCH)VmGI)d dj(LZPiJ!JkSw?dqqYVH6002ovPDHLkV1kjZpB(@I diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index c71acf5653..6391d1fcfa 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -44,8 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); + ModRecipe recipe = new ModRecipe(mod);; recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 20ee399b79..49615484ba 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.Summon; -using CalamityMod.Buffs.Cooldowns; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; @@ -16,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public const float NPCHomingInertia = 20f; public const float NPCHomingSpeed = 14f; - public const float AttackRate = 110f; + public const float AttackRate = 140f; - public const float DistanceToCheck = 750f; + public const float DistanceToCheck = 585f; public const int ExplosionShrapnelBaseDamage = 16; // Uses player.MinionDamage @@ -139,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon Utils.PoofOfSmoke(projectile.Center); for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), + Projectile.NewProjectile(projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, projectile.owner); } projectile.Kill(); diff --git a/Tiles/Abyss/RustyChestLocked.cs b/Tiles/Abyss/RustyChestLocked.cs deleted file mode 100644 index 9391ea2eb8..0000000000 --- a/Tiles/Abyss/RustyChestLocked.cs +++ /dev/null @@ -1,124 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Items; -using CalamityMod.Items.Placeables.Furniture; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Abyss -{ - public class RustyChestLocked : ModTile - { - public override void SetDefaults() - { - this.SetUpChest(); - ModTranslation name = CreateMapEntryName("chestRusty"); - name.SetDefault("Rusty Chest"); - AddMapEntry(new Color(57, 48, 83), name, MapChestName); - dustType = ModContent.DustType(); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Rusty Chest"; - chestDrop = ModContent.ItemType(); - } - - public override bool HasSmartInteract() => true; - - public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; - - public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) - { - Player closest = Main.player[Player.FindClosest(new Vector2(i, j) * 16f, 1, 1)]; - if (!closest.InventoryHas(ModContent.ItemType())) - return false; - - for (int k = 0; k < closest.inventory.Length; k++) - { - if (closest.inventory[k].type == ModContent.ItemType()) - { - if (ItemLoader.ConsumeItem(closest.inventory[k], closest)) - { - closest.inventory[k].stack--; - } - if (closest.inventory[k].stack <= 0) - { - closest.inventory[k] = new Item(); - } - break; - } - } - - dustType = this.dustType; - - return true; - } - - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; - - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = 1; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } - - public override bool NewRightClick(int i, int j) - { - Tile tile = Main.tile[i, j]; - - int left = i; - int top = j; - - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); - } - - public override void MouseOver(int i, int j) - { - if (IsLockedChest(i, j)) - CalamityUtils.ChestMouseOver("Rusty Chest", i, j); - else - CalamityUtils.ChestMouseOver("Rusty Chest", i, j); - } - - public override void MouseOverFar(int i, int j) - { - if (IsLockedChest(i, j)) - CalamityUtils.ChestMouseFar("Rusty Chest", i, j); - else - CalamityUtils.ChestMouseFar("Rusty Chest", i, j); - } - } -} diff --git a/Tiles/Abyss/RustyChestLocked.png b/Tiles/Abyss/RustyChestLocked.png deleted file mode 100644 index e88cc3af08cae44425ffbcd12207ba60254c3e63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1539 zcmZ8hdpOf;9RCe-m~2Ql<eYjLJ_ z*-RkTa%w)@l51_DAuVUknQoMchs_liN%)AGZ3ecL1T99K0Mm0sTG!*)vqZF&I6arQ zc00xwkD=*xMV}?rKfPL5Sg2Aw92O{YH2GY1nKgQ~o6qD_wsl9l7JgPmx7kH)t4`_X z&fe2g+hSycxy%=drAM#08o%BvZyGU@1&^{8jq^3$@j6!FJ6CPPjqH~aT6T8lb6qY1XMQ?%Kh-r=;a)*qT1}%tycn8Uir(|)AaVaX(=J0UYgau^?tKi zpNe5Wtgn#bj$xTR{EPUsF>+x|nz-aq1>$^;J;r>abRe{Cy{Ufzrudn$$FQt{rg5it zPfESaj4<^FMrVe0q%m&R9w4;;@?|Ky$*c&YxYFK8 zK7UP^IJz;7Ei=jVAlH6+E1cB3ir|I#JQvmaolyQmO~yT2>SJtu9X>qV$pa!2m*&z=en#uu%-np*+ksxH_2~CS+(>Fb&R02wUdRl>4CyPlF*dWY0Hx5_f;}7Lve3>**K_X}ZL;D0cdJ?gcknPjQ=BQjgm6w>bul zLX&)Fcuh3P$|umcnvW@$rAK-?0U>;($}|vrA-y~LRT;z~hBCzQ8KjgJLu_}jr1>(6 z0z+nuFgk)*+8xwJRGmd{5NosAb5YmMWbbrQSxpjh3)#w1iV_^AO+|7K6uGE>;Wh=X zcmIN)`xNfg4X@gu)r=OvYlVyCL2OyE<=uoWyEhqEV%h2UlnPx=L$YB=?wqQm?x4ec5*8D8?DoL`1-yL%Y;PYgM2uq(a(iRn{ziVoNV;mRDc=sNSf5j;^UWy&lWE^Dab1e;v`x5@FIrO|+E=M&nZbZQ*@~Z0HV(c$ z4(qQWCJQqlRAL(s6D}cOVmB#oyd{SN(Xk(Jtp!`tEqdIc@*4eSxe8 z^JB+Gv|m>epYGhMOR=X*%hP>}c6p>pB2U^6h`Nf#+3}W1O;NFpESo*~;WO(m_(CBK z+rFcRyX{gTEhZ5Pjav|?L7SKiIMuLK1p71G#L{9#!_LZ9C0g?q=@lq)7DpY@y+8fz zkchKq)*@XEG}tI2ghgt$Q{fvhN9Nn{1`ISV`@iy0XB4uLSEsD@Vq0|V0|PZ!6KinzD8_Gg7SO0<2vtK+56(R+(C zOw6&xWrIl09`1Z69Tjl_og-c!^!6}p+$7SYAeN*Z(IJ*3Trz!Xk9A|s@sBe%SD$+( zFi*ba=KgfP_umW4jCMc%Sz{M;^H@?yBO@a-6B`Q;N6+%hFFX4;o=h={yYuF1j@j?$ zdzK#m9X9JaAJcK!kW~sVU)7fE54-+6nZ41CeXVrqgH9xhKXl!;MXIOe z$~8b{KQhg@>gBq1YIgL))T`%!0>{cfM}|-BDr#M1BX4`(bk=!3rgxsq)*Lr9V)4rrrJuc|%JpOXlTSW-{5jL6=8JZ(D!aY?(vP1XUN@=x{a3m7cJ%d272kjQ zNwpv2V_Li3@%MMRWgic|tCLD*x3#??{dRB7q`dj8Wda$p7oJ|6{^k3}->bh&fBM_~ z{9IL_;F=}x@7(g#K5;$&erW8R3|5)D`wETs{yW?LT|F+|$}e8~#R`-4vMf^n&pucA zy(-40?(N^G*uDDqw>LX{omUdSqWRiczO0iC4Un+76Ub5~@F9GiX+^}p7MEPbHo0kSPk1e5&{Qipu^+fHCyyF7Jl{ijDJ0A-A%^@8z;qu zrzRhtYV~o;`Qv;{&HsCo*60A^_UArX7PkA2uhZDKrhp<8+#;>lBa&&a6AydQ*VkK(9a*Gwqz|`bnDdCwI4QRJ>S^u z@ObynHLJZ`cRB^m>!0^t>TEhYgTe~DWM4f DO(J%R diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs new file mode 100644 index 0000000000..4111461e82 --- /dev/null +++ b/Tiles/Abyss/RustyChestTile.cs @@ -0,0 +1,81 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class RustyChestTile : ModTile + { + public override void SetDefaults() + { + this.SetUpChest(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Rusty Chest"); + AddMapEntry(new Color(191, 142, 111), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Rusty Chest"; + chestDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract() => true; + + public string MapChestName(string name, int i, int j) + { + // Bounds check + if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) + return name; + + // Tile null check + Tile tile = Main.tile[i, j]; + if (tile is null) + return name; + + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + if (chest == -1) + return name; + return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) + { + return CalamityUtils.ChestRightClick(i, j); + } + + public override void MouseOver(int i, int j) + { + CalamityUtils.ChestMouseOver("Rusty Chest", i, j); + } + + public override void MouseOverFar(int i, int j) + { + CalamityUtils.ChestMouseFar("Rusty Chest", i, j); + } + } +} diff --git a/Tiles/Abyss/RustyChestTile.png b/Tiles/Abyss/RustyChestTile.png new file mode 100644 index 0000000000000000000000000000000000000000..56fa385bc1f723d7c1d8d4f89b636349e9b9cc09 GIT binary patch literal 995 zcmV<9104K`P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ9419(Y9K~#8N?V8(5 zR8bVhXCyCpK~qb?EG;S+>LKev=!OsxL`4wzQ2hlVg!vHu0n&p>4@LigK~Mw{LWB_A zzz6fCkS>IgbTQHlOROMce=}>)HM3g#l)^f(f3W#Zr|p@&zq9t7eLf~RKR=(aL_tQ) z5C)_X2BeW(-`KQhnZ0^5mdqS3D;w4}=lxu}4jtLO87FQ&cnD z+IQ&GiLE$sss9O-X3$Vv2<5aLt%bICT*J)zx)0+zckfL(5g|wT9Wm?Bii~C%oA?YR z$0Yi%zK6DVK(fwkY$}IJ3=F5QFJZ5Sl0}uc_q}KK;6&H?`%q4E-O9{S8mfW5E4LTb z5Y-?-j&n{QYlU98J_P;secI?M3;Q93Yz^^yN;OkgvmMH5O?`z@4ISFK3)h*Pt#^{c z#N=Zr)zrZqTc88OPoZXO$a_F;h6~%!XgM0;oNI-&;BlGXG;&1 zJJdJQo#?*Pi{rn+oI{ZZv?}oq?b+lY8bSYd|MxH0t0A7k)>l{H8}q}|j8}0*%^0i7 zO3{D%+w7wL_A^GF`7L+G82=Pj%NWUtTaO-MW|V$t86(|+_@}TuYm_oZqHS+A)Hh?4 zFy~N#?;9%hllr@wa!u>U;r;Bbvan-R2q~%4rOexsF=H0hV5_A^E)h1GVB*=LZlW2D_g>{8h5fYz)lLL;0rzWZt)`1M?k z<*PHh4iQn`$D*QL-=0Iu?T7~dd~*(k9iv9%6qY9$(l<4K|DwE!>gE4SVF@?$g^iHT zMslu#0|OJUr;B4qMcmsN8@-qV1zgL8r!;i*-r@`s zQ*u&@;4=HyYOg3ZiJwFBh}Q@GKMWf;iS#IlC22==h$RV|C~iu2J8|UsU6tKwO5YC{ z?Y?RLJ5TR-n!Iqi)!Y-pt$8KPtcn^Og4?6k&Pxr`5qtbDbKREPZ{?qVeLX>I%PGOg zr@r%?t7H%LdCyKSd>=4>fy>JU|Bbx=SWgjqof3BLS9Izfenu`&*$Ytyd~g2zPoMgf z6=a^HBS(4Dud*IRr>ilaFZ>mlwfylP%O&yEt3x>d&YR{q-`ev1g%#%_E?GUjuIL?h zF5-${cYOPf&s6lLim8UBg{!n_TwShe#(z(>Eo0AJ@0tud&zgS~ zQ+HTx)+zkGM5pl6{e`#A?K`s9%Xd-fixq*rtJ2$x?0DYENJU(5`l50C?&+N}U2*E) z-45QjPSO5)%`H;v+0m<|tEPKv=d56gHoJZ;_0Q9{zUM3c-#7a0|M}mv)@PshpAuSH zxpQ*Ey!ZDP7CM7`vLo4L19$fV1s15^ZnV0F#(Z{qeBoX2=aM=0?KfIkf$|CBVh3$a zo0MKdVPFDrC2@RO|QA(t=l5p?}oj~ckDd0zerutM1Hz0SY?5FhqW8a z?hPDVP5}a7k%rg^)sVBM{CD{mR$85#@BHQv6VN`O`48s(Dqr+MnCVPyZ&h7XA~3Zu Nc)I$ztaD0e0sx9`5b*#2 literal 0 HcmV?d00001 diff --git a/World/Abyss.cs b/World/Abyss.cs index ba826d1a67..31232fee81 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -737,7 +737,7 @@ namespace CalamityMod.World SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type) && CalamityUtils.ParanoidTileRetrieval(x, y + 1).active()) { - chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType(), tileStyle: 1); + chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); } } } diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 6cf3b5a228..d641ea220f 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -139,7 +139,7 @@ namespace CalamityMod.World } PutItemInChest(ref chest, ItemID.GoldCoin, goldCoins); } - else if (type == ModContent.TileType()) + else if (type == ModContent.TileType()) { // 15-29 torches (in accordence with vanilla) PutItemInChest(ref chest, ItemID.Torch, 15, 29); From 1f6610d87df27677d0fde7156d057c15b3c92ec9 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 31 May 2020 14:00:33 -0400 Subject: [PATCH 24/41] soul of cryogen no longer spams icicle sounds --- Items/Accessories/Wings/SoulofCryogen.cs | 2 +- Projectiles/Rogue/FrostShardFriendly.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index ed641c39f5..615bf881f3 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Accessories.Wings { if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) { - int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)(25 * player.AverageDamage()), 3f, player.whoAmI); + int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)(25 * player.AverageDamage()), 3f, player.whoAmI, 1f); Main.projectile[p].Calamity().forceTypeless = true; Main.projectile[p].frame = Main.rand.Next(5); modPlayer.icicleCooldown = 10; diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index fd43227505..5acb692e02 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -67,7 +67,8 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item27, projectile.position); + if (projectile.ai[0] != 1f) + Main.PlaySound(SoundID.Item27, projectile.position); for (int index1 = 0; index1 < 3; ++index1) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76); From 3a34d1aad7a27dcdd3d7403ce26d345e3f6f038e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 31 May 2020 14:00:58 -0400 Subject: [PATCH 25/41] added a small chance for the sound to still play --- Projectiles/Rogue/FrostShardFriendly.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index 5acb692e02..c48e26e7bd 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (projectile.ai[0] != 1f) + if (projectile.ai[0] != 1f || Main.rand.NextBool(20)) Main.PlaySound(SoundID.Item27, projectile.position); for (int index1 = 0; index1 < 3; ++index1) { From 38af94cfa8907eeb38f94bf40857c237b145643f Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 31 May 2020 14:06:11 -0400 Subject: [PATCH 26/41] if the player is dead, null, or wrong owner, KILLLLLLLLLLL --- Projectiles/Rogue/FinalDawnFireSlash.cs | 3 +++ Projectiles/Rogue/FinalDawnHorizontalSlash.cs | 4 ++++ Projectiles/Rogue/FinalDawnProjectile.cs | 3 +++ Projectiles/Rogue/FinalDawnThrow.cs | 6 +++++- Projectiles/Rogue/FinalDawnThrow2.cs | 6 +++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs index b3930b6fa6..18e059abb4 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; + if (player.dead || player is null || Main.myPlayer != projectile.owner) + projectile.Kill(); + player.direction = projectile.direction; player.heldProj = projectile.whoAmI; diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index d7d6474030..5ed9d58eea 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -29,6 +29,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Player player = Main.player[projectile.owner]; + + if (player.dead || player is null || Main.myPlayer != projectile.owner) + projectile.Kill(); + projectile.Center = player.Center; player.heldProj = projectile.whoAmI; projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index c2f298dd27..a7e799af8d 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -30,6 +30,9 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; + if (player.dead || player is null || Main.myPlayer != projectile.owner) + projectile.Kill(); + if (Main.myPlayer == player.whoAmI) { projectile.velocity = Main.MouseWorld - player.Center; diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index 04c7a8ceae..9151e544a7 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -33,12 +33,16 @@ namespace CalamityMod.Projectiles.Rogue } public override void AI() { + Player player = Main.player[projectile.owner]; + + if (player.dead || player is null || Main.myPlayer != projectile.owner) + projectile.Kill(); + if (projectile.localAI[0] == 0) { Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[0] = 1; } - Player player = Main.player[projectile.owner]; projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation += 0.25f * projectile.direction; diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index a247f73d2e..80aa357634 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -53,12 +53,16 @@ namespace CalamityMod.Projectiles.Rogue } public override void AI() { + Player player = Main.player[projectile.owner]; + + if (player.dead || player is null || Main.myPlayer != projectile.owner) + projectile.Kill(); + if (projectile.localAI[0] == 0) { Main.PlaySound(SoundID.Item71, projectile.position); projectile.localAI[0] = 1; } - Player player = Main.player[projectile.owner]; projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1; projectile.rotation += 0.25f * projectile.direction; From 771dc8a1033118f5e2c837cdb3882209baf6b48a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 31 May 2020 22:38:41 -0400 Subject: [PATCH 27/41] nerfed crate drop rates --- Items/Fishing/AstralCatches/AstralCrate.cs | 2 +- Items/Fishing/SulphurCatches/AbyssalCrate.cs | 6 +++--- Items/Fishing/SunkenSeaCatches/SunkenCrate.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 2e29d34eed..1011abd771 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index 94230ce88a..feee04676e 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -77,14 +77,14 @@ namespace CalamityMod.Items.Fishing.SulphurCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, + DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.2f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, 0.2f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -94,7 +94,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType()); // Equipment - DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, + DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.4f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index 4df71a1f85..ca9397f4e0 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, 0.2f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), From 01816609db50aceaae4dedb53e87ee04918f039e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 31 May 2020 23:17:04 -0400 Subject: [PATCH 28/41] photo left buff --- Items/Weapons/Ranged/Photoviscerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 09bcc37c8e..c346c6f2b8 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < 2; i++) { Vector2 velocity = new Vector2(speedX, speedY).RotatedByRandom(0.05f); - Projectile.NewProjectile(position, velocity, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 0f); } if (Main.rand.NextBool(8)) { From 2b8e488900625f8c487ca0cfc19f4bf4ca0a2921 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 1 Jun 2020 09:43:31 -0400 Subject: [PATCH 29/41] improved blood crawler counting loop --- Projectiles/Summon/BabyBloodCrawler.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index f5b91bd9d2..f0d3a1b2d4 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -51,7 +51,10 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < Main.maxProjectiles; j++) { Projectile proj = Main.projectile[j]; - if (proj.active && proj.owner == projectile.owner && proj.type == ModContent.ProjectileType() && proj.Calamity().lineColor == 0) + // Short circuits to make the loop as fast as possible + if (!proj.active || proj.owner != projectile.owner || !proj.minion || proj.Calamity().lineColor != 0) + continue; + if (proj.type == projectile.type) { spiderCount += (int)proj.minionSlots; proj.Calamity().lineColor = 1; From c2158e0da5a3249139ecfbbb26d311fd8c2191a3 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 1 Jun 2020 12:44:06 -0400 Subject: [PATCH 30/41] fixed wof key drop rates --- Items/CalamityGlobalItem.cs | 2 +- NPCs/CalamityGlobalNPCLoot.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8f7a486be7..52ee2ba370 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -2811,7 +2811,7 @@ Provides heat and cold protection in Death Mode"; DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 4); - DropHelper.DropItemFromSetChance(player, 5, ItemID.CorruptionKey, ItemID.CrimsonKey); + DropHelper.DropItemFromSetChance(player, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); DropHelper.DropItemCondition(player, ModContent.ItemType(), !CalamityWorld.demonMode); // Demon Trophy break; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 1f158d932d..8b6541c677 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 8, 1, 1); DropHelper.DropItemChance(npc, ModContent.ItemType(), !Main.hardMode, Main.hardMode ? 0.1f : 1f); // 100% chance on first kill, 10% chance afterwards - DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 5, ItemID.CorruptionKey, ItemID.CrimsonKey); + DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); From c6c7d629cca5bad75fcbbfb3ccd88e99e2a30369 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 1 Jun 2020 20:27:39 -0500 Subject: [PATCH 31/41] 1 - Astrum Deus changes, not tested. 2 - Abyss enemy modifications, again. 3 - Some boss AI quirks made expert-exclusive to change it from normal. 4 - Cosmic Guardian AI changes. --- CalPlayer/CalamityPlayerLifeRegen.cs | 10 +- CalamityMod.cs | 26 +- Items/SummonItems/Starcore.cs | 6 +- NPCs/Abyss/BoxJellyfish.cs | 18 +- NPCs/Abyss/Cuttlefish.cs | 83 +- NPCs/Abyss/Reaper.cs | 26 +- NPCs/AstrumDeus/AstrumDeusBody.cs | 186 --- NPCs/AstrumDeus/AstrumDeusBody.png | Bin 1620 -> 0 bytes NPCs/AstrumDeus/AstrumDeusBodyAlt.png | Bin 1182 -> 0 bytes NPCs/AstrumDeus/AstrumDeusBodySpectral.cs | 79 +- NPCs/AstrumDeus/AstrumDeusHead.cs | 165 --- NPCs/AstrumDeus/AstrumDeusHead.png | Bin 2119 -> 0 bytes NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 55 +- NPCs/AstrumDeus/AstrumDeusHead_Head_Boss.png | Bin 417 -> 0 bytes NPCs/AstrumDeus/AstrumDeusProbe.cs | 142 -- NPCs/AstrumDeus/AstrumDeusProbe.png | Bin 536 -> 0 bytes NPCs/AstrumDeus/AstrumDeusProbe2.cs | 143 -- NPCs/AstrumDeus/AstrumDeusProbe2.png | Bin 536 -> 0 bytes NPCs/AstrumDeus/AstrumDeusProbe3.cs | 58 +- NPCs/AstrumDeus/AstrumDeusTail.cs | 162 --- NPCs/AstrumDeus/AstrumDeusTail.png | Bin 1462 -> 0 bytes NPCs/AstrumDeus/AstrumDeusTailSpectral.cs | 50 +- NPCs/CalamityAI.cs | 1270 ++++++++--------- NPCs/CalamityGlobalAI.cs | 47 +- NPCs/CalamityGlobalNPC.cs | 21 +- NPCs/CalamityGlobalNPCLoot.cs | 9 - NPCs/Crabulon/CrabShroom.cs | 10 +- NPCs/Crabulon/CrabulonIdle.cs | 144 +- NPCs/Cryogen/Cryogen.cs | 62 +- NPCs/DesertScourge/DesertScourgeHead.cs | 50 +- NPCs/DevourerofGods/DevourerofGodsBody2.cs | 69 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 52 +- NPCs/DevourerofGods/DevourerofGodsHead2.cs | 454 +++--- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 297 ++-- NPCs/DevourerofGods/DevourerofGodsTail2.cs | 69 +- NPCs/HiveMind/DankCreeper.cs | 15 +- NPCs/HiveMind/HiveMind.cs | 28 +- NPCs/Leviathan/Leviathan.cs | 145 +- NPCs/Leviathan/Siren.cs | 158 +- NPCs/OldDuke/OldDuke.cs | 4 +- NPCs/Perforator/PerforatorHeadLarge.cs | 32 +- NPCs/Perforator/PerforatorHeadMedium.cs | 32 +- NPCs/Perforator/PerforatorHeadSmall.cs | 30 +- NPCs/Perforator/PerforatorHive.cs | 2 +- .../PlaguebringerGoliath.cs | 59 +- NPCs/Polterghast/PolterPhantom.cs | 20 +- NPCs/Polterghast/Polterghast.cs | 28 +- NPCs/Providence/ProvSky.cs | 2 +- NPCs/Providence/Providence.cs | 77 +- NPCs/Ravager/RavagerBody.cs | 29 +- NPCs/Signus/Signus.cs | 150 +- NPCs/SlimeGod/SlimeGod.cs | 2 +- NPCs/SlimeGod/SlimeGodRun.cs | 2 +- NPCs/StormWeaver/StormWeaverBodyNaked.cs | 62 +- NPCs/StormWeaver/StormWeaverHead.cs | 32 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 133 +- NPCs/StormWeaver/StormWeaverTailNaked.cs | 58 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- NPCs/Yharon/Yharon.cs | 312 ++-- Projectiles/Boss/DeusMine.cs | 15 +- Projectiles/Boss/FlareDust.cs | 32 +- Projectiles/Boss/FlareDust2.cs | 4 +- Projectiles/Boss/HolyBlast.cs | 2 +- Projectiles/Boss/HolyBomb.cs | 2 +- Projectiles/Boss/HolyBurnOrb.cs | 2 +- Projectiles/Boss/HolyFire.cs | 2 +- Projectiles/Boss/HolyFire2.cs | 2 +- Projectiles/Boss/HolyFlare.cs | 2 +- Projectiles/Boss/HolyLight.cs | 2 +- Projectiles/Boss/HolySpear.cs | 8 +- Projectiles/Boss/MoltenBlast.cs | 2 +- Projectiles/Boss/MoltenBlob.cs | 2 +- Projectiles/Boss/ProvidenceHolyRay.cs | 2 +- Projectiles/Boss/SandBlast.cs | 26 +- UI/BossHealthBarManager.cs | 33 +- World/CalamityWorld.cs | 83 +- World/SunkenSea.cs | 2 +- 77 files changed, 2216 insertions(+), 3184 deletions(-) delete mode 100644 NPCs/AstrumDeus/AstrumDeusBody.cs delete mode 100644 NPCs/AstrumDeus/AstrumDeusBody.png delete mode 100644 NPCs/AstrumDeus/AstrumDeusBodyAlt.png delete mode 100644 NPCs/AstrumDeus/AstrumDeusHead.cs delete mode 100644 NPCs/AstrumDeus/AstrumDeusHead.png delete mode 100644 NPCs/AstrumDeus/AstrumDeusHead_Head_Boss.png delete mode 100644 NPCs/AstrumDeus/AstrumDeusProbe.cs delete mode 100644 NPCs/AstrumDeus/AstrumDeusProbe.png delete mode 100644 NPCs/AstrumDeus/AstrumDeusProbe2.cs delete mode 100644 NPCs/AstrumDeus/AstrumDeusProbe2.png delete mode 100644 NPCs/AstrumDeus/AstrumDeusTail.cs delete mode 100644 NPCs/AstrumDeus/AstrumDeusTail.png diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 558a5f6620..8464d5b0e9 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -102,8 +102,8 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - player.lifeRegen -= 16; - } + lifeRegenLost += 16; + } if (modPlayer.vaporfied) { @@ -111,8 +111,8 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - player.lifeRegen -= 8; - } + lifeRegenLost += 8; + } if (modPlayer.cragsLava) { @@ -198,7 +198,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - lifeRegenLost += 20; + lifeRegenLost += 16; } if (modPlayer.pFlames) diff --git a/CalamityMod.cs b/CalamityMod.cs index a45ea7e09b..d7f613dab1 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -66,7 +66,6 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Typeless; using CalamityMod.Skies; using CalamityMod.UI; using CalamityMod.World; @@ -1645,7 +1644,6 @@ namespace CalamityMod { NPCID.TheDestroyer, NPCID.SolarCrawltipedeHead, - ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), @@ -2756,12 +2754,9 @@ namespace CalamityMod { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 5400 }, @@ -2776,12 +2771,12 @@ namespace CalamityMod { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 9000 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 18000 } }; @@ -2866,9 +2861,6 @@ namespace CalamityMod { ModContent.NPCType(), bitingEnemeyVelocityScale }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, diff --git a/Items/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index 426f2b1657..1b9d3ec1c5 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -31,15 +31,11 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()); } public override bool UseItem(Player player) { - for (int x = 0; x < 10; x++) - { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - } NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); return true; diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index c1ef114b12..76efd02013 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -91,17 +91,17 @@ namespace CalamityMod.NPCs.Abyss if (flag16) { npc.localAI[2] = 1f; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; npc.velocity *= 0.975f; float num263 = 0.8f; if (npc.velocity.X > -num263 && npc.velocity.X < num263 && npc.velocity.Y > -num263 && npc.velocity.Y < num263) { npc.TargetClosest(true); float num264 = CalamityWorld.death ? 12f : 8f; - Vector2 vector31 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num265 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector31.X; - float num266 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector31.Y; - float num267 = (float)Math.Sqrt((double)(num265 * num265 + num266 * num266)); + Vector2 vector31 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num265 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector31.X; + float num266 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector31.Y; + float num267 = (float)Math.Sqrt(num265 * num265 + num266 * num266); num267 = num264 / num267; num265 *= num267; num266 *= num267; @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.Abyss else { npc.localAI[2] = 0f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.02f; + npc.velocity.X = npc.velocity.X + npc.direction * 0.02f; npc.rotation = npc.velocity.X * 0.4f; if (npc.velocity.X < -1f || npc.velocity.X > 1f) { @@ -134,8 +134,8 @@ namespace CalamityMod.NPCs.Abyss npc.ai[0] = -1f; } } - int num268 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num269 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + int num268 = (int)(npc.position.X + (npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (npc.height / 2)) / 16; if (Main.tile[num268, num269 - 1] == null) { Main.tile[num268, num269 - 1] = new Tile(); @@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.Abyss { npc.ai[0] = 1f; } - if ((double)npc.velocity.Y > 1.2 || (double)npc.velocity.Y < -1.2) + if (npc.velocity.Y > 1.2 || npc.velocity.Y < -1.2) { npc.velocity.Y = npc.velocity.Y * 0.99f; } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index db90af3107..2b3f5d5bc6 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -48,7 +48,6 @@ namespace CalamityMod.NPCs.Abyss int num = 200; if (npc.ai[2] == 0f) { - npc.localAI[0] += 1f; npc.alpha = num; npc.TargetClosest(true); if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && @@ -60,7 +59,82 @@ namespace CalamityMod.NPCs.Abyss { npc.ai[2] = -16f; } - return; + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + } + if (npc.collideY) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + npc.velocity.X = npc.velocity.X + npc.direction * 0.02f; + npc.rotation = npc.velocity.X * 0.4f; + if (npc.velocity.X < -1f || npc.velocity.X > 1f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if (npc.velocity.Y < -1f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if (npc.velocity.Y > 1f) + { + npc.ai[0] = -1f; + } + } + int num268 = (int)(npc.position.X + (npc.width / 2)) / 16; + int num269 = (int)(npc.position.Y + (npc.height / 2)) / 16; + if (Main.tile[num268, num269 - 1] == null) + { + Main.tile[num268, num269 - 1] = new Tile(); + } + if (Main.tile[num268, num269 + 1] == null) + { + Main.tile[num268, num269 + 1] = new Tile(); + } + if (Main.tile[num268, num269 + 2] == null) + { + Main.tile[num268, num269 + 2] = new Tile(); + } + if (Main.tile[num268, num269 - 1].liquid > 128) + { + if (Main.tile[num268, num269 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num268, num269 + 2].active()) + { + npc.ai[0] = -1f; + } + } + else + { + npc.ai[0] = 1f; + } + if (npc.velocity.Y > 1.2 || npc.velocity.Y < -1.2) + { + npc.velocity.Y = npc.velocity.Y * 0.99f; + } + return; } if (npc.ai[2] < 0f) { @@ -75,8 +149,9 @@ namespace CalamityMod.NPCs.Abyss npc.ai[2] += 1f; if (npc.ai[2] == 0f) { - npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); + npc.ai[0] = 0f; + npc.ai[2] = 1f; + npc.velocity.X = npc.direction * 2; } return; } diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 3e59dba172..6f5ea57545 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -77,9 +77,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - bool phase1 = (double)npc.life > (double)npc.lifeMax * 0.5; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.1; + bool phase1 = npc.life > npc.lifeMax * 0.5; + bool phase2 = npc.life <= npc.lifeMax * 0.5; + bool phase3 = npc.life <= npc.lifeMax * 0.1; npc.chaseable = hasBeenHit; if (npc.soundDelay <= 0) { @@ -108,41 +108,33 @@ namespace CalamityMod.NPCs.Abyss reset2 = true; npc.netUpdate = true; } + npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - int num = 200; if (npc.ai[2] == 0f) { - npc.localAI[0] += 1f; - npc.alpha = num; npc.TargetClosest(true); - if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f) + if (!Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 170f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.ai[2] = -16f; } - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || npc.velocity.Y > 2f || npc.justHit || npc.localAI[0] >= 420f) + if (npc.justHit || npc.localAI[0] >= 420f) { npc.ai[2] = -16f; } return; } + if (npc.ai[2] < 0f) { - if (npc.alpha > 0) - { - npc.alpha -= num / 16; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } npc.ai[2] += 1f; if (npc.ai[2] == 0f) { npc.ai[2] = 1f; - npc.velocity.X = (float)(npc.direction * 2); + npc.velocity.X = npc.direction * 2; } return; } + if (npc.ai[2] == 1f) { if (npc.direction == 0) diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs deleted file mode 100644 index 8a74392812..0000000000 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ /dev/null @@ -1,186 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusBody : ModNPC - { - private int spawn = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 85; - npc.npcSlots = 5f; - npc.width = 38; - npc.height = 44; - npc.defense = 40; - npc.Calamity().RevPlusDR(0.1f); - npc.LifeMaxNERB(12000, 18000, 360000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(spawn); - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - writer.Write(npc.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - spawn = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - npc.localAI[3] = reader.ReadSingle(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - CalamityAI.AstrumDeusAI(npc, mod, false, false); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = npc.localAI[3] == 1f ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAlt") : Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); - - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.dontTakeDamage ? new Color(125, 75, Main.DiscoB, npc.alpha) : npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = npc.localAI[3] == 1f ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow") : ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow"); - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Orange, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - if (npc.localAI[3] != 1f) - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (NPC.CountNPCS(ModContent.NPCType()) < 3 && CalamityWorld.revenge) - { - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(25)) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server && num660 < 200) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } - } - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } -} diff --git a/NPCs/AstrumDeus/AstrumDeusBody.png b/NPCs/AstrumDeus/AstrumDeusBody.png deleted file mode 100644 index 284653890c2549207bf389c3df613d39171fd83a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1620 zcmV-a2CMmrP)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ>+DSw~RCwC#n@>z!MI6V!uizhIVu7^O(uHl>$ORgzWRsd|tck>MD5kYnrA>OM zX+3(dQ4ebBp+`-6A+Z>br388~h9+%-L{fr6x?C_N-LjzkNehh)8iUWnoA0vo+nIgu z?Jo2(zsvI8n>X`@`Mlrn`xS|^ zqL~+`-b&dHI5S!`|7d;Tc>uuogWpCXB(B9EM4B(i-4=ozF}C;D_x-IR!pk4=WFo0u z%w#i>>b2cBw>ag6v|ASOj+ihXQz?7v$QuBFTVo?e6xZt-0un;VAt@|h^JvLPXkL3p z-xxPqI%2k)7)cKG(E%0pX0s21<3w{&VtAe9llz)9f*3`^Op;G} z=(D6=iTa#W%F@{1`t+_VeBO8I9Irq-X0D$(NMl^jRl`*5(lqx?tAKc&X?KHL% zRbR>eu)m{@n25yK6z}x-nszL+;4nqWdf(eo8=TnC>+5T40RVi=>{#VgRJy#rnfe6A z`dI(O&0a4GK{9J+|458fz>b(OA0rj-%5;#+JQVXJHgdwOCq1JSCN$qsGabD1a&Gr< z>$A!i{Vt+gGFH2`Rfc-iKPY0P0(Qj2)iICntr!WR@=Qj|Vi}FDsAEPUMx~rWR>ZKK z_N-o>QHu33I)(WZl1Qb@^Yf~IPRCS=n0ocD70ksx(tSdMn4yy+*Ap>^lKMhs!3Dl5 zBx_z5x}|{pG@tuTM@&h?gk{x|9FD{nwa;ngt_mefT|zSCtUl}O>^=bi7#&w?Xn)o%IpV1EF)^c(%#my>gf?<6D{`*Fytd5wmgy(alrzh7zDC+*e@&2r zNaQn`%ACnXrMSc}N2=b80v-Tl)GC1_hcjx-dJpeYGG@)(VBYM%cHD@)MX%e8?T!7Z zKTnM%szU7aS`j&uBPK2})hdqHUOedm!0M&z+J8Ee&G@Dq=iE#8i#9~1Ea!GN*RD6T zX(dz|KQz+?4HPc65!{_NlN_*b8>rjrExWv%c$Q@Mj+X7mrdbjx|_qDZn z0MKJu^X48qTFbGM0D$Em2F=mLGS{5j`LzI;2$m-I-sSDAa>T?UCU57Ian?VK6wcNc zjF762_frRPAFypl6=&>{iKJI7S7W=ZzZ0pryD~i0f8P-kkr=O(8*PL{C5=YCVmpp% zc{{<4U#EmU$I*c^o+GB5s3fD2+?!u2AvT-2eLYtB*E_la06$L*8L!J|WBZnX{gmY$ zF*c9P@0H5^_A!i*NFqN|d-plmzFem6RtI zr7{#GX6BXX<)xM=nCKbmnFu>%9ARK!VeoWu45^5FJKZoZ#8AXFI4CHv(ZzADQm)mC zMD`F(!6Zf#K_O{}MGgvOj;#W`rxUnMauPQ5p8xRdTWNPKx|NTfe}D6PT(A4& z#b?us1>W7WyjL=*`mJPmr|v)QBY#}iC`<6npJ$^t$Hq$AruNgC1G8#>9sXm_c}i@( zP|rF$i5|wbMhB6%my3nMr6%acsU@YI-@vW9xVFmg(SIH`X5HprEh4o+T+d(Zo!+V& z$HtK_85L{55yl+FF7D;_JL-8$RAtnIEoTpk{cqDMx+Jh8!06U>EA=bu(hWlIs7PE| zzNqoVKI_#7IhGyV%Daq%+vQ^QF;176TxwVQloHq9d2Mp;pxE>UhnTK#-%LsKJ$OT5 zN{-PZr;{1;t-U*>)*Q3E@kppiL%ph7s%&A(mh*E}U3kMD%j6XD@xPlZ*0e%t%JKtJ zS0L`~v$W6J5cNEvyIA6&&xcQMLKk-3;bJ%C(woxr`s|CHccvdcVUg>-;izg)f))p- zNaJ3&lKBo1oBi!e?_S?`q)%`8UiRoWj;tzO2BK@)w)Fpc)zmmmQ9)w+^qI4s|67&X zefeIq?zaU@Ldr9IcI@GB`VrK;c4wHqfxCRwDznufy^YmY}WgOV$}~GX(jnT;CR+Qfr&}*p3#OW*LJQ_Hf%b%qVGszbLXPP4%Z|+ z{_BY>TIn;VH)H;}%gevBZh}~)*gi?nP+5XSW`AY)j{lEJ85d@?eEs?JIMY|n7x{CK z*WT%u`?B&~T+YUJK_6ybHiJt>E`Q&)e`md$e%9{qE`QmO;~dKtS@FsB)U||eU^^fK z)RsPP*S*7kUnKgKeoyMQE%?ac<}uw#u)(0?nGyf~8m$k)^Oqm|_x!y**P5Hl=U0An zeDCUiHErwn1fbeN(T(Z>yldi3;U$#>j)11Dbvg{(nS<^`^{{x4~tOWAuauopL9EROc) z2)e8U@kCQ5>k_sV%!~~2yP~e|8EW0q0C1%_(^JT4bApM00e?#Wiz zm3NlCD3`y)&|EzFjbhs*!$)O22FG`a9_i&~n{$H0{)P$1z8X`BUw0$()) < 6 && CalamityWorld.revenge) + if (Main.expertMode) { - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(25)) + if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(25)) { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server && num660 < 200) - { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; + if (NPC.CountNPCS(ModContent.NPCType()) < 3) + { + int num660 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + if (Main.netMode == NetmodeID.Server && num660 < 200) + { + NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } } } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 50; npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); @@ -204,7 +191,7 @@ namespace CalamityMod.NPCs.AstrumDeus if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 10; num623++) diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs deleted file mode 100644 index 4951512def..0000000000 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ /dev/null @@ -1,165 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -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 Terraria.ModLoader.Config; -using CalamityMod; - -namespace CalamityMod.NPCs.AstrumDeus -{ - [AutoloadBossHead] - public class AstrumDeusHead : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 100; - npc.npcSlots = 5f; - npc.width = 56; - npc.height = 56; - npc.defense = 20; - npc.Calamity().RevPlusDR(0.1f); - npc.LifeMaxNERB(12000, 18000, 360000); - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - CalamityAI.AstrumDeusAI(npc, mod, true, false); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); - - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.dontTakeDamage ? new Color(125, 75, Main.DiscoB, npc.alpha) : npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow"); - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Orange, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - return false; - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 240, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - } - } -} diff --git a/NPCs/AstrumDeus/AstrumDeusHead.png b/NPCs/AstrumDeus/AstrumDeusHead.png deleted file mode 100644 index 36c7f52056f6d539c76f10ea55d0266a6b3eef20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2119 zcmV-N2)Or&P)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ@%}GQ-RCwC#oNb5|RT#(rQwf=Z^y03o*S%t}2#dJ2ENEt^C6VAp5kV4IBou-a zeJJcxpOos$MzItKYJ`GV;T05#P!eBYQP*Ti1jBW&wY&DBA51B7`Y`8zch1v!X69b+ zoxR3+zAX37nVEC;{O*4w{;QnuwtPI02nS0hf0$G07k~nSYJB&mw0|& zb{D+emfe%%y)0t39Xn(leD$#vHCNG(k0U+5z7=$Cr|09*U}8cL!ku!%L$B5!8lpG5L%wHUb;iM${0zqP+F zYy^p(z$VZ@XFRrU%?kj4*-P52?|1f>B5%2Sd!TsXP>JipqpY zfF1kxpq}xgCvXxqFa&^2n>PXgw!HTV0H9@I4*+1w+=6KqY0;JP-4OAalf0N_Id7_I zn)KehAGMJEVgJU@4nXw3CXMt2P8Na8X*-rbZ@!5L?3{M5lZ0{HKX7yhq+7sAp1X4Q~Uopb3Li?c|qj!_uS866R8fo9HTnzwtau-OVojaR&kk{9|siw^w534mp*KZ;|{_(Q|PA&8V z=ADT=Gp}gPJZJ90sX?oq^q$iDYQ{KFv(BCw5rG+Vb*(=qN`qDu!12%v4_){5z)2&} zseQ82EaO3vvuX3js@4=_?%T4kCj@}*r`A_>{%o{my``1W&}1&3RSP|Vjn+WUgq$JH zJZFf;)wvC?t#^_-v(S}zzmLLe0D!JJ?(Khrmm|Q}rSzNkOS6gok6GiK7_WPrUIQCN zAS3u2iZ-Ox>*UVTk+Cy@@qS@E_hcO|mVp2Owwv?%FzUSi_UWyreXDi;VstsZdF=jG zX{scVURh>1p1?X17{+s6#(Ub#FejGltks%a-IIhr@bokQ!0!jI!{s%#%5qkd-j?H* z{hUjm)(1Pwb@d8ki4(jwgJ=T1ce!X*uWRH>0%LyAF<; z&$FVO*Q|M*dplxtXy966{3!3Al{^}ENN~@MB+(OCZvv}*wv1j)W-#=|!^Ycb>%t_D zCgVhEAEvvH^Zcty|0>ag68~v+K8FTcBzgktWYs*Wl9tsxflWYQRq>TpPtkXHlz-Ea9W8Td<*55@Bxe6B=3_c3(KkY>)O@%maW?&zoY!cF0Yvl8`c5FKN%LYgdKsuw8_p3VtB^2O3C za4zpYbMe`oPQ%gbW}%Ln=4m{V1LTB*{-~nKXz^Bf{&V2u04<= 720f) - { - npc.localAI[0] = 0f; - int seeProjFileforDmg = 0; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, ModContent.ProjectileType(), seeProjFileforDmg, 0f, Main.myPlayer, 0f, 0f); - } - bool anySmallDeusHeads = NPC.AnyNPCs(ModContent.NPCType()); - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = anySmallDeusHeads ? ModContent.NPCType() : ModContent.NPCType(); - NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 75; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Astral/AstralProbeGlow"); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, Color.White * 0.6f, npc.rotation, vector11, npc.scale, npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - - return false; - } - } -} diff --git a/NPCs/AstrumDeus/AstrumDeusProbe.png b/NPCs/AstrumDeus/AstrumDeusProbe.png deleted file mode 100644 index cb5bb69dc7c508eab14e0d597a424f80114a13b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 536 zcmV+z0_XjSP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0j)_yK~z{r-IdQP zgK-?khm=~`sLjD+6XmivOe-ZtTB0a&QA*wQDPvi1OE>1R;-z|q~!?wY) zQ19L>&Lo|BfeWj})_Dnjl$_-=6o zW$$&A2jCd4=Tc$bD3p-iE#LDY$<56s~R2 zU~+Jlgq>eVH9LfF6AAd5U|Hn-R)@3sN0|3*9qz#T)77t~>{p0o273DNfrL*;SVWeH zc^=@#AvgSdT!f=JFI;&uB#|>U+-km$rO1t*HLlFa-;p?PQ(M6&=3Cev?uLEZ2i(zb z-tdxSd>`IekHPjYL{z2Pv;b^X;yUsDFP}TVhl$)0Fjl(P=$?G*R_mhgm zWeU#d8CY&^=MSi)Hr;Y`R`AhM8E5sCdb^~~rb&Q_>4GfNPwA`<%-`Y)xHP+_w| aF4q^Q(yC;=UHYK_0000= 360f) - { - npc.localAI[0] = 0f; - int seeProjFileforDmg = 0; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, ModContent.ProjectileType(), seeProjFileforDmg, 0f, Main.myPlayer, 0f, 0f); - } - bool anySmallDeusHeads = NPC.AnyNPCs(ModContent.NPCType()); - if (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - Player player = Main.player[npc.target]; - int npcType = anySmallDeusHeads ? ModContent.NPCType() : ModContent.NPCType(); - NPC parent = Main.npc[NPC.FindFirstNPC(npcType)]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 150; - npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; - npc.ai[1] += 2f; - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Astral/AstralProbeGlow"); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, Color.White * 0.6f, npc.rotation, vector11, npc.scale, npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - - return false; - } - } -} diff --git a/NPCs/AstrumDeus/AstrumDeusProbe2.png b/NPCs/AstrumDeus/AstrumDeusProbe2.png deleted file mode 100644 index cb5bb69dc7c508eab14e0d597a424f80114a13b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 536 zcmV+z0_XjSP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0j)_yK~z{r-IdQP zgK-?khm=~`sLjD+6XmivOe-ZtTB0a&QA*wQDPvi1OE>1R;-z|q~!?wY) zQ19L>&Lo|BfeWj})_Dnjl$_-=6o zW$$&A2jCd4=Tc$bD3p-iE#LDY$<56s~R2 zU~+Jlgq>eVH9LfF6AAd5U|Hn-R)@3sN0|3*9qz#T)77t~>{p0o273DNfrL*;SVWeH zc^=@#AvgSdT!f=JFI;&uB#|>U+-km$rO1t*HLlFa-;p?PQ(M6&=3Cev?uLEZ2i(zb z-tdxSd>`IekHPjYL{z2Pv;b^X;yUsDFP}TVhl$)0Fjl(P=$?G*R_mhgm zWeU#d8CY&^=MSi)Hr;Y`R`AhM8E5sCdb^~~rb&Q_>4GfNPwA`<%-`Y)xHP+_w| aF4q^Q(yC;=UHYK_0000 600f) @@ -119,7 +113,7 @@ namespace CalamityMod.NPCs.AstrumDeus } if (Main.player[npc.target].dead) { - num4 = (float)npc.direction * num / 2f; + num4 = npc.direction * num / 2f; num5 = -num / 2f; } if (npc.velocity.X < num4) @@ -155,17 +149,17 @@ namespace CalamityMod.NPCs.AstrumDeus num11 /= 16; if (!WorldGen.SolidTile(num10, num11)) { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); } if (num4 > 0f) { npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); + npc.rotation = (float)Math.Atan2(num5, num4); } if (num4 < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + npc.rotation = (float)Math.Atan2(num5, num4) + 3.14f; } float num12 = 0.7f; if (npc.collideX) @@ -185,11 +179,11 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) { npc.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) { npc.velocity.Y = -2f; } @@ -221,9 +215,9 @@ namespace CalamityMod.NPCs.AstrumDeus spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -256,12 +250,12 @@ namespace CalamityMod.NPCs.AstrumDeus if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 30; npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); @@ -269,7 +263,7 @@ namespace CalamityMod.NPCs.AstrumDeus if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 10; num623++) @@ -291,25 +285,25 @@ namespace CalamityMod.NPCs.AstrumDeus { scaleFactor10 = 1f; } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + int num626 = Gore.NewGore(new Vector2(npc.position.X + (npc.width / 2) - 24f, npc.position.Y + (npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; expr_13AB6_cp_0.velocity.X += 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + num626 = Gore.NewGore(new Vector2(npc.position.X + (npc.width / 2) - 24f, npc.position.Y + (npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; expr_13B79_cp_0.velocity.X -= 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + num626 = Gore.NewGore(new Vector2(npc.position.X + (npc.width / 2) - 24f, npc.position.Y + (npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; expr_13C3C_cp_0.velocity.X += 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + num626 = Gore.NewGore(new Vector2(npc.position.X + (npc.width / 2) - 24f, npc.position.Y + (npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; expr_13CFF_cp_0.velocity.X -= 1f; diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs deleted file mode 100644 index b1da58c004..0000000000 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ /dev/null @@ -1,162 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; - -namespace CalamityMod.NPCs.AstrumDeus -{ - public class AstrumDeusTail : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - } - - public override void SetDefaults() - { - npc.damage = 70; - npc.npcSlots = 5f; - npc.width = 52; - npc.height = 68; - npc.defense = 60; - npc.Calamity().RevPlusDR(0.35f); - npc.LifeMaxNERB(12000, 18000, 360000); - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; - aiType = -1; - npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - npc.behindTiles = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.dontCountMe = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - CalamityAI.AstrumDeusAI(npc, mod, false, false); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return !npc.dontTakeDamage; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); - - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.dontTakeDamage ? new Color(125, 75, Main.DiscoB, npc.alpha) : npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow"); - Color color37 = Color.Lerp(Color.White, Color.Orange, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 50; - npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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 + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 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, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 120, true); - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } - } -} diff --git a/NPCs/AstrumDeus/AstrumDeusTail.png b/NPCs/AstrumDeus/AstrumDeusTail.png deleted file mode 100644 index 2e13fbf3f8ad9c98e807e6374ec9d5341bf1edd3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1462 zcmV;n1xfmeP)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ>JV``BRCwC#TTf^mMI8P%wPMV{7|4sJoA*kKr_!c12oVXG(hxk@9@1N(LCwL6 zg%odc6gX$P*h? zaQ548A^<4uRxAH(2>{T#va~LJ_tba*kWxe*PHX%9?==9xYuhWSiU#`!w060(%huJ1 zbfbTa>@KD6$B8Ss9;9v~8gFLgHb(~=D;NnbrCM8#BO+USLapDgzg$g4nB3g?Vqg5L z#y^;w*XG6h<*>eycpgU)P2rTbqVf%}AxT8?3j0$Jf6L;2avnB>j^y)jz=0Ozm#r0H=td#U@sFkbnwcTNBR#y|g5TiHam z5~y~RC-MOvrgF&;!)p3@e+Yp8exZgZ4Ef4NinC2}gkRlWLWsruEk8c`FZI41z~BAu}YT}vl5wBVP$O<2gaVC zM1KPS-V2`5Vrv}4 zW#!7>lV=#ZpVS8)c_aS)`b(qVPMl##MG~H)1rg2it2Siom4X#B7dwvVZ7DK4u_2ko zO^;}nBv#Idtjr_HwW-^21hoInr!{WU3jc8Cu92HIe<_jl94(5d;hi@kORG5z9huP^ zGXQ|m=$+9)hi0vajEH1*&}=Dsf6vkNN>+rEcYM|x zWs8M9qU#+v*gp`c$jRteZDNavvbb2(Z#s);(;u{BxXqfIK2{I<*jQbgOx=ztwqLaK zN>MB85#21Y`Ok?h6@}=s)&^$MD-@oi{}YZ9k%a$C{c56hWhvT7MCB3PY(ymziHOD$ z8Fd=_mz18mzD>%KJfiEBM^2V0uAcj66#($I>c{r6-XQ?McYn>ql?!>=#dEZnn9eX1 z72}ssl= (CalamityWorld.bossRushActive ? 300f : (revenge ? 360f : 420f))) @@ -183,37 +187,37 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - int damageBoom = Main.expertMode ? 23 : 28; + int damageBoom = expertMode ? 23 : 28; float velocity = revenge ? 7.5f : 6.5f; if (death) velocity += 2f; if (CalamityWorld.bossRushActive) velocity = 11f; - int totalProjectiles = 30; + int totalProjectiles = expertMode ? 30 : 20; float radians = MathHelper.TwoPi / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { - int projectileType = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - if (projectileType == ModContent.ProjectileType()) - damageBoom = Main.expertMode ? 25 : 30; - + int projectileType = ModContent.ProjectileType(); Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); Projectile.NewProjectile(npc.Center, vector255, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } - damageBoom = Main.expertMode ? 28 : 33; - int num320 = Main.rand.Next(5, 9); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) + damageBoom = expertMode ? 28 : 33; + int num320 = expertMode ? 14 : 7; + for (int num321 = 0; num321 < num320; num321++) { Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - if (death) + vector15 *= Main.rand.Next(50, 401); + + if (expertMode) + vector15 *= death ? 0.05f : 0.05f * (1f - lifeRatio); + + if (CalamityWorld.bossRushActive) vector15 *= 1.1f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); - num3 = num321; + + Projectile.NewProjectile(npc.Center, vector15, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); } } } @@ -228,7 +232,7 @@ namespace CalamityMod.NPCs { if (npc.type == ModContent.NPCType()) { - int num = (Main.expertMode || CalamityWorld.bossRushActive) ? 4 : 3; + int num = expertMode ? 4 : 3; npc.localAI[0] += Main.rand.Next(num); if (npc.localAI[0] >= Main.rand.Next(700, 10000)) { @@ -242,7 +246,7 @@ namespace CalamityMod.NPCs float num943 = player.position.Y + player.height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int projectileType = ModContent.ProjectileType(); - int damage = Main.expertMode ? 25 : 30; + int damage = expertMode ? 25 : 30; float num941 = CalamityWorld.bossRushActive ? 7.5f : 5f; num944 = num941 / num944; num942 *= num944; @@ -268,7 +272,7 @@ namespace CalamityMod.NPCs float num943 = player.position.Y + player.height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int projectileType = ModContent.ProjectileType(); - int damage = Main.expertMode ? 23 : 28; + int damage = expertMode ? 23 : 28; float num941 = CalamityWorld.bossRushActive ? 12f : 8f; num944 = num941 / num944; num942 *= num944; @@ -376,14 +380,14 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] == 1f) { - num188 = revenge ? 15f : 13f; - num189 = 0.16f; + num188 = revenge ? 13f : 11f; + num189 = revenge ? 0.14f : 0.12f; if (notOcean) { - num188 = 17f; - num189 = 0.18f; + num188 = 15f; + num189 = 0.15f; } - if (player.gravDir == -1f) + if (player.gravDir == -1f && expertMode) { num188 = 20f; num189 = 0.2f; @@ -393,10 +397,10 @@ namespace CalamityMod.NPCs num188 = 22f; num189 = 0.24f; } - if (death) + if (expertMode) { - num188 += 1f; - num189 += 0.02f; + num188 += death ? 4f : 4f * (1f - lifeRatio); + num189 += death ? 0.04f : 0.04f * (1f - lifeRatio); } } @@ -634,8 +638,9 @@ namespace CalamityMod.NPCs speed = 6f; else if (revenge) speed = 5.5f; - float speedBoost = death ? 2f : 2f * (1f - lifeRatio); - speed += speedBoost; + + if (expertMode) + speed += death ? 2f : 2f * (1f - lifeRatio); // Variables for target location relative to npc location float xDistance = player.Center.X - vectorCenter.X; @@ -766,26 +771,15 @@ namespace CalamityMod.NPCs { npc.chaseable = true; npc.rotation = npc.velocity.X * 0.04f; + float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; + npc.ai[1] += 1f; + float divisor = expertMode ? (death ? 30f : revenge ? 35f : 40f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 45f; - bool shootProjectile = false; - if (lifeRatio < 0.1f || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 30f == 29f) - shootProjectile = true; - } - else if (lifeRatio < 0.5f || death) - { - if (npc.ai[1] % 35f == 34f) - shootProjectile = true; - } - else if (npc.ai[1] % 40f == 39f) - shootProjectile = true; - - if (shootProjectile) + if (npc.ai[1] % divisor == divisor - 1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -822,8 +816,9 @@ namespace CalamityMod.NPCs projectileSpeed += 1f; if (!calamity) projectileSpeed += 2f; - float projectileSpeedBoost = death ? 3f : 3f * (1f - lifeRatio); - projectileSpeed += projectileSpeedBoost; + + if (expertMode) + projectileSpeed += death ? 3f : 3f * (1f - lifeRatio); vectorCenter = npc.Center; float relativeSpeedX = player.position.X + player.width * 0.5f - vectorCenter.X; @@ -882,7 +877,7 @@ namespace CalamityMod.NPCs npc.velocity.X = -8f; } - if (npc.ai[1] >= 300f) + if (npc.ai[1] >= divisor * 6f) { npc.TargetClosest(true); npc.ai[0] = 4f; @@ -900,8 +895,10 @@ namespace CalamityMod.NPCs npc.chaseable = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - float shootBoost = death ? 2f : 2f * (1f - lifeRatio); - npc.localAI[0] += 1f + shootBoost; + npc.localAI[0] += 1f; + if (expertMode) + npc.localAI[0] += death ? 2f : 2f * (1f - lifeRatio); + if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[0] += 2f; if (death || !calamity) @@ -1127,7 +1124,7 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.calamitas = npc.whoAmI; // Seeker ring - if (calamityGlobalNPC.newAI[1] == 0f && lifeRatio <= 0.35f) + if (calamityGlobalNPC.newAI[1] == 0f && lifeRatio <= 0.35f && expertMode) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1358,8 +1355,8 @@ namespace CalamityMod.NPCs { if (!brotherAlive) { - float shootBoost = death ? 1f : 1f * (1f - lifeRatio); - npc.localAI[1] += shootBoost; + if (expertMode) + npc.localAI[1] += death ? 1f : 1f * (1f - lifeRatio); if (revenge) npc.localAI[1] += 0.5f; } @@ -1538,7 +1535,7 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; if (npc.ai[2] >= (phase2 ? 120f : 180f)) { - npc.ai[1] = (phase2 && !brotherAlive && lifeRatio < 0.7f && revenge ? 4f : 0f); + npc.ai[1] = phase2 && !brotherAlive && lifeRatio < 0.7f && revenge ? 4f : 0f; npc.ai[2] = 0f; npc.TargetClosest(true); npc.netUpdate = true; @@ -2223,9 +2220,12 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - int shootBuff = death ? 1 : (int)(2f * (1f - lifeRatio)); - float shootTimer = 1f + shootBuff; - bool dayTime = Main.dayTime; + + float shootTimer = 1f; + if (expertMode) + shootTimer += death ? 1 : (int)(2f * (1f - lifeRatio)); + + bool dayTime = Main.dayTime; // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -2384,11 +2384,12 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 2f) { // Set walking speed - float speedBoost = death ? 3f : 3f * (1f - lifeRatio); - float num823 = (CalamityWorld.bossRushActive ? 8f : 5f) + speedBoost; + float num823 = CalamityWorld.bossRushActive ? 8f : 5f; + if (expertMode) + num823 += death ? 3f : 3f * (1f - lifeRatio); - // Set walking direction - if (Math.Abs(npc.Center.X - player.Center.X) < 200f) + // Set walking direction + if (Math.Abs(npc.Center.X - player.Center.X) < 200f) { npc.velocity.X *= 0.9f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) @@ -2476,11 +2477,13 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == -1f) { // Set jump velocity, reset and set AI to next phase (Stomp) - float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); - float velocityX = (CalamityWorld.bossRushActive ? 9f : 6f) + velocityBoost; - npc.velocity.X = velocityX * npc.direction; + float velocityX = CalamityWorld.bossRushActive ? 9f : 6f; + if (expertMode) + velocityX += death ? 6f : 6f * (1f - lifeRatio); - if (revenge) + npc.velocity.X = velocityX * npc.direction; + + if (expertMode) { if (player.position.Y < npc.Bottom.Y) npc.velocity.Y = -14.5f; @@ -2531,7 +2534,7 @@ namespace CalamityMod.NPCs { // Set velocities while falling, this happens before the stomp // Fall through - if (!player.dead && revenge) + if (!player.dead && expertMode) { if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) npc.noTileCollide = true; @@ -2545,8 +2548,10 @@ namespace CalamityMod.NPCs if (npc.Bottom.Y < player.position.Y) { - float fallSpeedBoost = death ? 0.8f : 0.8f * (1f - lifeRatio); - float fallSpeed = 0.8f + fallSpeedBoost; + float fallSpeed = 0.8f; + if (expertMode) + fallSpeed += death ? 0.8f : 0.8f * (1f - lifeRatio); + npc.velocity.Y += fallSpeed; } } @@ -2557,8 +2562,10 @@ namespace CalamityMod.NPCs else if (npc.direction > 0) npc.velocity.X += 0.2f; - float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); - float num626 = (CalamityWorld.bossRushActive ? 12f : 9f) + velocityBoost; + float num626 = CalamityWorld.bossRushActive ? 12f : 9f; + if (expertMode) + num626 += death ? 6f : 6f * (1f - lifeRatio); + if (npc.velocity.X < -num626) npc.velocity.X = -num626; if (npc.velocity.X > num626) @@ -2651,13 +2658,11 @@ namespace CalamityMod.NPCs } // Emit dust to make the teleport pretty - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) + for (int num245 = 0; num245 < 10; num245++) { int num244 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); Main.dust[num244].noGravity = true; Main.dust[num244].velocity *= 0.5f; - num = num245; } } @@ -2694,22 +2699,19 @@ namespace CalamityMod.NPCs } // Emit dust to make the teleport pretty - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) + for (int num245 = 0; num245 < 10; num245++) { int num244 = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); Main.dust[num244].noGravity = true; Main.dust[num244].velocity *= 0.5f; - num = num245; } } } #endregion #region Astrum Deus - public static void AstrumDeusAI(NPC npc, Mod mod, bool head, bool finalWorm) + public static void AstrumDeusAI(NPC npc, Mod mod, bool head) { - // All parts of every worm use the following code CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Difficulty variables @@ -2718,11 +2720,96 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive); + // 8 seconds of reistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 480f) + calamityGlobalNPC.newAI[1] += 1f; + + // Get a target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); + + Player player = Main.player[npc.target]; + + // Life + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool phase2 = (lifeRatio < 0.9f && expertMode) || death || (doubleWormPhase && expertMode); + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase3 = (lifeRatio < 0.7f && expertMode) || death || (doubleWormPhase && expertMode); + bool phase4 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase5 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? 1200f : 1800f; + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + + // Enrage variable if player is flying upside down + bool targetFloatingUp = player.gravDir == -1f && expertMode; + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Split into two worms + if (head) + { + float splitAnimationTime = 180f; + bool despawnRemainingWorm = doubleWormPhase && NPC.CountNPCS(ModContent.NPCType()) < 2; + if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) + { + npc.dontTakeDamage = true; + + calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; + npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + + if (calamityGlobalNPC.newAI[2] == splitAnimationTime) + { + if (head) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !doubleWormPhase) + { + int npc2 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[npc2].Calamity().newAI[0] = 1f; + int npc3 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[npc3].Calamity().newAI[0] = 2f; + Main.npc[npc3].Calamity().newAI[3] = 600f; + } + + for (int num957 = 0; num957 < Main.maxNPCs; num957++) + { + if (Main.npc[num957].Calamity().newAI[0] == 0f || despawnRemainingWorm) + { + if (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) + Main.npc[num957].active = false; + } + } + } + + return; + } + } + } + + // Copy dontTakeDamage and Opacity from previous segment + else + { + npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; + npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; + } + + // Set worm variable + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Dust and alpha effects - if (head || Main.npc[(int)npc.ai[1]].alpha < 128) + if ((head || Main.npc[(int)npc.ai[1]].alpha < 128) && !npc.dontTakeDamage) { // Spawn dust if (npc.alpha != 0) @@ -2741,18 +2828,30 @@ namespace CalamityMod.NPCs npc.alpha = 0; } - // Set worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - - // Get a target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); - - Player player = Main.player[npc.target]; - - // Velocity - npc.velocity.Length(); + // Check if other segments are still alive, if not, die + if (npc.type > ModContent.NPCType()) + { + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + } // Direction if (npc.velocity.X < 0f) @@ -2760,43 +2859,17 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > 0f) npc.spriteDirection = 1; - // Despawn - float maxSpeed = 20f; - bool flies = false; - if (player.dead || Main.dayTime || (!finalWorm && (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active))) - { - flies = true; - npc.TargetClosest(false); - float velocity = finalWorm ? 10f : 3f; - npc.velocity.Y -= velocity; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - maxSpeed = 40f; - npc.velocity.Y -= velocity; - } - - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int num957 = 0; num957 < Main.maxNPCs; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle || Main.npc[num957].type == ModContent.NPCType() || - Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) - Main.npc[num957].active = false; - } - } - } - - // All heads use this code + // Head code if (head) { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (calamityGlobalNPC.newAI[1] == 0f && npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { - int maxLength = finalWorm ? 13 : 5; + int maxLength = doubleWormPhase ? 45 : 90; int Previous = npc.whoAmI; - int bodyType = finalWorm ? ModContent.NPCType() : ModContent.NPCType(); - int tailType = finalWorm ? ModContent.NPCType() : ModContent.NPCType(); + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); for (int num36 = 0; num36 < maxLength; num36++) { int lol; @@ -2809,261 +2882,345 @@ namespace CalamityMod.NPCs Main.npc[lol].localAI[3] = 1f; Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].Calamity().newAI[0] = calamityGlobalNPC.newAI[0]; + Main.npc[lol].Calamity().newAI[3] = calamityGlobalNPC.newAI[3]; Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } - calamityGlobalNPC.newAI[1] = 1f; } } } - // All body and tail segments use this code - else + if (head) { - // Kill segments - bool flag = false; - if (npc.ai[1] <= 0f) - flag = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - flag = true; + int num12 = (int)(npc.position.X / 16f) - 1; + int num13 = (int)((npc.position.X + npc.width) / 16f) + 2; + int num14 = (int)(npc.position.Y / 16f) - 1; + int num15 = (int)((npc.position.Y + npc.height) / 16f) + 2; - if (flag) + if (num12 < 0) + num12 = 0; + if (num13 > Main.maxTilesX) + num13 = Main.maxTilesX; + if (num14 < 0) + num14 = 0; + if (num15 > Main.maxTilesY) + num15 = Main.maxTilesY; + + // Fly or not + bool flag2 = flyAtTarget; + if (!flag2) { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - } - - // Only the main worm uses this code - if (finalWorm) - { - // Only the main worm head uses this code - if (head) - { - // For other worms and probes - CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI; - - // Change color depending on phase - if (NPC.AnyNPCs(ModContent.NPCType())) - calamityGlobalNPC.newAI[0] = 1f; - else - calamityGlobalNPC.newAI[0] = 0f; - - // Calculate phases based on worm HP - int astrumDeusTotalHP = 0; - double mainDeusHPRatio = npc.life / (double)npc.lifeMax; - if (calamityGlobalNPC.newAI[0] == 1f) + for (int k = num12; k < num13; k++) { - for (int i = 0; i < Main.maxNPCs; i++) + for (int l = num14; l < num15; l++) { - if (Main.npc[i].type == ModContent.NPCType()) + if (Main.tile[k, l] != null && ((Main.tile[k, l].nactive() && (Main.tileSolid[Main.tile[k, l].type] || (Main.tileSolidTop[Main.tile[k, l].type] && Main.tile[k, l].frameY == 0))) || Main.tile[k, l].liquid > 64)) { - astrumDeusTotalHP += Main.npc[i].life; - if (calamityGlobalNPC.newAI[2] < 10f) + Vector2 vector2; + vector2.X = k * 16; + vector2.Y = l * 16; + if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) { - calamityGlobalNPC.newAI[2] += 1f; - calamityGlobalNPC.newAI[3] += Main.npc[i].lifeMax; + flag2 = true; + break; } } } - - double astrumDeusHPRatio = astrumDeusTotalHP / calamityGlobalNPC.newAI[3]; - if (astrumDeusHPRatio < 0.33) - { - if (mainDeusHPRatio > 0.33) - calamityGlobalNPC.newAI[0] = 0f; - } - else if (astrumDeusHPRatio < 0.66) - { - if (mainDeusHPRatio > 0.66) - calamityGlobalNPC.newAI[0] = 0f; - } } - - // Change vulnerability based on phase (indicated by color) - npc.dontTakeDamage = calamityGlobalNPC.newAI[0] == 1f; - npc.chaseable = calamityGlobalNPC.newAI[0] != 1f; - - // Speed and turn speed - float speedLimit = revenge ? 7f : 6f; - float turnSpeedLimit = revenge ? 0.11f : 0.1f; - if (CalamityWorld.bossRushActive) - { - speedLimit *= 1.5f; - turnSpeedLimit *= 1.5f; - } - - // Speed and turn speed boosts based on remaining HP - float speedBoost = death ? speedLimit : speedLimit * (1f - (float)mainDeusHPRatio); - float turnSpeedBoost = death ? turnSpeedLimit : turnSpeedLimit * (1f - (float)mainDeusHPRatio); - if (player.gravDir == -1f) - { - speedBoost = speedLimit; - turnSpeedBoost = turnSpeedLimit; - } - - // Velocity - float num188 = 10f + speedBoost; - float num189 = 0.2f + turnSpeedBoost; - - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - - int num42 = -1; - int num43 = (int)(player.Center.X / 16f); - int num44 = (int)(player.Center.Y / 16f); - - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - break; - } - - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X += num189; - } - else - { - if (npc.velocity.X > num191) - npc.velocity.X -= num189; - } - - if (npc.velocity.Y < num192) - { - npc.velocity.Y += num189; - } - else - { - if (npc.velocity.Y > num192) - npc.velocity.Y -= num189; - } - - if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num189 * 2f; - else - npc.velocity.Y -= num189 * 2f; - } - - if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num189 * 2f; - else - npc.velocity.X -= num189 * 2f; - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - npc.velocity.X += num189 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189 * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num189; - else - npc.velocity.Y -= num189; - } - } - else - { - if (npc.velocity.Y < num192) - npc.velocity.Y += num189 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= num189 * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num189; - else - npc.velocity.X -= num189; - } - } - } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; } - // Only the main worm body and tail use this code - else + // Start flying if target is not within a certain distance + if (!flag2) { - // Change vulnerability based on phase (indicated by color) - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) + npc.localAI[1] = 1f; + + if (head) { - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; + Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + int num16 = targetFloatingUp ? 50 : 200; + int heightReduction = death ? (targetFloatingUp ? 180 : 130) : (int)((targetFloatingUp ? 180f : 130f) * (1f - lifeRatio)); + int height = 400 - heightReduction; + bool flag3 = true; + + if (npc.position.Y > player.position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, height); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + flag2 = true; + } + } + } + else + npc.localAI[1] = 0f; + + // Despawn + float fallSpeed = 20f; + if (player.dead || Main.dayTime) + { + flag2 = false; + float velocity = 2f; + npc.velocity.Y -= velocity; + if ((double)npc.position.Y < Main.topWorld + 16f) + { + fallSpeed = 40f; + npc.velocity.Y -= velocity; } - // Shoot lasers - if (npc.type == ModContent.NPCType() && Main.netMode != NetmodeID.MultiplayerClient) + if ((double)npc.position.Y < Main.topWorld + 16f) { - int shootTime = 4; - if (npc.life <= npc.lifeMax * 0.65 || death || player.gravDir == -1f) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { - shootTime += death ? 4 : 2; + if (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) + Main.npc[num957].active = false; } - if (npc.life <= npc.lifeMax * 0.3 || death || player.gravDir == -1f) + } + } + + float fallSpeedBoost = death ? 5f : 5f * (1f - lifeRatio); + fallSpeed += fallSpeedBoost; + + // Speed and movement + float speedBoost = death ? (targetFloatingUp ? 0.2f : 0.1f) : ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); + float turnSpeedBoost = death ? (targetFloatingUp ? 0.3f : 0.15f) : ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); + float speed = 0.1f + speedBoost; + float turnSpeed = 0.15f + turnSpeedBoost; + + if (flyAtTarget) + { + float speedMultiplier = phase5 ? 2f : phase4 ? 1.5f : 1f; + speed *= speedMultiplier; + fallSpeed *= speedMultiplier; + } + + if (CalamityWorld.bossRushActive) + { + speed *= 1.5f; + turnSpeed *= 1.5f; + } + + Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num20 = player.position.X + (player.width / 2); + float num21 = player.position.Y + (player.height / 2); + num20 = (int)(num20 / 16f) * 16; + num21 = (int)(num21 / 16f) * 16; + vector3.X = (int)(vector3.X / 16f) * 16; + vector3.Y = (int)(vector3.Y / 16f) * 16; + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); + + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y += 0.15f; + + if (npc.velocity.Y > fallSpeed) + npc.velocity.Y = fallSpeed; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= speed * 1.1f; + else + npc.velocity.X += speed * 1.1f; + } + else if (npc.velocity.Y == fallSpeed) + { + if (npc.velocity.X < num20) + npc.velocity.X += speed; + else if (npc.velocity.X > num20) + npc.velocity.X -= speed; + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + npc.velocity.X += speed * 0.9f; + else + npc.velocity.X -= speed * 0.9f; + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + num24 = 10f; + if (num24 > 20f) + num24 = 20f; + + npc.soundDelay = (int)num24; + Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + + num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = fallSpeed / num22; + num20 *= num27; + num21 *= num27; + + bool flag6 = false; + if (flyAtTarget) + { + if (((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f) || (npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && num22 < 400f) { - shootTime += death ? 6 : 2; + flag6 = true; + + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < fallSpeed) + npc.velocity *= 1.1f; } - npc.localAI[0] += Main.rand.Next(shootTime); - if (npc.localAI[0] >= Main.rand.Next(1400, 20000)) + + if (npc.position.Y > player.position.Y) + { + flag6 = true; + + if (Math.Abs(npc.velocity.X) < fallSpeed / 2f) + { + if (npc.velocity.X == 0f) + npc.velocity.X -= npc.direction; + + npc.velocity.X *= 1.1f; + } + else if (npc.velocity.Y > -fallSpeed) + npc.velocity.Y -= speed; + } + } + + if (!flag6) + { + if (!flyAtTarget) + { + if (((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f)) && ((npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f))) + { + if (npc.velocity.X < num20) + npc.velocity.X += turnSpeed; + else if (npc.velocity.X > num20) + npc.velocity.X -= turnSpeed; + if (npc.velocity.Y < num21) + npc.velocity.Y += turnSpeed; + else if (npc.velocity.Y > num21) + npc.velocity.Y -= turnSpeed; + } + } + + if ((npc.velocity.X > 0f && num20 > 0f) || (npc.velocity.X < 0f && num20 < 0f) || (npc.velocity.Y > 0f && num21 > 0f) || (npc.velocity.Y < 0f && num21 < 0f)) + { + if (npc.velocity.X < num20) + npc.velocity.X += speed; + else if (npc.velocity.X > num20) + npc.velocity.X -= speed; + if (npc.velocity.Y < num21) + npc.velocity.Y += speed; + else if (npc.velocity.Y > num21) + npc.velocity.Y -= speed; + + if (Math.Abs(num21) < fallSpeed * 0.2 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed * 2f; + else + npc.velocity.Y -= speed * 2f; + } + if (Math.Abs(num20) < fallSpeed * 0.2 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed * 2f; + else + npc.velocity.X -= speed * 2f; + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + npc.velocity.X += speed * 1.1f; + else if (npc.velocity.X > num20) + npc.velocity.X -= speed * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += speed; + else + npc.velocity.Y -= speed; + } + } + else + { + if (npc.velocity.Y < num21) + npc.velocity.Y += speed * 1.1f; + else if (npc.velocity.Y > num21) + npc.velocity.Y -= speed * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += speed; + else + npc.velocity.X -= speed; + } + } + } + } + + if (flag2) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + npc.localAI[0] = 0f; + } + + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + npc.netUpdate = true; + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + } + + // Only the main worm body and tail use this code + else + { + // Shoot lasers + if (npc.type == ModContent.NPCType() && Main.netMode != NetmodeID.MultiplayerClient) + { + int shootTime = 1; + if (phase2 || targetFloatingUp) + shootTime += 1; + if (phase3 || targetFloatingUp) + shootTime += 1; + + npc.localAI[0] += 1f; + float shootProjectile = 600 / shootTime; + if (!flyAtTarget) + { + float timer = npc.ai[0] + 12f; + float divisor = timer + shootProjectile; + if (npc.localAI[0] % divisor == 0f) { - npc.localAI[0] = 0f; npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Vector2.Distance(player.Center, npc.Center) > 80f) { float num941 = revenge ? 14f : 13f; if (CalamityWorld.bossRushActive) @@ -3074,7 +3231,7 @@ namespace CalamityMod.NPCs { num941 = 16f; } - if (player.gravDir == -1f) + if (targetFloatingUp) { num941 *= 2f; } @@ -3089,377 +3246,61 @@ namespace CalamityMod.NPCs int num946 = ModContent.ProjectileType(); vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } } } - - // Follow the head - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - - if (num191 < 0f) - npc.spriteDirection = -1; - else if (num191 > 0f) - npc.spriteDirection = 1; - } - } - } - - // Only the smaller worms use this code - else - { - // Change vulnerability based on phase (indicated by final worm color) - if (CalamityGlobalNPC.astrumDeusHeadMain != -1) - { - if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active) - { - npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage; - npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable; - } - } - - // Life remaining - float deusHPRatio = npc.life / (float)npc.lifeMax; - - // Only the smaller worm heads use this code - if (head) - { - // Spawn mine probes - float firstProbeSpawnThreshold = death ? 0.9f : 0.66f; - float secondProbeSpawnThreshold = death ? 0.8f : 0.33f; - - if (deusHPRatio <= firstProbeSpawnThreshold) - { - if (calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 3; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; - } - calamityGlobalNPC.newAI[0] = 1f; - } - } - if (deusHPRatio <= secondProbeSpawnThreshold) - { - if (calamityGlobalNPC.newAI[0] == 1f && Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - Eye.ai[3] = I * 72; - } - calamityGlobalNPC.newAI[0] = 2f; - } - } - - // Velocity variables - float speedAdd = expertMode ? 0.06f : 0.045f; - float turnSpeedAdd = expertMode ? 0.04f : 0.03f; - float newSpeedBoost = death ? speedAdd : speedAdd * (1f - deusHPRatio); - float newTurnSpeedBoost = death ? turnSpeedAdd : turnSpeedAdd * (1f - deusHPRatio); - float newSpeed = 0.12f + newSpeedBoost; - float newTurnSpeed = 0.08f + newTurnSpeedBoost; - - // Movement variables - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; - - if (num180 < 0) - num180 = 0; - if (num181 > Main.maxTilesX) - num181 = Main.maxTilesX; - if (num182 < 0) - num182 = 0; - if (num183 > Main.maxTilesY) - num183 = Main.maxTilesY; - - // Fly or not - if (!flies) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = num952 * 16; - vector105.Y = num953 * 16; - if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - - if (!flies) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - - int rectX = (int)(600f * deusHPRatio); - if (rectX < 200) - rectX = 200; - - int rectY = (int)(enraged ? 200f : 400f * deusHPRatio); - if (rectY < (enraged ? 75 : 150)) - rectY = enraged ? 75 : 150; - - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < Main.maxPlayers; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - flies = true; - } - } - else - npc.localAI[1] = 0f; - - // Velocity - float num188 = newSpeed; - float num189 = newTurnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - - // Spread the worms out based on proximity to other worms - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == npc.type && i != npc.whoAmI) - { - Vector2 vector = Main.npc[i].Center - npc.Center; - if (vector.Length() < 80f) - { - vector.Normalize(); - vector *= 300f; - num191 -= vector.X; - num192 -= vector.Y; - } - } - } - - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - - if (!flies) - { - npc.TargetClosest(true); - - npc.velocity.Y += 0.15f; - if (npc.velocity.Y > maxSpeed) - npc.velocity.Y = maxSpeed; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < maxSpeed * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= num188 * 1.1f; - else - npc.velocity.X += num188 * 1.1f; - } - else if (npc.velocity.Y == maxSpeed) - { - if (npc.velocity.X < num191) - npc.velocity.X += num188; - else if (npc.velocity.X > num191) - npc.velocity.X -= num188; - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - npc.velocity.X += num188 * 0.9f; - else - npc.velocity.X -= num188 * 0.9f; - } - } else { - if (npc.behindTiles && npc.soundDelay == 0) + if (npc.localAI[0] % shootProjectile == 0f) { - float num195 = num193 / 40f; - if (num195 < 10f) - num195 = 10f; - if (num195 > 20f) - num195 = 20f; - - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = maxSpeed / num193; - num191 *= num198; - num192 *= num198; - - if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) - { - if (npc.velocity.X < num191) - npc.velocity.X += num189; - else if (npc.velocity.X > num191) - npc.velocity.X -= num189; - - if (npc.velocity.Y < num192) - npc.velocity.Y += num189; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= num189; - } - - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X += num188; - } - else - { - if (npc.velocity.X > num191) - npc.velocity.X -= num188; - } - - if (npc.velocity.Y < num192) - { - npc.velocity.Y += num188; - } - else - { - if (npc.velocity.Y > num192) - npc.velocity.Y -= num188; - } - - if (Math.Abs(num192) < maxSpeed * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num188 * 2f; - else - npc.velocity.Y -= num188 * 2f; - } - - if (Math.Abs(num191) < maxSpeed * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num188 * 2f; - else - npc.velocity.X -= num188 * 2f; - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - npc.velocity.X += num188 * 1.1f; - else if (npc.velocity.X > num191) - npc.velocity.X -= num188 * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < maxSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num188; - else - npc.velocity.Y -= num188; - } - } - else - { - if (npc.velocity.Y < num192) - npc.velocity.Y += num188 * 1.1f; - else if (npc.velocity.Y > num192) - npc.velocity.Y -= num188 * 1.1f; - - if ((Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < maxSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num188; - else - npc.velocity.X -= num188; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - - if (flies) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; + int num945 = expertMode ? 45 : 60; + int num946 = ModContent.ProjectileType(); + Projectile.NewProjectile(npc.Center, Vector2.Zero, num946, num945, 0f, Main.myPlayer, 0f, 0f); } } } + + // Follow the head + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } } } #endregion @@ -3640,10 +3481,10 @@ namespace CalamityMod.NPCs } } - float num823 = 7.5f; - float num824 = 0.08f; + float num823 = expertMode ? 7.5f : 6f; + float num824 = expertMode ? 0.08f : 0.06f; if (!player.ZoneDungeon || CalamityWorld.bossRushActive) - num823 = 25f; + num823 = expertMode ? 25f : 20f; Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; @@ -3691,9 +3532,9 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[0] = npc.life; calamityGlobalNPC.newAI[2] += 1f; - int glob = revenge ? 8 : 4; + int glob = expertMode ? 8 : 4; if (calamityGlobalNPC.newAI[0] <= 0.5f) - glob = revenge ? 16 : 8; + glob = expertMode ? 16 : 8; for (int num662 = 0; num662 < glob; num662++) { @@ -3721,6 +3562,7 @@ namespace CalamityMod.NPCs // Variables float rotationMult = 3f; float rotationAmt = 0.03f; + bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; @@ -3766,7 +3608,7 @@ namespace CalamityMod.NPCs // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; - bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; float newPhaseTimer = 180f; bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || @@ -3953,7 +3795,7 @@ namespace CalamityMod.NPCs if (phase3) num1307 = 1; - int damage = Main.expertMode ? 50 : 60; + int damage = expertMode ? 50 : 60; if (num1307 == 0 && canHit) { @@ -4065,7 +3907,7 @@ namespace CalamityMod.NPCs Vector2 value53 = player.Center - npc.Center; value53.Y -= 20f; npc.ai[2] += 0.0222222228f; - if (Main.expertMode) + if (expertMode) npc.ai[2] += 0.0166666675f; float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4 @@ -4288,7 +4130,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 20f) { int num1325 = 10; - if (Main.expertMode) + if (expertMode) num1325 = (int)(num1325 * 0.75); npc.ai[3] += 1f; @@ -4388,8 +4230,8 @@ namespace CalamityMod.NPCs } // Adjust stats - calamityGlobalNPC.DR = calamityGlobalNPC.newAI[1] == 1f ? 0.15f : 0.6f; - npc.defense = calamityGlobalNPC.newAI[1] == 1f ? npc.defDefense / 4 : npc.defDefense; + calamityGlobalNPC.DR = calamityGlobalNPC.newAI[1] == 1f ? 0f : 0.5f; + npc.defense = calamityGlobalNPC.newAI[1] == 1f ? 0 : npc.defDefense; if (phase3AI) { npc.damage = (int)(npc.defDamage * 1.32f); diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index d1a11035ac..bdc64d5252 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -2546,7 +2546,7 @@ namespace CalamityMod.NPCs float KBResistMultiplier = 1f - baseKnockBackResist * 0.4f; for (float num = 1f; num < balance; num += 0.34f) { - if ((double)KBResist < 0.05) + if (KBResist < 0.05) { KBResist = 0f; break; @@ -2565,11 +2565,14 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; int enrageScale = 0; - if ((double)(npc.position.Y / 16f) < Main.worldSurface) + if ((npc.position.Y / 16f) < Main.worldSurface) enrageScale++; if (!Main.player[npc.target].ZoneJungle) enrageScale++; + if (CalamityWorld.bossRushActive) + enrageScale = 0; + // Boost defense and damage as health decreases int statBoost = (int)(20f * (1f - npc.life / (float)npc.lifeMax)); if (death) @@ -2610,7 +2613,7 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; - if (npc.position.X < (float)(Main.maxTilesX * 8)) + if (npc.position.X < (Main.maxTilesX * 8)) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -4379,13 +4382,17 @@ namespace CalamityMod.NPCs float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on life percentage - bool phase2 = lifeRatio < 0.66f || death; - bool phase3 = lifeRatio < 0.33f || death; + bool phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.7f || death; + bool startFlightPhase = lifeRatio < 0.5f || death; + bool phase4 = lifeRatio < 0.25f; + bool phase5 = lifeRatio < 0.1f; // Flight timer + float newAISet = phase5 ? 900f : phase4 ? 450f : 0f; calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= 1800f) - calamityGlobalNPC.newAI[3] = 0f; + calamityGlobalNPC.newAI[3] = newAISet; // Set worm variable for worms if (npc.ai[3] > 0f) @@ -4401,10 +4408,7 @@ namespace CalamityMod.NPCs bool targetFloatingUp = player.gravDir == -1f; // Phase for flying at the player - bool flyAtTarget = calamityGlobalNPC.newAI[3] >= 900f && (lifeRatio < 0.5f || death); - - // Velocity - npc.velocity.Length(); + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase; // Dust on spawn and alpha effects if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) @@ -4499,10 +4503,10 @@ namespace CalamityMod.NPCs } // Fire lasers - if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > (flyAtTarget ? 320f : 80f)) + if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 80f && !flyAtTarget) { // Laser rate of fire - int shootTime = 1 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 7D : 3D) * lifeRatio); + int shootTime = 2 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 5D : 2D) * (1f - lifeRatio)); if (CalamityWorld.bossRushActive) shootTime += 1; @@ -4561,11 +4565,6 @@ namespace CalamityMod.NPCs damage += 4; projectileType = ModContent.ProjectileType(); } - else if (phase2) - { - damage += 2; - projectileType = ModContent.ProjectileType(); - } } else projectileType = ProjectileID.SaucerScrap; @@ -4701,6 +4700,7 @@ namespace CalamityMod.NPCs } } } + float fallSpeedBoost = death ? 5f : 5f * (1f - lifeRatio); fallSpeed += fallSpeedBoost; @@ -4710,6 +4710,13 @@ namespace CalamityMod.NPCs float speed = 0.1f + speedBoost; float turnSpeed = 0.15f + turnSpeedBoost; + if (flyAtTarget) + { + float speedMultiplier = phase5 ? 2f : phase4 ? 1.5f : 1f; + speed *= speedMultiplier; + fallSpeed *= speedMultiplier; + } + if (CalamityWorld.bossRushActive) { speed *= 1.5f; @@ -13543,6 +13550,12 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.MoonLordFreeEye) { + if (Main.npc[(int)npc.ai[3]].ai[0] == 2f) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + if (calamityGlobalNPC.newAI[0] == 0f) { int eyeCount = NPC.CountNPCS(npc.type); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6f6a616e52..e1882075d4 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -169,7 +169,6 @@ namespace CalamityMod.NPCs public static int leviathan = -1; public static int siren = -1; public static int scavenger = -1; - public static int astrumDeusHeadMain = -1; public static int energyFlame = -1; public static int doughnutBoss = -1; public static int holyBossAttacker = -1; @@ -280,9 +279,6 @@ namespace CalamityMod.NPCs /// public static List AstrumDeusIDs = new List { - NPCType(), - NPCType(), - NPCType(), NPCType(), NPCType(), NPCType() @@ -374,7 +370,6 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref leviathan, NPCType()); ResetSavedIndex(ref siren, NPCType()); ResetSavedIndex(ref scavenger, NPCType()); - ResetSavedIndex(ref astrumDeusHeadMain, NPCType()); ResetSavedIndex(ref energyFlame, NPCType()); ResetSavedIndex(ref doughnutBoss, NPCType()); ResetSavedIndex(ref holyBossAttacker, NPCType()); @@ -1427,17 +1422,24 @@ namespace CalamityMod.NPCs #region Strike NPC public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { + // Damage reduction on spawn if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { - if (DestroyerIDs.Contains(npc.type)) + if (DestroyerIDs.Contains(npc.type) || AstrumDeusIDs.Contains(npc.type)) { - if (newAI[1] < 480f || newAI[2] > 0f) + if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) { damage *= 0.01; } } } + // Large Deus worm takes reduced damage to last a long enough time + if (AstrumDeusIDs.Contains(npc.type) && newAI[0] == 0f) + { + damage *= 0.8; + } + // Override hand/head eye 'death' code and use custom 'death' code instead, this is here just in case the AI code fails if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { @@ -2916,8 +2918,7 @@ namespace CalamityMod.NPCs break; case 29: - if (!AstrumDeusIDs.Contains(npc.type) && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) + if (!AstrumDeusIDs.Contains(npc.type) && npc.type != NPCType()) { npc.active = false; npc.netUpdate = true; @@ -5920,7 +5921,7 @@ namespace CalamityMod.NPCs { return CalamityWorld.downedAstrageldon; } - else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + else if (type == NPCType() || type == NPCType() || type == NPCType()) { return CalamityWorld.downedStarGod; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 721657255b..6faba5ba67 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -13,8 +13,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumDeus; @@ -26,7 +24,6 @@ using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Ravager; @@ -1342,12 +1339,6 @@ namespace CalamityMod.NPCs if (lastPlayer >= 0) { CalamityWorld.ChangeTime(false); - - for (int x = 0; x < 10; x++) - { - NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); - } - NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); CalamityMod.astralKillCount = 0; } diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index d33f5aee09..750129fd1c 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Crabulon public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.2f, 0.4f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.2f, 0.4f); bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; float speed = revenge ? 1.25f : 1f; Player player = Main.player[npc.target]; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Crabulon npc.velocity.Y = speed; } npc.TargetClosest(true); - if (npc.position.X + (float)npc.width < player.position.X) + if (npc.position.X + npc.width < player.position.X) { if (npc.velocity.X < 0f) { @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.Crabulon } npc.velocity.X += (CalamityWorld.bossRushActive ? 0.2f : 0.1f); } - else if (npc.position.X > player.position.X + (float)player.width) + else if (npc.position.X > player.position.X + player.width) { if (npc.velocity.X > 0f) { @@ -85,9 +85,9 @@ namespace CalamityMod.NPCs.Crabulon spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; - 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, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 5e50e22318..c1671858b1 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -17,8 +17,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Crabulon { [AutoloadBossHead] @@ -77,13 +75,21 @@ namespace CalamityMod.NPCs.Crabulon { npc.gfxOffY = -16; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.3f, 0.7f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.3f, 0.7f); bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + npc.spriteDirection = npc.direction; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = (lifeRatio < 0.5f && expertMode) || death; + bool phase3 = (lifeRatio < 0.1f && expertMode) || death; + // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(true); @@ -123,10 +129,10 @@ namespace CalamityMod.NPCs.Crabulon if (npc.ai[0] != 0f && npc.ai[0] < 3f) { - Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num349 = player.position.X + (float)(player.width / 2) - vector34.X; - float num350 = player.position.Y + (float)(player.height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num349 = player.position.X + (player.width / 2) - vector34.X; + float num350 = player.position.Y + (player.height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); if (Main.netMode != NetmodeID.MultiplayerClient) { int num352 = 1; @@ -136,12 +142,12 @@ namespace CalamityMod.NPCs.Crabulon npc.localAI[3] += 2f; num352 += 3; } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) + if (phase2) { npc.localAI[3] += 1f; num352 += 2; } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (phase3) { npc.localAI[3] += 2f; num352 += 3; @@ -158,7 +164,7 @@ namespace CalamityMod.NPCs.Crabulon { npc.localAI[3] = 0f; npc.ai[3] += 1f; - if (npc.ai[3] >= (float)num352) + if (npc.ai[3] >= num352) { npc.ai[3] = 0f; } @@ -170,18 +176,18 @@ namespace CalamityMod.NPCs.Crabulon { num353 += 3f; } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) + if (phase2) { num353 += 1f; } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (phase3) { num353 += 1f; } - vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num349 = player.position.X + (float)player.width * 0.5f - vector34.X; - num350 = player.position.Y + (float)player.height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); + vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num349 = player.position.X + player.width * 0.5f - vector34.X; + num350 = player.position.Y + player.height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num351 = num353 / num351; num349 *= num351; num350 *= num351; @@ -229,9 +235,9 @@ namespace CalamityMod.NPCs.Crabulon { float num823 = 1.25f; bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) + if (phase2) num823 = 1.5f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (phase3) num823 = 2f; if (CalamityWorld.bossRushActive) num823 = 12f; @@ -245,7 +251,7 @@ namespace CalamityMod.NPCs.Crabulon if (flag51) { npc.velocity.X *= 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) { npc.velocity.X = 0f; } @@ -262,9 +268,9 @@ namespace CalamityMod.NPCs.Crabulon } int num854 = 80; int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); bool flag52 = false; - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width && npc.position.Y + (float)npc.height < player.position.Y + (float)player.height - 16f) + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) { flag52 = true; } @@ -278,7 +284,7 @@ namespace CalamityMod.NPCs.Crabulon { npc.velocity.Y = 0f; } - if ((double)npc.velocity.Y > -0.2) + if (npc.velocity.Y > -0.2) { npc.velocity.Y -= 0.025f; } @@ -297,7 +303,7 @@ namespace CalamityMod.NPCs.Crabulon { npc.velocity.Y = 0f; } - if ((double)npc.velocity.Y < 0.1) + if (npc.velocity.Y < 0.1) { npc.velocity.Y += 0.025f; } @@ -349,13 +355,13 @@ namespace CalamityMod.NPCs.Crabulon break; } } - if (npc.life < npc.lifeMax / 2 || death) + if (phase2) { - npc.ai[1] += (!revenge ? 4f : 1f); + npc.ai[1] += !revenge ? 4f : 1f; } - if (npc.life < npc.lifeMax / 4 || death) + if (phase3) { - npc.ai[1] += (!revenge ? 4f : 1f); + npc.ai[1] += !revenge ? 4f : 1f; } } @@ -387,8 +393,20 @@ namespace CalamityMod.NPCs.Crabulon break; } } - npc.velocity.X = (float)(velocityX * npc.direction); - npc.velocity.Y = velocityY; + + if (expertMode) + { + if (player.position.Y < npc.Bottom.Y) + npc.velocity.Y = velocityY; + else + npc.velocity.Y = 1f; + + npc.noTileCollide = true; + } + else + npc.velocity.Y = velocityY; + + npc.velocity.X = velocityX * npc.direction; npc.ai[0] = 4f; npc.ai[1] = 0f; @@ -405,14 +423,14 @@ namespace CalamityMod.NPCs.Crabulon Projectile.NewProjectile((int)npc.Center.X, (int)npc.Center.Y + 20, 0f, 0f, ModContent.ProjectileType(), 20, 0f, Main.myPlayer, 0f, 0f); int num354 = expertMode ? 12 : 16; - if (npc.ai[2] % 2f == 0f && (double)npc.life < (double)npc.lifeMax * 0.5 && revenge) + if (npc.ai[2] % 2f == 0f && phase2 && revenge) { if (Main.netMode != NetmodeID.MultiplayerClient) { float velocityX = npc.ai[2] == 0f ? -4f : 4f; for (int x = 0; x < 20; x++) { - Projectile.NewProjectile(npc.Center.X + (float)shotSpacing, npc.Center.Y - 1000f, velocityX, 0f, ModContent.ProjectileType(), num354, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, velocityX, 0f, ModContent.ProjectileType(), num354, 0f, Main.myPlayer, 0f, 0f); shotSpacing -= 100; } shotSpacing = 1000; @@ -421,13 +439,13 @@ namespace CalamityMod.NPCs.Crabulon npc.TargetClosest(true); npc.ai[2] += 1f; - if (npc.ai[2] >= ((double)npc.life < (double)npc.lifeMax * 0.5 ? 4f : 3f)) + if (npc.ai[2] >= (phase2 ? 4f : 3f)) { - if (Main.netMode != NetmodeID.MultiplayerClient && revenge && (double)npc.life >= (double)npc.lifeMax * 0.5) + if (Main.netMode != NetmodeID.MultiplayerClient && revenge && !phase2) { for (int x = 0; x < 20; x++) { - Projectile.NewProjectile(npc.Center.X + (float)shotSpacing, npc.Center.Y - 1000f, 0f, 0f, ModContent.ProjectileType(), num354, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, 0f, 0f, ModContent.ProjectileType(), num354, 0f, Main.myPlayer, 0f, 0f); shotSpacing -= 100; } shotSpacing = 1000; @@ -449,17 +467,25 @@ namespace CalamityMod.NPCs.Crabulon { for (int num623 = 0; num623 < 4; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); Main.dust[num624].velocity *= 0.2f; } } } else { - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) + if (!player.dead && expertMode) + { + if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) + npc.noTileCollide = true; + else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) + npc.noTileCollide = false; + } + + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) { npc.velocity.X *= 0.9f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.3f : 0.15f); + npc.velocity.Y += CalamityWorld.bossRushActive ? 0.3f : 0.15f; } else { @@ -481,11 +507,11 @@ namespace CalamityMod.NPCs.Crabulon { num626 += 3f; } - if (npc.life < npc.lifeMax / 2 || death) + if (phase2) { num626 += 1f; } - if (npc.life < npc.lifeMax / 10 || death) + if (phase3) { num626 += 1f; } @@ -503,26 +529,26 @@ namespace CalamityMod.NPCs.Crabulon if (npc.localAI[0] == 0f && npc.life > 0) { - npc.localAI[0] = (float)npc.lifeMax; + npc.localAI[0] = npc.lifeMax; } if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.05); - if ((float)(npc.life + num660) < npc.localAI[0]) + int num660 = (int)(npc.lifeMax * 0.05); + if ((npc.life + num660) < npc.localAI[0]) { - npc.localAI[0] = (float)npc.life; + npc.localAI[0] = npc.life; int num661 = expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3); for (int num662 = 0; num662 < num661; num662++) { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); int num663 = ModContent.NPCType(); int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-50, 51) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-50, -31) * 0.1f; + Main.npc[num664].velocity.X = Main.rand.Next(-50, 51) * 0.1f; + Main.npc[num664].velocity.Y = Main.rand.Next(-50, -31) * 0.1f; if (Main.netMode == NetmodeID.Server && num664 < 200) { NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); @@ -558,17 +584,17 @@ namespace CalamityMod.NPCs.Crabulon Texture2D textureAttack = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonAttack"); Texture2D textureAttackGlow = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)Main.npcTexture[npc.type].Width, (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(Main.npcTexture[npc.type].Width, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (npc.ai[0] > 2f) { - vector11 = new Vector2((float)(textureAttack.Width / 2), (float)(textureAttack.Height / 2)); + vector11 = new Vector2(textureAttack.Width / 2, textureAttack.Height / 2); vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)textureAttack.Width, (float)(textureAttack.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(textureAttack, vector43, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -577,9 +603,9 @@ namespace CalamityMod.NPCs.Crabulon } else if (npc.ai[0] == 2f) { - vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); + vector11 = new Vector2(texture.Width / 2, texture.Height / 2); vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture, vector43, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -643,12 +669,12 @@ namespace CalamityMod.NPCs.Crabulon } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 200; npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); @@ -656,7 +682,7 @@ namespace CalamityMod.NPCs.Crabulon if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) @@ -667,7 +693,7 @@ namespace CalamityMod.NPCs.Crabulon num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 56, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 200) / 100; Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon2"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Crabulon3"), 1f); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 20046193a3..83c8440805 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -124,9 +124,21 @@ namespace CalamityMod.NPCs.Cryogen bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - double multAdd = revenge ? 0.1 : 0D; - if ((int)npc.ai[0] + 1 > currentPhase && currentPhase < 6) + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < (death ? 0.95 : revenge ? 0.89 : 0.83); + bool phase3 = lifeRatio < (death ? 0.8 : revenge ? 0.73 : 0.66); + bool phase4 = lifeRatio < (death ? 0.7 : revenge ? 0.6 : 0.49); + bool phase5 = lifeRatio < (death ? 0.55 : revenge ? 0.43 : 0.32); + bool phase6 = lifeRatio < (death ? 0.4 : revenge ? 0.27 : 0.15); + bool phase7 = lifeRatio < (death ? 0.25 : 0.15) && revenge; + bool phase8 = lifeRatio < (revenge ? 0.225 : 0.1); + bool phase9 = lifeRatio < (revenge ? 0.2 : 0.05) || death; + + if ((int)npc.ai[0] + 1 > currentPhase && currentPhase < 6) { HandlePhaseTransition((int)npc.ai[0] + 1); } @@ -195,7 +207,7 @@ namespace CalamityMod.NPCs.Cryogen else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !revenge || npc.life >= npc.lifeMax * 0.15)) + if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !phase7)) { time++; if (time >= 600) @@ -227,7 +239,7 @@ namespace CalamityMod.NPCs.Cryogen { int totalProjectiles = 16; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = Main.expertMode ? 20 : 23; + int damage = expertMode ? 20 : 23; float velocity = CalamityWorld.bossRushActive ? 12f : 8f; for (int k = 0; k < totalProjectiles; k++) { @@ -257,8 +269,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - double HPMult = death ? 0.95 : 0.83 + multAdd; - if (npc.life < npc.lifeMax * HPMult) + if (phase2) { npc.TargetClosest(true); npc.ai[0] = 1f; @@ -278,7 +289,7 @@ namespace CalamityMod.NPCs.Cryogen { int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = Main.expertMode ? 20 : 23; + int damage = expertMode ? 20 : 23; float velocity2 = CalamityWorld.bossRushActive ? 12f : 8f; for (int k = 0; k < totalProjectiles; k++) { @@ -341,8 +352,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.X = -velocity; } - double HPMult = death ? 0.8 : 0.66 + multAdd; - if (npc.life < npc.lifeMax * HPMult) + if (phase3) { npc.TargetClosest(true); npc.ai[0] = 2f; @@ -366,7 +376,7 @@ namespace CalamityMod.NPCs.Cryogen { int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = Main.expertMode ? 20 : 23; + int damage = expertMode ? 20 : 23; float velocity = CalamityWorld.bossRushActive ? 14f : 9f; for (int k = 0; k < totalProjectiles; k++) { @@ -392,14 +402,14 @@ namespace CalamityMod.NPCs.Cryogen int num185 = ModContent.ProjectileType(); value9.X += num180; value9.Y += num182; - for (int num186 = 0; num186 < 15; num186++) + for (int num186 = 0; num186 < 6; num186++) { num180 = player.position.X + player.width * 0.5f - value9.X; num182 = player.position.Y + player.height * 0.5f - value9.Y; num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += Main.rand.Next(-180, 181); - num182 += Main.rand.Next(-180, 181); + num180 += Main.rand.Next(-360, 361); + num182 += Main.rand.Next(-360, 361); num180 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, -8f, num185, num184, 0f, Main.myPlayer, 0f, 0f); } @@ -427,8 +437,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - double HPMult = death ? 0.7 : 0.49 + multAdd; - if (npc.life < npc.lifeMax * HPMult) + if (phase4) { npc.TargetClosest(true); npc.ai[0] = 3f; @@ -463,7 +472,7 @@ namespace CalamityMod.NPCs.Cryogen int num185 = ModContent.ProjectileType(); value9.X += num180; value9.Y += num182; - for (int num186 = 0; num186 < 15; num186++) + for (int num186 = 0; num186 < 12; num186++) { num180 = player.position.X + player.width * 0.5f - value9.X; num182 = player.position.Y + player.height * 0.5f - value9.Y; @@ -530,8 +539,7 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.X = -velocity; } - double HPMult = death ? 0.55 : 0.32 + multAdd; - if (npc.life < npc.lifeMax * HPMult) + if (phase5) { npc.TargetClosest(true); npc.ai[0] = 4f; @@ -552,7 +560,7 @@ namespace CalamityMod.NPCs.Cryogen { int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = Main.expertMode ? 20 : 23; + int damage = expertMode ? 20 : 23; float velocity = CalamityWorld.bossRushActive ? 14f : 9f; for (int k = 0; k < totalProjectiles; k++) { @@ -661,8 +669,7 @@ namespace CalamityMod.NPCs.Cryogen } } - double HPMult = death ? 0.4 : 0.15 + multAdd; - if (npc.life < npc.lifeMax * HPMult) + if (phase6) { for (int num621 = 0; num621 < 40; num621++) { @@ -721,8 +728,7 @@ namespace CalamityMod.NPCs.Cryogen { npc.damage = (int)(npc.defDamage * 1.5f); - double HPMult = death ? 0.25 : 0.15; - if (revenge && npc.life < npc.lifeMax * HPMult) + if (phase7) { if (npc.ai[1] == 60f) npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (CalamityWorld.bossRushActive ? 30f : (isChill ? 18f : 24f)); @@ -771,7 +777,7 @@ namespace CalamityMod.NPCs.Cryogen num1374 *= num1376; iceShard--; - if (npc.life < npc.lifeMax * (0.1 + multAdd) || death) + if (phase9) { if (num1375 < 170f || iceShard > 0) { @@ -783,7 +789,7 @@ namespace CalamityMod.NPCs.Cryogen return; } } - else if (npc.life < npc.lifeMax * (0.125 + multAdd)) + else if (phase8) { if (num1375 < 190f || iceShard > 0) { @@ -904,7 +910,7 @@ namespace CalamityMod.NPCs.Cryogen } } - if (!revenge || npc.life >= npc.lifeMax * (death ? 0.25 : 0.15)) + if (!phase7) { if (npc.ai[3] == 0f && npc.life > 0) { @@ -1009,7 +1015,7 @@ namespace CalamityMod.NPCs.Cryogen if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) @@ -1020,7 +1026,7 @@ namespace CalamityMod.NPCs.Cryogen num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 200) / 100; for (int i = 1; i < 4; i++) { Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoDeathGore" + i), 1f); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 6bc5d371f4..ba89e10baf 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -18,18 +18,14 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] public class DesertScourgeHead : ModNPC { private bool flies = false; - private float speed = 15f; - private float turnSpeed = 0.15f; - private const int minLength = 30; - private const int maxLength = 31; + private float speed = 8f; + private float turnSpeed = 0.08f; private bool TailSpawned = false; public override void SetStaticDefaults() @@ -89,17 +85,28 @@ namespace CalamityMod.NPCs.DesertScourge bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - float speedMult = expertMode ? 1.5f : 1.45f; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) - speedMult = 2f; - if (CalamityWorld.bossRushActive) - speedMult *= 2f; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; - float speedBoost = death ? speedMult : speedMult - ((float)npc.life / (float)npc.lifeMax); - speed = 13f * speedBoost; - turnSpeed = 0.13f * speedBoost; + if (expertMode) + { + speed += death ? 10f : 10f * (1f - lifeRatio); + turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); + } - if (npc.ai[3] > 0f) + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (CalamityWorld.bossRushActive) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } @@ -123,7 +130,8 @@ namespace CalamityMod.NPCs.DesertScourge if (!TailSpawned && npc.ai[0] == 0f) { int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) + int minLength = expertMode ? 30 : 25; + for (int num36 = 0; num36 < minLength + 1; num36++) { int lol; if (num36 >= 0 && num36 < minLength) @@ -135,9 +143,9 @@ namespace CalamityMod.NPCs.DesertScourge lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } @@ -145,9 +153,9 @@ namespace CalamityMod.NPCs.DesertScourge } } int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; if (num180 < 0) { num180 = 0; diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index 1e100a2eb9..4ffd7fe296 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.DevourerofGods global.DR = 0.5f; global.unbreakableDR = true; npc.lifeMax = 100000; - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; @@ -64,7 +64,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (invinceTime > 0) { invinceTime--; @@ -76,13 +77,29 @@ namespace CalamityMod.NPCs.DevourerofGods npc.damage = npc.defDamage; npc.dontTakeDamage = false; } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -96,7 +113,39 @@ namespace CalamityMod.NPCs.DevourerofGods npc.alpha = 0; } } - } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 2c4b5c6d84..980867be92 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -24,7 +24,6 @@ namespace CalamityMod.NPCs.DevourerofGods private bool halfLife = false; private bool halfLife2 = false; private int spawnDoGCountdown = 0; - private int phaseSwitch = 0; public override void SetStaticDefaults() { @@ -39,8 +38,8 @@ namespace CalamityMod.NPCs.DevourerofGods npc.height = 104; npc.defense = 50; npc.LifeMaxNERB(675000, 750000); - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; npc.aiStyle = -1; aiType = -1; @@ -69,7 +68,6 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(halfLife); writer.Write(halfLife2); writer.Write(spawnDoGCountdown); - writer.Write(phaseSwitch); } public override void ReceiveExtraAI(BinaryReader reader) @@ -77,11 +75,12 @@ namespace CalamityMod.NPCs.DevourerofGods halfLife = reader.ReadBoolean(); halfLife2 = reader.ReadBoolean(); spawnDoGCountdown = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // whoAmI variable CalamityGlobalNPC.DoGHead = npc.whoAmI; @@ -96,7 +95,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool death = CalamityWorld.death; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Light Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); @@ -133,7 +132,9 @@ namespace CalamityMod.NPCs.DevourerofGods spawnDoGCountdown--; if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - for (int i = 0; i < 2; i++) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + + for (int i = 0; i < 2; i++) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); } } @@ -150,7 +151,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (spawnDoGCountdown > 0) { spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + + if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); } } @@ -251,7 +255,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Flying movement npc.localAI[1] = 0f; - phaseSwitch += 1; + calamityGlobalNPC.newAI[2] += 1f; float speed = death ? 16.5f : 15f; float turnSpeed = death ? 0.33f : 0.3f; @@ -260,7 +264,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (expertMode) { - phaseSwitch += (int)(9f * (1f - lifeRatio)); + calamityGlobalNPC.newAI[2] += 9f * (1f - lifeRatio); speed += 3f * (1f - lifeRatio); turnSpeed += 0.06f * (1f - lifeRatio); @@ -270,7 +274,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Go to ground phase sooner if (Vector2.Distance(player.Center, vector) > 5600f) - phaseSwitch += 10; + calamityGlobalNPC.newAI[2] += 10f; float num188 = speed; float num189 = turnSpeed; @@ -452,10 +456,10 @@ namespace CalamityMod.NPCs.DevourerofGods npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (phaseSwitch > 900) + if (calamityGlobalNPC.newAI[2] > 900f) { npc.ai[2] = 1f; - phaseSwitch = 0; + calamityGlobalNPC.newAI[2] = 0f; npc.netUpdate = true; } } @@ -469,7 +473,7 @@ namespace CalamityMod.NPCs.DevourerofGods Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } - phaseSwitch += 1; + calamityGlobalNPC.newAI[2] += 1f; float fallSpeed = death ? 17.75f : 16f; float speed = death ? 0.22f : 0.18f; @@ -599,11 +603,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (expertMode) { - maximumSpeed1 += (double)(0.08f * (1f - lifeRatio)); - maximumSpeed2 += (double)(0.16f * (1f - lifeRatio)); + maximumSpeed1 += 0.08f * (1f - lifeRatio); + maximumSpeed2 += 0.16f * (1f - lifeRatio); } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); float num25 = Math.Abs(num20); float num26 = Math.Abs(num21); float num27 = fallSpeed / num22; @@ -634,14 +638,14 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.Y > num21) npc.velocity.Y -= speed; - if ((double)Math.Abs(num21) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) + if (Math.Abs(num21) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num20 < 0f) || (npc.velocity.X < 0f && num20 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += speed * 2f; else npc.velocity.Y -= speed * 2f; } - if ((double)Math.Abs(num20) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) + if (Math.Abs(num20) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num21 < 0f) || (npc.velocity.Y < 0f && num21 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += speed * 2f; @@ -656,7 +660,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.X > num20) npc.velocity.X -= speed * 1.1f; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) { if (npc.velocity.Y > 0f) npc.velocity.Y += speed; @@ -671,7 +675,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.Y > num21) npc.velocity.Y -= speed * 1.1f; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) { if (npc.velocity.X > 0f) npc.velocity.X += speed; @@ -681,7 +685,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; if (flies) { @@ -701,10 +705,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) npc.netUpdate = true; - if (phaseSwitch > 900) + if (calamityGlobalNPC.newAI[2] > 900f) { npc.ai[2] = 0f; - phaseSwitch = 0; + calamityGlobalNPC.newAI[2] = 0f; npc.netUpdate = true; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index 909c6114c2..22380d2245 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -11,9 +12,8 @@ namespace CalamityMod.NPCs.DevourerofGods public class DevourerofGodsHead2 : ModNPC { private bool tail = false; - private bool flies = false; - private const int minLength = 15; - private const int maxLength = 16; + private const int minLength = 10; + private const int maxLength = 11; private int invinceTime = 180; public override void SetStaticDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.height = 76; npc.defense = 40; npc.lifeMax = 100000; - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; @@ -66,11 +66,6 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - float playerRunAcceleration = player.velocity.Y == 0f ? Math.Abs(player.moveSpeed * 0.3f) : (player.runAcceleration * 0.8f); - if (playerRunAcceleration <= 1f) - { - playerRunAcceleration = 1f; - } if (invinceTime > 0) { invinceTime--; @@ -82,24 +77,29 @@ namespace CalamityMod.NPCs.DevourerofGods npc.damage = npc.defDamage; npc.dontTakeDamage = false; } + Vector2 vector = npc.Center; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } - npc.velocity.Length(); + if (npc.alpha != 0) { int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } + npc.alpha -= 12; if (npc.alpha < 0) { npc.alpha = 0; } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!tail && npc.ai[0] == 0f) @@ -117,9 +117,9 @@ namespace CalamityMod.NPCs.DevourerofGods segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; + Main.npc[segment].ai[2] = npc.whoAmI; + Main.npc[segment].ai[1] = Previous; + Main.npc[Previous].ai[0] = segment; npc.netUpdate = true; Previous = segment; } @@ -130,9 +130,10 @@ namespace CalamityMod.NPCs.DevourerofGods NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } + if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { - for (int num569 = 0; num569 < 200; num569++) + for (int num569 = 0; num569 < Main.maxNPCs; num569++) { if (Main.npc[num569].active && (Main.npc[num569].type == ModContent.NPCType() || Main.npc[num569].type == ModContent.NPCType() || Main.npc[num569].type == ModContent.NPCType())) { @@ -140,10 +141,10 @@ namespace CalamityMod.NPCs.DevourerofGods } } } + if (player.dead) { npc.TargetClosest(false); - flies = true; npc.velocity.Y = npc.velocity.Y - 3f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -151,7 +152,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if ((double)npc.position.Y < Main.topWorld + 16f) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].aiStyle == npc.aiStyle) { @@ -160,272 +161,159 @@ namespace CalamityMod.NPCs.DevourerofGods } } } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - float speed = playerRunAcceleration * 16f; - float turnSpeed = playerRunAcceleration * 0.23f; - if (Vector2.Distance(player.Center, vector) > 3000f) //RAGE - { - speed = playerRunAcceleration * 60f; - turnSpeed = playerRunAcceleration * 0.8f; - } - if (!flies) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flies = true; - break; - } - } - } - } - } - if (!flies) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1000; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flies = true; - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flies) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flies) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 0f; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + float num188 = CalamityWorld.revenge ? 16f : 14f; + float num189 = CalamityWorld.revenge ? 0.15f : 0.13f; + + if (Vector2.Distance(player.Center, vector) > 3000f) //RAGE + { + num188 *= 2f; + num189 *= 2f; + } + + for (int num52 = 0; num52 < Main.maxNPCs; num52++) + { + if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) + { + Vector2 vector4 = Main.npc[num52].Center - npc.Center; + if (vector4.Length() < 60f) + { + vector4.Normalize(); + vector4 *= 200f; + num191 -= vector4.X; + num192 -= vector4.Y; + } + } + } + + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 0a8fcc8143..7159881be7 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -34,14 +34,12 @@ namespace CalamityMod.NPCs.DevourerofGods private const int minLength = 100; private const int maxLength = 101; private bool halfLife = false; - private int laserShoot = 0; - private int phaseSwitch = 0; private int[] shotSpacing = new int[4] { 1050, 1050, 1050, 1050 }; private const int spacingVar = 105; private const int totalShots = 20; - private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + private const int idleCounterMax = 360; + private int idleCounter = idleCounterMax; public int laserWallPhase = 0; - private int laserWallCounter = 0; private int postTeleportTimer = 0; public override void SetStaticDefaults() @@ -87,15 +85,12 @@ namespace CalamityMod.NPCs.DevourerofGods { writer.Write(npc.dontTakeDamage); writer.Write(halfLife); - writer.Write(laserShoot); - writer.Write(phaseSwitch); writer.Write(shotSpacing[0]); writer.Write(shotSpacing[1]); writer.Write(shotSpacing[2]); writer.Write(shotSpacing[3]); writer.Write(idleCounter); writer.Write(laserWallPhase); - writer.Write(laserWallCounter); writer.Write(postTeleportTimer); } @@ -103,15 +98,12 @@ namespace CalamityMod.NPCs.DevourerofGods { npc.dontTakeDamage = reader.ReadBoolean(); halfLife = reader.ReadBoolean(); - laserShoot = reader.ReadInt32(); - phaseSwitch = reader.ReadInt32(); shotSpacing[0] = reader.ReadInt32(); shotSpacing[1] = reader.ReadInt32(); shotSpacing[2] = reader.ReadInt32(); shotSpacing[3] = reader.ReadInt32(); idleCounter = reader.ReadInt32(); laserWallPhase = reader.ReadInt32(); - laserWallCounter = reader.ReadInt32(); postTeleportTimer = reader.ReadInt32(); } @@ -128,7 +120,7 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC.DoGHead = npc.whoAmI; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Variables Vector2 vector = npc.Center; @@ -141,7 +133,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool breathFireMore = lifeRatio < 0.15 || death; // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Worm shit again if (npc.ai[3] > 0f) @@ -153,9 +145,6 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - // Velocity - npc.velocity.Length(); - float distanceFromTarget = Vector2.Distance(player.Center, vector); bool tooFarAway = distanceFromTarget > 5600f; @@ -169,10 +158,10 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.MultiplayerClient) { - laserWallCounter += 1; - if (laserWallCounter >= 720) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= 720f) { - laserWallCounter = 0; + calamityGlobalNPC.newAI[3] = 0f; laserWallPhase = 1; } } @@ -181,7 +170,7 @@ namespace CalamityMod.NPCs.DevourerofGods { npc.alpha += 5; if (npc.alpha == 255) - laserShoot = 0; + calamityGlobalNPC.newAI[1] = 0f; if (npc.alpha >= 255) { @@ -190,7 +179,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (idleCounter <= 0) { laserWallPhase = 2; - idleCounter = death ? 540 : 360; + idleCounter = idleCounterMax; } } } @@ -262,9 +251,9 @@ namespace CalamityMod.NPCs.DevourerofGods segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; + Main.npc[segment].ai[2] = npc.whoAmI; + Main.npc[segment].ai[1] = Previous; + Main.npc[Previous].ai[0] = segment; NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); Previous = segment; } @@ -279,15 +268,15 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (breathFireMore ? 60f : 120f) == 0f) { - Vector2 vector44 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num427 = player.position.X + (float)(player.width / 2) - vector44.X; - float num428 = player.position.Y + (float)(player.height / 2) - vector44.Y; + Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num427 = player.position.X + (player.width / 2) - vector44.X; + float num428 = player.position.Y + (player.height / 2) - vector44.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float num430 = 16f; int num432 = ModContent.ProjectileType(); - float num429 = (float)Math.Sqrt((double)(num427 * num427 + num428 * num428)); + float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); num429 = num430 / num429; num427 *= num429; num428 *= num429; @@ -306,52 +295,68 @@ namespace CalamityMod.NPCs.DevourerofGods // Laser walls if (!speedBoost2 && (laserWallPhase == 1 || calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive))) { - laserShoot += 1; + calamityGlobalNPC.newAI[1] += 1f; float speed = 4f; - int divisor = CalamityWorld.bossRushActive ? 90 : 120; + float divisor = 120f; - if (laserShoot % divisor == 0) + if (calamityGlobalNPC.newAI[1] % divisor == 0f) { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 12); - - float targetPosY = player.position.Y + (Main.rand.NextBool(2) ? 50f : 0f); - - // Side walls - for (int x = 0; x < totalShots; x++) + if (calamityGlobalNPC.newAI[1] % idleCounterMax == 0f) { - Projectile.NewProjectile(player.position.X + 1000f, targetPosY + (float)shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, targetPosY + (float)shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[0] -= spacingVar; - } - - if (Main.rand.NextBool(2) && revenge) - { - for (int x = 0; x < 10; x++) + int cosmicGuardianCount = NPC.CountNPCS(ModContent.NPCType()); + if (cosmicGuardianCount < 2) { - Projectile.NewProjectile(player.position.X + 1000f, targetPosY + (float)shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, targetPosY + (float)shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[3] -= Main.rand.NextBool(2) ? 180 : 200; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + + int spawnAmt = cosmicGuardianCount == 0 ? 2 : 1; + + for (int i = 0; i < spawnAmt; i++) + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); } - shotSpacing[3] = 1050; } - shotSpacing[0] = 1050; - - // Lower wall - for (int x = 0; x < totalShots; x++) + else { - Projectile.NewProjectile(player.position.X + (float)shotSpacing[1], player.position.Y + 1000f, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[1] -= spacingVar; - } - shotSpacing[1] = 1050; + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 12); - // Upper wall - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(player.position.X + (float)shotSpacing[2], player.position.Y - 1000f, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[2] -= spacingVar; + float targetPosY = player.position.Y + (Main.rand.NextBool(2) ? 50f : 0f); + + // Side walls + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + 1000f, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[0] -= spacingVar; + } + + if (Main.rand.NextBool(2) && revenge) + { + for (int x = 0; x < 10; x++) + { + Projectile.NewProjectile(player.position.X + 1000f, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[3] -= Main.rand.NextBool(2) ? 180 : 200; + } + shotSpacing[3] = 1050; + } + shotSpacing[0] = 1050; + + // Lower wall + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + 1000f, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[1] -= spacingVar; + } + shotSpacing[1] = 1050; + + // Upper wall + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - 1000f, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[2] -= spacingVar; + } + shotSpacing[2] = 1050; } - shotSpacing[2] = 1050; } } } @@ -387,9 +392,9 @@ namespace CalamityMod.NPCs.DevourerofGods // Movement int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; if (num180 < 0) num180 = 0; @@ -414,7 +419,7 @@ namespace CalamityMod.NPCs.DevourerofGods Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } - phaseSwitch += 1; + calamityGlobalNPC.newAI[2] += 1f; npc.localAI[1] = 0f; @@ -443,20 +448,20 @@ namespace CalamityMod.NPCs.DevourerofGods if (revenge && laserWallPhase == 0 && !player.dead && player.active) Teleport(player); else - phaseSwitch += 10; + calamityGlobalNPC.newAI[2] += 10f; } float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); int num42 = -1; int num43 = (int)(player.Center.X / 16f); int num44 = (int)(player.Center.Y / 16f); // Charge at target for 1.5 seconds - bool flyAtTarget = (!speedBoost || speedBoost2) && phaseSwitch > phaseLimit - 90 && revenge; + bool flyAtTarget = (!speedBoost || speedBoost2) && calamityGlobalNPC.newAI[2] > phaseLimit - 90 && revenge; for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) { @@ -477,7 +482,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (num42 > 0) { num42 *= 16; - float num47 = (float)(num42 - 800); + float num47 = num42 - 800; if (player.position.Y > num47) { num192 = num47; @@ -514,53 +519,15 @@ namespace CalamityMod.NPCs.DevourerofGods } } - if (!flyAtTarget) - { - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); float num198 = num188 / num193; num191 *= num198; num192 *= num198; @@ -583,7 +550,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity.Y -= num189; } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189 * 2f; @@ -591,7 +558,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity.Y -= num189 * 2f; } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += num189 * 2f; @@ -608,7 +575,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.X > num191) npc.velocity.X -= num189 * 1.1f; - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189; @@ -623,7 +590,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.Y > num192) npc.velocity.Y -= num189 * 1.1f; - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += num189; @@ -633,12 +600,12 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; - if (phaseSwitch > phaseLimit) + if (calamityGlobalNPC.newAI[2] > phaseLimit) { npc.ai[2] = 1f; - phaseSwitch = 0; + calamityGlobalNPC.newAI[2] = 0f; npc.netUpdate = true; } } @@ -652,7 +619,7 @@ namespace CalamityMod.NPCs.DevourerofGods Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } - phaseSwitch += 1; + calamityGlobalNPC.newAI[2] += 1f; float turnSpeed = death ? 0.24f : 0.18f; @@ -678,12 +645,12 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int num953 = num182; num953 < num183; num953++) { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) { Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + vector105.X = num952 * 16; + vector105.Y = num953 * 16; + if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) { flies = true; break; @@ -732,16 +699,16 @@ namespace CalamityMod.NPCs.DevourerofGods npc.localAI[1] = 0f; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); if (!flies) { @@ -751,7 +718,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 2.2) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 2.2) { if (npc.velocity.X < 0f) npc.velocity.X -= num189 * 1.1f; @@ -786,11 +753,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (expertMode) { - maximumSpeed1 += (double)(0.12f * (1f - lifeRatio)); - maximumSpeed2 += (double)(0.25f * (1f - lifeRatio)); + maximumSpeed1 += 0.12f * (1f - lifeRatio); + maximumSpeed2 += 0.25f * (1f - lifeRatio); } - num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); float num25 = Math.Abs(num191); float num26 = Math.Abs(num192); float num27 = fallSpeed / num193; @@ -822,7 +789,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.Y > num192) npc.velocity.Y -= turnSpeed; - if ((double)Math.Abs(num192) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < fallSpeed * maximumSpeed1 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += turnSpeed * 2f; @@ -830,7 +797,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity.Y -= turnSpeed * 2f; } - if ((double)Math.Abs(num191) < (double)fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < fallSpeed * maximumSpeed1 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += turnSpeed * 2f; @@ -845,7 +812,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.X > num191) npc.velocity.X -= turnSpeed * 1.1f; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) { if (npc.velocity.Y > 0f) npc.velocity.Y += turnSpeed; @@ -860,7 +827,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.Y > num192) npc.velocity.Y -= turnSpeed * 1.1f; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * maximumSpeed2) { if (npc.velocity.X > 0f) npc.velocity.X += turnSpeed; @@ -870,7 +837,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; if (flies) { @@ -890,10 +857,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) npc.netUpdate = true; - if (phaseSwitch > (death ? 600 : 900)) + if (calamityGlobalNPC.newAI[2] > (death ? 600f : 900f)) { npc.ai[2] = 0f; - phaseSwitch = 0; + calamityGlobalNPC.newAI[2] = 0f; npc.netUpdate = true; } } @@ -937,8 +904,8 @@ namespace CalamityMod.NPCs.DevourerofGods int x2 = x + 50; int y2 = y + 50; - float locationX = (float)Main.rand.Next(x, x2); - float locationY = (float)Main.rand.Next(y, y2); + float locationX = Main.rand.Next(x, x2); + float locationY = Main.rand.Next(y, y2); Vector2 teleportLocation = new Vector2(locationX, locationY); npc.position = teleportLocation; @@ -957,7 +924,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - Vector2 npcCenter = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); + Vector2 npcCenter = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), (int)npcCenter.X, (int)npcCenter.Y); int dustAmt = 50; @@ -968,14 +935,14 @@ namespace CalamityMod.NPCs.DevourerofGods random += j * 2; int dustAmtSpawned = 0; int scale = random * 13; - float dustPositionX = npcCenter.X - (float)(scale / 2); - float dustPositionY = npcCenter.Y - (float)(scale / 2); + float dustPositionX = npcCenter.X - (scale / 2); + float dustPositionY = npcCenter.Y - (scale / 2); while (dustAmtSpawned < dustAmt) { - float dustVelocityX = (float)Main.rand.Next(-random, random); - float dustVelocityY = (float)Main.rand.Next(-random, random); - float dustVelocityScalar = (float)random * 2f; - float dustVelocity = (float)Math.Sqrt((double)(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY)); + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); dustVelocity = dustVelocityScalar / dustVelocity; dustVelocityX *= dustVelocity; dustVelocityY *= dustVelocity; @@ -983,8 +950,8 @@ namespace CalamityMod.NPCs.DevourerofGods Main.dust[dust].noGravity = true; Main.dust[dust].position.X = teleportLocation.X; Main.dust[dust].position.Y = teleportLocation.Y; - Main.dust[dust].position.X += (float)Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += (float)Main.rand.Next(-10, 11); + Main.dust[dust].position.X += Main.rand.Next(-10, 11); + Main.dust[dust].position.Y += Main.rand.Next(-10, 11); Main.dust[dust].velocity.X = dustVelocityX; Main.dust[dust].velocity.Y = dustVelocityY; dustAmtSpawned++; @@ -999,10 +966,10 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -1194,12 +1161,12 @@ namespace CalamityMod.NPCs.DevourerofGods Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 50; npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + 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, 173, 0f, 0f, 100, default, 2f); @@ -1207,7 +1174,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 30; num623++) diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index 807acfabde..9f17f12891 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.height = 50; npc.defense = 70; npc.lifeMax = 100000; - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; @@ -61,7 +61,8 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (invinceTime > 0) { invinceTime--; @@ -73,13 +74,29 @@ namespace CalamityMod.NPCs.DevourerofGods npc.damage = npc.defDamage; npc.dontTakeDamage = false; } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -93,7 +110,39 @@ namespace CalamityMod.NPCs.DevourerofGods npc.alpha = 0; } } - } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index b0d436e06f..368d7fed21 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -21,10 +21,10 @@ namespace CalamityMod.NPCs.HiveMind npc.width = 70; npc.height = 70; npc.defense = 6; - npc.lifeMax = 45; + npc.lifeMax = 90; if (CalamityWorld.bossRushActive) { - npc.lifeMax = 10000; + npc.lifeMax = 20000; } npc.aiStyle = -1; aiType = -1; @@ -44,10 +44,15 @@ namespace CalamityMod.NPCs.HiveMind float speed = revenge ? 12f : 11f; if (CalamityWorld.bossRushActive) speed = 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; + + if (npc.ai[1] < 90f) + npc.ai[1] += 1f; + speed = MathHelper.Lerp(3f, speed, npc.ai[1] / 90f); + + Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + 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 num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = speed / num1375; num1373 *= num1376; num1374 *= num1376; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 9593334f92..a7a6ed4c1b 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -154,21 +154,21 @@ namespace CalamityMod.NPCs.HiveMind } if (npc.ai[3] == 0f && npc.life > 0) { - npc.ai[3] = (float)npc.lifeMax; + npc.ai[3] = npc.lifeMax; } if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.25); - if ((float)(npc.life + num660) < npc.ai[3]) + int num660 = (int)(npc.lifeMax * 0.25); + if ((npc.life + num660) < npc.ai[3]) { - npc.ai[3] = (float)npc.life; + npc.ai[3] = npc.life; int num661 = Main.rand.Next(3, 6); for (int num662 = 0; num662 < num661; num662++) { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); + int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); int num663 = ModContent.NPCType(); if (Main.rand.NextBool(3) || npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { @@ -176,8 +176,6 @@ namespace CalamityMod.NPCs.HiveMind } int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; if (Main.netMode == NetmodeID.Server && num664 < 200) { NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); @@ -205,7 +203,7 @@ namespace CalamityMod.NPCs.HiveMind if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } for (int i = 0; i < 2; i++) { @@ -227,7 +225,7 @@ namespace CalamityMod.NPCs.HiveMind int tilePosY = (int)(npc.position.Y + npc.height) / 16 + 1; if (Main.tile[tilePosX, tilePosY] == null) Main.tile[tilePosX, tilePosY] = new Tile(); - while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[(int)Main.tile[tilePosX, tilePosY].type])) + while (!(Main.tile[tilePosX, tilePosY].nactive() && Main.tileSolid[Main.tile[tilePosX, tilePosY].type])) { tilePosY++; npc.position.Y += 16; @@ -246,7 +244,7 @@ namespace CalamityMod.NPCs.HiveMind if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } for (int i = 0; i < 2; i++) { @@ -285,19 +283,19 @@ namespace CalamityMod.NPCs.HiveMind { if (Main.rand.NextBool(60) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = npc.Center + new Vector2(0f, npc.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.EaterofSouls); } if (Main.rand.NextBool(150) && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); + Vector2 spawnAt = npc.Center + new Vector2(0f, npc.height / 2f); NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, NPCID.DevourerHead); } } int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + while (num285 < damage / npc.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, 14, (float)hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 14, hitDirection, -1f, 0, default, 1f); num285++; } } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index eff39b30d3..5c8f21f8ae 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -18,8 +18,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Leviathan { [AutoloadBossHead] @@ -108,7 +106,13 @@ namespace CalamityMod.NPCs.Leviathan bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = (lifeRatio < 0.5f && expertMode) || death; + + npc.spriteDirection = (npc.direction > 0) ? 1 : -1; bool sirenAlive = false; if (CalamityGlobalNPC.siren != -1) @@ -141,7 +145,7 @@ namespace CalamityMod.NPCs.Leviathan } Player player = Main.player[npc.target]; - bool flag6 = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + bool flag6 = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive; if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) @@ -156,7 +160,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.Y > 16f) npc.velocity.Y = 16f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if (npc.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < 200; x++) { @@ -187,6 +191,11 @@ namespace CalamityMod.NPCs.Leviathan npc.TargetClosest(true); float num412 = sirenAlive ? 3.5f : 7f; float num413 = sirenAlive ? 0.1f : 0.2f; + if (expertMode && !sirenAlive) + { + num412 += death ? 3.5f : 3.5f * (1f - lifeRatio); + num413 += death ? 0.1f : 0.1f * (1f - lifeRatio); + } if (CalamityWorld.bossRushActive) { num412 *= 1.5f; @@ -194,15 +203,15 @@ namespace CalamityMod.NPCs.Leviathan } int num414 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)player.width) + if (npc.position.X + (npc.width / 2) < player.position.X + player.width) { num414 = -1; } - Vector2 vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num415 = player.position.X + (float)(player.width / 2) + (float)(num414 * 800) - vector40.X; - float num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num415 = player.position.X + (player.width / 2) + (num414 * 800) - vector40.X; + float num416 = player.position.Y + (player.height / 2) - vector40.Y; + float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num412 / num417; num415 *= num417; num416 *= num417; @@ -261,9 +270,9 @@ namespace CalamityMod.NPCs.Leviathan if (npc.ai[2] >= 75f) { npc.ai[2] = 0f; - vector40 = new Vector2(npc.position.X + (float)npc.width * 0.5f, (npc.position.Y + (float)npc.height * 0.5f) + 160f); - num415 = player.position.X + (float)(player.width / 2) - vector40.X; - num416 = player.position.Y + (float)(player.height / 2) - vector40.Y; + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 160f); + num415 = player.position.X + (player.width / 2) - vector40.X; + num416 = player.position.Y + (player.height / 2) - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -284,7 +293,7 @@ namespace CalamityMod.NPCs.Leviathan num418 *= 1.5f; } - num417 = (float)Math.Sqrt((double)(num415 * num415 + num416 * num416)); + num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num418 / num417; num415 *= num417; num416 *= num417; @@ -299,11 +308,11 @@ namespace CalamityMod.NPCs.Leviathan { npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - float num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num1058 = player.position.X + (player.width / 2) - vector120.X; + float num1059 = player.position.Y + (player.height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); npc.ai[1] += revenge ? 2f : 1f; if (!sirenAlive || death) @@ -329,27 +338,29 @@ namespace CalamityMod.NPCs.Leviathan if (Main.netMode != NetmodeID.MultiplayerClient) { int type = spawnAberration ? ModContent.NPCType() : ModContent.NPCType(); - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, type, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.01f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.01f; - Main.npc[num1062].netUpdate = true; + NPC.NewNPC((int)vector119.X, (int)vector119.Y, type, 0, 0f, 0f, 0f, 0f, 255); } } - if (num1060 > 1200f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, player.position, player.width, player.height)) + if (num1060 > 1200f) { float num1063 = sirenAlive ? 7f : 8f; float num1064 = sirenAlive ? 0.05f : 0.065f; - if (CalamityWorld.bossRushActive) + if (expertMode && !sirenAlive) + { + num1063 += death ? 4f : 4f * (1f - lifeRatio); + num1064 += death ? 0.03f : 0.03f * (1f - lifeRatio); + } + if (CalamityWorld.bossRushActive) { num1063 *= 1.5f; num1064 *= 1.5f; } vector120 = vector119; - num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + num1058 = player.position.X + (player.width / 2) - vector120.X; + num1059 = player.position.Y + (player.height / 2) - vector120.Y; + num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); num1060 = num1063 / num1060; if (npc.velocity.X < num1058) @@ -394,7 +405,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.ai[2] > (sirenAlive ? 2f : 3f)) { - npc.ai[0] = ((double)npc.life < (double)npc.lifeMax * 0.5 || death) ? 2f : 0f; + npc.ai[0] = phase2 ? 2f : 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.netUpdate = true; @@ -418,8 +429,8 @@ namespace CalamityMod.NPCs.Leviathan int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)(float)num24, default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * 3.1415926535897931 / (float)num24, default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; @@ -429,19 +440,15 @@ namespace CalamityMod.NPCs.Leviathan npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (float)(npc.height / 2) - (player.position.Y + (float)(player.height / 2))) < 20f) + if (Math.Abs(npc.position.Y + (npc.height / 2) - (player.position.Y + (player.height / 2))) < 20f) { npc.ai[1] += 1f; npc.ai[2] = 0f; float num1044 = revenge ? 20f : 18f; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) - { - num1044 += 2f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) - { - num1044 += 2f; - } + if (revenge && !sirenAlive) + { + num1044 += death ? 4f : 4f * (1f - lifeRatio); + } if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1044 += 4f; @@ -450,15 +457,11 @@ namespace CalamityMod.NPCs.Leviathan { num1044 *= 1.25f; } - if (sirenAlive) - { - num1044 *= 0.75f; - } - Vector2 vector117 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1045 = player.position.X + (float)(player.width / 2) - vector117.X; - float num1046 = player.position.Y + (float)(player.height / 2) - vector117.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + Vector2 vector117 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num1045 = player.position.X + (player.width / 2) - vector117.X; + float num1046 = player.position.Y + (player.height / 2) - vector117.Y; + float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); num1047 = num1044 / num1047; npc.velocity.X = num1045 * num1047; npc.velocity.Y = num1046 * num1047; @@ -469,16 +472,12 @@ namespace CalamityMod.NPCs.Leviathan float num1048 = revenge ? 7.5f : 6.5f; float num1049 = revenge ? 0.12f : 0.11f; - if ((double)npc.life < (double)npc.lifeMax * 0.66 || death) - { - num1048 += 2f; - num1049 += 0.05f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.33 || death) - { - num1048 += 2f; - num1049 += 0.1f; - } + if (revenge && !sirenAlive) + { + num1048 += death ? 6f : 6f * (1f - lifeRatio); + num1049 += death ? 0.1f : 0.1f * (1f - lifeRatio); + } + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 3f; @@ -490,7 +489,7 @@ namespace CalamityMod.NPCs.Leviathan num1049 *= 1.25f; } - if (npc.position.Y + (float)(npc.height / 2) < (player.position.Y + (float)(player.height / 2))) + if (npc.position.Y + (npc.height / 2) < (player.position.Y + (player.height / 2))) npc.velocity.Y += num1049; else npc.velocity.Y -= num1049; @@ -500,10 +499,10 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.Y > num1048) npc.velocity.Y = num1048; - if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (player.position.X + (float)(player.width / 2))) > chargeDistance + 200f) - npc.velocity.X += num1049 * (float)npc.direction; - else if (Math.Abs(npc.position.X + (float)(npc.width / 2) - (player.position.X + (float)(player.width / 2))) < chargeDistance) - npc.velocity.X -= num1049 * (float)npc.direction; + if (Math.Abs(npc.position.X + (npc.width / 2) - (player.position.X + (player.width / 2))) > chargeDistance + 200f) + npc.velocity.X += num1049 * npc.direction; + else if (Math.Abs(npc.position.X + (npc.width / 2) - (player.position.X + (player.width / 2))) < chargeDistance) + npc.velocity.X -= num1049 * npc.direction; else npc.velocity.X *= 0.8f; @@ -524,9 +523,9 @@ namespace CalamityMod.NPCs.Leviathan npc.spriteDirection = npc.direction; int num1051 = 1; - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2)) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2)) num1051 = -1; - if (npc.direction == num1051 && Math.Abs(npc.position.X + (float)(npc.width / 2) - (player.position.X + (float)(player.width / 2))) > chargeDistance) + if (npc.direction == num1051 && Math.Abs(npc.position.X + (npc.width / 2) - (player.position.X + (player.width / 2))) > chargeDistance) npc.ai[2] = 1f; if (npc.ai[2] != 1f) @@ -538,16 +537,12 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity *= 0.9f; float num1052 = revenge ? 0.11f : 0.1f; - if (npc.life < npc.lifeMax / 4 || death) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } - if (npc.life < npc.lifeMax / 10 || death) - { - npc.velocity *= 0.9f; - num1052 += 0.05f; - } + if (revenge && !sirenAlive) + { + npc.velocity *= death ? 0.81f : MathHelper.Lerp(0.81f, 1f, lifeRatio); + num1052 += death ? 0.1f : 0.1f * (1f - lifeRatio); + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 655efca8b6..2594065283 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -10,8 +10,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Leviathan { [AutoloadBossHead] @@ -120,11 +118,11 @@ namespace CalamityMod.NPCs.Leviathan bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; - Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); - bool isNotOcean = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); + bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool phase2 = lifeRatio < 0.66f || death; @@ -170,11 +168,11 @@ namespace CalamityMod.NPCs.Leviathan // Ice Shield if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - npc.ai[3] = (float)(num6 + 1); + int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI); + npc.ai[3] = num6 + 1; npc.localAI[1] = -1f; npc.netUpdate = true; - Main.npc[num6].ai[0] = (float)npc.whoAmI; + Main.npc[num6].ai[0] = npc.whoAmI; Main.npc[num6].netUpdate = true; } @@ -229,7 +227,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.Y > 16f) npc.velocity.Y = 16f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) + if (npc.position.Y > Main.worldSurface * 16.0) { for (int x = 0; x < 200; x++) { @@ -262,7 +260,7 @@ namespace CalamityMod.NPCs.Leviathan // Phase switch if (npc.ai[0] == -1f) { - int random = phase2 ? 3 : 2; + int random = (phase2 && expertMode) ? 3 : 2; int num871 = Main.rand.Next(random); if (num871 == 0) @@ -272,7 +270,7 @@ namespace CalamityMod.NPCs.Leviathan else num871 = 3; - npc.ai[0] = (float)num871; + npc.ai[0] = num871; if (npc.ai[0] != 3f) { @@ -295,10 +293,10 @@ namespace CalamityMod.NPCs.Leviathan npc.rotation = npc.velocity.X * 0.02f; npc.spriteDirection = npc.direction; - Vector2 vector118 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1055 = player.position.X + (float)(player.width / 2) - vector118.X; - float num1056 = player.position.Y + (float)(player.height / 2) - 200f - vector118.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + Vector2 vector118 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num1055 = player.position.X + (player.width / 2) - vector118.X; + float num1056 = player.position.Y + (player.height / 2) - 200f - vector118.Y; + float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); if (num1057 < 600f) { @@ -312,7 +310,7 @@ namespace CalamityMod.NPCs.Leviathan { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; } @@ -320,23 +318,23 @@ namespace CalamityMod.NPCs.Leviathan { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y < -4f) npc.velocity.Y = -4f; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X > 8f) npc.velocity.X = 8f; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X < -8f) npc.velocity.X = -8f; } @@ -348,11 +346,11 @@ namespace CalamityMod.NPCs.Leviathan npc.rotation = npc.velocity.X * 0.02f; npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); - Vector2 vector120 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num1058 = player.position.X + (float)(player.width / 2) - vector120.X; - float num1059 = player.position.Y + (float)(player.height / 2) - vector120.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num1058 = player.position.X + (player.width / 2) - vector120.X; + float num1059 = player.position.Y + (player.height / 2) - vector120.Y; + float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); npc.ai[1] += 1f; if (phase2) @@ -375,8 +373,8 @@ namespace CalamityMod.NPCs.Leviathan { int num1061 = 371; int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); + Main.npc[num1062].velocity.X = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); + Main.npc[num1062].velocity.Y = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); Main.npc[num1062].localAI[0] = 60f; Main.npc[num1062].netUpdate = true; } @@ -388,7 +386,7 @@ namespace CalamityMod.NPCs.Leviathan { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; } @@ -396,23 +394,23 @@ namespace CalamityMod.NPCs.Leviathan { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y < -4f) npc.velocity.Y = -4f; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X > 8f) npc.velocity.X = 8f; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X < -8f) npc.velocity.X = -8f; } @@ -435,32 +433,34 @@ namespace CalamityMod.NPCs.Leviathan else if (npc.ai[0] == 2f) { npc.rotation = npc.velocity.X * 0.02f; - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); + Vector2 vector121 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); npc.ai[1] += 1f; bool flag104 = false; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - if (npc.ai[1] % 10f == 9f) - flag104 = true; - } - else - { - if ((phase3 && !leviAlive) || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 20f == 19f) - flag104 = true; - } - else if (phase2) - { - if (npc.ai[1] % 25f == 24f) - flag104 = true; - } - else if (npc.ai[1] % 30f == 29f) - flag104 = true; - } + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + if (npc.ai[1] % 10f == 9f) + flag104 = true; + } + else if (expertMode) + { + if ((phase3 && !leviAlive) || CalamityWorld.bossRushActive) + { + if (npc.ai[1] % 15f == 14f) + flag104 = true; + } + else if (phase2) + { + if (npc.ai[1] % 20f == 19f) + flag104 = true; + } + else if (npc.ai[1] % 25f == 24f) + flag104 = true; + } + else if (npc.ai[1] % 30f == 29f) + flag104 = true; - if (flag104 && (npc.position.Y + (float)npc.height < player.position.Y || (!leviAlive && phase2)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) + if (flag104 && (npc.position.Y + npc.height < player.position.Y || (!leviAlive && phase2)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -475,9 +475,9 @@ namespace CalamityMod.NPCs.Leviathan num1070 += 2f; } - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + float num1071 = player.position.X + player.width * 0.5f - vector121.X; + float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); num1073 = num1070 / num1073; num1071 *= num1073; num1072 *= num1073; @@ -502,7 +502,7 @@ namespace CalamityMod.NPCs.Leviathan if (isNotOcean) num1074 *= 2; - float ai0 = ((!leviAlive && num1075 == ModContent.ProjectileType()) ? 1f : 0f); + float ai0 = (!leviAlive && num1075 == ModContent.ProjectileType()) ? 1f : 0f; Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, ai0, 0f); } } @@ -511,7 +511,7 @@ namespace CalamityMod.NPCs.Leviathan { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; } @@ -519,23 +519,23 @@ namespace CalamityMod.NPCs.Leviathan { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y < -4f) npc.velocity.Y = -4f; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 100f) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X > 8f) npc.velocity.X = 8f; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 100f) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X < -8f) npc.velocity.X = -8f; } @@ -555,11 +555,11 @@ namespace CalamityMod.NPCs.Leviathan // Set up charge else if (npc.ai[0] == 3f) { - ChargeLocation(player, vector, leviAlive, expertMode); + ChargeLocation(player, vector, leviAlive, revenge); npc.ai[1] += 1f; - if (npc.ai[1] >= (expertMode ? 40f : 60f)) + if (npc.ai[1] >= (revenge ? 40f : 60f)) { forceChargeFrames = true; npc.ai[0] = npc.ai[2] >= (leviAlive ? 2f : 3f) ? -1f : 4f; @@ -568,11 +568,15 @@ namespace CalamityMod.NPCs.Leviathan // Velocity and rotation float chargeVelocity = leviAlive ? 16f : 21f; + + if (revenge) + chargeVelocity += 2f + (death ? 4f : 4f * (1f - lifeRatio)); + if (CalamityWorld.bossRushActive) chargeVelocity = 26f; npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction int num22 = Math.Sign(player.Center.X - vector.X); @@ -595,8 +599,8 @@ namespace CalamityMod.NPCs.Leviathan int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)(float)num24, default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * 3.1415926535897931 / (float)num24, default) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; @@ -618,7 +622,7 @@ namespace CalamityMod.NPCs.Leviathan // Rotation when charging private void ChargeRotation(Player player, Vector2 vector) { - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); if (npc.spriteDirection == 1) num17 += 3.14159274f; if (num17 < 0f) @@ -632,14 +636,14 @@ namespace CalamityMod.NPCs.Leviathan if (npc.rotation < num17) { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) + if ((num17 - npc.rotation) > 3.1415926535897931) npc.rotation -= num18; else npc.rotation += num18; } if (npc.rotation > num17) { - if ((double)(npc.rotation - num17) > 3.1415926535897931) + if ((npc.rotation - num17) > 3.1415926535897931) npc.rotation += num18; else npc.rotation -= num18; @@ -656,16 +660,16 @@ namespace CalamityMod.NPCs.Leviathan } // Move to charge location - private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool expertMode) + private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool revenge) { float distance = leviAlive ? 400f : 350f; // Velocity if (npc.localAI[0] == 0f) - npc.localAI[0] = (float)((int)distance * Math.Sign((vector - player.Center).X)); + npc.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X); Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 9f; - float acceleration = expertMode ? 0.75f : 0.5f; + float acceleration = revenge ? 0.75f : 0.5f; if (CalamityWorld.bossRushActive) acceleration = 1f; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 77993c29e4..a0fb7767ad 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -42,9 +42,9 @@ namespace CalamityMod.NPCs.OldDuke npc.aiStyle = -1; aiType = -1; npc.damage = 200; - npc.defense = 140; + npc.defense = 100; CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.6f; + global.DR = 0.5f; global.customDR = true; npc.lifeMax = CalamityWorld.revenge ? 1000000 : 750000; npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index abefdd659e..378067401a 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -55,14 +55,29 @@ namespace CalamityMod.NPCs.Perforator { bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - float speedMult = expertMode ? 1.5f : 1.425f; - if (CalamityWorld.bossRushActive) - speedMult = 3f; - float speedBoost = death ? speedMult : speedMult - ((float)npc.life / (float)npc.lifeMax); - speed = 17f * speedBoost; - turnSpeed = 0.15f * speedBoost; - if (npc.ai[3] > 0f) + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (expertMode) + { + speed += death ? 10f : 10f * (1f - lifeRatio); + turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); + } + + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (CalamityWorld.bossRushActive) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } @@ -71,14 +86,15 @@ namespace CalamityMod.NPCs.Perforator { npc.TargetClosest(true); } + Player player = Main.player[npc.target]; - npc.velocity.Length(); npc.alpha -= 42; if (npc.alpha < 0) { npc.alpha = 0; } + if (!TailSpawned) { int Previous = npc.whoAmI; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 8882bb537c..46154e7443 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -55,14 +55,29 @@ namespace CalamityMod.NPCs.Perforator { bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - float speedMult = expertMode ? 1.5f : 1.425f; - if (CalamityWorld.bossRushActive) - speedMult = 3f; - float speedBoost = death ? speedMult : speedMult - ((float)npc.life / (float)npc.lifeMax); - speed = 15f * speedBoost; - turnSpeed = 0.13f * speedBoost; - if (npc.ai[3] > 0f) + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (expertMode) + { + speed += death ? 10f : 10f * (1f - lifeRatio); + turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); + } + + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (CalamityWorld.bossRushActive) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } @@ -71,14 +86,15 @@ namespace CalamityMod.NPCs.Perforator { npc.TargetClosest(true); } + Player player = Main.player[npc.target]; - npc.velocity.Length(); npc.alpha -= 42; if (npc.alpha < 0) { npc.alpha = 0; } + if (!TailSpawned) { int Previous = npc.whoAmI; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index c8ebcab0e9..e520dc20d7 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -53,13 +53,28 @@ namespace CalamityMod.NPCs.Perforator { bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - float speedMult = expertMode ? 1.5f : 1.425f; - if (CalamityWorld.bossRushActive) - speedMult = 3f; - float speedBoost = death ? speedMult : speedMult - ((float)npc.life / (float)npc.lifeMax); - speed = 13f * speedBoost; - turnSpeed = 0.11f * speedBoost; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (expertMode) + { + speed += death ? 10f : 10f * (1f - lifeRatio); + turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); + } + + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed *= 2f; + turnSpeed *= 2f; + } + + if (CalamityWorld.bossRushActive) + { + speed *= 2f; + turnSpeed *= 2f; + } + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; @@ -69,14 +84,15 @@ namespace CalamityMod.NPCs.Perforator { npc.TargetClosest(true); } + Player player = Main.player[npc.target]; - npc.velocity.Length(); npc.alpha -= 42; if (npc.alpha < 0) { npc.alpha = 0; } + if (!TailSpawned) { int Previous = npc.whoAmI; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index fbec41d482..09996c2e17 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.Perforator if (NPC.AnyNPCs(ModContent.NPCType())) wormsAlive++; - if (largeWormAlive) + if (largeWormAlive && expertMode) { npc.dontTakeDamage = true; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 26d9f78b5a..91c51eff6a 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -124,8 +124,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = npc.frame.Width / 2; npc.height = (int)(npc.frame.Height * (charging ? 1.5f : 1.8f)); - // Mode variables - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Mode variables + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; @@ -133,7 +136,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.7f, 0f); // Show message - if (!halfLife && (npc.life <= npc.lifeMax * 0.5 || death)) + if (!halfLife && ((lifeRatio < 0.5f && expertMode) || death)) { string key = "Mods.CalamityMod.PlagueBossText"; Color messageColor = Color.Lime; @@ -164,7 +167,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Defense gain if (expertMode) { - int num1040 = death ? 20 : (int)(20f * (1f - npc.life / (float)npc.lifeMax)); + int num1040 = death ? 20 : (int)(20f * (1f - lifeRatio)); npc.defense = npc.defDefense + num1040; } @@ -184,7 +187,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (!player.ZoneJungle && !CalamityWorld.bossRushActive) jungleEnrage = true; - bool diagonalDash = revenge && (npc.life <= npc.lifeMax * 0.8 || death); + bool diagonalDash = revenge && (lifeRatio < 0.8f || death); if (npc.ai[0] != 0f && npc.ai[0] != 4f) { @@ -275,9 +278,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1044 = revenge ? 28f : 26f; if (aboveGroundEnrage) num1044 += 6f; - if (npc.life < npc.lifeMax * 0.66 || death) + if (lifeRatio < 0.66f || death) num1044 += 2f; - if (npc.life < npc.lifeMax * 0.33 || death) + if (lifeRatio < 0.33f || death) num1044 += 2f; if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1044 += 2f; @@ -349,12 +352,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1048 = revenge ? 14f : 12f; float num1049 = revenge ? 0.25f : 0.22f; - if (npc.life < npc.lifeMax * 0.66 || death) + if (lifeRatio < 0.66f || death) { num1048 += 1f; num1049 += 0.05f; } - if (npc.life < npc.lifeMax * 0.33 || death) + if (lifeRatio < 0.33f || death) { num1048 += 1f; num1049 += 0.05f; @@ -411,9 +414,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1050 = 300; else if (aboveGroundEnrage || CalamityWorld.bossRushActive) num1050 = 400; - else if (npc.life < npc.lifeMax * 0.33 || death) + else if (lifeRatio < 0.33f || death) num1050 = revenge ? 450 : 475; - else if (npc.life < npc.lifeMax * 0.66) + else if (lifeRatio < 0.66f) num1050 = revenge ? 475 : 500; int num1051 = 1; @@ -450,17 +453,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; - if (npc.life < npc.lifeMax * 0.8 || death) + if (lifeRatio < 0.8f || death) { npc.velocity *= 0.98f; num1052 += 0.05f; } - if (npc.life < npc.lifeMax * 0.6 || death) + if (lifeRatio < 0.6f || death) { npc.velocity *= 0.98f; num1052 += 0.05f; } - if (npc.life < npc.lifeMax * 0.4 || death) + if (lifeRatio < 0.4f || death) { npc.velocity *= 0.98f; num1052 += 0.05f; @@ -494,7 +497,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); if (num1057 < 600f) { - npc.ai[0] = (npc.life <= npc.lifeMax * 0.66 || death) ? 5f : 1f; + npc.ai[0] = (lifeRatio < 0.66f || death) ? 5f : 1f; npc.ai[1] = 0f; npc.netUpdate = true; return; @@ -519,9 +522,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; npc.ai[1] += num1038 / 2; - if (npc.life < npc.lifeMax * 0.75) + if (lifeRatio < 0.75f) npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.5) + if (lifeRatio < 0.5f) npc.ai[1] += 0.25f; bool flag103 = false; @@ -598,9 +601,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; npc.ai[1] += num1038 / 2; bool flag103 = false; - if (npc.life < npc.lifeMax * 0.25 || death) + if (lifeRatio < 0.25f || death) npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.1 || death) + if (lifeRatio < 0.1f || death) npc.ai[1] += 0.25f; if (npc.ai[1] > 40f) @@ -669,7 +672,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath vector121.X += (npc.direction * 120); npc.ai[1] += 1f; - int num650 = ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((npc.life < npc.lifeMax * 0.1 || death || aboveGroundEnrage) ? 20 : ((npc.life < npc.lifeMax * 0.5) ? 25 : 30))); + int num650 = ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death || aboveGroundEnrage) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30))); if (npc.ai[1] % (float)num650 == (float)(num650 - 1) && vectorCenter.Y < player.position.Y) { @@ -695,7 +698,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (expertMode) { num1074 = 32; - int damageBoost = death ? 5 : (int)(6f * (1f - npc.life / (float)npc.lifeMax)); + int damageBoost = death ? 5 : (int)(6f * (1f - lifeRatio)); num1074 += damageBoost; if (Main.rand.NextBool(6)) @@ -722,7 +725,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - if (npc.ai[1] > (float)num650 * 10f) + if (npc.ai[1] > num650 * 10f) { npc.ai[0] = -1f; npc.ai[1] = 3f; @@ -890,19 +893,19 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; - if (npc.life < npc.lifeMax / 2 || death) + if (lifeRatio < 0.5f || death) { - npc.velocity *= 0.98f; + npc.velocity *= 0.9f; num1052 += 0.05f; } - if (npc.life < npc.lifeMax / 3 || death) + if (lifeRatio < 0.3f || death) { - npc.velocity *= 0.98f; + npc.velocity *= 0.9f; num1052 += 0.05f; } - if (npc.life < npc.lifeMax / 5 || death) + if (lifeRatio < 0.1f || death) { - npc.velocity *= 0.98f; + npc.velocity *= 0.9f; num1052 += 0.05f; } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 23b57bdd04..99a96a40c9 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -8,8 +8,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Polterghast { @@ -140,19 +138,17 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) { - num734 = 18.5f; - num735 = 0.12f; + num734 = 21f; + num735 = 0.13f; } - if (expertMode) - { - num734 += revenge ? 1.5f : 1f; - num734 *= revenge ? 1.2f : 1.1f; - num735 += revenge ? 0.015f : 0.01f; - num735 *= revenge ? 1.2f : 1.1f; - } + if (expertMode) + { + num734 += revenge ? 5f : 3.5f; + num735 += revenge ? 0.035f : 0.025f; + } - Vector2 vector91 = new Vector2(num730, num731); + Vector2 vector91 = new Vector2(num730, num731); float num736 = Main.player[npc.target].Center.X - vector91.X; float num737 = Main.player[npc.target].Center.Y - vector91.Y; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 7a8b222ab1..cf6c9480f5 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -182,8 +182,8 @@ namespace CalamityMod.NPCs.Polterghast // Velocity and acceleration bool charging = npc.ai[2] >= 300f; bool reset = npc.ai[2] >= 600f; - float num734 = 2.5f; - float num735 = 0.025f; + float num734 = 10f; // max should be 21 + float num735 = 0.05f; // max should be 0.13 if (!player.ZoneDungeon && !CalamityWorld.bossRushActive && player.position.Y < Main.worldSurface * 16.0) { despawnTimer--; @@ -191,8 +191,8 @@ namespace CalamityMod.NPCs.Polterghast despawnBoost = true; speedBoost = true; - num734 += 2f; - num735 += 0.025f; + num734 += 5f; + num735 += 0.05f; } else despawnTimer++; @@ -207,16 +207,16 @@ namespace CalamityMod.NPCs.Polterghast if (phase2) { - num734 += 1.5f; - num735 += 0.01f; + num734 += 2.5f; + num735 += 0.02f; } if (!phase3) { if (charging) { - num734 += phase2 ? 9.5f : 8.5f; - num735 += phase2 ? 0.05f : 0.045f; + num734 += phase2 ? 4.5f : 3.5f; + num735 += phase2 ? 0.03f : 0.025f; } npc.ai[2] += 1f; @@ -230,8 +230,8 @@ namespace CalamityMod.NPCs.Polterghast { if (charging) { - num734 += phase5 ? 14.5f : 10.5f; - num735 += phase5 ? 0.085f : 0.055f; + num734 += phase5 ? 8.5f : 4.5f; + num735 += phase5 ? 0.06f : 0.03f; } else { @@ -266,10 +266,8 @@ namespace CalamityMod.NPCs.Polterghast if (expertMode) { - num734 += revenge ? 1.5f : 1f; - num734 *= revenge ? 1.2f : 1.1f; - num735 += revenge ? 0.015f : 0.01f; - num735 *= revenge ? 1.2f : 1.1f; + num734 += revenge ? 5f : 3.5f; + num735 += revenge ? 0.035f : 0.025f; } Vector2 vector91 = new Vector2(num730, num731); @@ -568,7 +566,7 @@ namespace CalamityMod.NPCs.Polterghast { npc.HitSound = SoundID.NPCHit36; - if (!spawnGhost) + if (!spawnGhost && expertMode) { spawnGhost = true; diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs index 1ee38e5c67..12600cb22e 100644 --- a/NPCs/Providence/ProvSky.cs +++ b/NPCs/Providence/ProvSky.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Providence } float spawnAnimationTimer = 180f; - float intensityScalar = Main.dayTime ? 0.25f : 0.2f; + float intensityScalar = 0.25f; if (Main.npc[CalamityGlobalNPC.holyBoss].Calamity().newAI[3] < spawnAnimationTimer) intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[CalamityGlobalNPC.holyBoss].Calamity().newAI[3] / spawnAnimationTimer); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 4981529049..353e1d9c13 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -122,6 +122,7 @@ namespace CalamityMod.NPCs.Providence writer.Write(npc.dontTakeDamage); writer.Write(npc.chaseable); writer.Write(npc.canGhostHeal); + writer.Write(npc.localAI[2]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -137,6 +138,7 @@ namespace CalamityMod.NPCs.Providence npc.dontTakeDamage = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); npc.canGhostHeal = reader.ReadBoolean(); + npc.localAI[2] = reader.ReadSingle(); } public override void AI() @@ -214,13 +216,15 @@ namespace CalamityMod.NPCs.Providence // Phase times float phaseTime = nightTime ? 240f : 300f; float crystalPhaseTime = nightTime ? 60f : 120f; + float attackDelayAfterCocoon = 90f; // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); bool phase2 = (lifeRatio < 0.75f || death) && !nightTime; + bool delayAttacks = npc.localAI[2] > 0f; - // Projectile fire rate multiplier - double attackRateMult = 1D; + // Projectile fire rate multiplier + double attackRateMult = 1D; // Distance X needed from target in order to fire holy or molten blasts float distanceNeededToShoot = revenge ? 360f : 420f; @@ -385,16 +389,18 @@ namespace CalamityMod.NPCs.Providence bossLife = npc.life; int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); - NPC.NewNPC(x - 100, y - 100, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(x + 100, y - 100, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC(x, y + 100, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(x - 100, y - 100, ModContent.NPCType()); + NPC.NewNPC(x + 100, y - 100, ModContent.NPCType()); + NPC.NewNPC(x, y + 100, ModContent.NPCType()); } } } } // Set DR based on current attack phase - npc.Calamity().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f || spawnAnimation) ? cocoonDR : normalDR; + npc.Calamity().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f || spawnAnimation) ? + cocoonDR : delayAttacks ? + MathHelper.Lerp(normalDR, cocoonDR, npc.localAI[2] / attackDelayAfterCocoon) : normalDR; // Movement if (npc.ai[0] != 2f && npc.ai[0] != 5f) @@ -497,9 +503,6 @@ namespace CalamityMod.NPCs.Providence // Phase switch if (npc.ai[0] == -1f) { - npc.noGravity = true; - npc.noTileCollide = true; - phaseChange++; if (phaseChange > 14) phaseChange = 0; @@ -693,6 +696,10 @@ namespace CalamityMod.NPCs.Providence if (Math.Abs(vector.X - player.Center.X) > 5600f) phase = 0; + // Reset attack delay for laser + if (phase == 7) + npc.localAI[2] = 0f; + // Reset arrays npc.ai[0] = phase; npc.ai[1] = 0f; @@ -705,9 +712,6 @@ namespace CalamityMod.NPCs.Providence // Holy blasts else if (npc.ai[0] == 0f) { - npc.noGravity = true; - npc.noTileCollide = true; - if (spawnAnimation) { if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[3] == 0f) @@ -767,6 +771,13 @@ namespace CalamityMod.NPCs.Providence return; } + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } + float num852 = Math.Abs(vector.X - player.Center.X); if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) { @@ -815,8 +826,12 @@ namespace CalamityMod.NPCs.Providence // Holy fire else if (npc.ai[0] == 1f) { - npc.noGravity = true; - npc.noTileCollide = true; + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -853,9 +868,6 @@ namespace CalamityMod.NPCs.Providence // Cocoon flames else if (npc.ai[0] == 2f) { - npc.noGravity = true; - npc.noTileCollide = true; - npc.TargetClosest(true); if (!targetDead) @@ -885,6 +897,7 @@ namespace CalamityMod.NPCs.Providence { Vector2 spinningPoint = calamityGlobalNPC.newAI[1] % 2f == 0f ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)) * velocity; double radians = MathHelper.TwoPi / chains; + Main.PlaySound(SoundID.Item20, npc.position); for (int i = 0; i < chains; i++) { Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.ai[2])); @@ -909,6 +922,7 @@ namespace CalamityMod.NPCs.Providence { calamityGlobalNPC.newAI[1] += 1f; double radians = MathHelper.TwoPi / totalProjectiles; + Main.PlaySound(SoundID.Item20, npc.position); for (int i = 0; i < totalProjectiles; i++) { Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i); @@ -980,14 +994,19 @@ namespace CalamityMod.NPCs.Providence text = false; npc.ai[0] = -1f; + npc.localAI[2] = attackDelayAfterCocoon; } } // Molten blasts else if (npc.ai[0] == 3f) { - npc.noGravity = true; - npc.noTileCollide = true; + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } float num852 = Math.Abs(vector.X - player.Center.X); if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) @@ -1037,8 +1056,12 @@ namespace CalamityMod.NPCs.Providence // Holy bombs else if (npc.ai[0] == 4f) { - npc.noGravity = true; - npc.noTileCollide = true; + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1075,9 +1098,6 @@ namespace CalamityMod.NPCs.Providence // Cocoon spears else if (npc.ai[0] == 5f) { - npc.noGravity = true; - npc.noTileCollide = true; - npc.TargetClosest(true); if (!targetDead) @@ -1135,15 +1155,15 @@ namespace CalamityMod.NPCs.Providence npc.ai[1] += 1f; if (npc.ai[1] >= phaseTime) + { npc.ai[0] = -1f; + npc.localAI[2] = attackDelayAfterCocoon; + } } // Crystal else if (npc.ai[0] == 6f) { - npc.noGravity = true; - npc.noTileCollide = true; - npc.TargetClosest(true); if (!targetDead) @@ -1166,9 +1186,6 @@ namespace CalamityMod.NPCs.Providence // Holy ray else if (npc.ai[0] == 7f) { - npc.noGravity = true; - npc.noTileCollide = true; - Vector2 value19 = new Vector2(27f, 59f); float rotation = 450f + (guardianAmt * 18); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index e2743f7e04..d01c62751d 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.Ravager npc.dontTakeDamage = false; if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } } @@ -419,7 +419,7 @@ namespace CalamityMod.NPCs.Ravager float velocityX = ((enrage || npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + velocityXBoost; float velocityY = -16f; - if (revenge) + if (expertMode) { npc.noTileCollide = true; if (shouldFall) @@ -457,17 +457,20 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - if (NPC.CountNPCS(ModContent.NPCType()) < 2) - { - NPC.NewNPC((int)npc.Center.X - 360, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 360, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - } + if (expertMode) + { + if (NPC.CountNPCS(ModContent.NPCType()) < 2) + { + NPC.NewNPC((int)npc.Center.X - 360, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 360, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + } - if (NPC.CountNPCS(ModContent.NPCType()) < 2) - { - NPC.NewNPC((int)player.Center.X - 180, (int)player.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)player.Center.X + 180, (int)player.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - } + if (NPC.CountNPCS(ModContent.NPCType()) < 2) + { + NPC.NewNPC((int)player.Center.X - 180, (int)player.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)player.Center.X + 180, (int)player.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + } + } } if (revenge) @@ -490,7 +493,7 @@ namespace CalamityMod.NPCs.Ravager npc.TargetClosest(true); // Fall through - if (!player.dead && revenge) + if (!player.dead && expertMode) { if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) npc.noTileCollide = true; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 7df77f7d7a..a6facf1fc0 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -118,18 +118,14 @@ namespace CalamityMod.NPCs.Signus bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + Vector2 vectorCenter = npc.Center; - double lifeRatio = (double)npc.life / (double)npc.lifeMax; + double lifeRatio = npc.life / (double)npc.lifeMax; lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); - double mult = 1.0 - - (revenge ? 0.25 : 0.0); - - bool cosmicDust = lifeToAlpha > (int)(15D * mult) || death; - bool speedBoost = lifeToAlpha > (int)(25D * mult) || death; - bool cosmicRain = lifeToAlpha > (int)(35D * mult) || death; - bool cosmicSpeed = lifeToAlpha > (int)(50D * mult) || death; + bool phase2 = (lifeRatio < 0.75f && expertMode) || death; + bool phase3 = lifeRatio < 0.5f || death; // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -183,7 +179,7 @@ namespace CalamityMod.NPCs.Signus else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float num1000 = cosmicSpeed ? 11f : 13f; + float num1000 = expertMode ? 11f : 13f; float num1006 = 0.111111117f * num1000; if (lifeToAlpha < 50 && npc.ai[0] != 1f) @@ -206,27 +202,23 @@ namespace CalamityMod.NPCs.Signus float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; + npc.knockBackResist = 0.05f; if (expertMode) - { npc.knockBackResist *= Main.expertKnockBack; - } - if (speedBoost) - { + if (phase3 || revenge) npc.knockBackResist = 0f; - } + float speed = expertMode ? 14f : 12f; - if (speedBoost) - { - speed = expertMode ? 16f : 14f; - } + if (expertMode) + speed += death ? 4f : 4f * (float)(1D - lifeRatio); + if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { speed += 3f; - } + float num795 = player.Center.X - vectorCenter.X; float num796 = player.Center.Y - vectorCenter.Y; - float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); + float num797 = (float)Math.Sqrt(num795 * num795 + num796 * num796); num797 = speed / num797; num795 *= num797; num796 *= num797; @@ -242,6 +234,10 @@ namespace CalamityMod.NPCs.Signus if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; + + if (expertMode) + npc.localAI[1] += death ? 2f : 2f * (float)(1D - lifeRatio); + if (npc.localAI[1] >= 120f) { npc.localAI[1] = 0f; @@ -275,8 +271,8 @@ namespace CalamityMod.NPCs.Signus return; } npc.ai[0] = 1f; - npc.ai[1] = (float)num1250; - npc.ai[2] = (float)num1251; + npc.ai[1] = num1250; + npc.ai[2] = num1251; npc.netUpdate = true; return; } @@ -284,14 +280,18 @@ namespace CalamityMod.NPCs.Signus } else if (npc.ai[0] == 1f) { - Vector2 position = new Vector2(npc.ai[1] * 16f - (float)(npc.width / 2), npc.ai[2] * 16f - (float)(npc.height / 2)); + Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); for (int m = 0; m < 5; m++) { int dust = Dust.NewDust(position, npc.width, npc.height, 173, 0f, 0f, 90, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } + npc.alpha += 2; + if (expertMode) + npc.alpha += death ? 2 : (int)(3D * (1D - lifeRatio)); + if (npc.alpha >= 255) { Main.PlaySound(SoundID.Item8, vectorCenter); @@ -311,10 +311,10 @@ namespace CalamityMod.NPCs.Signus npc.alpha -= 50; if (npc.alpha <= lifeToAlpha) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); if (Main.netMode != NetmodeID.MultiplayerClient && revenge) { - int num660 = NPC.NewNPC((int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); + int num660 = NPC.NewNPC((int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); @@ -332,7 +332,7 @@ namespace CalamityMod.NPCs.Signus if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num623].velocity *= 3f; @@ -340,7 +340,7 @@ namespace CalamityMod.NPCs.Signus if (Main.rand.NextBool(2)) { Main.dust[num623].scale = 0.5f; - Main.dust[num623].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num623].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 20; num623++) @@ -378,21 +378,12 @@ namespace CalamityMod.NPCs.Signus float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; - Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2), npc.position.Y + (float)(npc.height / 2)); + Vector2 vector121 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); + npc.ai[1] += 1f; - bool flag104 = false; - if (npc.life < npc.lifeMax / 2 || death) - { - if (npc.ai[1] % 45f == 44f) - { - flag104 = true; - } - } - else if (npc.ai[1] % 65f == 64f) - { - flag104 = true; - } - if (flag104) + float divisor = expertMode ? (death ? 55f : revenge ? 60f : 65f) - (float)Math.Ceiling(30D * (1D - lifeRatio)) : 70f; + + if (npc.ai[1] % divisor == divisor - 1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -401,27 +392,15 @@ namespace CalamityMod.NPCs.Signus { num1070 += 3f; } - if (cosmicRain) - { - num1070 += 1f; - } - if (cosmicSpeed) - { - num1070 += 1f; - } - if (revenge) - { - num1070 += 1f; - } - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + float num1071 = player.position.X + player.width * 0.5f - vector121.X; + float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); num1073 = num1070 / num1073; num1071 *= num1073; num1072 *= num1073; int num1074 = expertMode ? 48 : 60; int num1075 = ModContent.ProjectileType(); - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, (float)(npc.target + 1)); + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, npc.target + 1); } } if (npc.position.Y > player.position.Y - 200f) //200 @@ -430,7 +409,7 @@ namespace CalamityMod.NPCs.Signus { npc.velocity.Y *= 0.975f; } - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y > 3f) { npc.velocity.Y = 3f; @@ -442,37 +421,37 @@ namespace CalamityMod.NPCs.Signus { npc.velocity.Y *= 0.975f; } - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y < -3f) { npc.velocity.Y = -3f; } } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + 500f) //100 + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 500f) //100 { if (npc.velocity.X > 0f) { npc.velocity.X *= 0.98f; } - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X > 8f) { npc.velocity.X = 8f; } } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - 500f) //100 + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 500f) //100 { if (npc.velocity.X < 0f) { npc.velocity.X *= 0.98f; } - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X < -8f) { npc.velocity.X = -8f; } } - if (npc.ai[1] > 300f) + if (npc.ai[1] >= divisor * 5f) { npc.ai[0] = 4f; npc.ai[1] = 0f; @@ -489,12 +468,12 @@ namespace CalamityMod.NPCs.Signus { for (int x = 0; x < 5; x++) { - int num660 = NPC.NewNPC((int)(player.position.X + (float)spawnX), (int)(player.position.Y + (float)spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num660 = NPC.NewNPC((int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); } - int num661 = NPC.NewNPC((int)(player.position.X - (float)spawnX), (int)(player.position.Y + (float)spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num661 = NPC.NewNPC((int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); @@ -521,7 +500,10 @@ namespace CalamityMod.NPCs.Signus npc.spriteDirection = Math.Sign(npc.velocity.X); if (chargeSwitch == 0) //line up the charge { - float scaleFactor6 = death ? 16f : 14f; + float scaleFactor6 = 14f; + if (expertMode) + scaleFactor6 += death ? 6f : 6f * (float)(1D - lifeRatio); + Vector2 center5 = player.Center; Vector2 vector126 = center5 - vectorCenter; Vector2 vector127 = vector126 - Vector2.UnitY * 300f; @@ -580,7 +562,7 @@ namespace CalamityMod.NPCs.Signus if (Main.netMode != NetmodeID.MultiplayerClient) { dustTimer--; - if (cosmicDust && dustTimer <= 0) + if (phase2 && dustTimer <= 0) { Main.PlaySound(SoundID.Item73, npc.position); int damage = expertMode ? 60 : 70; @@ -606,7 +588,7 @@ namespace CalamityMod.NPCs.Signus vec2.Normalize(); if (vec2.HasNaNs()) { - vec2 = new Vector2((float)npc.direction, 0f); + vec2 = new Vector2(npc.direction, 0f); } npc.velocity = (npc.velocity * (num1000 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1000; } @@ -705,7 +687,7 @@ namespace CalamityMod.NPCs.Signus glowMaskTexture = ModContent.GetTexture("CalamityMod/NPCs/Signus/SignusGlow"); } - Vector2 vector11 = new Vector2((float)(NPCTexture.Width / 2), (float)(NPCTexture.Height / frameCount / 2)); + Vector2 vector11 = new Vector2(NPCTexture.Width / 2, NPCTexture.Height / frameCount / 2); Color color36 = Color.White; float amount9 = 0.5f; float scale = npc.scale; @@ -719,16 +701,16 @@ namespace CalamityMod.NPCs.Signus 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 - Main.screenPosition; - vector41 -= new Vector2((float)NPCTexture.Width, (float)(NPCTexture.Height / frameCount)) * scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(NPCTexture, vector41, new Rectangle?(frame), color38, rotation, vector11, scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)NPCTexture.Width, (float)(NPCTexture.Height / frameCount)) * scale / 2f; + vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(NPCTexture, vector43, new Rectangle?(frame), npc.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); @@ -741,9 +723,9 @@ namespace CalamityMod.NPCs.Signus Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); color41 = npc.GetAlpha(color41); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)glowMaskTexture.Width, (float)(glowMaskTexture.Height / frameCount)) * scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(glowMaskTexture.Width, glowMaskTexture.Height / frameCount) * scale / 2f; vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY); spriteBatch.Draw(glowMaskTexture, vector44, new Rectangle?(frame), color41, rotation, vector11, scale, spriteEffects, 0f); } @@ -822,12 +804,12 @@ namespace CalamityMod.NPCs.Signus } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 200; npc.height = 150; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); @@ -835,7 +817,7 @@ namespace CalamityMod.NPCs.Signus if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 60; num623++) @@ -846,7 +828,7 @@ namespace CalamityMod.NPCs.Signus num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 200) / 100; Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus2"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Signus3"), 1f); diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 0fd646eeda..42abf10f88 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.position.Y = (float)(player.Center.Y / 16) * 16f - (float)(npc.height / 2) - 150f; } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient) + if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 1); Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index be8a22d675..af90721897 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.position.Y = (float)(player.Center.Y / 16) * 16f - (float)(npc.height / 2) - 150f; } - if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient) + if ((double)npc.life <= (double)npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 1); Vector2 spawnAt = vector + new Vector2(0f, (float)npc.height / 2f); diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 6585d8c743..87b8a51a12 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,13 +1,10 @@ using CalamityMod.World; -using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.StormWeaver { @@ -42,8 +39,8 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -85,6 +82,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { bool expertMode = Main.expertMode; + if (invinceTime > 0) { invinceTime--; @@ -96,24 +94,14 @@ namespace CalamityMod.NPCs.StormWeaver npc.damage = npc.defDamage; npc.dontTakeDamage = false; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } + bool flag = false; if (npc.ai[1] <= 0f) { @@ -129,6 +117,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitEffect(0, 10.0); npc.checkDead(); } + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) @@ -146,34 +135,31 @@ namespace CalamityMod.NPCs.StormWeaver npc.alpha = 0; } } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 77b5dae334..e8835f8db7 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -145,17 +145,22 @@ namespace CalamityMod.NPCs.StormWeaver } tail = true; } + int damage = expertMode ? 62 : 75; - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 360f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } + if (expertMode) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 360f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (BoltCountdown == 0) { BoltCountdown = 600; @@ -296,9 +301,10 @@ namespace CalamityMod.NPCs.StormWeaver } else { - num188 = revenge ? 14f : 13f; - num189 = revenge ? 0.44f : 0.4f; - if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) + num188 = revenge ? 11f : 10f; + num189 = revenge ? 0.31f : 0.28f; + + if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0 && expertMode) { num188 *= 2f; num189 *= 2f; diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 13473f9169..03e2215449 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -3,16 +3,14 @@ using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Projectiles.Rogue; 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 Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.StormWeaver { [AutoloadBossHead] @@ -53,8 +51,8 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -93,6 +91,7 @@ namespace CalamityMod.NPCs.StormWeaver bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + if (invinceTime > 0) { invinceTime--; @@ -104,12 +103,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.damage = npc.defDamage; npc.dontTakeDamage = false; } + if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) { CalamityUtils.StartRain(); } - double lifeRatio = (double)npc.life / (double)npc.lifeMax; + + double lifeRatio = npc.life / (double)npc.lifeMax; int lifePercentage = (int)(100.0 * lifeRatio); + int BoltProjectiles = 2; if (lifePercentage < 33 || death) { @@ -119,16 +121,19 @@ namespace CalamityMod.NPCs.StormWeaver { BoltProjectiles = 3; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(true); } - npc.velocity.Length(); + if (npc.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) @@ -138,11 +143,13 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num935].noLight = true; } } + npc.alpha -= 12; if (npc.alpha < 0) { npc.alpha = 0; } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!tail && npc.ai[0] == 0f) @@ -160,25 +167,30 @@ namespace CalamityMod.NPCs.StormWeaver lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; npc.netUpdate = true; Previous = lol; } tail = true; } + int damage = expertMode ? 62 : 75; - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } + if (expertMode) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + npc.netUpdate = true; + float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; + Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (BoltCountdown == 0) { BoltCountdown = 600; @@ -193,7 +205,7 @@ namespace CalamityMod.NPCs.StormWeaver { speed2 += 1; } - float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + float spawnX2 = Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; float spawnY2 = -1000f + Main.player[npc.target].Center.Y; Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; @@ -203,15 +215,16 @@ namespace CalamityMod.NPCs.StormWeaver { Vector2 spawn2 = baseSpawn; spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / BoltProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; Vector2 vector94 = Main.player[npc.target].Center - spawn2; - float ai = (float)Main.rand.Next(100); + float ai = Main.rand.Next(100); Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); } } } } + if (Main.player[npc.target].dead && npc.life > 0) { npc.TargetClosest(false); @@ -241,6 +254,7 @@ namespace CalamityMod.NPCs.StormWeaver } } } + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f && npc.life > 0) { CalamityWorld.DoGSecondStageCountdown = 0; @@ -261,6 +275,7 @@ namespace CalamityMod.NPCs.StormWeaver } } } + if (npc.velocity.X < 0f) { npc.spriteDirection = -1; @@ -269,39 +284,24 @@ namespace CalamityMod.NPCs.StormWeaver { npc.spriteDirection = 1; } + if (Main.player[npc.target].dead) { npc.TargetClosest(false); } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); float num188 = revenge ? 13f : 12f; - float num189 = revenge ? 0.41f : 0.38f; - if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) + float num189 = revenge ? 0.31f : 0.28f; + + if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0 && expertMode) { num188 *= 2f; num189 *= 2f; } + float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; float num50 = npc.velocity.Length(); @@ -318,29 +318,16 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity *= num49; } } - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); float num198 = num188 / num193; num191 *= num198; num192 *= num198; @@ -368,7 +355,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity.Y = npc.velocity.Y - num189; } } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) { @@ -379,7 +366,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity.Y = npc.velocity.Y - num189 * 2f; } } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) { @@ -403,7 +390,7 @@ namespace CalamityMod.NPCs.StormWeaver { npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.Y > 0f) { @@ -425,7 +412,7 @@ namespace CalamityMod.NPCs.StormWeaver { npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.X > 0f) { @@ -438,7 +425,7 @@ namespace CalamityMod.NPCs.StormWeaver } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 673beadc96..ff43e49722 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -40,8 +40,8 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -93,24 +93,14 @@ namespace CalamityMod.NPCs.StormWeaver npc.damage = npc.defDamage; npc.dontTakeDamage = false; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } + bool flag = false; if (npc.ai[1] <= 0f) { @@ -126,6 +116,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitEffect(0, 10.0); npc.checkDead(); } + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) @@ -143,34 +134,31 @@ namespace CalamityMod.NPCs.StormWeaver npc.alpha = 0; } } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index a9b76ac438..a2a206f111 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -679,7 +679,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } - if (bulletHellCounter2 % 225 == 0) //giant homing fireballs + if (bulletHellCounter2 % 225 == 0 && expertMode) //giant homing fireballs { Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, passedVar); passedVar += 1f; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 9d92548304..e89c8204cf 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -31,7 +31,9 @@ namespace CalamityMod.NPCs.Yharon public class Yharon : ModNPC { private Rectangle safeBox = default; - private bool enraged = false; + private Vector2 flareDustBulletHellSpawn = default; + + private bool enraged = false; private bool protectionBoost = false; private bool moveCloser = false; private bool phaseOneLoot = true; @@ -122,6 +124,7 @@ namespace CalamityMod.NPCs.Yharon writer.Write(secondPhasePhase); writer.Write(teleportLocation); writer.Write(invincibilityCounter); + writer.WriteVector2(flareDustBulletHellSpawn); writer.Write(safeBox.X); writer.Write(safeBox.Y); writer.Write(safeBox.Width); @@ -146,7 +149,8 @@ namespace CalamityMod.NPCs.Yharon secondPhasePhase = reader.ReadInt32(); teleportLocation = reader.ReadInt32(); invincibilityCounter = reader.ReadInt32(); - safeBox.X = reader.ReadInt32(); + flareDustBulletHellSpawn = reader.ReadVector2(); + safeBox.X = reader.ReadInt32(); safeBox.Y = reader.ReadInt32(); safeBox.Width = reader.ReadInt32(); safeBox.Height = reader.ReadInt32(); @@ -238,15 +242,15 @@ namespace CalamityMod.NPCs.Yharon } // Phase bools - bool phase2Check = npc.life <= npc.lifeMax * (revenge ? 0.8 : 0.7); - bool phase3Check = npc.life <= npc.lifeMax * (revenge ? 0.5 : 0.4); + bool phase2Check = npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); + bool phase3Check = npc.life <= npc.lifeMax * (revenge ? 0.5 : (expertMode ? 0.4 : 0.25)); bool phase4Check = npc.life <= npc.lifeMax * 0.1; bool phase2Change = npc.ai[0] > 5f; bool phase3Change = npc.ai[0] > 12f; bool isCharging = npc.ai[3] < 20f; // Flare limit - int flareCount = 3; + int maxFlareCount = 3; // Timer, velocity and acceleration for idle phase before phase switch int phaseSwitchTimer = expertMode ? 36 : 38; @@ -440,30 +444,6 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 9f || npc.ai[0] == 16f) npcRotationSpeed = 0.01f; - /*if (npc.rotation < npcRotation) - { - if (npcRotation - npc.rotation > pie) - npc.rotation -= npcRotationSpeed; - else - npc.rotation += npcRotationSpeed; - } - if (npc.rotation > npcRotation) - { - if (npc.rotation - npcRotation > pie) - npc.rotation += npcRotationSpeed; - else - npc.rotation -= npcRotationSpeed; - } - - if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) - npc.rotation = npcRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > npcRotation - npcRotationSpeed && npc.rotation < npcRotation + npcRotationSpeed) - npc.rotation = npcRotation;*/ - if (npcRotationSpeed != 0f) npc.rotation = npc.rotation.AngleTowards(npcRotation, npcRotationSpeed); @@ -698,17 +678,8 @@ namespace CalamityMod.NPCs.Yharon { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (NPC.CountNPCS(ModContent.NPCType()) < flareCount) - { - int num1062 = NPC.NewNPC((int)fromMouth.X, (int)fromMouth.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - - Main.npc[num1062].velocity = player.Center - fromMouth; - Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; - Main.npc[num1062].netUpdate = true; - } - - Projectile.NewProjectile(fromMouth, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + SpawnDetonatingFlares(fromMouth, player, maxFlareCount, new int[] { ModContent.NPCType() }); + Projectile.NewProjectile(fromMouth, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -975,8 +946,11 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust bullet hell else if (npc.ai[0] == 8f) { - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + } npc.ai[2] += 1f; @@ -985,34 +959,10 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] >= 120f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - Vector2 flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) { - if (NPC.CountNPCS(ModContent.NPCType()) < flareCount) - { - int num1062 = NPC.NewNPC((int)flareDustBulletHellSpawn.X, (int)flareDustBulletHellSpawn.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - - Main.npc[num1062].velocity = player.Center - flareDustBulletHellSpawn; - Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; - Main.npc[num1062].netUpdate = true; - } - - int totalProjectiles = 45; - float offsetAngle = 360 / totalProjectiles; - int totalSpaces = 9; - int spaceStart = Main.rand.Next(totalProjectiles - totalSpaces); - float ai0 = npc.ai[2] % (flareDustSpawnDivisor * 2) == 0f ? 1f : 0f; - - int spacesMade = 0; - for (int i = 0; i < totalProjectiles; i++) - { - if (i >= spaceStart && spacesMade < totalSpaces) - spacesMade++; - else - Projectile.NewProjectile(flareDustBulletHellSpawn, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, ai0, i * offsetAngle); - } + SpawnDetonatingFlares(flareDustBulletHellSpawn, player, maxFlareCount, new int[] { ModContent.NPCType() }); + DoFlareDustBulletHell(0, flareDustSpawnDivisor, projectileDamage, 36, 0f, 0f, false); } } @@ -1312,10 +1262,11 @@ namespace CalamityMod.NPCs.Yharon { npc.dontTakeDamage = phase4Check; - Vector2 flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (npc.ai[2] == 0f) + { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + } npc.ai[2] += 1f; @@ -1325,38 +1276,13 @@ namespace CalamityMod.NPCs.Yharon Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(ModContent.NPCType()) < flareCount && NPC.CountNPCS(ModContent.NPCType()) < flareCount) - { - int NPCType = Main.rand.NextBool(2) ? ModContent.NPCType() : ModContent.NPCType(); - int num1062 = NPC.NewNPC((int)flareDustBulletHellSpawn.X, (int)flareDustBulletHellSpawn.Y, NPCType, 0, 0f, 0f, 0f, 0f, 255); - - Main.npc[num1062].velocity = player.Center - flareDustBulletHellSpawn; - Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; - Main.npc[num1062].netUpdate = true; - } - } + SpawnDetonatingFlares(flareDustBulletHellSpawn, player, maxFlareCount, new int[] { ModContent.NPCType(), ModContent.NPCType() }); } if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) - { - float projectileVelocity = 4f; - int totalProjectiles = 4; - double radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-npc.localAI[2], -projectileVelocity)) * projectileVelocity; - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i); - Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); - } - - float radialOffset = 1.2f; - npc.localAI[2] += npc.ai[2] < (flareDustPhaseTimer / 2) ? radialOffset : -radialOffset; - } + DoFlareDustBulletHell(1, flareDustPhaseTimer, projectileDamage, 4, 4f, 1.5f, false); } npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); @@ -1491,17 +1417,7 @@ namespace CalamityMod.NPCs.Yharon { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (NPC.CountNPCS(ModContent.NPCType()) < flareCount && NPC.CountNPCS(ModContent.NPCType()) < flareCount) - { - int NPCType = Main.rand.NextBool(2) ? ModContent.NPCType() : ModContent.NPCType(); - int num1062 = NPC.NewNPC((int)fromMouth.X, (int)fromMouth.Y, NPCType, 0, 0f, 0f, 0f, 0f, 255); - - Main.npc[num1062].velocity = player.Center - fromMouth; - Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; - Main.npc[num1062].netUpdate = true; - } - + SpawnDetonatingFlares(fromMouth, player, maxFlareCount, new int[] { ModContent.NPCType(), ModContent.NPCType() }); Projectile.NewProjectile(fromMouth, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1532,8 +1448,8 @@ namespace CalamityMod.NPCs.Yharon #region AI2 public void Yharon_AI2(bool expertMode, bool revenge, bool death, float pie) { - bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.8 : 0.7); - bool phase3 = npc.life <= npc.lifeMax * (revenge ? 0.5 : 0.4); + bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); + bool phase3 = npc.life <= npc.lifeMax * (revenge ? 0.5 : (expertMode ? 0.4 : 0.25)); bool phase4 = npc.life <= npc.lifeMax * 0.15 && revenge; if (npc.ai[0] != 8f) @@ -2115,13 +2031,14 @@ namespace CalamityMod.NPCs.Yharon npc.rotation -= spinRotation * npc.direction; if (npc.ai[1] == 1f) + { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + flareDustBulletHellSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + } npc.ai[1] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 flareDustBulletHellSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (npc.ai[1] % flareDustSpawnDivisor == 0f) { if (npc.ai[1] >= 120f) @@ -2131,41 +2048,12 @@ namespace CalamityMod.NPCs.Yharon if (phase3) { if (npc.ai[1] % flareDustSpawnDivisor2 == 0f) - { - float projectileVelocity = 4f; - int totalProjectiles = 5; - double radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-npc.localAI[2], -projectileVelocity)) * projectileVelocity; - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i); - Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); - } - - float radialOffset = phase4 ? 3f : 1.5f; - npc.localAI[2] += npc.ai[1] < (spinPhaseTimer / 2) ? radialOffset : -radialOffset; - } + DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, 5, 4f, phase4 ? 3f : 1.5f, true); } else if (phase2) { if (npc.ai[1] % flareDustSpawnDivisor == 0f) - { - int totalProjectiles = 30; - float offsetAngle = 360 / totalProjectiles; - int totalSpaces = 5; - int spaceStart = Main.rand.Next(totalProjectiles - totalSpaces); - float ai0 = npc.ai[1] % (flareDustSpawnDivisor * 2) == 0f ? 1f : 0f; - - int spacesMade = 0; - for (int i = 0; i < totalProjectiles; i++) - { - if (i >= spaceStart && spacesMade < totalSpaces) - spacesMade++; - else - Projectile.NewProjectile(flareDustBulletHellSpawn, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, ai0, i * offsetAngle); - } - } + DoFlareDustBulletHell(0, (int)spinPhaseTimer, projectileDamage, 36, 0f, 0f, true); } else { @@ -2234,40 +2122,19 @@ namespace CalamityMod.NPCs.Yharon npc.velocity.Y -= 3f; } - bool spawnNPC = npc.ai[1] == 20f || npc.ai[1] == 80f || npc.ai[1] == 140f; - int flareCount = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - - if (flareCount > 6) - spawnNPC = false; - if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - Boom(600, projectileDamage); + if (expertMode) + DoFireRing(600, projectileDamage); - if (spawnNPC) + if (npc.ai[1] == 20f || npc.ai[1] == 80f || npc.ai[1] == 140f) { Vector2 vector7 = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); if (Vector2.Distance(vector7, targetData.Center) > 150f) - { - Point point2 = vector7.ToPoint(); - - int npc2 = NPC.NewNPC(point2.X, point2.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - - Main.npc[npc2].velocity = targetData.Center - vector7; - Main.npc[npc2].velocity.Normalize(); - Main.npc[npc2].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; - Main.npc[npc2].netUpdate = true; - - int npc3 = NPC.NewNPC(point2.X, point2.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - - Main.npc[npc3].velocity = targetData.Center - vector7; - Main.npc[npc3].velocity.Normalize(); - Main.npc[npc3].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; - Main.npc[npc3].netUpdate = true; - } + SpawnDetonatingFlares(vector7, targetData, 6, new int[] { ModContent.NPCType(), ModContent.NPCType() }); } } @@ -2460,6 +2327,91 @@ namespace CalamityMod.NPCs.Yharon } #endregion + #region Spawn Detonating Flares + private void SpawnDetonatingFlares(Vector2 origin, Player target, int maxFlareCount, int[] flareTypes) + { + if (flareTypes.Length > 1) + { + if (NPC.CountNPCS(flareTypes[0]) + NPC.CountNPCS(flareTypes[1]) < maxFlareCount) + SpawnFlares(flareTypes[0], flareTypes[1]); + } + else + { + if (NPC.CountNPCS(flareTypes[0]) < maxFlareCount) + SpawnFlares(flareTypes[0]); + } + + void SpawnFlares(int type1 = 0, int type2 = 0) + { + int type = type2 == 0 ? type1 : Main.rand.NextBool(2) ? type1 : type2; + int npc = NPC.NewNPC((int)origin.X, (int)origin.Y, type, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[npc].velocity = target.Center - origin; + Main.npc[npc].velocity.Normalize(); + Main.npc[npc].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; + Main.npc[npc].netUpdate = true; + } + } + #endregion + + #region Flare Dust Bullet Hell + private void DoFlareDustBulletHell(int attackType, int timer, int projectileDamage, int totalProjectiles, float projectileVelocity, float radialOffset, bool phase2) + { + float aiVariableUsed = phase2 ? npc.ai[1] : npc.ai[2]; + switch (attackType) + { + case 0: + float offsetAngle = 360 / totalProjectiles; + int totalSpaces = totalProjectiles / 5; + int spaceStart = Main.rand.Next(totalProjectiles - totalSpaces); + float ai0 = aiVariableUsed % (timer * 2) == 0f ? 1f : 0f; + + int spacesMade = 0; + for (int i = 0; i < totalProjectiles; i++) + { + if (i >= spaceStart && spacesMade < totalSpaces) + spacesMade++; + else + Projectile.NewProjectile(flareDustBulletHellSpawn, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, ai0, i * offsetAngle); + } + break; + + case 1: + double radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-npc.localAI[2], -projectileVelocity)) * projectileVelocity; + + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i); + Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); + } + + npc.localAI[2] += aiVariableUsed < (timer / 2) ? radialOffset : -radialOffset; + break; + + default: + break; + } + } + #endregion + + #region Fire Ring + public void DoFireRing(int timeLeft, int damage) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float velocity = 5f; + int totalProjectiles = 50; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = timeLeft; + } + } + } + #endregion + #region Drawing public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -2468,8 +2420,6 @@ namespace CalamityMod.NPCs.Yharon bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); - bool fastChargePhase = (!startSecondAI && (npc.ai[0] == 5f || npc.ai[0] == 11f || npc.ai[0] == 18f)) || (startSecondAI && npc.ai[0] == 7f); - bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f)); @@ -2518,8 +2468,6 @@ namespace CalamityMod.NPCs.Yharon num153 = 0; if (idlePhases) num153 = 7; - if (fastChargePhase) - num153 = 30; if (invincible) color36 = invincibleColor; @@ -2984,24 +2932,6 @@ namespace CalamityMod.NPCs.Yharon } #endregion - #region Boom - public void Boom(int timeLeft, int damage) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float velocity = 5f; - int totalProjectiles = 50; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = timeLeft; - } - } - } - #endregion - #region Hit Effect public override void HitEffect(int hitDirection, double damage) { @@ -3011,7 +2941,7 @@ namespace CalamityMod.NPCs.Yharon } if (npc.life <= 0) { - Boom(150, 1000); + DoFireRing(150, 1000); npc.position.X = npc.position.X + (npc.width / 2); npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 300; diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 2c74d10bcc..78b854ac0d 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity *= 0.985f; if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; @@ -66,14 +65,14 @@ namespace CalamityMod.Projectiles.Boss { projectile.localAI[1] += 1f; byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, projectile.alpha); } @@ -83,8 +82,8 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); projectile.position = projectile.Center; projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X = projectile.position.X - (projectile.width / 2); + projectile.position.Y = projectile.position.Y - (projectile.height / 2); for (int num621 = 0; num621 < 30; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); @@ -92,7 +91,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 60; num623++) diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 3560d62f37..cc785ed1f6 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -8,9 +8,6 @@ namespace CalamityMod.Projectiles.Boss { public class FlareDust : ModProjectile { - private bool start = true; - private Vector2 center = Vector2.Zero; - private Vector2 velocity = Vector2.Zero; private double distance = 0D; public override void SetStaticDefaults() @@ -35,19 +32,13 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(projectile.localAI[0]); - writer.Write(start); - writer.WriteVector2(center); writer.Write(distance); - writer.WriteVector2(velocity); } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); - start = reader.ReadBoolean(); - center = reader.ReadVector2(); distance = reader.ReadDouble(); - velocity = reader.ReadVector2(); } public override void AI() @@ -74,32 +65,23 @@ namespace CalamityMod.Projectiles.Boss return; } - if (start) - { - center = projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center - projectile.Center) * 2f; - start = false; - } - - center += velocity; - double rad = MathHelper.ToRadians(projectile.ai[1]); - float amount = 1f - projectile.localAI[0] / 180f; - if (amount < 0f) - amount = 0f; + float amount = projectile.localAI[0] / 300f; + if (amount > 1f) + amount = 1f; distance += MathHelper.Lerp(1f, 3f, amount); if (projectile.ai[0] == 0f) { - projectile.position.X = center.X - (int)(Math.Sin(rad) * distance) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distance) - projectile.height / 2; + projectile.position.X = projectile.Center.X - (int)(Math.Sin(rad) * distance) - projectile.width / 2; + projectile.position.Y = projectile.Center.Y - (int)(Math.Cos(rad) * distance) - projectile.height / 2; } else { - projectile.position.X = center.X - (int)(Math.Cos(rad) * distance) - projectile.width / 2; - projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distance) - projectile.height / 2; + projectile.position.X = projectile.Center.X - (int)(Math.Cos(rad) * distance) - projectile.width / 2; + projectile.position.Y = projectile.Center.Y - (int)(Math.Sin(rad) * distance) - projectile.height / 2; } projectile.ai[1] += (0.25f + amount) * 0.5f; diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 16839a0373..c1cfa98b70 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] += 0.1f; - float amplitude = velocity.Length(); + float amplitude = 2f; float wavyVelocity = (float)Math.Cos(projectile.ai[1]); @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] += 0.1f; - float amplitude = velocity.Length(); + float amplitude = 2f; float wavyVelocity = (float)Math.Sin(projectile.ai[1]); diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 6fb98462e3..8b7b847ea5 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index b521ae0237..93ffadc8b7 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 39e45b9d5a..5d17b0f98e 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D value = Main.projectileTexture[projectile.type]; - Color baseColor = Main.dayTime ? new Color(255, 150, 0, 255) : new Color(0, 150, 255, 255); + Color baseColor = Main.dayTime ? new Color(255, 200, 100, 255) : new Color(100, 200, 255, 255); Color color33 = baseColor * 0.5f; color33.A = 0; Vector2 vector28 = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index ccca0e7846..b20d003d87 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index cb6fc777f7..a4adf1752e 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index b4bd36ae31..85311e0ac8 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 6bd41b956d..703f19c388 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D value = Main.projectileTexture[projectile.type]; - Color baseColor = new Color(100, 255, 0, 255); + Color baseColor = new Color(100, 255, 100, 255); Color color33 = baseColor * 0.5f; color33.A = 0; Vector2 vector28 = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 27bd3afa89..3657ea8e96 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -117,14 +117,14 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D value = Main.projectileTexture[projectile.type]; - int green = projectile.ai[0] != 0f ? 255 : 100; - int blue = projectile.ai[0] != 0f ? 0 : 100; + int green = projectile.ai[0] != 0f ? 255 : 125; + int blue = projectile.ai[0] != 0f ? 0 : 125; Color baseColor = new Color(255, green, blue, 255); if (!Main.dayTime) { - int red = projectile.ai[0] != 0f ? 0 : 100; - green = projectile.ai[0] != 0f ? 255 : 100; + int red = projectile.ai[0] != 0f ? 100 : 175; + green = projectile.ai[0] != 0f ? 255 : 175; baseColor = new Color(red, green, 255, 255); } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index a00aef3307..2d4b147680 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 78c1d38c0d..d9a83eaa19 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(0, 150, 250, projectile.alpha); + return Main.dayTime ? new Color(250, 150, 0, projectile.alpha) : new Color(100, 200, 250, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 8a33dff998..af047341c4 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture2D20 = Main.dayTime ? ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid") : ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight"); Texture2D texture2D21 = Main.dayTime ? ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd") : ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight"); float num223 = projectile.localAI[1]; //length of laser - Color color44 = Main.dayTime ? new Color(250, 250, 250, 0) : new Color(150, 150, 250, 0) * 0.9f; + Color color44 = Main.dayTime ? new Color(250, 250, 250, 0) : new Color(175, 175, 250, 0) * 0.9f; Vector2 vector = projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index f38d82234b..bc3cdee6ea 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.ignoreWater = true; projectile.penetrate = 1; - projectile.timeLeft = 300; + projectile.timeLeft = 600; projectile.alpha = 255; } @@ -31,26 +31,26 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 10; num621++) + for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 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 + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } projectile.ai[1] = 1f; Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; projectile.alpha -= 50; if (projectile.alpha < 0) { projectile.alpha = 0; } - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 0.8f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } @@ -58,12 +58,12 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int dust = 0; dust <= 10; dust++) + for (int dust = 0; dust <= 3; dust++) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float num463 = Main.rand.Next(-10, 11); + float num464 = Main.rand.Next(-10, 11); + float num465 = Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index a92be8d623..19f89b3168 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -10,7 +10,6 @@ using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SlimeGod; @@ -134,10 +133,6 @@ namespace CalamityMod.UI OneToMany[NPCID.MoonLordHand] = MoonLord; OneToMany[NPCID.MoonLordCore] = MoonLord; - int[] StarWorm = new int[] { ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = StarWorm; - OneToMany[ModContent.NPCType()] = StarWorm; - int[] Void = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; @@ -312,10 +307,6 @@ namespace CalamityMod.UI { AttemptAddBar(i, NPCID.PirateShip); } - else if (Main.npc[i].type == ModContent.NPCType()) - { - AttemptAddBar(i, ModContent.NPCType()); - } else if (Main.npc[i].type == ModContent.NPCType()) { AttemptAddBar(i, ModContent.NPCType()); @@ -441,8 +432,7 @@ namespace CalamityMod.UI Skelet, SkeletPrime, MartSaucer, - PirShip, - Astrum + PirShip } enum SpecialType2 : byte @@ -491,10 +481,6 @@ namespace CalamityMod.UI { _special2 = SpecialType2.Ceaseless; } - else if (type == ModContent.NPCType()) - { - _special = SpecialType.Astrum; - } else { switch (type) @@ -675,10 +661,6 @@ namespace CalamityMod.UI int count6 = NPC.CountNPCS(NPCID.PirateShipCannon); _specialData[5] = count6; break; - case SpecialType.Astrum: - int count7 = NPC.CountNPCS(ModContent.NPCType()); - _specialData[6] = count7; - break; } switch (_special2) @@ -804,12 +786,6 @@ namespace CalamityMod.UI float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); return; - case SpecialType.Astrum: - string count7 = "(Small Worms left: " + _specialData[6] + ")"; - Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; - float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; } switch (_special2) @@ -923,13 +899,6 @@ namespace CalamityMod.UI DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); _openAnimCounter--; return; - case SpecialType.Astrum: - string count7 = "(Small Worms left: " + _specialData[6] + ")"; - Vector2 countSize7 = Main.fontItemStack.MeasureString(count7) * textScale; - float countX7 = Math.Max(x, x + mainBarWidth - countSize7.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count7, new Vector2(countX7, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; } switch (_special2) diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 5b7748ec10..f91d883f6d 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1044,10 +1044,89 @@ namespace CalamityMod.World int x = WorldGen.genRand.Next(10, Main.maxTilesX - 10); int y = WorldGen.genRand.Next((int)Main.worldSurface - 1, Main.maxTilesY - 20); + int y2 = y - 1; + if (y2 < 10) + y2 = 10; + if (Main.tile[x, y] != null) { if (Main.tile[x, y].nactive()) { + if (Main.tile[x, y].liquid <= 32) + { + if (Main.tile[x, y].type == TileID.JungleGrass) + { + if (Main.tile[x, y2].liquid == 0) + { + // Plantera Bulbs pre-mech + if (WorldGen.genRand.Next(1500) == 0) + { + if (Main.hardMode && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)) + { + bool placeBulb = true; + int minDistanceFromOtherBulbs = 150; + for (int i = x - minDistanceFromOtherBulbs; i < x + minDistanceFromOtherBulbs; i += 2) + { + for (int j = y - minDistanceFromOtherBulbs; j < y + minDistanceFromOtherBulbs; j += 2) + { + if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].type == TileID.PlanteraBulb) + { + placeBulb = false; + break; + } + } + } + + if (placeBulb) + { + WorldGen.PlaceJunglePlant(x, y2, TileID.PlanteraBulb, 0, 0); + WorldGen.SquareTileFrame(x, y2); + WorldGen.SquareTileFrame(x + 2, y2); + WorldGen.SquareTileFrame(x - 1, y2); + if (Main.tile[x, y2].type == TileID.PlanteraBulb && Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, x, y2, 5); + } + } + } + } + + // Life Fruit pre-mech + int random = Main.expertMode ? 30 : 40; + if (WorldGen.genRand.Next(random) == 0) + { + if (Main.hardMode && !NPC.downedMechBossAny) + { + bool placeFruit = true; + int minDistanceFromOtherFruit = Main.expertMode ? 50 : 60; + for (int i = x - minDistanceFromOtherFruit; i < x + minDistanceFromOtherFruit; i += 2) + { + for (int j = y - minDistanceFromOtherFruit; j < y + minDistanceFromOtherFruit; j += 2) + { + if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].type == TileID.LifeFruit) + { + placeFruit = false; + break; + } + } + } + + if (placeFruit) + { + WorldGen.PlaceJunglePlant(x, y2, TileID.LifeFruit, WorldGen.genRand.Next(3), 0); + WorldGen.SquareTileFrame(x, y2); + WorldGen.SquareTileFrame(x + 1, y2 + 1); + if (Main.tile[x, y2].type == TileID.LifeFruit && Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, x, y2, 4); + } + } + } + } + } + } + } + int tileType = Main.tile[x, y].type; bool tenebris = tileType == ModContent.TileType() && downedCalamitas; @@ -1364,10 +1443,6 @@ namespace CalamityMod.World break; case 29: ChangeTime(false); - for (int x = 0; x < 10; x++) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; case 30: diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 7c58b60de3..95882ac4ae 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -88,7 +88,7 @@ namespace CalamityMod.World Point point = new Point(num, num2); for (int i = point.Y - num2; i <= point.Y + num2; i++) { - float num4 = num / num2 * (i - point.Y); + float num4 = num / num2 * (float)(i - point.Y); int num5 = Math.Min(num, (int)Math.Sqrt(num3 - num4 * num4)); for (int j = point.X - num5; j <= point.X + num5; j++) { From d3e5de1b3b47c0023b3a8a4a99d5308ae3c58d2c Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 1 Jun 2020 21:29:46 -0500 Subject: [PATCH 32/41] Fixed conflict shit. --- NPCs/AstrumDeus/AstrumDeusBodySpectral.cs | 9 ++--- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 13 ++----- NPCs/AstrumDeus/AstrumDeusTailSpectral.cs | 6 +-- NPCs/CalamityAI.cs | 38 +++++++++---------- NPCs/DesertScourge/DesertScourgeHead.cs | 8 ++-- NPCs/DevourerofGods/DevourerofGodsHead.cs | 4 +- NPCs/DevourerofGods/DevourerofGodsHead2.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 6 +-- NPCs/Leviathan/Leviathan.cs | 8 ++-- NPCs/Leviathan/Siren.cs | 6 +-- NPCs/Perforator/PerforatorHeadLarge.cs | 2 +- NPCs/Perforator/PerforatorHeadMedium.cs | 2 +- NPCs/Perforator/PerforatorHeadSmall.cs | 2 +- .../PlaguebringerGoliath.cs | 20 +++++----- NPCs/Polterghast/PolterPhantom.cs | 4 +- NPCs/Signus/Signus.cs | 22 +++++------ NPCs/StormWeaver/StormWeaverBodyNaked.cs | 6 +-- NPCs/StormWeaver/StormWeaverHead.cs | 8 ++-- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 6 +-- NPCs/StormWeaver/StormWeaverTailNaked.cs | 7 +--- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- NPCs/Yharon/Yharon.cs | 14 +++---- Projectiles/Boss/SandBlast.cs | 4 +- 23 files changed, 91 insertions(+), 108 deletions(-) diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index 2054803354..6f5917544c 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -26,7 +25,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.height = 44; npc.defense = 50; npc.LifeMaxNERB(187500, 225000, 6500000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -90,7 +89,7 @@ namespace CalamityMod.NPCs.AstrumDeus float amount9 = 0.5f; int num153 = 5; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -114,7 +113,7 @@ namespace CalamityMod.NPCs.AstrumDeus Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f) * npc.Opacity; Color color42 = Color.Lerp(Color.White, Color.Orange, 0.5f) * npc.Opacity; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { @@ -170,7 +169,7 @@ namespace CalamityMod.NPCs.AstrumDeus int num660 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server && num660 < 200) { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); } npc.netUpdate = true; } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 6aa9a0294f..027f0b42a3 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -11,11 +11,6 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -24,8 +19,6 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.AstrumDeus { @@ -46,7 +39,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.height = 56; npc.defense = 25; npc.LifeMaxNERB(187500, 225000, 6500000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -110,7 +103,7 @@ namespace CalamityMod.NPCs.AstrumDeus float amount9 = 0.5f; int num153 = 5; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -134,7 +127,7 @@ namespace CalamityMod.NPCs.AstrumDeus Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f) * npc.Opacity; Color color42 = Color.Lerp(Color.White, Color.Orange, 0.5f) * npc.Opacity; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index c538382666..0920f9585f 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.height = 68; npc.defense = 75; npc.LifeMaxNERB(187500, 225000, 6500000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.AstrumDeus float amount9 = 0.5f; int num153 = 5; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.AstrumDeus texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow"); Color color37 = Color.Lerp(Color.White, Color.Orange, 0.5f) * npc.Opacity; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 7e8cc34fd0..5ca417d5d1 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } calamityGlobalNPC.newAI[2] = 1f; @@ -810,7 +810,7 @@ namespace CalamityMod.NPCs } float projectileSpeed = CalamityWorld.bossRushActive ? 7f : 5f; - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) projectileSpeed += 4f; if (revenge) projectileSpeed += 1f; @@ -899,7 +899,7 @@ namespace CalamityMod.NPCs if (expertMode) npc.localAI[0] += death ? 2f : 2f * (1f - lifeRatio); - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[0] += 2f; if (death || !calamity) npc.localAI[0] += 1f; @@ -1365,7 +1365,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 14f : 12.5f); - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num828 += 5f; int num829 = expertMode ? 34 : 42; @@ -1483,7 +1483,7 @@ namespace CalamityMod.NPCs { if (revenge) npc.localAI[1] += 0.5f; - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[1] += 0.5f; if (expertMode) npc.localAI[1] += 0.5f; @@ -1595,8 +1595,8 @@ namespace CalamityMod.NPCs else { int num62 = 500; - float num63 = (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 20f : 14f; - float num64 = (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 0.5f : 0.35f; + float num63 = (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 20f : 14f; + float num64 = (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 0.5f : 0.35f; if (provy) { @@ -1811,7 +1811,7 @@ namespace CalamityMod.NPCs npc.velocity.Y -= num862; } - npc.ai[2] += (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f; + npc.ai[2] += (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f; if (npc.ai[2] >= 240f) { npc.TargetClosest(true); @@ -1873,7 +1873,7 @@ namespace CalamityMod.NPCs num870 += 2f; if (death) num870 += 2f; - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num870 += 4f; if (provy) num870 *= 1.15f; @@ -2084,7 +2084,7 @@ namespace CalamityMod.NPCs npc.velocity.Y -= num862; } - npc.ai[2] += (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f; + npc.ai[2] += (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f; if (npc.ai[2] >= 180f) { npc.TargetClosest(true); @@ -2146,7 +2146,7 @@ namespace CalamityMod.NPCs num870 += 2f; if (death) num870 += 2f; - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num870 += 4f; if (provy) num870 *= 1.15f; @@ -2278,7 +2278,7 @@ namespace CalamityMod.NPCs // Fire projectiles while walking, teleporting, or falling if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || - calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2292,7 +2292,7 @@ namespace CalamityMod.NPCs laserDamage *= 3; // Fire astral flames while teleporting - if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { float velocity = CalamityWorld.bossRushActive ? 10f : 7f; int totalProjectiles = 8; @@ -2363,7 +2363,7 @@ namespace CalamityMod.NPCs // Stay vulnerable for a maximum of 1.5 or 2.5 seconds npc.ai[1] += 1f; - if (npc.ai[1] >= ((phase3 || calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) + if (npc.ai[1] >= ((phase3 || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) { // Increase defense npc.defense = 70; @@ -2718,7 +2718,7 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive); + bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive); // 8 seconds of reistance to prevent spawn killing if (calamityGlobalNPC.newAI[1] < 480f) @@ -2887,7 +2887,7 @@ namespace CalamityMod.NPCs Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } } @@ -3425,7 +3425,7 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[1] += expertMode ? 1.5f : 1f; calamityGlobalNPC.newAI[1] += calamityGlobalNPC.newAI[2]; - if (calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) calamityGlobalNPC.newAI[1] += 2f; if (calamityGlobalNPC.newAI[1] >= 900f) @@ -3690,7 +3690,7 @@ namespace CalamityMod.NPCs npc.netSpam = 5; if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } return; } @@ -3863,7 +3863,7 @@ namespace CalamityMod.NPCs npc.netSpam = 5; if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index ba89e10baf..1d1a3e1006 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; npc.height = 80; npc.LifeMaxNERB(2300, 2650, 16500000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = 6; aiType = -1; @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.DesertScourge turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed *= 2f; turnSpeed *= 2f; @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.DesertScourge Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } TailSpawned = true; @@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.DesertScourge { npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000; + int num954 = (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000; if (CalamityWorld.bossRushActive) num954 /= 2; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 980867be92..2d3962f967 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.height = 104; npc.defense = 50; npc.LifeMaxNERB(675000, 750000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; npc.aiStyle = -1; @@ -196,7 +196,7 @@ namespace CalamityMod.NPCs.DevourerofGods Main.npc[segment].ai[2] = (float)npc.whoAmI; Main.npc[segment].ai[1] = (float)Previous; Main.npc[Previous].ai[0] = (float)segment; - NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0); Previous = segment; } tail = true; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index 22380d2245..fdc938723f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if (!npc.active && Main.netMode == NetmodeID.Server) { - NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 7159881be7..77b64b28d0 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.height = 186; npc.defense = 50; npc.LifeMaxNERB(1150000, 1350000, 9200000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; npc.aiStyle = -1; @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.DevourerofGods Main.npc[segment].ai[2] = npc.whoAmI; Main.npc[segment].ai[1] = Previous; Main.npc[Previous].ai[0] = segment; - NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0); Previous = segment; } tail = true; @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[0] = 0f; // Laser walls - if (!speedBoost2 && (laserWallPhase == 1 || calamityGlobalNPC.enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive))) + if (!speedBoost2 && (laserWallPhase == 1 || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive))) { calamityGlobalNPC.newAI[1] += 1f; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 5c8f21f8ae..744d5cc708 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Leviathan npc.defense = 40; npc.Calamity().RevPlusDR(0.35f); npc.LifeMaxNERB(69000, 90700, 7000000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; @@ -284,7 +284,7 @@ namespace CalamityMod.NPCs.Leviathan num418 = (sirenAlive && !death) ? 14f : 17f; num419 = 33; } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num418 = 22f; } @@ -449,7 +449,7 @@ namespace CalamityMod.NPCs.Leviathan { num1044 += death ? 4f : 4f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1044 += 4f; } @@ -478,7 +478,7 @@ namespace CalamityMod.NPCs.Leviathan num1049 += death ? 0.1f : 0.1f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 3f; num1049 += 0.2f; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 2594065283..68f98a60ba 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Leviathan npc.defense = 20; npc.Calamity().RevPlusDR(0.05f); npc.LifeMaxNERB(27400, 41600, 2600000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; @@ -437,7 +437,7 @@ namespace CalamityMod.NPCs.Leviathan npc.ai[1] += 1f; bool flag104 = false; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (npc.ai[1] % 10f == 9f) flag104 = true; @@ -465,7 +465,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.netMode != NetmodeID.MultiplayerClient) { float num1070 = revenge ? 15f : 13f; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1070 = 24f; else if (isNotOcean || (!leviAlive && phase2) || death) num1070 = revenge ? 17f : 16f; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index def9779f16..11624e8da5 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Perforator turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed *= 2f; turnSpeed *= 2f; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 86cf201f5a..25dd02aa2c 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Perforator turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed *= 2f; turnSpeed *= 2f; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index cb765e20f4..6fc46d8860 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.Perforator turnSpeed += death ? 0.1f : 0.1f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed *= 2f; turnSpeed *= 2f; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 91c51eff6a..1643ca0bcd 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -22,8 +22,6 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.PlaguebringerGoliath { [AutoloadBossHead] @@ -56,7 +54,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.defense = 40; npc.Calamity().RevPlusDR(0.25f); npc.LifeMaxNERB(58500, 77275, 3700000); - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; @@ -282,7 +280,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1044 += 2f; if (lifeRatio < 0.33f || death) num1044 += 2f; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1044 += 2f; int num1043 = 2; @@ -362,7 +360,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1048 += 1f; num1049 += 0.05f; } - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 2f; num1049 += 0.1f; @@ -410,7 +408,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.spriteDirection = npc.direction; int num1050 = revenge ? 525 : 550; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1050 = 300; else if (aboveGroundEnrage || CalamityWorld.bossRushActive) num1050 = 400; @@ -672,7 +670,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath vector121.X += (npc.direction * 120); npc.ai[1] += 1f; - int num650 = ((npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death || aboveGroundEnrage) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30))); + int num650 = ((npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death || aboveGroundEnrage) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30))); if (npc.ai[1] % (float)num650 == (float)(num650 - 1) && vectorCenter.Y < player.position.Y) { @@ -681,7 +679,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (jungleEnrage || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) projectileSpeed += 10f; if (CalamityWorld.bossRushActive) projectileSpeed *= 1.5f; @@ -925,7 +923,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } @@ -1038,7 +1036,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.ai[0] != 0f && npc.ai[0] != 4f) num153 = 7; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -1060,7 +1058,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 5d7a1b275f..b6e99ca985 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -29,8 +29,8 @@ namespace CalamityMod.NPCs.Polterghast npc.width = 90; npc.height = 120; npc.LifeMaxNERB(130000, 150000, 900000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index a6facf1fc0..874c634b3d 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -16,8 +16,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.Signus { [AutoloadBossHead] @@ -59,8 +57,8 @@ namespace CalamityMod.NPCs.Signus else music = MusicID.Boss4; } - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; @@ -213,7 +211,7 @@ namespace CalamityMod.NPCs.Signus if (expertMode) speed += death ? 4f : 4f * (float)(1D - lifeRatio); - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) speed += 3f; float num795 = player.Center.X - vectorCenter.X; @@ -317,12 +315,12 @@ namespace CalamityMod.NPCs.Signus int num660 = NPC.NewNPC((int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); } int num661 = NPC.NewNPC((int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); } for (int num621 = 0; num621 < 5; num621++) { @@ -388,7 +386,7 @@ namespace CalamityMod.NPCs.Signus if (Main.netMode != NetmodeID.MultiplayerClient) { float num1070 = 15f; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1070 += 3f; } @@ -471,12 +469,12 @@ namespace CalamityMod.NPCs.Signus int num660 = NPC.NewNPC((int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); } int num661 = NPC.NewNPC((int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); } spawnY -= 60; } @@ -694,7 +692,7 @@ namespace CalamityMod.NPCs.Signus float rotation = npc.rotation; float offsetY = npc.gfxOffY; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -716,7 +714,7 @@ namespace CalamityMod.NPCs.Signus Color color40 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 87b8a51a12..445d0a20f3 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.StormWeaver int num159 = 1; float num160 = 0f; int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityMod.CalamityConfig.Afterimages) + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) { Color color26 = npc.GetAlpha(color25); { @@ -274,7 +274,7 @@ namespace CalamityMod.NPCs.StormWeaver int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { - NetMessage.SendData(23, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); } npc.netUpdate = true; } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index e8835f8db7..adb60026cc 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -5,8 +5,6 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.StormWeaver { @@ -50,8 +48,8 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -171,7 +169,7 @@ namespace CalamityMod.NPCs.StormWeaver if (BoltCountdown == 0) { int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed2 += 1; } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 03e2215449..78a8e17226 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.StormWeaver if (BoltCountdown == 0) { int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed2 += 1; } @@ -443,7 +443,7 @@ namespace CalamityMod.NPCs.StormWeaver int num159 = 1; float num160 = 0f; int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityMod.CalamityConfig.Afterimages) + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) { Color color26 = npc.GetAlpha(color25); { diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index ff43e49722..c565aa4c42 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,13 +1,10 @@ using CalamityMod.World; -using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.StormWeaver { @@ -40,7 +37,7 @@ namespace CalamityMod.NPCs.StormWeaver else music = MusicID.Boss3; } - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -190,7 +187,7 @@ namespace CalamityMod.NPCs.StormWeaver int num159 = 1; float num160 = 0f; int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityMod.CalamityConfig.Afterimages) + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) { Color color26 = npc.GetAlpha(color25); { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 489e16c88a..b476a96e5b 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.value = Item.buyPrice(10, 0, 0, 0); npc.LifeMaxNERB(5000000, 5500000, 2100000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index e89c8204cf..0e62462c48 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.Yharon npc.height = 200; npc.defense = 150; npc.LifeMaxNERB(2275000, 2525000, 3700000); - double HPBoost = CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; @@ -257,7 +257,7 @@ namespace CalamityMod.NPCs.Yharon float acceleration = expertMode ? 0.7f : 0.69f; float velocity = expertMode ? 11f : 10.8f; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { acceleration = 0.95f; velocity = 14f; @@ -286,7 +286,7 @@ namespace CalamityMod.NPCs.Yharon float fastChargeVelocityMultiplier = 1.5f; int fastChargeTelegraphTimer = 120; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { chargeTime = 40; chargeSpeed = 35f; @@ -1592,7 +1592,7 @@ namespace CalamityMod.NPCs.Yharon float teleportPhaseTimer = 45f; - if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { acceleration = 1.2f; velocity = 18f; @@ -2479,7 +2479,7 @@ namespace CalamityMod.NPCs.Yharon else color = lightColor; - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += num154) { @@ -2530,7 +2530,7 @@ namespace CalamityMod.NPCs.Yharon scaleFactor9 = 20f; } - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num160 = 0; num160 < num156; num160++) { @@ -2607,7 +2607,7 @@ namespace CalamityMod.NPCs.Yharon color46 *= num162; } - if (CalamityMod.CalamityConfig.Afterimages) + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163 += num154) { diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index bc3cdee6ea..62c780ae9a 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - for (int dust = 0; dust <= 3; dust++) + Main.PlaySound(SoundID.Item14, projectile.position); + for (int dust = 0; dust <= 3; dust++) { float num463 = Main.rand.Next(-10, 11); float num464 = Main.rand.Next(-10, 11); From d509daab0c6502a92ef107ab0fbcefd067c11cd0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 2 Jun 2020 23:08:39 -0400 Subject: [PATCH 33/41] living fire blocks fixed... probably --- .../LivingBrimstoneFireBlockTile.cs | 104 +++++++++++++----- .../LivingGodSlayerFireBlockTile.cs | 102 ++++++++++++----- Tiles/LivingFire/LivingHolyFireBlockTile.cs | 103 ++++++++++++----- 3 files changed, 229 insertions(+), 80 deletions(-) diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index 49e4b83c8e..74118d3786 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -9,38 +9,88 @@ using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.LivingFire { - public class LivingBrimstoneFireBlockTile : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - soundType = SoundID.Dig; - drop = ModContent.ItemType(); - AddMapEntry(new Color(178, 34, 34)); - animationFrameHeight = 90; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = false; - } + public class LivingBrimstoneFireBlockTile : ModTile + { + //Thank you to Seraph for getting living fire blocks to work properly. + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + soundType = SoundID.Dig; + drop = ModContent.ItemType(); + AddMapEntry(new Color(178, 34, 34)); + animationFrameHeight = 90; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = false; + Main.tileFrameImportant[Type] = false; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.HookCheck = new PlacementHook(CanPlaceAlter, -1, 0, true ); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); - public override void AnimateTile(ref int frame, ref int frameCounter) - { + TileObjectData.addTile(Type); + } + + public int CanPlaceAlter(int i, int j, int type, int style, int direction) => 1; + + public static int AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, 1, 1); + } + return 1; + } + + public override bool CanPlace(int i, int j) + { + List> around = new List> + { + new List() {i, j-1 }, + new List() {i-1, j }, + new List() {i+1, j }, + new List() {i, j+1 } + }; + //if (Main.tile[i, j]) || tile.type == Type + + //return true; //temporary for testing purposes + + if (Main.tile[i, j].wall != WallID.None) + { + return true; + } + + for (int k = 0; k < around.Count; ++k) + { + Tile tile = Main.tile[around[k][0], around[k][1]]; + if (tile.active() && (Main.tileSolid[tile.type] || tile.type == Type)) + { + return true; + } + } + return false; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { frame = Main.tileFrame[TileID.LivingFire]; - } + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { r = 1f; g = 0f; b = 0f; - } + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.Brimstone, 0f, 0f, 1, default, 1f); - return false; - } - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.Brimstone, 0f, 0f, 1, default, 1f); + return false; + } + } } diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index f2bfffc8ef..6ca183c3fa 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -9,37 +9,87 @@ using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.LivingFire { - public class LivingGodSlayerFireBlockTile : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - soundType = SoundID.Dig; - drop = ModContent.ItemType(); - AddMapEntry(new Color(186, 85, 211)); - animationFrameHeight = 90; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - } + public class LivingGodSlayerFireBlockTile : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + soundType = SoundID.Dig; + drop = ModContent.ItemType(); + AddMapEntry(new Color(186, 85, 211)); + animationFrameHeight = 90; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = false; + Main.tileFrameImportant[Type] = false; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.HookCheck = new PlacementHook(CanPlaceAlter, -1, 0, true ); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); - public override void AnimateTile(ref int frame, ref int frameCounter) - { + TileObjectData.addTile(Type); + } + + public int CanPlaceAlter(int i, int j, int type, int style, int direction) => 1; + + public static int AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, 1, 1); + } + return 1; + } + + public override bool CanPlace(int i, int j) + { + List> around = new List> + { + new List() {i, j-1 }, + new List() {i-1, j }, + new List() {i+1, j }, + new List() {i, j+1 } + }; + //if (Main.tile[i, j]) || tile.type == Type + + //return true; //temporary for testing purposes + + if (Main.tile[i, j].wall != WallID.None) + { + return true; + } + + for (int k = 0; k < around.Count; ++k) + { + Tile tile = Main.tile[around[k][0], around[k][1]]; + if (tile.active() && (Main.tileSolid[tile.type] || tile.type == Type)) + { + return true; + } + } + return false; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { frame = Main.tileFrame[TileID.LivingFire]; - } + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { r = 1f; g = 0f; b = 1f; - } + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 1, default, 1f); - return false; - } - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 1, default, 1f); + return false; + } + } } diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index 0e593e3cff..b8e74a4553 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -9,38 +9,87 @@ using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.LivingFire { - public class LivingHolyFireBlockTile : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - soundType = SoundID.Dig; - drop = ModContent.ItemType(); - AddMapEntry(new Color(255, 215, 0)); - animationFrameHeight = 90; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.Tree | AnchorType.AlternateTile | AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.Tree | AnchorType.AlternateTile | AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.Tree | AnchorType.AlternateTile | AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.Tree | AnchorType.AlternateTile | AnchorType.EmptyTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = false; - } + public class LivingHolyFireBlockTile : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + soundType = SoundID.Dig; + drop = ModContent.ItemType(); + AddMapEntry(new Color(255, 215, 0)); + animationFrameHeight = 90; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = false; + Main.tileFrameImportant[Type] = false; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.HookCheck = new PlacementHook(CanPlaceAlter, -1, 0, true ); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); - public override void AnimateTile(ref int frame, ref int frameCounter) - { + TileObjectData.addTile(Type); + } + + public int CanPlaceAlter(int i, int j, int type, int style, int direction) => 1; + + public static int AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, 1, 1); + } + return 1; + } + + public override bool CanPlace(int i, int j) + { + List> around = new List> + { + new List() {i, j-1 }, + new List() {i-1, j }, + new List() {i+1, j }, + new List() {i, j+1 } + }; + //if (Main.tile[i, j]) || tile.type == Type + + //return true; //temporary for testing purposes + + if (Main.tile[i, j].wall != WallID.None) + { + return true; + } + + for (int k = 0; k < around.Count; ++k) + { + Tile tile = Main.tile[around[k][0], around[k][1]]; + if (tile.active() && (Main.tileSolid[tile.type] || tile.type == Type)) + { + return true; + } + } + return false; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { frame = Main.tileFrame[TileID.LivingFire]; - } + } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { r = 1f; g = 1f; b = 0f; - } + } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.ProfanedFire, 0f, 0f, 1, default, 1f); - return false; - } - } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.ProfanedFire, 0f, 0f, 1, default, 1f); + return false; + } + } } From 1fbab4668cea8f0027d0b16773141bc5b484aa61 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 2 Jun 2020 22:39:58 -0500 Subject: [PATCH 34/41] 1 - Rev+ DR applies in Normal/Expert. 2 - Cnidrion climbs and falls through blocks slower. 3 - Worm bosses resist explosives in Expert+. 4 - Added some pierce resist functions. --- Items/DifficultyItems/Revenge.cs | 2 - NPCs/Abyss/BobbitWormHead.cs | 2 +- NPCs/Abyss/ColossalSquid.cs | 2 +- NPCs/Abyss/EidolonWyrmHead.cs | 2 +- NPCs/AcidRain/AcidEel.cs | 2 +- NPCs/AcidRain/FlakCrab.cs | 2 +- NPCs/AcidRain/GammaSlime.cs | 2 +- NPCs/AcidRain/NuclearTerror.cs | 2 +- NPCs/AcidRain/Orthocera.cs | 4 +- NPCs/AcidRain/Skyfin.cs | 4 +- NPCs/AcidRain/SulfurousSkater.cs | 2 +- NPCs/AcidRain/Trilobite.cs | 4 +- NPCs/AquaticScourge/AquaticScourgeBody.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeTail.cs | 2 +- NPCs/Astral/Aries.cs | 2 +- NPCs/Astral/AstralProbe.cs | 2 +- NPCs/Astral/AstralachneaGround.cs | 2 +- NPCs/Astral/AstralachneaWall.cs | 2 +- NPCs/Astral/Atlas.cs | 2 +- NPCs/Astral/BigSightseer.cs | 2 +- NPCs/Astral/FusionFeeder.cs | 2 +- NPCs/Astral/Hadarian.cs | 2 +- NPCs/Astral/Hive.cs | 2 +- NPCs/Astral/Mantis.cs | 2 +- NPCs/Astral/Nova.cs | 2 +- NPCs/Astral/SmallSightseer.cs | 2 +- NPCs/Astral/StellarCulex.cs | 2 +- NPCs/AstrumAureus/AstrumAureus.cs | 2 +- NPCs/AstrumDeus/AstrumDeusProbe3.cs | 2 +- NPCs/BrimstoneElemental/Brimling.cs | 2 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 2 +- NPCs/Bumblebirb/Bumblefuck.cs | 3 +- NPCs/Calamitas/Calamitas.cs | 2 +- NPCs/Calamitas/CalamitasRun.cs | 2 +- NPCs/Calamitas/CalamitasRun2.cs | 4 +- NPCs/Calamitas/CalamitasRun3.cs | 4 +- NPCs/Calamitas/SoulSeeker.cs | 2 +- NPCs/CalamityAI.cs | 33 +- NPCs/CalamityGlobalNPC.cs | 375 ++++++++++-------- NPCs/Crags/DespairStone.cs | 2 +- NPCs/Crags/SoulSlurper.cs | 2 +- NPCs/Cryogen/Cryogen.cs | 2 +- NPCs/Cryogen/CryogenIce.cs | 2 +- NPCs/DesertScourge/DesertScourgeBody.cs | 2 +- NPCs/DesertScourge/DesertScourgeTail.cs | 2 +- NPCs/GreatSandShark/GreatSandShark.cs | 2 +- NPCs/Leviathan/Leviathan.cs | 2 +- NPCs/Leviathan/Siren.cs | 2 +- NPCs/Leviathan/SirenIce.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerBody.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 2 +- NPCs/NormalNPCs/ArmoredDiggerTail.cs | 2 +- NPCs/NormalNPCs/Cnidrion.cs | 100 ++--- NPCs/NormalNPCs/Cryon.cs | 2 +- NPCs/NormalNPCs/Horse.cs | 2 +- NPCs/NormalNPCs/MantisShrimp.cs | 2 +- NPCs/NormalNPCs/OverloadedSoldier.cs | 2 +- NPCs/NormalNPCs/PhantomDebris.cs | 2 +- NPCs/NormalNPCs/ProfanedEnergyBody.cs | 2 +- NPCs/NormalNPCs/SandTortoise.cs | 2 +- NPCs/NormalNPCs/ScornEater.cs | 2 +- NPCs/NormalNPCs/ShockstormShuttle.cs | 2 +- NPCs/NormalNPCs/ThiccWaifu.cs | 2 +- NPCs/OldDuke/OldDuke.cs | 4 +- .../PlaguebringerGoliath.cs | 6 +- .../PlaguebringerShade.cs | 2 +- NPCs/Polterghast/Polterghast.cs | 5 +- .../ProfanedGuardians/ProfanedGuardianBoss.cs | 2 +- .../ProfanedGuardianBoss2.cs | 2 +- .../ProfanedGuardianBoss3.cs | 2 +- NPCs/Providence/ProvSpawnDefense.cs | 6 +- NPCs/Providence/ProvSpawnHealer.cs | 6 +- NPCs/Providence/ProvSpawnOffense.cs | 6 +- NPCs/Providence/Providence.cs | 5 +- NPCs/Ravager/RavagerBody.cs | 2 +- NPCs/Ravager/RavagerClawLeft.cs | 2 +- NPCs/Ravager/RavagerClawRight.cs | 2 +- NPCs/Ravager/RavagerHead.cs | 2 +- NPCs/Ravager/RavagerLegLeft.cs | 2 +- NPCs/Ravager/RavagerLegRight.cs | 2 +- NPCs/StormWeaver/StasisProbe.cs | 2 +- NPCs/SulphurousSea/Gnasher.cs | 2 +- NPCs/SulphurousSea/Mauler.cs | 2 +- NPCs/SunkenSea/BlindedAngler.cs | 2 +- NPCs/SunkenSea/Clam.cs | 2 +- NPCs/SunkenSea/EutrophicRay.cs | 2 +- NPCs/SunkenSea/GiantClam.cs | 2 +- NPCs/SunkenSea/PrismTurtle.cs | 2 +- NPCs/SupremeCalamitas/SoulSeekerSupreme.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 5 +- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 9 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 9 +- NPCs/Yharon/Yharon.cs | 5 +- Utilities/CalamityUtils.cs | 37 +- 96 files changed, 413 insertions(+), 371 deletions(-) diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index f72e50ece4..a681d76e41 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -19,8 +19,6 @@ namespace CalamityMod.Items.DifficultyItems "Activates adrenaline. When adrenaline is maxed press B to activate adrenaline mode.\n" + "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + "All enemies drop 50% more cash.\n" + - "All enemies gain a new damage reduction stat, which can be reduced by applying various debuffs to them.\n" + - "The amount of this damage reduction stat varies based on enemy type.\n" + "Makes certain enemies immune to life steal and nerfs the effectiveness of life steal.\n" + "Increases enemy damage by 25% and spawn rates by 15%.\n" + "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index b6955e59e9..9d64cbbeaf 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Abyss npc.width = 80; npc.height = 40; npc.defense = 50; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.lifeMax = 10000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 5bd5615def..09ff55a9bb 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Abyss npc.width = 180; npc.height = 180; npc.defense = 50; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.lifeMax = 220000; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index bcf98857eb..0a043e6a15 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Abyss npc.width = 126; //36 npc.height = 76; //20 npc.defense = 300; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 160000; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index e62f67678b..87ff598a0d 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.damage = 120; npc.lifeMax = 5500; npc.defense = 45; diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 4ddb9baebd..64a564d31d 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { npc.lifeMax = 7000; - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 998805ac23..ed361355c4 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 130; npc.lifeMax = 5915; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.defense = 50; npc.aiStyle = aiType = -1; diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index fa9b875671..c1d60e6e58 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.AcidRain { npc.buffImmune[k] = true; } - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); npc.lavaImmune = false; npc.noGravity = false; npc.noTileCollide = false; diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 6dce668b5a..2a2d1b5c4b 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -29,14 +29,14 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 75; npc.lifeMax = 605; npc.defense = 15; - npc.Calamity().RevPlusDR(0.075f); + npc.DR_NERD(0.075f); if (CalamityWorld.downedPolterghast) { npc.damage = 150; npc.lifeMax = 4500; npc.defense = 65; - npc.Calamity().RevPlusDR(0.35f); + npc.DR_NERD(0.35f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 2b0665d63e..8adcdb1bef 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -39,13 +39,13 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 150; npc.lifeMax = 5001; npc.defense = 58; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); } else if (CalamityWorld.downedAquaticScourge) { npc.damage = 85; npc.lifeMax = 700; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 28ec6472ca..018bd4f27e 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 100; npc.lifeMax = 5000; npc.defense = 33; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); } npc.knockBackResist = 0f; diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 7c863b848b..5063cdb640 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -34,14 +34,14 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 66; npc.lifeMax = 850; npc.defense = 15; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); if (CalamityWorld.downedPolterghast) { npc.damage = 120; npc.lifeMax = 4900; npc.defense = 78; - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); } npc.knockBackResist = 0f; diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index f301459dfb..237bdcca83 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.width = 32; npc.height = 32; npc.defense = 20; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index ddc7788878..db1ce4db78 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.width = 32; npc.height = 32; npc.defense = 15; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 51cf177b30..31c51f86e8 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.width = 100; npc.height = 90; npc.defense = 10; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.aiStyle = -1; aiType = -1; npc.LifeMaxNERB(73000, 85000, 10000000); diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 5e138ab0dc..e391290aae 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.width = 30; npc.height = 50; npc.defense = 25; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index db1df80ed8..e27be4a2be 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Astral npc.height = 54; npc.aiStyle = 41; npc.defense = 14; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 300; npc.knockBackResist = 0.6f; npc.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index d8d5ef39ca..e6f1003bd7 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Astral npc.width = 30; //324 npc.height = 30; //216 npc.defense = 10; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 50; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index d8fb0fe039..3cea4ff667 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = 3; npc.damage = 55; npc.defense = 20; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 500; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.38f; diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 8431559a94..c3a3cb7d01 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = -1; npc.damage = 55; npc.defense = 20; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 500; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0f; diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 742571f908..3ce951f053 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs.Astral npc.height = 88; npc.damage = 70; npc.defense = 40; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 1200; npc.knockBackResist = 0.08f; npc.value = Item.buyPrice(0, 1, 0, 0); diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index fd595ec56f..5c6552fa6c 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Astral npc.height = 56; npc.damage = 50; npc.defense = 20; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 430; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 0d1a29c9aa..1e7216d85b 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = 103; npc.lifeMax = 400; npc.defense = 12; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.value = Item.buyPrice(0, 0, 20, 0); npc.knockBackResist = 0.8f; npc.behindTiles = true; diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 8359ba8dba..2cc7eb6e38 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = -1; npc.damage = 50; npc.defense = 8; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 330; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.75f; diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index d19fd83acd..c5566554ff 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = -1; npc.damage = 55; npc.defense = 15; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 470; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0f; diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index b779dbdc30..6a54edbd3c 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral npc.height = 58; npc.aiStyle = -1; npc.defense = 6; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 340; npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 07f67da582..2cd1f5bd17 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Astral npc.height = 50; npc.damage = 45; npc.defense = 15; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 230; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index 3235a53658..b16d5068ce 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Astral npc.height = 40; npc.damage = 38; npc.defense = 16; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 310; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index d4f8723145..d2dd20c242 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Astral npc.npcSlots = 0.5f; //needed? npc.damage = 55; npc.defense = 18; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.knockBackResist = 0.65f; npc.lifeMax = 210; npc.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 87350329db..060f4a97a5 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.width = 400; npc.height = 280; npc.defense = 50; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.LifeMaxNERB(96000, NPC.downedMoonlord ? 440000 : 122000, 8400000); // 30 seconds in boss rush npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index 85fb3a173b..eceae13038 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 30; npc.height = 30; npc.defense = 30; - npc.Calamity().RevPlusDR(0.2f); + npc.DR_NERD(0.2f); npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 6df0d07261..f3256cbe44 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.width = 60; npc.height = 60; npc.defense = 0; - npc.Calamity().RevPlusDR(normalDR); + npc.DR_NERD(normalDR); npc.lifeMax = 4000; npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 4590c6ea61..53fd072e5b 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.defense = 15; npc.value = Item.buyPrice(0, 12, 0, 0); npc.LifeMaxNERB(30000, 41000, 6500000); - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { npc.damage *= 3; diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 2f91ea7239..961b26103a 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -42,9 +42,8 @@ namespace CalamityMod.NPCs.Bumblebirb npc.width = 130; npc.height = 100; npc.defense = 40; + npc.DR_NERD(0.1f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.1f; - global.customDR = true; global.multDRReductions.Add(BuffID.Ichor, 0.88f); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); npc.LifeMaxNERB(227500, 252500, 3000000); diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index ced664f155..2c9a25d28b 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 15; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.value = 0f; npc.LifeMaxNERB(37500, 51750, 5200000); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index afae7d3bb0..1d1618fbdb 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 10; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.LifeMaxNERB(9000, 13200, 800000); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index b8c04bbdf6..b3f99c1857 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -28,8 +28,8 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 10; - npc.Calamity().RevPlusDR(0.15f); - npc.LifeMaxNERB(7500, 11025, 800000); + npc.DR_NERD(0.15f); + npc.LifeMaxNERB(7500, 11025, 800000); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { npc.damage *= 3; diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 174621b249..525a07add1 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -41,8 +41,8 @@ namespace CalamityMod.NPCs.Calamitas npc.height = 120; npc.defense = 25; npc.value = Item.buyPrice(0, 15, 0, 0); - npc.Calamity().RevPlusDR(0.15f); - npc.LifeMaxNERB(28125, 38812, 3900000); + npc.DR_NERD(0.15f); + npc.LifeMaxNERB(28125, 38812, 3900000); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { npc.damage *= 3; diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index 024128b3ef..feeae155ec 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Calamitas npc.canGhostHeal = false; npc.damage = 40; npc.defense = 10; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 2500; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 5ca417d5d1..d31d94e7a3 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2768,24 +2768,21 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[2] == splitAnimationTime) { - if (head) + if (Main.netMode != NetmodeID.MultiplayerClient && !doubleWormPhase) { - if (Main.netMode != NetmodeID.MultiplayerClient && !doubleWormPhase) - { - int npc2 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.npc[npc2].Calamity().newAI[0] = 1f; - int npc3 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.npc[npc3].Calamity().newAI[0] = 2f; - Main.npc[npc3].Calamity().newAI[3] = 600f; - } + int npc2 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[npc2].Calamity().newAI[0] = 1f; + int npc3 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Main.npc[npc3].Calamity().newAI[0] = 2f; + Main.npc[npc3].Calamity().newAI[3] = 600f; + } - for (int num957 = 0; num957 < Main.maxNPCs; num957++) + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].Calamity().newAI[0] == 0f || despawnRemainingWorm) { - if (Main.npc[num957].Calamity().newAI[0] == 0f || despawnRemainingWorm) - { - if (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) - Main.npc[num957].active = false; - } + if (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType()) + Main.npc[i].active = false; } } @@ -3213,10 +3210,10 @@ namespace CalamityMod.NPCs npc.localAI[0] += 1f; float shootProjectile = 600 / shootTime; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; if (!flyAtTarget) { - float timer = npc.ai[0] + 12f; - float divisor = timer + shootProjectile; if (npc.localAI[0] % divisor == 0f) { npc.TargetClosest(true); @@ -3253,7 +3250,7 @@ namespace CalamityMod.NPCs } else { - if (npc.localAI[0] % shootProjectile == 0f) + if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { int num945 = expertMode ? 45 : 60; int num946 = ModContent.ProjectileType(); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 77b674939e..295c7e1058 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -293,6 +293,19 @@ namespace CalamityMod.NPCs NPCType() }; + public static List PerforatorIDs = new List + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + public static List DesertScourgeIDs = new List { NPCType(), @@ -320,6 +333,27 @@ namespace CalamityMod.NPCs NPCType(), NPCType() }; + + public static List GrenadeResistIDs = new List + { + ProjectileID.Grenade, + ProjectileID.StickyGrenade, + ProjectileID.BouncyGrenade, + ProjectileID.Bomb, + ProjectileID.StickyBomb, + ProjectileID.BouncyBomb, + ProjectileID.Dynamite, + ProjectileID.StickyDynamite, + ProjectileID.BouncyDynamite, + ProjectileID.Explosives, + ProjectileID.ExplosiveBunny, + ProjectileID.PartyGirlGrenade, + ProjectileID.BombFish, + ProjectileID.Beenade, + ProjectileID.Bee, + ProjectileID.GiantBee + //ProjectileID.ScarabBomb + }; #endregion #region Instance Per Entity @@ -682,21 +716,18 @@ namespace CalamityMod.NPCs newAI[m] = 0f; } - // Apply DR to vanilla NPCs. No vanilla NPCs have DR except in Rev+. - // This also applies DR to other mods' NPCs who have set up their NPCs to have DR in Rev+. - if (CalamityWorld.revenge) - { - if (CalamityMod.DRValues.ContainsKey(npc.type)) - { - CalamityMod.DRValues.TryGetValue(npc.type, out float revDR); - DR = revDR; - } + // Apply DR to vanilla NPCs. + // This also applies DR to other mods' NPCs who have set up their NPCs to have DR. + if (CalamityMod.DRValues.ContainsKey(npc.type)) + { + CalamityMod.DRValues.TryGetValue(npc.type, out float newDR); + DR = newDR; + } - if (CalamityMod.bossKillTimes.ContainsKey(npc.type)) - { - CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); - KillTime = revKillTime; - } + if (CalamityMod.bossKillTimes.ContainsKey(npc.type)) + { + CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); + KillTime = revKillTime; } if (npc.boss && CalamityWorld.revenge) @@ -1012,17 +1043,6 @@ namespace CalamityMod.NPCs npc.canGhostHeal = false; } } - - /// - /// Sets the DR of this NPC only if Revengeance Mode is enabled. Otherwise sets DR to zero. - /// - /// The DR to set, assuming Rev+ difficulty. - /// Whether Revengeance Mode is currently enabled. - public bool RevPlusDR(float dr) - { - DR = CalamityWorld.revenge ? dr : 0f; - return CalamityWorld.revenge; - } #endregion #region Other Stat Changes @@ -3526,183 +3546,196 @@ namespace CalamityMod.NPCs } } - if (AstrumDeusIDs.Contains(npc.type)) + // Expert Mode resists, mostly worms + if (Main.expertMode) { - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) + if (AstrumDeusIDs.Contains(npc.type)) { - damage = (int)(damage * 0.1); + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)(damage * 0.1); + } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.2); + } + else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) + { + damage = (int)(damage * 0.4); + } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.5); + } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.6); + } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.85); + } } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.2); - } - else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) + else if (StormWeaverIDs.Contains(npc.type)) { - damage = (int)(damage * 0.4); + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + + if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.9); + } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + if (projectile.penetrate == -1) + projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; + damage = (int)(damage * 0.75); + } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.5); + } + else if (ProjectileID.Sets.StardustDragon[projectile.type]) + { + damage = (int)(damage * 0.1); + } } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (DestroyerIDs.Contains(npc.type)) + { + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.75); + } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.5); + } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.38); + } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.25); + } + } + else if (AquaticScourgeIDs.Contains(npc.type)) + { + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.9); + } + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.5); + } + else if (projectile.type == ProjectileType()) + { + if (projectile.penetrate == -1) + projectile.penetrate = 2; + damage = (int)(damage * 0.1); + } + } + else if (PerforatorIDs.Contains(npc.type)) + { + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + } + else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) + { + if (npc.type == NPCID.Creeper) + GrenadeResist(projectile, ref damage); + + PierceResistGlobal(projectile, ref damage); + + if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.7); + } + } + else if (DesertScourgeIDs.Contains(npc.type)) + { + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + } + } + + // Other projectile resists + if (npc.type == NPCType()) + { + if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.2); + } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.6); } - else if (projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { - damage = (int)(damage * 0.85); + damage = (int)(damage * 0.75); } - - if (projectile.penetrate == -1 && !projectile.minion) + else if (projectile.type == ProjectileID.LunarFlare) { - damage = (int)(damage * 0.2); - } - else if (projectile.penetrate > 1 && projectile.type != ProjectileType()) - { - damage /= projectile.penetrate; + damage = (int)(damage * 0.8); } } - else if (StormWeaverIDs.Contains(npc.type)) - { - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.9); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; - damage = (int)(damage * 0.75); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)(damage * 0.1); - } - - if (projectile.penetrate == -1 && !projectile.minion) - { - damage = (int)(damage * 0.2); - } - else if (projectile.penetrate > 1) - { - damage /= projectile.penetrate; - } - } - else if (DestroyerIDs.Contains(npc.type)) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - damage = (int)(damage * 0.5); - } - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.75); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.38); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.25); - } - } - else if (AquaticScourgeIDs.Contains(npc.type)) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - damage = (int)(damage * 0.5); - } - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.9); - } - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = 2; - damage = (int)(damage * 0.1); - } - } - else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) - { - if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) - { - damage = (int)(damage * 0.6); - } - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.7); - } - } - else if (DesertScourgeIDs.Contains(npc.type)) - { - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.7); - } - } - else if (npc.type == NPCType()) - { - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.2); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.6); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.75); - } - else if (projectile.type == ProjectileID.LunarFlare) - { - damage = (int)(damage * 0.8); - } - } else if (npc.type == NPCID.CultistBoss) { - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { damage = (int)(damage * 0.75); } } - else if (npc.type == NPCID.DukeFishron) + else if (npc.type == NPCID.DukeFishron) { - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { damage = (int)(damage * 1.35); } } - else if (npc.type == NPCType()) + else if (npc.type == NPCType()) { - if (projectile.type == ProjectileType()) - { + if (projectile.type == ProjectileType()) + { damage = (int)(damage * 1.5); } } } - #endregion - #region On Hit By Item - public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit) + private void GrenadeResist(Projectile projectile, ref int damage) + { + if (GrenadeResistIDs.Contains(projectile.type)) + damage = (int)(damage * 0.2); + } + + private void PierceResistGlobal(Projectile projectile, ref int damage) + { + if (projectile.minion) + return; + + if (projectile.penetrate == -1) + damage = (int)(damage * 0.5); + else if (projectile.penetrate > 1) + damage = (int)MathHelper.Clamp(damage * (float)Math.Pow(0.9, projectile.penetrate), damage * 0.5f, damage); + } + #endregion + + #region On Hit By Item + public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit) { if (player.Calamity().bloodflareSet) { diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 320c70dd31..35905612e1 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Crags npc.width = 72; //324 npc.height = 72; //216 npc.defense = 38; - npc.Calamity().RevPlusDR(0.35f); + npc.DR_NERD(0.35f); npc.lifeMax = 120; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index e8be1dc1c9..29c1c70e67 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Crags npc.width = 60; //324 npc.height = 40; //216 npc.defense = 40; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 60; npc.knockBackResist = 0.65f; npc.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index d404f67bf2..f717acd207 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Cryogen npc.width = 86; npc.height = 88; npc.defense = 12; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.LifeMaxNERB(17900, 26300, 3000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index d0f1d2fff8..94f11df12b 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Cryogen npc.damage = 50; npc.width = 190; npc.height = 190; - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 70287b8802..e20eb2e1ba 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; npc.height = 36; npc.defense = 6; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.LifeMaxNERB(2300, 2650, 16500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index e455f1ecdc..84063668b7 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; npc.height = 48; npc.defense = 9; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.LifeMaxNERB(2300, 2650, 16500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index bec5b5993c..2f9341f382 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.GreatSandShark npc.width = 300; npc.height = 120; npc.defense = 60; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.LifeMaxNERB(8000, 11000); npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 744d5cc708..3fd0f5cfe7 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 850; npc.height = 450; npc.defense = 40; - npc.Calamity().RevPlusDR(0.35f); + npc.DR_NERD(0.35f); npc.LifeMaxNERB(69000, 90700, 7000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 68f98a60ba..d04dc1678d 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 20; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.LifeMaxNERB(27400, 41600, 2600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index 46419e52c5..2237dcf9b5 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 10; - npc.Calamity().RevPlusDR(0.5f); + npc.DR_NERD(0.5f); npc.lifeMax = 650; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index bd17315df7..7fa78fa144 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 38; npc.height = 38; npc.defense = 30; - npc.Calamity().RevPlusDR(0.35f); + npc.DR_NERD(0.35f); npc.lifeMax = CalamityWorld.death ? 30000 : 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 0df0ae2e4f..1a9c9fcad1 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 54; npc.height = 54; npc.defense = 15; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = CalamityWorld.death ? 30000 : 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 48eb47a6f9..d2b51d0fc9 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 34; npc.height = 34; npc.defense = 45; - npc.Calamity().RevPlusDR(0.45f); + npc.DR_NERD(0.45f); npc.lifeMax = CalamityWorld.death ? 30000 : 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 2b75df0750..37a74c4614 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -26,7 +26,9 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 160; npc.height = 80; npc.defense = 6; - npc.Calamity().RevPlusDR(0.05f); + npc.noGravity = true; + npc.noTileCollide = true; + npc.DR_NERD(0.05f); npc.lifeMax = 400; npc.knockBackResist = 0.05f; aiType = -1; @@ -59,46 +61,44 @@ namespace CalamityMod.NPCs.NormalNPCs { Player player = Main.player[npc.target]; bool expertMode = Main.expertMode; - npc.noGravity = true; - npc.noTileCollide = true; npc.spriteDirection = (npc.direction > 0) ? 1 : -1; float num823 = 1f; npc.TargetClosest(true); bool flag51 = false; int offsetX = 80; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || (CalamityWorld.death && (double)npc.life < (double)npc.lifeMax * 0.6)) + if (npc.life < npc.lifeMax * 0.33 || (CalamityWorld.death && npc.life < npc.lifeMax * 0.6)) { num823 = 2f; } - if ((double)npc.life < (double)npc.lifeMax * 0.1) + if (npc.life < npc.lifeMax * 0.1) { num823 = 4f; } if (npc.ai[0] == 0f) { npc.ai[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || (CalamityWorld.death && (double)npc.life < (double)npc.lifeMax * 0.6)) + if (npc.life < npc.lifeMax * 0.33 || (CalamityWorld.death && npc.life < npc.lifeMax * 0.6)) { npc.ai[1] += 1f; } - if ((double)npc.life < (double)npc.lifeMax * 0.1) + if (npc.life < npc.lifeMax * 0.1) { npc.ai[1] += 1f; } if (npc.ai[1] >= 300f && Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[1] = 0f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) + if (npc.life < npc.lifeMax * 0.25) { - npc.ai[0] = (float)Main.rand.Next(3, 5); + npc.ai[0] = Main.rand.Next(3, 5); } - else if (CalamityWorld.death && (double)npc.life < (double)npc.lifeMax * 0.6) + else if (CalamityWorld.death && npc.life < npc.lifeMax * 0.6) { - npc.ai[0] = (float)Main.rand.Next(1, 5); + npc.ai[0] = Main.rand.Next(1, 5); } else { - npc.ai[0] = (float)Main.rand.Next(1, 3); + npc.ai[0] = Main.rand.Next(1, 3); } npc.netUpdate = true; } @@ -109,17 +109,17 @@ namespace CalamityMod.NPCs.NormalNPCs npc.ai[1] += 1f; if (npc.ai[1] % 30f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += offsetX * npc.direction; + float num829 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num831 = (float)Math.Sqrt(num829 * num829 + num830 * num830); float num832 = 6f; num831 = num832 / num831; num829 *= num831; num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; + num829 *= 1f + Main.rand.Next(-10, 11) * 0.01f; + num830 *= 1f + Main.rand.Next(-10, 11) * 0.01f; Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), expertMode ? 8 : 11, 0f, Main.myPlayer, 0f, 0f); } if (npc.ai[1] >= 120f) @@ -134,17 +134,17 @@ namespace CalamityMod.NPCs.NormalNPCs npc.ai[1] += 1f; if (npc.ai[1] > 60f && npc.ai[1] < 240f && npc.ai[1] % 16f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += offsetX * npc.direction; + float num829 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num831 = (float)Math.Sqrt(num829 * num829 + num830 * num830); float num832 = 8f; num831 = num832 / num831; num829 *= num831; num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-15, 16) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-15, 16) * 0.01f; + num829 *= 1f + Main.rand.Next(-15, 16) * 0.01f; + num830 *= 1f + Main.rand.Next(-15, 16) * 0.01f; Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), expertMode ? 9 : 12, 0f, Main.myPlayer, 0f, 0f); } if (npc.ai[1] >= 300f) @@ -159,17 +159,17 @@ namespace CalamityMod.NPCs.NormalNPCs npc.ai[1] += 1f; if (npc.ai[1] % 30f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num844 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += offsetX * npc.direction; + float num844 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; float num845 = Main.player[npc.target].position.Y - vector18.Y; - float num846 = (float)Math.Sqrt((double)(num844 * num844 + num845 * num845)); + float num846 = (float)Math.Sqrt(num844 * num844 + num845 * num845); float num847 = 10f; num846 = num847 / num846; num844 *= num846; num845 *= num846; - num844 *= 1f + (float)Main.rand.Next(-10, 11) * 0.001f; - num845 *= 1f + (float)Main.rand.Next(-10, 11) * 0.001f; + num844 *= 1f + Main.rand.Next(-10, 11) * 0.001f; + num845 *= 1f + Main.rand.Next(-10, 11) * 0.001f; int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, ModContent.ProjectileType(), expertMode ? 11 : 14, 0f, Main.myPlayer, 0f, 0f); } if (npc.ai[1] >= 120f) @@ -184,17 +184,17 @@ namespace CalamityMod.NPCs.NormalNPCs npc.ai[1] += 1f; if (npc.ai[1] % 20f == 0f) { - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 20f); - vector18.X += (float)(offsetX * npc.direction); - float num829 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector18.X; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + 20f); + vector18.X += offsetX * npc.direction; + float num829 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; float num830 = Main.player[npc.target].position.Y - vector18.Y; - float num831 = (float)Math.Sqrt((double)(num829 * num829 + num830 * num830)); + float num831 = (float)Math.Sqrt(num829 * num829 + num830 * num830); float num832 = 11f; num831 = num832 / num831; num829 *= num831; num830 *= num831; - num829 *= 1f + (float)Main.rand.Next(-5, 6) * 0.01f; - num830 *= 1f + (float)Main.rand.Next(-5, 6) * 0.01f; + num829 *= 1f + Main.rand.Next(-5, 6) * 0.01f; + num830 *= 1f + Main.rand.Next(-5, 6) * 0.01f; int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), expertMode ? 13 : 17, 0f, Main.myPlayer, 0f, 0f); } if (npc.ai[1] >= 240f) @@ -210,7 +210,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (flag51) { npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) { npc.velocity.X = 0f; } @@ -228,15 +228,15 @@ namespace CalamityMod.NPCs.NormalNPCs } int num854 = 80; int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width && npc.position.Y + npc.height < Main.player[npc.target].position.Y + Main.player[npc.target].height - 16f) { flag52 = true; } if (flag52) { - npc.velocity.Y = npc.velocity.Y + 0.5f; + npc.velocity.Y += 0.25f; } else if (Collision.SolidCollision(position2, num854, num855)) { @@ -244,17 +244,17 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.velocity.Y = 0f; } - if ((double)npc.velocity.Y > -0.2) + if (npc.velocity.Y > -0.2f) { - npc.velocity.Y = npc.velocity.Y - 0.025f; + npc.velocity.Y -= 0.025f; } else { - npc.velocity.Y = npc.velocity.Y - 0.2f; + npc.velocity.Y -= 0.2f; } - if (npc.velocity.Y < -4f) + if (npc.velocity.Y < -2f) { - npc.velocity.Y = -4f; + npc.velocity.Y = -2f; } } else @@ -263,18 +263,18 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.velocity.Y = 0f; } - if ((double)npc.velocity.Y < 0.1) + if (npc.velocity.Y < 0.1) { - npc.velocity.Y = npc.velocity.Y + 0.025f; + npc.velocity.Y += 0.025f; } else { - npc.velocity.Y = npc.velocity.Y + 0.5f; + npc.velocity.Y += 0.5f; } } - if (npc.velocity.Y > 10f) + if (npc.velocity.Y > 4f) { - npc.velocity.Y = 10f; + npc.velocity.Y = 4f; } } diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 29ccaebe17..1a31a56967 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 50; npc.height = 64; npc.defense = 10; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 300; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index a9b30b1ea8..2d08d1d703 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 230; npc.height = 230; npc.defense = 20; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 3800; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index a20513cfc0..37796796aa 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 40; npc.height = 24; npc.defense = 10; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 30; npc.aiStyle = 3; aiType = 67; diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index acf4b9cdb9..2653eca75d 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 18; npc.height = 40; npc.defense = 18; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = NPC.downedMoonlord ? 1800 : 135; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 2, 0); diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index e979d637b9..09743b48e9 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 44; npc.height = 22; npc.defense = 20; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = NPC.downedMoonlord ? 1600 : 120; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 4a67af7417..79c8c213ed 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 72; npc.height = 36; npc.defense = 50; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 6000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 776d409b8e..1f08cf8a7a 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 46; npc.height = 32; npc.defense = 30; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.scale = 1.5f; npc.lifeMax = 580; npc.knockBackResist = 0.2f; diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index b4493130b5..d5cd1f51e2 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 160; npc.height = 160; npc.defense = 38; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.lifeMax = 16000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 5390e4c091..48df531d90 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 64; npc.height = 38; npc.defense = 15; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 150; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 45de24678f..6eca11ab16 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 80; npc.height = 140; npc.defense = 18; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.lifeMax = 6000; if (CalamityWorld.downedProvidence) { diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index fbb66f2508..177ab2c180 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -40,9 +40,7 @@ namespace CalamityMod.NPCs.OldDuke aiType = -1; npc.damage = 200; npc.defense = 100; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.5f; - global.customDR = true; + npc.DR_NERD(0.5f, null, null, null, true); npc.lifeMax = CalamityWorld.revenge ? 1000000 : 750000; npc.knockBackResist = 0f; npc.noTileCollide = true; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 1643ca0bcd..b98b1d3f5d 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -52,10 +52,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = 198; npc.height = 198; npc.defense = 40; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.LifeMaxNERB(58500, 77275, 3700000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index 92932aeea9..2667b3c27b 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = 66; npc.height = 66; npc.defense = 30; - npc.Calamity().RevPlusDR(0.2f); + npc.DR_NERD(0.2f); npc.lifeMax = 3000; npc.value = Item.buyPrice(0, 1, 50, 0); if (CalamityWorld.bossRushActive) diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index cce3e2804b..3ac2b6384f 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -47,9 +47,8 @@ namespace CalamityMod.NPCs.Polterghast npc.width = 90; npc.height = 120; npc.defense = 90; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.15f; - global.customDR = true; + npc.DR_NERD(0.15f, null, null, null, true); + CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.Ichor, 0.88f); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); npc.LifeMaxNERB(412500, 495000, 3250000); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index cd992cd3c3..0922938200 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.width = 100; npc.height = 80; npc.defense = 50; - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); npc.LifeMaxNERB(102500, 112500, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index d0b31e0f7f..5f5f1215f8 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.width = 100; npc.height = 80; npc.defense = 50; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.LifeMaxNERB(40000, 50000, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index cb6eda06b1..ad91d73b1d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.width = 100; npc.height = 80; npc.defense = 35; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.LifeMaxNERB(25000, 35000, 200000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 17ef7c4a6f..03d02c235c 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -26,14 +26,14 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 50; - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { npc.lifeMax = 300000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index eb818524ce..a7271b8240 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -26,14 +26,14 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 35; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { npc.lifeMax = 400000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 9f6a2c4bd9..65f485cf55 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -29,14 +29,14 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 40; - npc.Calamity().RevPlusDR(0.3f); + npc.DR_NERD(0.3f); npc.lifeMax = 42500; if (CalamityWorld.bossRushActive) { npc.lifeMax = 400000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 747e5964f7..ed6732c7a8 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -64,9 +64,8 @@ namespace CalamityMod.NPCs.Providence npc.width = 600; npc.height = 450; npc.defense = 50; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = normalDR; - global.customDR = true; + npc.DR_NERD(normalDR, null, null, null, true); + CalamityGlobalNPC global = npc.Calamity(); global.flatDRReductions.Add(BuffID.Ichor, 0.05f); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); npc.LifeMaxNERB(440000, 500000, 12500000); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index a792aa4062..075451ed4e 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Ravager npc.height = 214; npc.defense = 55; npc.value = Item.buyPrice(0, 25, 0, 0); - npc.Calamity().RevPlusDR(0.4f); + npc.DR_NERD(0.4f); npc.LifeMaxNERB(42700, 53500, 4600000); if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) { diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 0954449eea..3f5b156737 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Ravager npc.width = 80; npc.height = 40; npc.defense = 40; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 6d505f3a11..4e714cdd55 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Ravager npc.width = 80; npc.height = 40; npc.defense = 40; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 96366209ce..3b59ad86a9 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Ravager npc.width = 80; npc.height = 80; npc.defense = 50; - npc.Calamity().RevPlusDR(0.1f); + npc.DR_NERD(0.1f); npc.lifeMax = 32705; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 66a47fa062..30943c5dd8 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Ravager npc.width = 60; npc.height = 60; npc.defense = 40; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 22010; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index ab6e021cae..981c543bde 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Ravager npc.width = 60; npc.height = 60; npc.defense = 40; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 22010; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index ba6b8f8bc8..1512bf4556 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.width = 30; npc.height = 30; npc.defense = 60; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.lifeMax = 1200; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 6e0e43ffbf..a540b0257b 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.SulphurousSea npc.width = 50; npc.height = 36; npc.defense = 30; - npc.Calamity().RevPlusDR(0.15f); + npc.DR_NERD(0.15f); npc.lifeMax = 35; npc.knockBackResist = 0.25f; npc.aiStyle = 3; diff --git a/NPCs/SulphurousSea/Mauler.cs b/NPCs/SulphurousSea/Mauler.cs index dc06a0cb05..023a4f0eec 100644 --- a/NPCs/SulphurousSea/Mauler.cs +++ b/NPCs/SulphurousSea/Mauler.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SulphurousSea npc.width = 180; npc.height = 90; npc.defense = 50; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.lifeMax = 165000; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index 2b6f1dff8c..660458a01d 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.SunkenSea npc.width = 56; npc.height = 44; npc.defense = 30; - npc.Calamity().RevPlusDR(0.2f); + npc.DR_NERD(0.2f); npc.lifeMax = 750; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 41f205a3d5..6a8fa5d317 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.SunkenSea npc.width = 56; npc.height = 38; npc.defense = 9999; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) { diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 05e024bc22..015a2dfb45 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.SunkenSea npc.width = 116; npc.height = 36; npc.defense = Main.hardMode ? 15 : 5; - npc.Calamity().RevPlusDR(0.05f); + npc.DR_NERD(0.05f); npc.lifeMax = Main.hardMode ? 500 : 150; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index af0cbde325..c2d3aa4716 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.SunkenSea npc.width = 160; npc.height = 120; npc.defense = 9999; - npc.Calamity().RevPlusDR(0.3f); + npc.DR_NERD(0.3f); npc.lifeMax = Main.hardMode ? 7500 : 1250; npc.buffImmune[ModContent.BuffType()] = false; npc.aiStyle = -1; diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index 61658caa30..0f1d7f69f8 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.SunkenSea npc.width = 72; npc.height = 58; npc.defense = Main.hardMode ? 25 : 10; - npc.Calamity().RevPlusDR(0.25f); + npc.DR_NERD(0.25f); npc.lifeMax = Main.hardMode ? 1000 : 350; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 6449c2b6e9..f9952ccbd7 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.canGhostHeal = false; npc.damage = 0; npc.defense = 80; - npc.Calamity().RevPlusDR(0.35f); + npc.DR_NERD(0.35f); npc.LifeMaxNERB(Main.expertMode ? 90000 : 50000, 170000); for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index b476a96e5b..f0ae6eb060 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -89,9 +89,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 120; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = CalamityWorld.bossRushActive ? bossRushDR : CalamityWorld.death ? deathDR : normalDR; - global.customDR = true; + npc.DR_NERD(normalDR, normalDR, deathDR, bossRushDR, true); + CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.Ichor, 0.9f); global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.value = Item.buyPrice(10, 0, 0, 0); diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index c964458d12..5092594133 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -31,14 +31,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 100; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; - global.customDR = true; + npc.DR_NERD(0.7f, 0.7f, 0.75f, 0.6f, true); + CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.Ichor, 0.9f); global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.LifeMaxNERB(1200000, 1500000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index c20411bdd7..c8678af304 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -31,14 +31,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 100; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; - global.customDR = true; + npc.DR_NERD(0.7f, 0.7f, 0.75f, 0.6f, true); + CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.Ichor, 0.9f); global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.LifeMaxNERB(1200000, 1500000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 0e62462c48..834552a393 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -82,9 +82,8 @@ namespace CalamityMod.NPCs.Yharon npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = Phase1_DR; - global.customDR = true; + npc.DR_NERD(Phase1_DR, null, null, null, true); + CalamityGlobalNPC global = npc.Calamity(); global.flatDRReductions.Add(BuffID.Ichor, 0.05f); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 92658a75e7..6d0668e0c0 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -142,13 +142,36 @@ namespace CalamityMod npc.lifeMax = revengeance.Value; } } - /// - /// Detects nearby hostile NPCs from a given point - /// - /// The position where we wish to check for nearby NPCs - /// Maximum amount of pixels to check around the origin - /// Whether bosses should be prioritized in targetting or not - public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool bossPriority = false) + /// + /// Allows you to set the DR value of a NPC to different values based on the mode. + /// + /// The NPC whose DR value you are trying to set. + /// The value DR will be set to in normal mode. + /// The value DR will be set to in Revegeneance mode. + /// The value DR will be set to during the Boss Rush. + public static void DR_NERD(this NPC npc, float normal, float? revengeance = null, float? death = null, float? bossRush = null, bool? customDR = null) + { + npc.Calamity().DR = normal; + + if (bossRush.HasValue && CalamityWorld.bossRushActive) + { + npc.Calamity().DR = bossRush.Value; + } + else if (revengeance.HasValue && CalamityWorld.revenge) + { + npc.Calamity().DR = CalamityWorld.death ? death.Value : revengeance.Value; + } + + if (customDR.HasValue) + npc.Calamity().customDR = true; + } + /// + /// Detects nearby hostile NPCs from a given point + /// + /// The position where we wish to check for nearby NPCs + /// Maximum amount of pixels to check around the origin + /// Whether bosses should be prioritized in targetting or not + public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool bossPriority = false) { NPC closestTarget = null; float distance = maxDistanceToCheck; From 71dfde16d34daa063e0aedf10b028efe4f23d580 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 2 Jun 2020 23:40:25 -0400 Subject: [PATCH 35/41] using directives :godflushed: --- Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs | 2 ++ Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs | 2 ++ Tiles/LivingFire/LivingHolyFireBlockTile.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index 74118d3786..f62f4cc6de 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -1,6 +1,8 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.LivingFire; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.Enums; diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index 6ca183c3fa..3f452f7b01 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -1,6 +1,8 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.LivingFire; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.Enums; diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index b8e74a4553..f49be7de88 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -1,6 +1,8 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.LivingFire; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.Enums; From 36e3dbc930571018ae366597a5f18d7391d7f107 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 2 Jun 2020 23:47:06 -0400 Subject: [PATCH 36/41] improved some magic bullet code and added whispering death debuff --- Projectiles/Summon/MagicBullet.cs | 93 +++++++++++++++++-------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs index 1864b8cf33..5e92de59ea 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -6,52 +6,59 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class MagicBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.light = 0.5f; - projectile.alpha = 255; - projectile.extraUpdates = 7; - projectile.scale = 1.18f; - projectile.friendly = true; - projectile.minion = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.penetrate = 1; - projectile.timeLeft = 600; + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 7; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.minion = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = ProjectileID.BulletHighVelocity; + projectile.penetrate = 1; + projectile.timeLeft = 600; projectile.tileCollide = false; - } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.BetsysCurse, 180); - target.AddBuff(BuffID.Ichor, 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.betsysCurse) + target.AddBuff(BuffID.BetsysCurse, 180); + if (!target.ichor) + target.AddBuff(BuffID.Ichor, 180); + if (target.Calamity().marked <= 0) + target.AddBuff(ModContent.BuffType(), 180); + if (target.Calamity().aCrunch <= 0) + target.AddBuff(ModContent.BuffType(), 180); + if (target.Calamity().wCleave <= 0) + target.AddBuff(ModContent.BuffType(), 180); + if (target.Calamity().wDeath <= 0) + target.AddBuff(ModContent.BuffType(), 180); + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.BetsysCurse, 180); - target.AddBuff(BuffID.Ichor, 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(189, 51, 164, projectile.alpha); - } - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(189, 51, 164, projectile.alpha); + } + } } From 79de5884258c35866795bc3a0f57f7641d426cf0 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 3 Jun 2020 11:04:47 -0400 Subject: [PATCH 37/41] living fire blocks now check for other living fire blocks --- CalamityMod.cs | 16 ++++++++++++++++ Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs | 2 +- Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs | 2 +- Tiles/LivingFire/LivingHolyFireBlockTile.cs | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 85b15eaeb6..f5da20e3ad 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -66,6 +66,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.LivingFire; using CalamityMod.Skies; using CalamityMod.UI; using CalamityMod.World; @@ -194,6 +195,7 @@ namespace CalamityMod public static List highTestFishList; public static List flamethrowerList; public static List forceItemList; + public static List livingFireBlockList; public static List zombieList; public static List demonEyeList; @@ -417,6 +419,7 @@ namespace CalamityMod highTestFishList = null; flamethrowerList = null; forceItemList = null; + livingFireBlockList = null; zombieList = null; demonEyeList = null; @@ -2346,6 +2349,19 @@ namespace CalamityMod ItemID.SuperHealingPotion }; + livingFireBlockList = new List() + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + TileID.LivingFire, + TileID.LivingCursedFire, + TileID.LivingDemonFire, + TileID.LivingFrostFire, + TileID.LivingIchor, + TileID.LivingUltrabrightFire + }; + zombieList = new List() { NPCID.Zombie, diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index f62f4cc6de..e7a37e66cc 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.LivingFire for (int k = 0; k < around.Count; ++k) { Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.active() && (Main.tileSolid[tile.type] || tile.type == Type)) + if (tile.active() && (Main.tileSolid[tile.type] || CalamityMod.livingFireBlockList.Contains(tile.type))) { return true; } diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index 3f452f7b01..039532b093 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.LivingFire for (int k = 0; k < around.Count; ++k) { Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.active() && (Main.tileSolid[tile.type] || tile.type == Type)) + if (tile.active() && (Main.tileSolid[tile.type] || CalamityMod.livingFireBlockList.Contains(tile.type))) { return true; } diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index f49be7de88..6d334a5e41 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.LivingFire for (int k = 0; k < around.Count; ++k) { Tile tile = Main.tile[around[k][0], around[k][1]]; - if (tile.active() && (Main.tileSolid[tile.type] || tile.type == Type)) + if (tile.active() && (Main.tileSolid[tile.type] || CalamityMod.livingFireBlockList.Contains(tile.type))) { return true; } From 83917e6fb44d23630538ee85a7771202a3c3f915 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 3 Jun 2020 14:28:20 -0400 Subject: [PATCH 38/41] added a holdoutoffset to Opal Striker --- Items/Weapons/Ranged/OpalStriker.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 2334271703..0ff489c56b 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -35,9 +35,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 97; } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } From 560dfc9f7aa0fe302ec1131d2aee222c763cc49e Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 3 Jun 2020 14:28:44 -0400 Subject: [PATCH 39/41] spacing stuff --- Items/Weapons/Ranged/OpalStriker.cs | 90 ++++++++++++++--------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 0ff489c56b..e02eeb06e3 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -6,53 +6,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class OpalStriker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Opal Striker"); - Tooltip.SetDefault("Fires a string of opal strikes"); - } + public class OpalStriker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Opal Striker"); + Tooltip.SetDefault("Fires a string of opal strikes"); + } - public override void SetDefaults() - { - item.damage = 9; - item.ranged = true; - item.width = 64; - item.height = 16; - item.useTime = 5; - item.reuseDelay = 25; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 0f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; - item.useAmmo = 97; - } + public override void SetDefaults() + { + item.damage = 9; + item.ranged = true; + item.width = 64; + item.height = 16; + item.useTime = 5; + item.reuseDelay = 25; + item.useAnimation = 20; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike"); + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 6f; + item.useAmmo = 97; + } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Marble, 20); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.Diamond, 3); - recipe.AddIngredient(ItemID.FlintlockPistol); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Marble, 20); + recipe.AddIngredient(ItemID.Amber, 5); + recipe.AddIngredient(ItemID.Diamond, 3); + recipe.AddIngredient(ItemID.FlintlockPistol); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } From 91e07c0532703a68065d08dfeda5147b457d39bb Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 3 Jun 2020 14:42:16 -0400 Subject: [PATCH 40/41] vivid tweaks --- Items/Weapons/Magic/VividClarity.cs | 33 ++++++++++++++--------------- Projectiles/Magic/VividBeam.cs | 31 +++++++++++++-------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index add2d994d1..e3d625197c 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -50,29 +50,28 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; - float value12 = 20f; - float value13 = 60f; - Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float speed = item.shootSpeed; + float xPos = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; + float yPos = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; + float f = Main.rand.NextFloat() * MathHelper.TwoPi; + float sourceVariationLow = 20f; + float sourceVariationHigh = 60f; + Vector2 source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(sourceVariationLow, sourceVariationHigh, Main.rand.NextFloat()); for (int num202 = 0; num202 < 50; num202++) { - vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) + source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(sourceVariationLow, sourceVariationHigh, Main.rand.NextFloat()); + if (Collision.CanHit(playerPos, 0, 0, source + (source - playerPos).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) { break; } - f = Main.rand.NextFloat() * 6.28318548f; + f = Main.rand.NextFloat() * MathHelper.TwoPi; } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 vector14 = mouseWorld - vector13; - Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; - vector14 = vector14.SafeNormalize(vector15) * num72; - vector14 = Vector2.Lerp(vector14, vector15, 0.25f); - Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); + Vector2 velocity = Main.MouseWorld - source; + Vector2 velocityVariation = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitY) * speed; + velocity = velocity.SafeNormalize(velocityVariation) * speed; + velocity = Vector2.Lerp(velocity, velocityVariation, 0.25f); + Projectile.NewProjectile(source, velocity, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); return false; } diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 1bba3fbf3a..834975c128 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -113,28 +113,27 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.ai[1] == 0f) { - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - float num17 = 6f; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + float xStart = projectile.position.X + (float)Main.rand.Next(-400, 400); + float yStart = projectile.position.Y - (float)Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float speed = 6f; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + int num19 = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[num19].ai[1] = projectile.position.Y; } if (projectile.ai[1] == 1f) { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f); + int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[boom].Calamity().forceMagic = true; } if (projectile.ai[1] == 2f) { - float spread = 30f * 0.0174f; + float spread = 30f * 0.01f * MathHelper.PiOver2; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; @@ -143,8 +142,8 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } From 01426576e1359551ab4e3a94d406aefa517317ce Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Wed, 3 Jun 2020 21:23:35 -0400 Subject: [PATCH 41/41] Removed two unnecessary minion anti-clump calls --- Projectiles/Summon/CosmicEnergySpiral.cs | 1 - Projectiles/Summon/HowlsHeartHowl.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index 76f7785437..64fe2da558 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -70,7 +70,6 @@ namespace CalamityMod.Projectiles.Summon float num634 = 1600f; //800 float num635 = 2400f; //1200 float num636 = 800f; - projectile.MinionAntiClump(); projectile.rotation += projectile.velocity.X * 0.1f; Vector2 vector46 = projectile.position; bool flag25 = false; diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index 9e7d20481d..caf409d2de 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -85,7 +85,6 @@ namespace CalamityMod.Projectiles.Summon } //Anti sticky movement although there should only be one - projectile.MinionAntiClump(); //Set tile collision for only when trying to return to the player projectile.tileCollide = projectile.ai[0] != 1f;