diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 43525deca8..b8ea136de2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -482,6 +482,7 @@ namespace CalamityMod.CalPlayer public bool reaverSpore = false; public bool reaverDoubleTap = false; public bool flamethrowerBoost = false; + public bool hoverboardBoost = false; //hoverboard + shroomite visage public bool shadeRegen = false; public bool shadowSpeed = false; public bool dsSetBonus = false; @@ -1091,6 +1092,7 @@ namespace CalamityMod.CalPlayer shadeRegen = false; flamethrowerBoost = false; + hoverboardBoost = false; //hoverboard + shroomite visage shadowSpeed = false; dsSetBonus = false; @@ -1711,6 +1713,7 @@ namespace CalamityMod.CalPlayer #region Armorbonuses flamethrowerBoost = false; + hoverboardBoost = false; //hoverboard + shroomite visage shadowSpeed = false; godSlayer = false; godSlayerDamage = false; @@ -3417,7 +3420,7 @@ namespace CalamityMod.CalPlayer } if (flamethrowerBoost && item.ranged && (item.useAmmo == 23 || item.type == ModContent.ItemType())) { - add += 0.25f; + add += hoverboardBoost ? 0.35f : 0.25f; } if (cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c21bd0a59f..c163c8913f 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -418,7 +418,15 @@ namespace CalamityMod.CalPlayer double playerUndergroundDepth = point.Y - Main.worldSurface; double depthRatio = playerUndergroundDepth / totalUndergroundDepth; int lightStrength = modPlayer.GetTotalLightStrength(); - float darknessStrength = (float)depthRatio; + + // In the last 50 blocks before hell, the darkness smoothly fades away. + float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); + float darknessStrength = (float)(depthRatio / FadeAwayStart); + if (depthRatio > FadeAwayStart) + { + // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. + darknessStrength = (1f - (float)depthRatio) / (1f - FadeAwayStart); + } // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. switch (lightStrength) @@ -2459,7 +2467,7 @@ namespace CalamityMod.CalPlayer } if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.inventory[player.selectedItem].type)) - player.AddBuff(165, 5, true); // Dryad's Blessing + player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing if (modPlayer.ZoneAbyss) { diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs new file mode 100644 index 0000000000..c1f2a160e7 --- /dev/null +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class AncientGodSlayerChestplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient God Slayer Chestplate"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.Calamity().customRarity = (CalamityRarity)14; + item.vanity = true; + item.value = Item.buyPrice(0, 60, 0, 0); + } + } +} diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.png b/Items/Armor/Vanity/AncientGodSlayerChestplate.png new file mode 100644 index 0000000000..c7da0556f9 Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerChestplate.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate_Arms.png b/Items/Armor/Vanity/AncientGodSlayerChestplate_Arms.png new file mode 100644 index 0000000000..3b67923316 Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerChestplate_Arms.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate_Body.png b/Items/Armor/Vanity/AncientGodSlayerChestplate_Body.png new file mode 100644 index 0000000000..34caebddaa Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerChestplate_Body.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate_FemaleBody.png b/Items/Armor/Vanity/AncientGodSlayerChestplate_FemaleBody.png new file mode 100644 index 0000000000..7992b4d30a Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerChestplate_FemaleBody.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs new file mode 100644 index 0000000000..a88e439438 --- /dev/null +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class AncientGodSlayerHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient God Slayer Helm"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.Calamity().customRarity = (CalamityRarity)14; + item.value = Item.buyPrice(0, 75, 0, 0); + item.vanity = true; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.png b/Items/Armor/Vanity/AncientGodSlayerHelm.png new file mode 100644 index 0000000000..95687a9e9a Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerHelm.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm_Head.png b/Items/Armor/Vanity/AncientGodSlayerHelm_Head.png new file mode 100644 index 0000000000..2c96461a7c Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerHelm_Head.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs new file mode 100644 index 0000000000..7058688781 --- /dev/null +++ b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class AncientGodSlayerLeggings : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient God Slayer Leggings"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.Calamity().customRarity = (CalamityRarity)14; + item.value = Item.buyPrice(0, 45, 0, 0); + item.vanity = true; + } + } +} diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.png b/Items/Armor/Vanity/AncientGodSlayerLeggings.png new file mode 100644 index 0000000000..87be871e83 Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerLeggings.png differ diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings_Legs.png b/Items/Armor/Vanity/AncientGodSlayerLeggings_Legs.png new file mode 100644 index 0000000000..cd7b2c6db3 Binary files /dev/null and b/Items/Armor/Vanity/AncientGodSlayerLeggings_Legs.png differ diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index 93531458f1..50a02d3f2e 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -34,14 +34,14 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and rogue damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 90\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; - modPlayer.rogueStealthMax += 1f; + modPlayer.rogueStealthMax += 0.9f; modPlayer.wearingRogueArmor = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 1c2c1897de..705e2cf3e6 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1424,7 +1424,9 @@ Provides heat and cold protection in Death Mode"; "Horizontal speed: 6.75\n" + "Acceleration multiplier: 1\n" + "Average vertical speed\n" + - "Flight time: 160"; + "Flight time: 160\n" + + "+10 defense, 10% increased damage reduction,\n" + + "and the Dryad's permanent blessing while wearing the Tiki Armor"; } } } @@ -1488,7 +1490,7 @@ Provides heat and cold protection in Death Mode"; "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 180\n" + - "+1 max minion and 10% increased minion damage while wearing the Spooky Armor"; + "+1 max minion and 5% increased minion damage while wearing the Spooky Armor"; } } } @@ -1499,10 +1501,13 @@ Provides heat and cold protection in Death Mode"; if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6.25\n" + "Acceleration multiplier: 1\n" + "Average vertical speed\n" + - "Flight time: 170"; + "Flight time: 170\n" + + "10% increased damage to bows, guns, rocket launchers, and flamethrowers while wearing the Shroomite Armor\n" + + "Boosted weapon type depends on the Shroomite Helmet worn"; } } } @@ -1576,6 +1581,7 @@ Provides heat and cold protection in Death Mode"; if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6.5\n" + "Acceleration multiplier: 1.5\n" + "Good vertical speed\n" + @@ -1592,6 +1598,7 @@ Provides heat and cold protection in Death Mode"; if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6.5\n" + "Acceleration multiplier: 1.5\n" + "Good vertical speed\n" + @@ -1609,6 +1616,7 @@ Provides heat and cold protection in Death Mode"; { line2.text = "Equipable\n" + "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6\n" + "Acceleration multiplier: 2.5\n" + "Good vertical speed\n" + @@ -2279,12 +2287,12 @@ Provides heat and cold protection in Death Mode"; #region Head if (item.type == ItemID.SpectreHood) player.magicDamage += 0.2f; - else if (item.type == (ItemID.GladiatorHelmet | ItemID.ObsidianHelm)) + else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) player.Calamity().throwingDamage += 0.03f; #endregion #region Body - if (item.type == (ItemID.GladiatorBreastplate | ItemID.ObsidianShirt)) + if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) player.Calamity().throwingCrit += 3; else if (item.type == ItemID.PalladiumBreastplate) player.Calamity().throwingCrit += 2; @@ -2303,7 +2311,7 @@ Provides heat and cold protection in Death Mode"; #endregion #region Legs - if (item.type == (ItemID.GladiatorLeggings | ItemID.ObsidianPants)) + if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) player.Calamity().throwingVelocity += 0.03f; else if (item.type == ItemID.PalladiumLeggings) player.Calamity().throwingCrit += 1; @@ -2465,6 +2473,39 @@ Provides heat and cold protection in Death Mode"; } } } + else if (item.type == ItemID.Hoverboard) // Boosted ranged stats while wearing shroomite armor + { + player.noFallDmg = true; + if (player.body == ArmorIDs.Body.ShroomiteBreastplate && player.legs == ArmorIDs.Legs.ShroomiteLeggings) + { + if (player.head == ArmorIDs.Head.ShroomiteHeadgear) //arrows + { + player.arrowDamage += 0.05f; + } + else if (player.head == ArmorIDs.Head.ShroomiteMask) //bullets + { + player.bulletDamage += 0.05f; + } + else if (player.head == ArmorIDs.Head.ShroomiteHelmet) //rockets + { + player.rocketDamage += 0.05f; + } + else if (player.Calamity().flamethrowerBoost) //flamethrowers + { + player.Calamity().hoverboardBoost = true; + } + } + } + else if (item.type == ItemID.LeafWings) // Bonus to defensive stats while wearing tiki armor + { + player.noFallDmg = true; + if (player.head == ArmorIDs.Head.TikiMask && player.body == ArmorIDs.Body.TikiShirt && player.legs == ArmorIDs.Legs.TikiPants) + { + player.statDefense += 10; + player.endurance += 0.1f; + player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing + } + } else if (item.type == ItemID.FestiveWings) // Drop powerful homing christmas tree bulbs while in flight { player.noFallDmg = true; @@ -2476,7 +2517,7 @@ Provides heat and cold protection in Death Mode"; if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) { player.maxMinions++; - player.minionDamage += 0.1f; + player.minionDamage += 0.05f; } } else if (item.type == ItemID.TatteredFairyWings) @@ -2531,9 +2572,11 @@ Provides heat and cold protection in Death Mode"; player.minionDamage += 0.05f; } } - else if (item.type == (ItemID.FishronWings | ItemID.BetsyWings | ItemID.Yoraiz0rWings | ItemID.JimsWings | ItemID.SkiphsWings | - ItemID.LokisWings | ItemID.ArkhalisWings | ItemID.LeinforsWings | ItemID.BejeweledValkyrieWing | ItemID.RedsWings | ItemID.DTownsWings | - ItemID.WillsWings | ItemID.CrownosWings | ItemID.CenxsWings | ItemID.Hoverboard | ItemID.LeafWings)) + else if (item.type == ItemID.FishronWings || item.type == ItemID.BetsyWings || item.type == ItemID.Yoraiz0rWings || + item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || item.type == ItemID.LokisWings || + item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || item.type == ItemID.BejeweledValkyrieWing || + item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || item.type == ItemID.WillsWings || + item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) { player.noFallDmg = true; } diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index cd84a9747a..0d192ab7ec 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 21; + item.damage = 28; item.noMelee = true; item.magic = true; item.channel = true; item.width = 86; item.height = 32; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 19; + item.useAnimation = 19; item.UseSound = SoundID.Item13; item.useStyle = 5; item.mana = 10; diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index 1a4ba247c4..0e77c061bf 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Magic value9 -= vector7; } Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); - int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, 440, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[laser].timeLeft = 120; Main.projectile[laser].tileCollide = false; } diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genisis.cs index 16c7e991e4..4e3358bc7b 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genisis.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 65; + item.damage = 55; item.magic = true; item.mana = 4; item.width = 74; item.height = 28; - item.useTime = 3; - item.useAnimation = 3; + item.useTime = 4; + item.useAnimation = 4; item.useStyle = 5; item.noMelee = true; item.knockBack = 1.5f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic item.autoReuse = true; item.shootSpeed = 6f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().customRarity = CalamityRarity.Turquoise; //12 } public override Vector2? HoldoutOffset() @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; for (int index = 0; index < num6; ++index) { - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, 440, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, ProjectileID.LaserMachinegunLaser, (int)((double)damage * 0.65), knockBack * 0.6f, player.whoAmI, 0f, 0f); Main.projectile[projectile].timeLeft = 120; } return false; diff --git a/Items/Weapons/Magic/MagnaCannon.cs b/Items/Weapons/Magic/MagnaCannon.cs index e95d0c25d1..2c2865967f 100644 --- a/Items/Weapons/Magic/MagnaCannon.cs +++ b/Items/Weapons/Magic/MagnaCannon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 19; + item.damage = 16; item.magic = true; item.mana = 12; item.width = 56; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic { for (int index = 0; index < 3; ++index) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(double)damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index ea52e1d093..3da96ef656 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 17; + item.damage = 22; item.magic = true; item.mana = 7; item.width = 28; item.height = 30; - item.useTime = 13; - item.useAnimation = 13; + item.useTime = 12; + item.useAnimation = 12; item.useStyle = 5; item.noMelee = true; item.knockBack = 5; diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index f451606dfd..6f8066883e 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 74; - item.damage = 470; + item.damage = 520; item.melee = true; item.useAnimation = 20; item.useTime = 20; diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index bab1525b74..65456aa44e 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 12; + item.damage = 11; item.ranged = true; item.width = 62; item.height = 26; item.crit += 6; - item.useTime = 25; - item.useAnimation = 25; + item.useTime = 26; + item.useAnimation = 26; item.useStyle = 5; item.noMelee = true; item.knockBack = 5.5f; diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 8267315809..5330a5f4bd 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 30; item.height = 44; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 25; + item.useAnimation = 25; item.useStyle = 5; item.noMelee = true; item.knockBack = 2f; diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index ee010d0502..e0b2e0c08c 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1280; + item.damage = 1000; item.knockBack = 15f; item.shootSpeed = 30f; item.useStyle = 5; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.channel = true; item.useTurn = false; - item.useAmmo = 75; + item.useAmmo = AmmoID.FallenStar; item.autoReuse = true; item.Calamity().customRarity = CalamityRarity.RareVariant; } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index b4284b5287..a44e6dca1b 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 9; + item.damage = 8; item.ranged = true; item.width = 50; item.height = 28; - item.useTime = 9; - item.useAnimation = 9; + item.useTime = 10; + item.useAnimation = 10; item.useStyle = 5; item.noMelee = true; item.knockBack = 1.25f; @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - item.useTime = 9; - item.useAnimation = 9; + item.useTime = 10; + item.useAnimation = 10; item.shootSpeed = 11f; } return base.CanUseItem(player); diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 2828158778..bff89b53bd 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 240; item.ranged = true; item.width = 74; item.height = 34; - item.crit += 16; + item.crit += 15; item.useTime = 2; item.useAnimation = 2; item.useStyle = 5; diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index af9f165277..d1c96c3770 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 14; + item.damage = 11; item.ranged = true; item.width = 22; item.height = 46; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)((double)damage * 0.4), 0f, player.whoAmI, 0f, 0f); return true; } diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index e00d679049..cfa9d84948 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 308; + item.damage = 291; item.knockBack = 15f; item.shootSpeed = 16f; item.useStyle = 5; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.channel = true; item.useTurn = false; - item.useAmmo = 75; + item.useAmmo = AmmoID.FallenStar; item.autoReuse = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index ee0a5f47b7..ae752a3fb3 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -18,13 +18,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 3000; - item.crit += 10; + item.damage = 2750; + item.crit += 9; item.ranged = true; item.width = 96; item.height = 40; - item.useTime = 50; - item.useAnimation = 50; + item.useTime = 51; + item.useAnimation = 51; item.useStyle = 5; item.noMelee = true; item.knockBack = 7.5f; diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index 8fca139416..cfc0d8be80 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 38; item.height = 34; - item.damage = 165; + item.damage = 145; item.crit += 20; item.noMelee = true; item.noUseGraphic = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Rogue/IchorSpear.png b/Items/Weapons/Rogue/IchorSpear.png index 6c8e3be05f..e564266e89 100644 Binary files a/Items/Weapons/Rogue/IchorSpear.png and b/Items/Weapons/Rogue/IchorSpear.png differ diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index bdd5e761b4..a51080fc3b 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -20,12 +20,12 @@ Stealth strikes are faster and explode into 5 bubbles"); { item.width = 26; item.height = 44; - item.damage = 16; + item.damage = 12; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 22; + item.useAnimation = 25; item.useStyle = 1; - item.useTime = 22; + item.useTime = 25; item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 74936e834e..0fa08a28e6 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -102,6 +102,12 @@ namespace CalamityMod.NPCs.CeaselessVoid // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } // Other bool lastSentinelKilled = !CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 3104d9ec74..96683ae9ce 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -757,6 +757,12 @@ namespace CalamityMod.NPCs.Signus // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } // Other bool lastSentinelKilled = CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && !CalamityWorld.downedSentinel3; diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 44261b12fd..e0dc7a035d 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -624,6 +624,12 @@ namespace CalamityMod.NPCs.StormWeaver // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } // Other bool lastSentinelKilled = CalamityWorld.downedSentinel1 && !CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 7d584fd0c2..891ad1a274 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2002,7 +2002,7 @@ namespace CalamityMod.Projectiles float maxDistance = distanceRequired; bool homeIn = false; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -2038,7 +2038,7 @@ namespace CalamityMod.Projectiles int[] targetArray = new int[maxTargets]; int targetArrayIndex = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Magic/ApothChloro.cs b/Projectiles/Magic/ApothChloro.cs index 9b0d7d14d0..7a7a88882a 100644 --- a/Projectiles/Magic/ApothChloro.cs +++ b/Projectiles/Magic/ApothChloro.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * 9.0); float num3 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); float num4 = projectile.localAI[0]; - if ((double)num4 == 0.0) + if (num4 == 0f) { projectile.localAI[0] = num3; num4 = num3; @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Magic bool flag2 = false; int num8 = 0; float num9; - if ((double)projectile.ai[1] == 0.0) + if (projectile.ai[1] == 0f) { - for (int index = 0; index < 200; ++index) + for (int index = 0; index < Main.maxNPCs; ++index) { if (Main.npc[index].CanBeChasedBy((object)this, false) && ((double)projectile.ai[1] == 0.0 || (double)projectile.ai[1] == (double)(index + 1))) { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = (float)(num8 + 1); flag2 = false; } - if ((double)projectile.ai[1] > 0.0) + if (projectile.ai[1] > 0f) { int index = (int)((double)projectile.ai[1] - 1.0); if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object)this, true) && !Main.npc[index].dontTakeDamage) diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index 9bb29400e4..38c81d0612 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(double)projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index b5b2c163c6..639bda17f7 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.ai[0] > 30f) { projectile.ai[0] = 30f; - for (int num376 = 0; num376 < 200; num376++) + for (int num376 = 0; num376 < Main.maxNPCs; num376++) { if (Main.npc[num376].CanBeChasedBy(projectile, false) && !Main.npc[num376].wet) { diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index b1a8273b55..f680b30f3f 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -55,39 +55,7 @@ namespace CalamityMod.Projectiles.Magic { projectile.timeLeft = 120; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index faa4bcabf3..d41955a085 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -86,37 +86,35 @@ namespace CalamityMod.Projectiles.Magic //homing if (projectile.localAI[0] >= 100) { + Vector2 center = projectile.Center; float homingRange = 800f; bool homeIn = false; - for (int i = 0; i < Main.npc.Length; i++) + float N = 30f; + float homingVelocity = 20f; + + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < homingRange) + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (homingRange + extraDistance)) { - homingRange = num478; - centerX = num476; - centerY = num477; + center = Main.npc[i].Center; homeIn = true; + break; } } } + if (homeIn) { projectile.extraUpdates = 1; - float homingStrength = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = homingStrength / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; - projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * N + homeInVector * homingVelocity) / (N + 1f); } else projectile.extraUpdates = 0; diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index eafdeb18df..881e97db47 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -33,10 +33,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float[] var_2_2DDF8_cp_0 = projectile.ai; - int var_2_2DDF8_cp_1 = 0; - float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; - var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; + projectile.ai[0] += 1f; int num1013 = 0; if (projectile.velocity.Length() <= 8f) //4 { @@ -109,7 +106,6 @@ namespace CalamityMod.Projectiles.Magic dust30.fadeIn = 0.5f; dust30.customData = projectile; vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; dust30.noGravity = true; dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; @@ -142,7 +138,7 @@ namespace CalamityMod.Projectiles.Magic int num1016 = 0; if (projectile.ai[1] == 0f) { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + for (int num1017 = 0; num1017 < Main.maxNPCs; num1017 = num3 + 1) { if (Main.npc[num1017].CanBeChasedBy(projectile, false)) { @@ -229,56 +225,50 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.Damage(); Main.PlaySound(SoundID.Item14, projectile.position); - int num3; - for (int num95 = 0; num95 < 4; num95 = num3 + 1) + + for (int num95 = 0; num95 < 4; num95++) { int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num95; } - for (int num97 = 0; num97 < 30; num97 = num3 + 1) + for (int num97 = 0; num97 < 30; num97++) { int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 3.7f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num98].noGravity = true; Dust dust = Main.dust[num98]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num98]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; dust.velocity *= 2f; - Main.dust[num98].noGravity = true; - Main.dust[num98].fadeIn = 1f; - Main.dust[num98].color = Color.Crimson * 0.5f; - num3 = num97; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.color = Color.Crimson * 0.5f; } - for (int num99 = 0; num99 < 10; num99 = num3 + 1) + for (int num99 = 0; num99 < 10; num99++) { int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[num100].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num100].noGravity = true; Dust dust = Main.dust[num100]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num3 = num99; } - for (int num101 = 0; num101 < 10; num101 = num3 + 1) + for (int num101 = 0; num101 < 10; num101++) { int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Main.dust[num102].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num102].noGravity = true; Dust dust = Main.dust[num102]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num3 = num101; } if (Main.myPlayer == projectile.owner) { - for (int num105 = 0; num105 < 1000; num105 = num3 + 1) + for (int num105 = 0; num105 < Main.maxProjectiles; num105++) { if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) { Main.projectile[num105].Kill(); } - num3 = num105; } int num106 = Main.rand.Next(5, 9); int num107 = Main.rand.Next(5, 9); @@ -288,7 +278,7 @@ namespace CalamityMod.Projectiles.Magic 180 }); int num109 = (num108 == 60) ? 180 : 60; - for (int num110 = 0; num110 < num106; num110 = num3 + 1) + for (int num110 = 0; num110 < num106; num110++) { Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); @@ -303,9 +293,8 @@ namespace CalamityMod.Projectiles.Magic } vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); - num3 = num110; } - for (int num111 = 0; num111 < num107; num111 = num3 + 1) + for (int num111 = 0; num111 < num107; num111++) { Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); @@ -320,7 +309,6 @@ namespace CalamityMod.Projectiles.Magic } vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); - num3 = num111; } } } diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index e0656ba0d2..07c6ba41a1 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -45,39 +45,7 @@ namespace CalamityMod.Projectiles.Magic return; } } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 500f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 18f, 10f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index b5c0dab6a1..fdaceac136 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -44,8 +44,9 @@ namespace CalamityMod.Projectiles.Magic bool target = false; NPC npc = null; bool pastNPC = false; - if (projectile.timeLeft < 18) { - for (int k = 0; k < 200; k++) + if (projectile.timeLeft < 18) + { + for (int k = 0; k < Main.maxNPCs; k++) { if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 && !shockedbefore.Contains(Main.npc[k])) { @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic } } } - //if not found, lokk thru npcs that have been shocked before + //if not found, look through npcs that have been shocked before if (!target) { foreach (NPC pastnpc in shockedbefore) { Vector2 newMove = pastnpc.Center -(projectile.velocity + projectile.Center); @@ -140,7 +141,8 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft -= 12; return false; } - private void AdjustMagnitude(ref Vector2 vector) + + private void AdjustMagnitude(ref Vector2 vector) { float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); if (magnitude > 6f) diff --git a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs index 72979280f7..9417f5e7fe 100644 --- a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs +++ b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 60f, 5, ModContent.ProjectileType(), 0.33); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 60f, 5, ModContent.ProjectileType(), 0.5); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index a7ebd15eee..eca2c6479b 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)((double)projectile.damage * 0.3), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); num3 = num321; } } diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 892076ff51..774a353bed 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -69,39 +69,7 @@ namespace CalamityMod.Projectiles.Rogue //Stealth strike if (stealthstrike) { - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < 200; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = 7f; - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); } //Gravity code else diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index 5e7e734678..e4093f4dbc 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -30,39 +30,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Kill(); } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 28f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 28f, 20f); } } } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 5996091ff6..b82bfc24ca 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -50,39 +50,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 350) projectile.velocity *= 1.06f; projectile.damage = (int) ((double)originalDamage * 1.25); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 21f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 21f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1500f, 20f, 20f); } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 42c14c09d5..6f0c6af21c 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -27,39 +27,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 350f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 350f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index 2ec13e5b9a..fc72f80c83 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -28,41 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index 1d8069a60c..11bf71d687 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -28,41 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index bb76ee6c12..5de9d71e66 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -47,39 +47,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[1] == 0f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 8f, 20f); } } } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 4b7f92b90a..b5e2ed4139 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { int num35 = -1; float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) + for (int num37 = 0; num37 < Main.maxNPCs; num37++) { if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index dc59b5e2f3..58e287a9bc 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -28,39 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); } public override void Kill(int timeLeft) @@ -68,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 20; num621++) { - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; @@ -81,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 35; num623++) { - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Rogue/EmpyreanKnife.cs b/Projectiles/Rogue/EmpyreanKnife.cs index a8139055b9..83d372c9ee 100644 --- a/Projectiles/Rogue/EmpyreanKnife.cs +++ b/Projectiles/Rogue/EmpyreanKnife.cs @@ -55,39 +55,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation += 0.5f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 250f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 15f, 20f); if (Main.rand.NextBool(6)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); diff --git a/Projectiles/Rogue/EnchantedAxeProj.cs b/Projectiles/Rogue/EnchantedAxeProj.cs index fae4fa688b..2b1cc1eb5c 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft % 7 == 1 && projectile.Calamity().stealthStrike) { float axeSpeed = 15f; - int axeDamage = 25; + int axeDamage = projectile.damage / 2; Projectile.NewProjectile(projectile.position, new Vector2(1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); Projectile.NewProjectile(projectile.position, new Vector2(0f, 1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); Projectile.NewProjectile(projectile.position, new Vector2(-1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index ebb9cc2dad..75d5df723c 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -54,39 +54,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 26f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 1200f, 26f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 73025c6167..6073018dd0 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -46,39 +46,7 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[proj].penetrate = 3; stealthTrailTimer = 10; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 16f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 16f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index b777df0ca0..177c8a1393 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -108,39 +108,7 @@ namespace CalamityMod.Projectiles.Rogue else { projectile.rotation += 0.2f * (float)projectile.direction; - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < Main.npc.Length; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = (projectile.Calamity().stealthStrike ? 14f : 7f); - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, (projectile.Calamity().stealthStrike ? 14f : 7f), 20f); } Player player = Main.player[projectile.owner]; diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 37fdea1ec1..93ad7842c7 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -46,39 +46,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = projectile.Calamity().stealthStrike ? 800f : 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 14f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.Calamity().stealthStrike ? 800f : 400f, 14f, 20f); projectile.velocity = initStealth && !flag17 ? initialVelocity : projectile.velocity; } diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index 607bcc2111..f4ba6c88f5 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; if (projectile.spriteDirection == -1) { projectile.rotation -= 1.57f; diff --git a/Projectiles/Rogue/IchorSpearProj.png b/Projectiles/Rogue/IchorSpearProj.png index 88bb1ebf5b..e564266e89 100644 Binary files a/Projectiles/Rogue/IchorSpearProj.png and b/Projectiles/Rogue/IchorSpearProj.png differ diff --git a/Projectiles/Rogue/IllustriousKnife.cs b/Projectiles/Rogue/IllustriousKnife.cs index 2c7926c5e3..4d27eeea5e 100644 --- a/Projectiles/Rogue/IllustriousKnife.cs +++ b/Projectiles/Rogue/IllustriousKnife.cs @@ -44,39 +44,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation += 0.5f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 20f); if (Main.rand.NextBool(6)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Rogue/InfernalSpearProjectile.cs b/Projectiles/Rogue/InfernalSpearProjectile.cs index f8f689c90a..304057b306 100644 --- a/Projectiles/Rogue/InfernalSpearProjectile.cs +++ b/Projectiles/Rogue/InfernalSpearProjectile.cs @@ -41,39 +41,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 7683a9041f..9408b4c5e6 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -46,39 +46,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = (lunarEnhance ? 1000f : 500f); - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = (lunarEnhance ? 35f : 15f); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, (lunarEnhance ? 1000f : 500f), (lunarEnhance ? 35f : 15f), 20f); if (Main.rand.Next(6) == 0 && lunarEnhance) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index a8bc0dd30e..b60308be26 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 20; projectile.friendly = true; projectile.alpha = 0; - projectile.penetrate = -1; + projectile.penetrate = 10; projectile.tileCollide = true; projectile.ignoreWater = true; projectile.timeLeft = 250; @@ -41,39 +41,7 @@ namespace CalamityMod.Projectiles.Rogue return; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index db14b0e295..ce7b0f3c88 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -61,37 +61,7 @@ namespace CalamityMod.Projectiles.Rogue private void HomingAI() { - // Find the closest NPC within range. - int targetIdx = -1; - float maxHomingRange = 400f; - bool hasHomingTarget = false; - for (int i = 0; i < Main.npc.Length; ++i) - { - NPC npc = Main.npc[i]; - if (npc == null || !npc.active) - continue; - - // Won't home in through walls and won't chase invulnerable targets. - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) - { - float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange) - { - targetIdx = i; - maxHomingRange = dist; - hasHomingTarget = true; - } - } - } - - // Home in on said closest NPC. - if (hasHomingTarget) - { - NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * (Penumbra.ShootSpeed * 1.5f); - float homingRatio = 35f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, (Penumbra.ShootSpeed * 1.5f), 35f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/PhantasmalRuinGhost.cs b/Projectiles/Rogue/PhantasmalRuinGhost.cs index 2f15cb74d6..87a20a8a60 100644 --- a/Projectiles/Rogue/PhantasmalRuinGhost.cs +++ b/Projectiles/Rogue/PhantasmalRuinGhost.cs @@ -35,39 +35,7 @@ namespace CalamityMod.Projectiles.Rogue } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default(Color), 0.85f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 18f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index fa1df00e7d..692c26b81c 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -85,39 +85,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] == 0f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); } } else diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index 9bac794afc..64b285965a 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -55,8 +55,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] > 30f) { projectile.ai[0] = 30f; - int num3; - for (int num376 = 0; num376 < 200; num376 = num3 + 1) + for (int num376 = 0; num376 < Main.maxNPCs; num376++) { if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) { @@ -71,7 +70,6 @@ namespace CalamityMod.Projectiles.Rogue flag10 = true; } } - num3 = num376; } } if (!flag10) diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 73a4de25e4..aee61d2fda 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -29,40 +29,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 300f; - bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 25f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/ProfanedPartisanspear.cs b/Projectiles/Rogue/ProfanedPartisanspear.cs index 8f9af9bf4e..44f713f455 100644 --- a/Projectiles/Rogue/ProfanedPartisanspear.cs +++ b/Projectiles/Rogue/ProfanedPartisanspear.cs @@ -94,37 +94,7 @@ namespace CalamityMod.Projectiles.Rogue float pcy = projectile.Center.Y; if (timer >= 10) { - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < 200; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = 7f; - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); } } diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index 08e5034d68..9bf3f81f5a 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue float num473 = projectile.Center.Y; float num474 = projectile.Calamity().stealthStrike ? 1800f : 600f; float homingSpeed = 0.25f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { @@ -73,39 +73,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = projectile.Calamity().stealthStrike ? 1800f : 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.Calamity().stealthStrike ? 1800f : 600f, 24f, 20f); } } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index e946070476..93ab84cc8c 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -48,39 +48,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); } } else @@ -107,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index 591845f492..5aed541a88 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -54,41 +54,33 @@ namespace CalamityMod.Projectiles.Rogue { projectile.extraUpdates = 1; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; + Vector2 center = projectile.Center; + float maxDistance = 500f; + bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + } else projectile.Kill(); } diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index 5db3ec264f..d75b3b6236 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -32,39 +32,37 @@ namespace CalamityMod.Projectiles.Rogue } else { - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1000f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + Vector2 center = projectile.Center; + float maxDistance = 1000f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + bool canHit = true; + if (extraDistance < maxDistance && !ignoreTiles) + canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (11f); + } else { projectile.velocity.X = 0f; diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index f08993ef5f..dfb1422fc9 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -77,39 +77,7 @@ namespace CalamityMod.Projectiles.Rogue } Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); float num633 = 700f; Vector2 vector46 = projectile.position; bool flag25 = false; diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index 2bf75fdea7..65fd621786 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Rogue bool flag49 = false; Vector2 center12 = new Vector2(0f, 0f); float num948 = 600f; - for (int num949 = 0; num949 < 200; num949++) + for (int num949 = 0; num949 < Main.maxNPCs; num949++) { if (Main.npc[num949].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index 24526ffae5..a314d723ed 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -39,40 +39,39 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { + + Vector2 center = projectile.Center; + float maxDistance = 300f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + bool canHit = true; + if (extraDistance < maxDistance && !ignoreTiles) + canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { projectile.extraUpdates = 2; - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index 2b063098c7..7448e97c94 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -42,39 +42,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation += projectile.velocity.X * 0.02f; projectile.velocity.Y = projectile.velocity.Y + 0.085f; projectile.velocity.X = projectile.velocity.X * 0.99f; - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < 200; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = 16f; - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 16f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 811ed0ff72..c5eebf5606 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -32,6 +32,11 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + //synthesized timeLeft + projectile.localAI[1]++; + if (projectile.localAI[1] > 600f) + projectile.Kill(); + if (projectile.ai[0] == 1f) { projectile.ai[0] = 0f; @@ -52,39 +57,41 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + projectile.localAI[0]++; + + Vector2 center = projectile.Center; + float maxDistance = 600f; + bool homeIn = false; + + if (projectile.localAI[0] >= 20f && !homeIn) //shorten knife lifespan if it hasn't found a target + if (projectile.timeLeft >= 60) + projectile.timeLeft = 60; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + projectile.timeLeft = 600; //when homing in, the projectile cannot run out of timeLeft, but synthesized timeLeft still runs + + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (10f + 1f); + } else { projectile.velocity.X *= 0.92f; diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index 8b0cf83d00..e3daa514b1 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -51,41 +51,33 @@ namespace CalamityMod.Projectiles.Rogue { projectile.extraUpdates = 1; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; + Vector2 center = projectile.Center; + float maxDistance = 500f; + bool homeIn = false; - for (int num475 = 0; num475 < Main.npc.Length; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + } else projectile.Kill(); } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 4085026e09..e548f4f7a1 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -61,39 +61,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[1] == 1f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 8f, 20f); } } diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index 07cf60313d..b965ea877c 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -48,39 +48,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); } } else diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index ecdde6f8f6..d2a0a701dd 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 40; } public override void AI() diff --git a/Projectiles/Typeless/BallisticPoisonCloud2.cs b/Projectiles/Typeless/BallisticPoisonCloud2.cs index 0e44037c13..06e12c4d98 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud2.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 40; } public override void AI() diff --git a/Projectiles/Typeless/BallisticPoisonCloud3.cs b/Projectiles/Typeless/BallisticPoisonCloud3.cs index caa48fea6e..29ff512173 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud3.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud3.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 40; } public override void AI() diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index f5dd461f36..037d95fe88 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -136,24 +136,12 @@ namespace CalamityMod.UI OneToMany[ModContent.NPCType()] = StarWorm; OneToMany[ModContent.NPCType()] = StarWorm; - int[] Cal = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Cal; - OneToMany[ModContent.NPCType()] = Cal; - OneToMany[ModContent.NPCType()] = Cal; - int[] Void = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; - int[] Perfs = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Perfs; - OneToMany[ModContent.NPCType()] = Perfs; - OneToMany[ModContent.NPCType()] = Perfs; - OneToMany[ModContent.NPCType()] = Perfs; - int[] Rav = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; OneToMany[ModContent.NPCType()] = Rav; @@ -243,6 +231,9 @@ namespace CalamityMod.UI //Prehardmode ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), //Hardmode ModContent.NPCType(), @@ -250,6 +241,8 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), //Clone's brothers + ModContent.NPCType(), //Abyss ModContent.NPCType(), @@ -452,9 +445,7 @@ namespace CalamityMod.UI enum SpecialType2 : byte { None, - Calam, Ceaseless, - Perforator, Ravage, SlimeCore } @@ -493,18 +484,10 @@ namespace CalamityMod.UI { _special2 = SpecialType2.Ravage; } - else if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.Perforator; - } else if (type == ModContent.NPCType()) { _special2 = SpecialType2.Ceaseless; } - else if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.Calam; - } else if (type == ModContent.NPCType()) { _special = SpecialType.Astrum; @@ -699,37 +682,26 @@ namespace CalamityMod.UI { default: break; - case SpecialType2.Calam: - int count = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[0] = count; - break; case SpecialType2.Ceaseless: - int count2 = NPC.CountNPCS(ModContent.NPCType()) + + int count = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[1] = count2; - break; - case SpecialType2.Perforator: - int count3 = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[2] = count3; + _specialData2[0] = count; break; case SpecialType2.Ravage: - int count4 = NPC.CountNPCS(ModContent.NPCType()) + + int count2 = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[3] = count4; + _specialData2[1] = count2; break; case SpecialType2.SlimeCore: - int count5 = NPC.CountNPCS(ModContent.NPCType()) + + int count3 = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[4] = count5; + _specialData2[2] = count3; break; } } @@ -841,32 +813,20 @@ namespace CalamityMod.UI { default: break; - case SpecialType2.Calam: - string count = "(Brothers left: " + _specialData2[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; + string count2 = "(Dark Energy left: " + _specialData2[0] + ")"; Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); return; - case SpecialType2.Perforator: - string count3 = "(Worms left: " + _specialData2[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[3] + ")"; + string count4 = "(Body Parts left: " + _specialData2[1] + ")"; Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); return; case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; + string count5 = "(Large Slimes left: " + _specialData2[2] + ")"; Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); @@ -973,36 +933,22 @@ namespace CalamityMod.UI { default: break; - case SpecialType2.Calam: - string count = "(Brothers left: " + _specialData2[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; + string count2 = "(Dark Energy left: " + _specialData2[0] + ")"; Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); _openAnimCounter--; return; - case SpecialType2.Perforator: - string count3 = "(Worms left: " + _specialData2[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[3] + ")"; + string count4 = "(Body Parts left: " + _specialData2[1] + ")"; Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); _openAnimCounter--; return; case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; + string count5 = "(Large Slimes left: " + _specialData2[2] + ")"; Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale);