diff --git a/Buffs/Cooldowns/BloodflareBloodFrenzyCooldown.png b/Buffs/Cooldowns/BloodflareBloodFrenzyCooldown.png index 3c28691a71..33222b1e47 100644 Binary files a/Buffs/Cooldowns/BloodflareBloodFrenzyCooldown.png and b/Buffs/Cooldowns/BloodflareBloodFrenzyCooldown.png differ diff --git a/Buffs/StatBuffs/BloodflareBloodFrenzy.png b/Buffs/StatBuffs/BloodflareBloodFrenzy.png index 32f5c6aa5c..b460c7f28a 100644 Binary files a/Buffs/StatBuffs/BloodflareBloodFrenzy.png and b/Buffs/StatBuffs/BloodflareBloodFrenzy.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 9f9fdc2f09..1310c4524d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -103,6 +103,8 @@ namespace CalamityMod.CalPlayer public int abyssLifeLostAtZeroBreathStat = 0; public int abyssDefenseLossStat = 0; public int stealthStat = 0; + public float standingRegenStat = 0f; + public float movingRegenStat = 0f; // Timer and Counter public int bossRushImmunityFrameCurseTimer = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2ea6e98c9f..5f9ddd40b9 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -88,7 +88,7 @@ namespace CalamityMod.CalPlayer EnduranceReductions(player, modPlayer); // Stat Meter - StatMeter(player, modPlayer); + UpdateStatMeter(player, modPlayer); // Rogue Mirrors RogueMirrors(player, modPlayer); @@ -3315,7 +3315,7 @@ namespace CalamityMod.CalPlayer #endregion #region Stat Meter - private static void StatMeter(Player player, CalamityPlayer modPlayer) + private static void UpdateStatMeter(Player player, CalamityPlayer modPlayer) { float allDamageStat = player.allDamage - 1f; modPlayer.damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f); @@ -3341,7 +3341,15 @@ namespace CalamityMod.CalPlayer modPlayer.meleeSpeedStat = (int)((1f - player.meleeSpeed) * (100f / player.meleeSpeed)); modPlayer.manaCostStat = (int)(player.manaCost * 100f); modPlayer.rogueVelocityStat = (int)((modPlayer.throwingVelocity - 1f) * 100f); + + // Max stealth 1f is actually "100 stealth", so multiply by 100 to get visual stealth number. modPlayer.stealthStat = (int)(modPlayer.rogueStealthMax * 100f); + // Then divide by 3, because it takes 3 seconds to regen full stealth. + // Divide by 3 again for moving, because it recharges at 1/3 speed (so divide by 9 overall). + // Then multiply by stealthGen variables, which start at 1f and increase proportionally to your boosts. + modPlayer.standingRegenStat = (modPlayer.rogueStealthMax * 100f / 3f) * modPlayer.stealthGenStandstill; + modPlayer.movingRegenStat = (modPlayer.rogueStealthMax * 100f / 9f) * modPlayer.stealthGenMoving * modPlayer.stealthAcceleration; + modPlayer.minionSlotStat = player.maxMinions; modPlayer.manaRegenStat = player.manaRegen; modPlayer.armorPenetrationStat = player.armorPenetration; diff --git a/Items/Accessories/BloodflareCore.png b/Items/Accessories/BloodflareCore.png index 69a8a4582e..d4ceceff99 100644 Binary files a/Items/Accessories/BloodflareCore.png and b/Items/Accessories/BloodflareCore.png differ diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 9f203b244c..36eb6d66b9 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -1,11 +1,10 @@ using CalamityMod.CalPlayer; using CalamityMod.World; +using System; using System.Collections.Generic; +using System.Text; using Terraria; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; -using System.Text; namespace CalamityMod.Items.Accessories { @@ -14,8 +13,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Stat Meter"); - Tooltip.SetDefault("Displays info about most of your stats\n" + - "Offensive stats displayed vary with held item"); + Tooltip.SetDefault("Displays almost all player stats"); } public override void SetDefaults() @@ -34,12 +32,18 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); Item heldItem = null; - if (player.selectedItem >= 0 && player.selectedItem < player.inventory.Length) + if (player.selectedItem >= 0 && player.selectedItem < Main.maxInventory) heldItem = player.inventory[player.selectedItem]; - foreach (TooltipLine line2 in list) - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - line2.text = CreateStatMeterTooltip(player, modPlayer, heldItem); + // Replace the vanilla tooltip with a full stat readout + foreach (TooltipLine l in list) + { + if (l.mod == "Terraria" && l.Name == "Tooltip0") + l.text = CreateStatMeterTooltip(player, modPlayer, heldItem); + } + + // To save screen space, favorited tooltips do not exist for the Stat Meter + list.RemoveAll(l => l.mod == "Terraria" && (l.Name == "Favorite" || l.Name == "FavoriteDesc")); } private string CreateStatMeterTooltip(Player player, CalamityPlayer modPlayer, Item heldItem) @@ -53,6 +57,9 @@ namespace CalamityMod.Items.Accessories int ammoConsumption = modPlayer.ammoReductionRanged; int rogueConsumption = modPlayer.ammoReductionRogue; int rogueStealth = modPlayer.stealthStat; + // Format the stealth regen statistics to be accurate to 2 decimal places. + string standingRegen = modPlayer.standingRegenStat.ToString("n2"); + string movingRegen = modPlayer.movingRegenStat.ToString("n2"); int lifeRegen = modPlayer.lifeRegenStat; int manaRegen = modPlayer.manaRegenStat; int armorPenetration = modPlayer.armorPenetrationStat; @@ -65,7 +72,7 @@ namespace CalamityMod.Items.Accessories int defenseLoss = modPlayer.abyssDefenseLossStat; // The notice about held item mattering is always displayed first. - StringBuilder sb = new StringBuilder("Offensive stats displayed vary with held item\n\n", 1024); + StringBuilder sb = new StringBuilder("Displays almost all player stats\nOffensive stats displayed vary with held item\n\n", 1024); // Only append rippers stats in Rev+, if rippers are enabled. if (CalamityWorld.revenge && CalamityMod.CalamityConfig.AdrenalineAndRage) @@ -76,13 +83,13 @@ namespace CalamityMod.Items.Accessories } // Append item stats only if the held item isn't null, and base it off of the item's damage type. - if (heldItem != null) + if (heldItem != null && !heldItem.IsAir) { if (heldItem.melee) { sb.Append("Melee Damage: ").Append(modPlayer.damageStats[0]) .Append("% | Melee Crit Chance: ").Append(modPlayer.critStats[0]) - .Append("%\nMeleeSpeed Boost: ").Append(meleeSpeed).Append("%\n\n"); + .Append("%\nMelee Speed Boost: ").Append(meleeSpeed).Append("%\n\n"); } else if (heldItem.ranged) { @@ -95,20 +102,23 @@ namespace CalamityMod.Items.Accessories sb.Append("Magic Damage: ").Append(modPlayer.damageStats[2]) .Append("% | Magic Crit Chance: ").Append(modPlayer.critStats[2]) .Append("%\nMana Usage: ").Append(manaCost) - .Append("% | Mana Regen").Append(manaRegen).Append("\n\n"); + .Append("% | Mana Regen: ").Append(manaRegen).Append("\n\n"); } else if (heldItem.summon) { sb.Append("Minion Damage: ").Append(modPlayer.damageStats[3]) .Append("% | Minion Slots: ").Append(minionSlots).Append("\n\n"); } - else if (heldItem.Calamity().rogue) + else if (heldItem.Calamity()?.rogue ?? false) { sb.Append("Rogue Damage: ").Append(modPlayer.damageStats[4]) .Append("% | Rogue Crit Chance: ").Append(modPlayer.critStats[3]) .Append("%\nRogue Velocity Boost: ").Append(rogueVelocity) .Append("% | Rogue Weapon Consumption Chance: ").Append(rogueConsumption) - .Append("%\nMax Stealth: ").Append(rogueStealth).Append("\n\n"); + .Append("%\nMax Stealth: ").Append(rogueStealth) + .Append(" | Standing Regen: ").Append(standingRegen).Append(" / sec") + .Append(" | Moving Regen: ").Append(movingRegen).Append(" / sec") + .Append("\n\n"); } } @@ -121,19 +131,17 @@ namespace CalamityMod.Items.Accessories sb.Append(" | Movement Speed Boost: ").Append(moveSpeed).Append("%\n\n"); sb.Append(CalamityWorld.death ? "Abyss/Cave Light Strength: " : "Abyss Light Strength: ").Append(lightLevel).Append("\n\n"); - // Abyss stats always render. - sb.Append("Other Abyss Stats:").Append("\n"); + // Abyss stats only render if the player is in the Abyss. if (modPlayer.ZoneAbyss) { + sb.Append("Other Abyss Stats:").Append("\n"); sb.Append("Breath Lost Per Tick: ").Append(breathLoss); sb.Append(" | Breath Loss Rate: ").Append(breathLossRate).Append("\n"); sb.Append("Life Lost Per Tick at Zero Breath: ").Append(lifeLostAtZeroBreath).Append("\n"); sb.Append("Defense Lost: ").Append(defenseLoss); } else - { - sb.Append("Only displayed while in the Abyss"); - } + sb.Append("Abyss stats only displayed while in the Abyss"); return sb.ToString(); } diff --git a/Items/Ammo/BloodfireArrow.png b/Items/Ammo/BloodfireArrow.png index 3dda2cfa68..495f11392e 100644 Binary files a/Items/Ammo/BloodfireArrow.png and b/Items/Ammo/BloodfireArrow.png differ diff --git a/Items/Armor/BloodflareBodyArmor.png b/Items/Armor/BloodflareBodyArmor.png index ed3eecb4a9..2b5bf3f904 100644 Binary files a/Items/Armor/BloodflareBodyArmor.png and b/Items/Armor/BloodflareBodyArmor.png differ diff --git a/Items/Armor/BloodflareBodyArmor_Arms.png b/Items/Armor/BloodflareBodyArmor_Arms.png index 394250f244..f115d32d10 100644 Binary files a/Items/Armor/BloodflareBodyArmor_Arms.png and b/Items/Armor/BloodflareBodyArmor_Arms.png differ diff --git a/Items/Armor/BloodflareBodyArmor_Body.png b/Items/Armor/BloodflareBodyArmor_Body.png index 8100aab0b2..36cd5c871b 100644 Binary files a/Items/Armor/BloodflareBodyArmor_Body.png and b/Items/Armor/BloodflareBodyArmor_Body.png differ diff --git a/Items/Armor/BloodflareBodyArmor_FemaleBody.png b/Items/Armor/BloodflareBodyArmor_FemaleBody.png index 8100aab0b2..de3eb55442 100644 Binary files a/Items/Armor/BloodflareBodyArmor_FemaleBody.png and b/Items/Armor/BloodflareBodyArmor_FemaleBody.png differ diff --git a/Items/Armor/BloodflareCuisses.png b/Items/Armor/BloodflareCuisses.png index 3198ee3a40..6960979550 100644 Binary files a/Items/Armor/BloodflareCuisses.png and b/Items/Armor/BloodflareCuisses.png differ diff --git a/Items/Armor/BloodflareCuisses_Legs.png b/Items/Armor/BloodflareCuisses_Legs.png index bf5f44dc2e..5503bc13cb 100644 Binary files a/Items/Armor/BloodflareCuisses_Legs.png and b/Items/Armor/BloodflareCuisses_Legs.png differ diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index a6dc429c56..8619b5f27a 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bloodflare Helm"); + DisplayName.SetDefault("Bloodflare Imp Mask"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + "10% increased rogue damage and critical strike chance, 15% increased movement speed\n" + "Provides heat protection in Death Mode"); diff --git a/Items/Armor/BloodflareHelm.png b/Items/Armor/BloodflareHelm.png index c6f2d9c5c1..380e84888a 100644 Binary files a/Items/Armor/BloodflareHelm.png and b/Items/Armor/BloodflareHelm.png differ diff --git a/Items/Armor/BloodflareHelm_Head.png b/Items/Armor/BloodflareHelm_Head.png index 57ffde4c45..ddb771214d 100644 Binary files a/Items/Armor/BloodflareHelm_Head.png and b/Items/Armor/BloodflareHelm_Head.png differ diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index 46671b61ac..ec7066ec40 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bloodflare Helmet"); + DisplayName.SetDefault("Bloodflare Wyvern Helm"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + "+3 max minions\n" + "Provides heat protection in Death Mode"); diff --git a/Items/Armor/BloodflareHelmet.png b/Items/Armor/BloodflareHelmet.png index 25f57b47e6..d68fe46f4b 100644 Binary files a/Items/Armor/BloodflareHelmet.png and b/Items/Armor/BloodflareHelmet.png differ diff --git a/Items/Armor/BloodflareHelmet_Head.png b/Items/Armor/BloodflareHelmet_Head.png index 8bfbc17752..ef81a2e06b 100644 Binary files a/Items/Armor/BloodflareHelmet_Head.png and b/Items/Armor/BloodflareHelmet_Head.png differ diff --git a/Items/Armor/BloodflareHornedHelm.png b/Items/Armor/BloodflareHornedHelm.png index 76774a6cff..201f6076b3 100644 Binary files a/Items/Armor/BloodflareHornedHelm.png and b/Items/Armor/BloodflareHornedHelm.png differ diff --git a/Items/Armor/BloodflareHornedHelm_Head.png b/Items/Armor/BloodflareHornedHelm_Head.png index 3089bfae55..e34fe22811 100644 Binary files a/Items/Armor/BloodflareHornedHelm_Head.png and b/Items/Armor/BloodflareHornedHelm_Head.png differ diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index 03e1e142ef..a778d484ae 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bloodflare Horned Mask"); + DisplayName.SetDefault("Bloodflare Hydra Hood"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + "10% increased magic damage and critical strike chance, +100 max mana, and 17% reduced mana usage\n" + "Provides heat protection in Death Mode"); diff --git a/Items/Armor/BloodflareHornedMask.png b/Items/Armor/BloodflareHornedMask.png index 071612ee3c..ee337168aa 100644 Binary files a/Items/Armor/BloodflareHornedMask.png and b/Items/Armor/BloodflareHornedMask.png differ diff --git a/Items/Armor/BloodflareHornedMask_Head.png b/Items/Armor/BloodflareHornedMask_Head.png index adafe0d349..cda2396385 100644 Binary files a/Items/Armor/BloodflareHornedMask_Head.png and b/Items/Armor/BloodflareHornedMask_Head.png differ diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index a0d6126416..67839aeb58 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bloodflare Mask"); + DisplayName.SetDefault("Bloodflare Ram Mask"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + "10% increased melee damage and critical strike chance\n" + "Provides heat protection in Death Mode"); diff --git a/Items/Armor/BloodflareMask.png b/Items/Armor/BloodflareMask.png index edd697c92d..076ee6cda0 100644 Binary files a/Items/Armor/BloodflareMask.png and b/Items/Armor/BloodflareMask.png differ diff --git a/Items/Armor/BloodflareMask_Head.png b/Items/Armor/BloodflareMask_Head.png index 5f127679a3..a168f50114 100644 Binary files a/Items/Armor/BloodflareMask_Head.png and b/Items/Armor/BloodflareMask_Head.png differ diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index 26488e824a..a2dd1def8c 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -57,7 +57,8 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)((double)1500 * (player.allDamage + player.minionDamage - 1f)), 0f, Main.myPlayer, 0f, 0f); + int shellfish = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)((double)1500 * (player.allDamage + player.minionDamage - 1f)), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[shellfish].Calamity().lineColor = 1; } } player.Calamity().wearingRogueArmor = true; diff --git a/Items/Fishing/Xerocodile.png b/Items/Fishing/Xerocodile.png index e53f5bf722..267f389556 100644 Binary files a/Items/Fishing/Xerocodile.png and b/Items/Fishing/Xerocodile.png differ diff --git a/Items/Materials/BloodOrb.png b/Items/Materials/BloodOrb.png index 2c44ef6550..ab5ccc9248 100644 Binary files a/Items/Materials/BloodOrb.png and b/Items/Materials/BloodOrb.png differ diff --git a/Items/Materials/Bloodstone.png b/Items/Materials/Bloodstone.png index d80fd83ee5..5775299e7a 100644 Binary files a/Items/Materials/Bloodstone.png and b/Items/Materials/Bloodstone.png differ diff --git a/Items/Materials/BloodstoneCore.png b/Items/Materials/BloodstoneCore.png index 75b36dec3d..4784da5dc1 100644 Binary files a/Items/Materials/BloodstoneCore.png and b/Items/Materials/BloodstoneCore.png differ diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index d965afecf9..0cdec52d73 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -2,6 +2,7 @@ using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Ores; +using CalamityMod.Tiles.SunkenSea; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -140,15 +141,21 @@ namespace CalamityMod.Items.Mounts Tile tile = Framing.GetTileSafely(num824, num825); if (num828 < (double)num814) { - if (tile != null && tile.active() && tile.type != (ushort)ModContent.TileType() && - tile.type != (ushort)ModContent.TileType() && (tile.type != TileID.Hellstone || Main.hardMode) && - (tile.type != TileID.LihzahrdBrick || NPC.downedGolemBoss) && (tile.type != TileID.BlueDungeonBrick || NPC.downedBoss3) && - (tile.type != TileID.GreenDungeonBrick || NPC.downedBoss3) && (tile.type != TileID.PinkDungeonBrick || NPC.downedBoss3) && tile.type != TileID.DemonAltar && + if (tile != null && tile.active() && + tile.type != (ushort)ModContent.TileType() && + tile.type != (ushort)ModContent.TileType() && + (tile.type != TileID.Hellstone || Main.hardMode) && + (tile.type != TileID.LihzahrdBrick || NPC.downedGolemBoss) && + (tile.type != (TileID.BlueDungeonBrick | TileID.GreenDungeonBrick | TileID.PinkDungeonBrick) || NPC.downedBoss3) && + tile.type != TileID.DemonAltar && (tile.type != (ushort)ModContent.TileType() || CalamityWorld.downedStarGod) && - ((tile.type != (ushort)ModContent.TileType() && tile.type != (ushort)ModContent.TileType()) || NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && - (!player.Calamity().ZoneSunkenSea || CalamityWorld.downedDesertScourge) && tile.type != (ushort)ModContent.TileType() && + (tile.type != ((ushort)ModContent.TileType() | (ushort)ModContent.TileType()) || CalamityWorld.downedCalamitas) && + (tile.type != ((ushort)ModContent.TileType() | (ushort)ModContent.TileType() | (ushort)ModContent.TileType() | (ushort)ModContent.TileType()) || CalamityWorld.downedDesertScourge) && + tile.type != (ushort)ModContent.TileType() && (Main.tileValue[tile.type] < tileValueLimit || tile.type == TileID.Heart || tile.type == TileID.LifeFruit) && - !player.noBuilding && tile.type != TileID.ElderCrystalStand && tile.type != TileID.Containers) + !player.noBuilding && + tile.type != TileID.ElderCrystalStand && + tile.type != TileID.Containers) { WorldGen.KillTile(num824, num825, false, false, false); if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs new file mode 100644 index 0000000000..d4cebdd680 --- /dev/null +++ b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs @@ -0,0 +1,26 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class FearlessGoldfishWarriorBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 109; + } + } +} diff --git a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.png b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.png new file mode 100644 index 0000000000..1c02717c81 Binary files /dev/null and b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.png differ diff --git a/Items/Placeables/Banners/PiggyBanner.cs b/Items/Placeables/Banners/PiggyBanner.cs index 40cd11d541..d54624180e 100644 --- a/Items/Placeables/Banners/PiggyBanner.cs +++ b/Items/Placeables/Banners/PiggyBanner.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useStyle = 1; item.consumable = true; item.rare = 1; + item.Calamity().customRarity = CalamityRarity.Dedicated; item.value = Item.buyPrice(0, 0, 10, 0); item.createTile = ModContent.TileType(); item.placeStyle = 108; diff --git a/Items/Placeables/Banners/RadiatorBanner.cs b/Items/Placeables/Banners/RadiatorBanner.cs new file mode 100644 index 0000000000..aad7677f23 --- /dev/null +++ b/Items/Placeables/Banners/RadiatorBanner.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class RadiatorBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 110; + } + } +} diff --git a/Items/Placeables/Banners/RadiatorBanner.png b/Items/Placeables/Banners/RadiatorBanner.png new file mode 100644 index 0000000000..d0a08249d3 Binary files /dev/null and b/Items/Placeables/Banners/RadiatorBanner.png differ diff --git a/Items/Weapons/Magic/SanguineFlare.png b/Items/Weapons/Magic/SanguineFlare.png index 1770591b91..1505f6b01d 100644 Binary files a/Items/Weapons/Magic/SanguineFlare.png and b/Items/Weapons/Magic/SanguineFlare.png differ diff --git a/Items/Weapons/Magic/Viscera.png b/Items/Weapons/Magic/Viscera.png index 350b6cf88f..f8335ff6f0 100644 Binary files a/Items/Weapons/Magic/Viscera.png and b/Items/Weapons/Magic/Viscera.png differ diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 1bf9f8f40b..48ebd44440 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 60; + item.width = 74; + item.height = 74; item.damage = 110; item.melee = true; item.useAnimation = 26; @@ -31,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 60; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/AbyssBlade.png b/Items/Weapons/Melee/AbyssBlade.png index dbb47e45a5..5e18511af5 100644 Binary files a/Items/Weapons/Melee/AbyssBlade.png and b/Items/Weapons/Melee/AbyssBlade.png differ diff --git a/Items/Weapons/Melee/DepthBlade.cs b/Items/Weapons/Melee/DepthBlade.cs index e2596721a3..b0822caff3 100644 --- a/Items/Weapons/Melee/DepthBlade.cs +++ b/Items/Weapons/Melee/DepthBlade.cs @@ -10,14 +10,15 @@ namespace CalamityMod.Items.Weapons.Melee { public override void SetStaticDefaults() { - DisplayName.SetDefault("Depth Blade"); + DisplayName.SetDefault("Depth Crusher"); Tooltip.SetDefault("Hitting enemies will inflict the crush depth debuff\n" + "The lower the enemies' defense, the more damage they take from this debuff"); } public override void SetDefaults() { - item.width = 40; + item.width = 56; + item.height = 50; item.damage = 22; item.melee = true; item.useAnimation = 22; @@ -27,9 +28,9 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 5.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 40; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; + item.hammer = 70; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/DepthBlade.png b/Items/Weapons/Melee/DepthBlade.png index de9a8d42e8..a3a09bfad2 100644 Binary files a/Items/Weapons/Melee/DepthBlade.png and b/Items/Weapons/Melee/DepthBlade.png differ diff --git a/Items/Weapons/Melee/Lacerator.png b/Items/Weapons/Melee/Lacerator.png index 849cca255f..f2966fe10c 100644 Binary files a/Items/Weapons/Melee/Lacerator.png and b/Items/Weapons/Melee/Lacerator.png differ diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 4d83db6a77..436b2c29d3 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 80; + item.width = 122; + item.height = 122; item.damage = 380; item.melee = true; item.useAnimation = 22; @@ -31,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 9f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 80; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/NeptunesBounty.png b/Items/Weapons/Melee/NeptunesBounty.png index 01e6765c31..7d5be66100 100644 Binary files a/Items/Weapons/Melee/NeptunesBounty.png and b/Items/Weapons/Melee/NeptunesBounty.png differ diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 1041483cad..7369dbcbb3 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 80; + item.width = 90; + item.height = 90; item.damage = 950; item.melee = true; item.useAnimation = 18; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 80; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/TheMutilator.png b/Items/Weapons/Melee/TheMutilator.png index db127ea0fc..c9ff1819bd 100644 Binary files a/Items/Weapons/Melee/TheMutilator.png and b/Items/Weapons/Melee/TheMutilator.png differ diff --git a/Items/Weapons/Ranged/ArterialAssault.png b/Items/Weapons/Ranged/ArterialAssault.png index ff0017d2a6..8115020d00 100644 Binary files a/Items/Weapons/Ranged/ArterialAssault.png and b/Items/Weapons/Ranged/ArterialAssault.png differ diff --git a/Items/Weapons/Ranged/ClaretCannon.png b/Items/Weapons/Ranged/ClaretCannon.png index c85ef4849d..c075ff581e 100644 Binary files a/Items/Weapons/Ranged/ClaretCannon.png and b/Items/Weapons/Ranged/ClaretCannon.png differ diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.png b/Items/Weapons/Rogue/BloodsoakedCrasher.png index 9406101582..1d8b42d1cf 100644 Binary files a/Items/Weapons/Rogue/BloodsoakedCrasher.png and b/Items/Weapons/Rogue/BloodsoakedCrasher.png differ diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 55d3cc016d..1eafad75c3 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -213,7 +213,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, CalamityWorld.defiled ? 20 : Main.expertMode ? 40 : 50, 1, 1); + int abyssShockerChance = CalamityWorld.defiled ? 20 : Main.expertMode ? 40 : 50; + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, abyssShockerChance, 1, 1); } } } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index c5b787f2ac..cfb4e6eaa1 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -251,10 +252,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - if (Main.rand.NextBool(25)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Flipper); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 15); + DropHelper.DropItemChance(npc, ItemID.Flipper, 25); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 802f74dbfe..c6f3e7d611 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -40,8 +40,8 @@ namespace CalamityMod.NPCs.AcidRain npc.DeathSound = SoundID.NPCDeath1; aiType = NPCID.GlowingSnail; //animationType = NPCID.GlowingSnail; - //banner = npc.type; - //bannerItem = ModContent.ItemType(); + banner = npc.type; + bannerItem = ModContent.ItemType(); } public override void AI() diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 1d38189046..5c92d6e53f 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1418,7 +1418,6 @@ namespace CalamityMod.NPCs break; case NPCID.Shark: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 15); DropHelper.DropItemChance(npc, ItemID.SharkToothNecklace, Main.expertMode ? 20 : 30); break; diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 0e45cd3550..554efac7fe 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Banners; namespace CalamityMod.NPCs.NormalNPCs { @@ -30,8 +31,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - //banner = npc.type; - //bannerItem = ModContent.ItemType(); + banner = npc.type; + bannerItem = ModContent.ItemType(); } public override void AI() diff --git a/Projectiles/Magic/ApothJaws.cs b/Projectiles/Magic/ApothJaws.cs index c7d7b89a24..2be7e77648 100644 --- a/Projectiles/Magic/ApothJaws.cs +++ b/Projectiles/Magic/ApothJaws.cs @@ -37,7 +37,10 @@ namespace CalamityMod.Projectiles.Magic double angle = (double)Main.rand.Next(360) * Math.PI / 180; float offsetX = projectile.position.X + (float)Main.rand.Next((int)projectile.width); float offsetY = projectile.position.Y + (float)Main.rand.Next((int)projectile.height); - Projectile.NewProjectile(offsetX, offsetY, 14 * (float)Math.Cos(angle), 14 * (float)Math.Sin(angle), ModContent.ProjectileType(), projectile.damage, projectile.knockBack / 2, Main.myPlayer); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(offsetX, offsetY, 14 * (float)Math.Cos(angle), 14 * (float)Math.Sin(angle), ModContent.ProjectileType(), projectile.damage, projectile.knockBack / 2, Main.myPlayer); + } } if (projectile.timeLeft < 30) projectile.alpha = projectile.alpha + 6; diff --git a/Projectiles/Magic/ApothMark.cs b/Projectiles/Magic/ApothMark.cs index 75e7e93ec8..d50a614559 100644 --- a/Projectiles/Magic/ApothMark.cs +++ b/Projectiles/Magic/ApothMark.cs @@ -44,11 +44,18 @@ namespace CalamityMod.Projectiles.Magic double offsetRotation = Math.Atan2(-38, 48) + (double)projectile.rotation; double offsetX = offsetHyp * Math.Cos(offsetRotation); double offsetY = offsetHyp * Math.Sin(offsetRotation); - Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 0f); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 0f); + } offsetRotation = Math.Atan2(38, 48) + (double)projectile.rotation; offsetX = offsetHyp * Math.Cos(offsetRotation); offsetY = offsetHyp * Math.Sin(offsetRotation); - Projectile.NewProjectile(projectile.position.X + projectile.width / 2 + (float)offsetX, projectile.position.Y + projectile.height / 2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 1f); + + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.position.X + projectile.width / 2 + (float)offsetX, projectile.position.Y + projectile.height / 2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, Main.myPlayer, projectile.rotation, 1f); + } } } diff --git a/Projectiles/Magic/SanguineFlareProj.png b/Projectiles/Magic/SanguineFlareProj.png index 17f3a43676..f3ac337933 100644 Binary files a/Projectiles/Magic/SanguineFlareProj.png and b/Projectiles/Magic/SanguineFlareProj.png differ diff --git a/Projectiles/Melee/YateveoBloomProj.png b/Projectiles/Melee/YateveoBloomProj.png index 87f8d7972f..0b29644221 100644 Binary files a/Projectiles/Melee/YateveoBloomProj.png and b/Projectiles/Melee/YateveoBloomProj.png differ diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.png b/Projectiles/Melee/Yoyos/LaceratorYoyo.png index 723b5cd9c1..19b6b30cfd 100644 Binary files a/Projectiles/Melee/Yoyos/LaceratorYoyo.png and b/Projectiles/Melee/Yoyos/LaceratorYoyo.png differ diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 82d20734fd..a3066f1645 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.ToRadians(90); projectile.localAI[0] += 1f; if (projectile.localAI[0] == 15f) { diff --git a/Projectiles/Ranged/BloodfireArrowProj.png b/Projectiles/Ranged/BloodfireArrowProj.png index 27358b7594..495f11392e 100644 Binary files a/Projectiles/Ranged/BloodfireArrowProj.png and b/Projectiles/Ranged/BloodfireArrowProj.png differ diff --git a/Projectiles/Ranged/BloodfireBullet.png b/Projectiles/Ranged/BloodfireBullet.png index 8bf58f71c3..53c3c26f74 100644 Binary files a/Projectiles/Ranged/BloodfireBullet.png and b/Projectiles/Ranged/BloodfireBullet.png differ diff --git a/Projectiles/Rogue/BloodsoakedCrashax.png b/Projectiles/Rogue/BloodsoakedCrashax.png index 9406101582..1d8b42d1cf 100644 Binary files a/Projectiles/Rogue/BloodsoakedCrashax.png and b/Projectiles/Rogue/BloodsoakedCrashax.png differ diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index a08e5df2b2..22dec12228 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -114,7 +114,8 @@ namespace CalamityMod.Projectiles.Summon projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + MathHelper.Pi; + projectile.rotation = (vector46 - projectile.Center).ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.ToRadians(180) * projectile.direction); + projectile.spriteDirection *= -1; } else { diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index 6b501625e8..3668dbfcd5 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -86,9 +86,9 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + if (player.gravDir == -1f) { projectile.position.Y = projectile.position.Y + 120f; projectile.rotation = 3.14f; diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index fbbc4e0c43..b0c6d3b1ef 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -100,7 +100,18 @@ namespace CalamityMod.Projectiles.Summon value68 = Main.projectile[chase].Center; num1064 = Main.projectile[chase].rotation; scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; + + // Calculations have a safeguard against division by 0. + float speed = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) + { + speed = Main.projectile[i].velocity.Length(); + break; + } + } + scaleFactor17 = MechwormHead.ComputeDistance(16f, speed); Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; } else diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index 1e637f7a92..e6a56751f1 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -98,10 +98,20 @@ namespace CalamityMod.Projectiles.Summon } } value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; num1064 = Main.projectile[chase].rotation; scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 16f; + + // Calculations have a safeguard against division by 0. + float speed = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) + { + speed = Main.projectile[i].velocity.Length(); + break; + } + } + scaleFactor17 = MechwormHead.ComputeDistance(16f, speed); Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; } else diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 8abc0dd6e4..7854389b83 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + Main.time = 120 * 120; Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); Player player9 = Main.player[projectile.owner]; if (dust > 0) @@ -220,11 +221,22 @@ namespace CalamityMod.Projectiles.Summon spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(21f, 25f); spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Summon/MechwormHeadGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } + /// + /// Determines the distance factor used in mechworm segments to make it adjust based on components of the head. + /// However, eventually even this equation will falter in use. These conditions should never happen with the mechworm, however. + /// + /// The original distance factor. + /// The speed of the mechworm's head. + /// The base of the exponent used in the equation. + /// + public static float ComputeDistance(float initialDistance, float speed, float @base = 0.98f) + { + return initialDistance * (float)Math.Pow(@base, speed); + } } } diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index cfe7a43cae..3684de995d 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -85,7 +85,18 @@ namespace CalamityMod.Projectiles.Summon value68 = Main.projectile[byUUID].Center; num1064 = Main.projectile[byUUID].rotation; float num1063 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); - scaleFactor17 = 16f; + + // Calculations have a safeguard against division by 0. + float speed = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && Main.projectile[i].type == ModContent.ProjectileType()) + { + speed = Main.projectile[i].velocity.Length(); + break; + } + } + scaleFactor17 = MechwormHead.ComputeDistance(16f, speed); scaleFactor18 = num1063; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != ModContent.ProjectileType()) diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 087e4f87b1..5daeba3b35 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = 1; projectile.light = 1f; projectile.timeLeft = 300; + projectile.minion = true; } public override void AI() diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 2f4c8ed7ca..ea988d7a61 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -239,8 +239,8 @@ namespace CalamityMod.Projectiles.Summon } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } if (num651 > 70f) @@ -276,8 +276,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index a8a121a645..dc2d685e63 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 900; projectile.ignoreWater = true; projectile.alpha = 255; + projectile.minion = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30 - @@ -132,9 +133,7 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[1] += 1f; if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) { - int storm = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 1f, 0f); - Main.projectile[storm].minion = true; - Main.projectile[storm].melee = false; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0f, 0f); } if (projectile.localAI[1] >= 120f) { diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 922b667f11..1f086bf8ff 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Projectiles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -46,10 +47,11 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); if (spawnDust) { - projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + modProj.spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 20; for (int num502 = 0; num502 < num501; num502++) { @@ -84,18 +86,16 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - projectile.damage = 70; + //lineColor == 1 means it is spawned from Mollusk Armor rather than the weapon + projectile.damage = (int)((modProj.lineColor == 1 ? 1500f : 70f) * (player.allDamage + player.minionDamage - 1f)); if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * (player.allDamage + player.minionDamage - 1f)); projectile.damage = damage2; } - float[] var0 = projectile.ai; - int var1 = 1; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; + projectile.ai[1] += 1f; Vector2 vector46 = projectile.position; if (!fly) { @@ -125,21 +125,39 @@ namespace CalamityMod.Projectiles.Summon float num633 = 1000f; bool chaseNPC = false; float npcPositionX = 0f; - for (int num645 = 0; num645 < 200; num645++) - { - NPC npcTarget = Main.npc[num645]; - if (npcTarget.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC) - { - num633 = num646; - vector46 = npcTarget.Center; - npcPositionX = npcTarget.position.X; - chaseNPC = true; - } - } - } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC) + { + num633 = num646; + vector46 = npc.Center; + npcPositionX = npc.position.X; + chaseNPC = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC npcTarget = Main.npc[num645]; + if (npcTarget.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !chaseNPC) + { + num633 = num646; + vector46 = npcTarget.Center; + npcPositionX = npcTarget.position.X; + chaseNPC = true; + } + } + } + } if (chaseNPC) { if (npcPositionX - projectile.position.X > 0f) @@ -295,8 +313,8 @@ namespace CalamityMod.Projectiles.Summon projectile.rotation = projectile.velocity.X * 0.03f; if (playerDistance > 1500f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } if (playerDistance < 100f) @@ -335,10 +353,7 @@ namespace CalamityMod.Projectiles.Summon int num988 = 10; bool flag54 = false; bool flag55 = false; - float[] var0 = projectile.localAI; - int var1 = 0; - float num73 = var0[var1]; - var0[var1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; @@ -418,7 +433,7 @@ namespace CalamityMod.Projectiles.Summon int num28 = 10; Point[] array2 = new Point[num28]; int num29 = 0; - for (int l = 0; l < 1000; l++) + for (int l = 0; l < Main.projectile.Length; l++) { if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) { diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 88749010b5..a6d43e2f95 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -363,6 +363,12 @@ namespace CalamityMod.Tiles case 108: item = "PiggyBanner"; break; + case 109: + item = "FearlessGoldfishWarriorBanner"; + break; + case 110: + item = "RadiatorBanner"; + break; default: return; } @@ -708,6 +714,12 @@ namespace CalamityMod.Tiles case 108: type = "Piggy"; break; + case 109: + type = "FearlessGoldfishWarrior"; + break; + case 110: + type = "Radiator"; + break; default: return; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 8143642365..59a49dbb3e 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 5a61865508..6bc03d305b 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1270,8 +1270,10 @@ namespace CalamityMod.World { if (Main.rand.NextBool(50000)) { - if (!NPC.downedBoss1 && bossType == 0) // Only set countdown and boss type if conditions are met - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight)) + // Only set countdown and boss type if conditions are met + // Night time bosses set message only before 11pm. Day time bosses only before 2pm. + if (!NPC.downedBoss1 && bossType == 0) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) { BossText(); bossType = NPCID.EyeofCthulhu; @@ -1337,7 +1339,7 @@ namespace CalamityMod.World if (Main.hardMode) { if (!NPC.downedMechBoss1 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight)) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) { BossText(); bossType = NPCID.TheDestroyer; @@ -1345,7 +1347,7 @@ namespace CalamityMod.World } if (!NPC.downedMechBoss2 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight)) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) { BossText(); bossType = NPCID.Spazmatism; @@ -1353,7 +1355,7 @@ namespace CalamityMod.World } if (!NPC.downedMechBoss3 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight)) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) { BossText(); bossType = NPCID.SkeletronPrime; @@ -1385,7 +1387,7 @@ namespace CalamityMod.World } if (!downedCalamitas && bossType == 0) - if (!Main.dayTime && player.ZoneOverworldHeight) + if (!Main.dayTime && player.ZoneOverworldHeight && Main.time < 12600) { BossText(); bossType = ModContent.NPCType(); @@ -1413,7 +1415,7 @@ namespace CalamityMod.World { if (!downedGuardians && bossType == 0) if (Main.dayTime && (player.ZoneUnderworldHeight || - (player.ZoneHoly && player.ZoneOverworldHeight))) + (player.ZoneHoly && player.ZoneOverworldHeight)) && Main.time < 34200) //only before 2pm { BossText(); bossType = ModContent.NPCType(); @@ -1462,7 +1464,7 @@ namespace CalamityMod.World switch (bossType) { case NPCID.EyeofCthulhu: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight)) + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) canSpawn = false; break; case NPCID.EaterofWorldsHead: @@ -1478,15 +1480,15 @@ namespace CalamityMod.World canSpawn = false; break; case NPCID.TheDestroyer: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight)) + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) canSpawn = false; break; case NPCID.Spazmatism: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight)) + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) canSpawn = false; break; case NPCID.SkeletronPrime: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight)) + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) canSpawn = false; break; case NPCID.Plantera: @@ -1526,7 +1528,7 @@ namespace CalamityMod.World } else if (bossType == ModContent.NPCType()) { - if (Main.dayTime || !player.ZoneOverworldHeight) + if (Main.dayTime || !player.ZoneOverworldHeight || Main.time > 16200) canSpawn = false; } else if (bossType == ModContent.NPCType()) @@ -1543,7 +1545,7 @@ namespace CalamityMod.World else if (bossType == ModContent.NPCType()) { if (!Main.dayTime || (!player.ZoneUnderworldHeight && - (!player.ZoneHoly || !player.ZoneOverworldHeight))) + (!player.ZoneHoly || !player.ZoneOverworldHeight)) || Main.time > 37800) canSpawn = false; } else if (bossType == ModContent.NPCType())