From 8e887c0c2113bca38eee15e2f1c5e9dbcd8b6645 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 19 Sep 2021 18:25:38 -0500 Subject: [PATCH] 1 - Crabulon, Astrum Aureus and Ravager can now walk on platforms. 2 - True melee damage tooltip only displays on true melee weapons. 3 - True melee code adjustments to make it better. --- CalamityLists.cs | 69 ----------------- ILEditing/ILChanges.cs | 14 +++- Items/CalamityGlobalItem.cs | 57 +++++++++++++- Items/CalamityGlobalItemTooltip.cs | 4 +- Items/Tools/MarniteObliterator.cs | 3 +- .../DraedonsArsenal/HydraulicVoltCrasher.cs | 1 + Items/Weapons/Melee/AstralPike.cs | 3 +- Items/Weapons/Melee/Brimlance.cs | 3 +- Items/Weapons/Melee/DevilsSunrise.cs | 3 +- Items/Weapons/Melee/DiseasedPike.cs | 3 +- Items/Weapons/Melee/DragonRage.cs | 3 +- Items/Weapons/Melee/ExsanguinationLance.cs | 3 +- Items/Weapons/Melee/FulgurationHalberd.cs | 3 +- Items/Weapons/Melee/GildedProboscis.cs | 3 +- Items/Weapons/Melee/MarniteSpear.cs | 3 +- Items/Weapons/Melee/Murasama.cs | 1 + Items/Weapons/Melee/Omniblade.cs | 3 +- Items/Weapons/Melee/PhosphorescentGauntlet.cs | 1 + Items/Weapons/Melee/SausageMaker.cs | 3 +- Items/Weapons/Melee/YateveoBloom.cs | 3 +- NPCs/CalamityAI.cs | 77 +++++++++++-------- NPCs/CalamityGlobalAI.cs | 10 +-- NPCs/Crabulon/CrabulonIdle.cs | 68 ++++++++-------- NPCs/Ravager/RavagerBody.cs | 63 ++++++++------- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 12 +-- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 2 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 2 +- Projectiles/Boss/ArtemisLaserBeamStart.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 48 +++++++++++- .../HydraulicVoltCrasherProjectile.cs | 1 + Projectiles/Melee/DevilsSunriseProj.cs | 2 +- Projectiles/Melee/DragonRageStaff.cs | 1 + Projectiles/Melee/MarniteObliteratorProj.cs | 2 +- Projectiles/Melee/MurasamaSlash.cs | 2 +- .../Melee/Spears/AmidiasTridentProj.cs | 1 - Projectiles/Melee/Spears/AstralPikeProj.cs | 2 +- Projectiles/Melee/Spears/BansheeHookProj.cs | 1 - Projectiles/Melee/Spears/BrimlanceProj.cs | 2 +- Projectiles/Melee/Spears/DiseasedPikeSpear.cs | 2 +- Projectiles/Melee/Spears/EarthenPikeSpear.cs | 1 - .../Spears/ExsanguinationLanceProjectile.cs | 2 +- .../Melee/Spears/FulgurationHalberdProj.cs | 2 +- .../Melee/Spears/GildedProboscisProj.cs | 2 +- .../Melee/Spears/GoldplumeSpearProjectile.cs | 1 - .../Spears/HellionFlowerSpearProjectile.cs | 1 - .../Melee/Spears/InsidiousImpalerProj.cs | 1 - .../Melee/Spears/MarniteSpearProjectile.cs | 2 +- Projectiles/Melee/Spears/NadirSpear.cs | 1 - Projectiles/Melee/Spears/SausageMakerSpear.cs | 2 +- .../Melee/Spears/SpatialLanceProjectile.cs | 1 - .../Melee/Spears/StarnightLanceProjectile.cs | 1 - Projectiles/Melee/Spears/StreamGougeProj.cs | 1 - .../Melee/Spears/TenebreusTidesProjectile.cs | 1 - .../Melee/Spears/TerraLanceProjectile.cs | 1 - .../Melee/Spears/UrchinSpearProjectile.cs | 1 - Projectiles/Melee/Spears/YateveoBloomSpear.cs | 2 +- Projectiles/Melee/TaintedBladeSlasher.cs | 1 + Projectiles/Typeless/YanmeisKnifeSlash.cs | 3 - 58 files changed, 285 insertions(+), 228 deletions(-) diff --git a/CalamityLists.cs b/CalamityLists.cs index a959c6f8df..28188e69eb 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod public class CalamityLists { public static IList donatorList; - public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D public static List rangedProjectileExceptionList; public static List projectileDestroyExceptionList; public static List projectileMinionList; @@ -515,73 +514,6 @@ namespace CalamityMod "James" }; - trueMeleeProjectileList = new List() - { - // Vanilla shit - ProjectileID.Spear, - ProjectileID.Trident, - ProjectileID.TheRottedFork, - ProjectileID.Swordfish, - ProjectileID.Arkhalis, - ProjectileID.DarkLance, - ProjectileID.CobaltNaginata, - ProjectileID.PalladiumPike, - ProjectileID.MythrilHalberd, - ProjectileID.OrichalcumHalberd, - ProjectileID.AdamantiteGlaive, - ProjectileID.TitaniumTrident, - ProjectileID.MushroomSpear, - ProjectileID.Gungnir, - ProjectileID.ObsidianSwordfish, - ProjectileID.MonkStaffT1, - ProjectileID.MonkStaffT2, - - // Tools - ProjectileID.CobaltDrill, - ProjectileID.MythrilDrill, - ProjectileID.AdamantiteDrill, - ProjectileID.PalladiumDrill, - ProjectileID.OrichalcumDrill, - ProjectileID.TitaniumDrill, - ProjectileID.ChlorophyteDrill, - ProjectileID.CobaltChainsaw, - ProjectileID.MythrilChainsaw, - ProjectileID.AdamantiteChainsaw, - ProjectileID.PalladiumChainsaw, - ProjectileID.OrichalcumChainsaw, - ProjectileID.TitaniumChainsaw, - ProjectileID.ChlorophyteChainsaw, - ProjectileID.VortexDrill, - ProjectileID.VortexChainsaw, - ProjectileID.NebulaDrill, - ProjectileID.NebulaChainsaw, - ProjectileID.SolarFlareDrill, - ProjectileID.SolarFlareChainsaw, - ProjectileID.StardustDrill, - ProjectileID.StardustChainsaw, - ProjectileID.Hamdrax, - ProjectileID.ChlorophyteJackhammer, - ProjectileID.SawtoothShark, - ProjectileID.ButchersChainsaw, - - // Calamity shit - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - rangedProjectileExceptionList = new List() { ProjectileID.Phantasm, @@ -2956,7 +2888,6 @@ namespace CalamityMod public static void UnloadLists() { donatorList = null; - trueMeleeProjectileList = null; rangedProjectileExceptionList = null; projectileDestroyExceptionList = null; projectileMinionList = null; diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 693201e942..60c3f9ba6d 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -2,6 +2,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Ravager; using CalamityMod.Projectiles; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.World; @@ -127,7 +130,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.AddBuff += AllowBuffTimeStackingForManaBurn; // Ravager platform fall fix - + On.Terraria.NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; // Damage and health balance IL.Terraria.Main.DamageVar += AdjustDamageVariance; @@ -337,6 +340,15 @@ namespace CalamityMod.ILEditing return orig(i, j, forced); } + private static bool EnableCalamityBossPlatformCollision(On.Terraria.NPC.orig_Collision_DecideFallThroughPlatforms orig, NPC self) + { + if ((self.type == ModContent.NPCType() || self.type == ModContent.NPCType() || self.type == ModContent.NPCType()) && + self.target >= 0 && Main.player[self.target].position.Y > self.position.Y + self.height) + return true; + + return orig(self); + } + private static void DisableTeleporters(On.Terraria.Wiring.orig_Teleport orig) { if (CalamityPlayer.areThereAnyDamnBosses) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 49382c01e9..020e63fb74 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Items public bool devItem = false; public bool challengeDrop = false; public bool canFirePointBlankShots = false; + public bool trueMelee = false; // See RogueWeapon.cs for rogue modifier shit #region Modifiers @@ -204,6 +205,42 @@ namespace CalamityMod.Items canFirePointBlankShots = true; break; + // Set projectile true melee items to be true melee, this is so bosses know when the player is using a true melee projectile weapon + case ItemID.Spear: + case ItemID.Trident: + case ItemID.PalladiumPike: + case ItemID.ObsidianSwordfish: + case ItemID.CobaltDrill: + case ItemID.MythrilDrill: + case ItemID.AdamantiteDrill: + case ItemID.PalladiumDrill: + case ItemID.OrichalcumDrill: + case ItemID.TitaniumDrill: + case ItemID.ChlorophyteDrill: + case ItemID.CobaltChainsaw: + case ItemID.MythrilChainsaw: + case ItemID.AdamantiteChainsaw: + case ItemID.PalladiumChainsaw: + case ItemID.OrichalcumChainsaw: + case ItemID.TitaniumChainsaw: + case ItemID.ChlorophyteChainsaw: + case ItemID.VortexDrill: + case ItemID.VortexChainsaw: + case ItemID.NebulaDrill: + case ItemID.NebulaChainsaw: + case ItemID.SolarFlareDrill: + case ItemID.SolarFlareChainsaw: + case ItemID.StardustDrill: + case ItemID.StardustChainsaw: + case ItemID.Drax: + case ItemID.ChlorophyteJackhammer: + case ItemID.SawtoothShark: + case ItemID.Arkhalis: + case ItemID.ButchersChainsaw: + case ItemID.MonkStaffT2: + trueMelee = true; + break; + case ItemID.Dynamite: case ItemID.StickyDynamite: case ItemID.BouncyDynamite: @@ -313,6 +350,7 @@ namespace CalamityMod.Items break; case ItemID.AdamantiteGlaive: + trueMelee = true; item.damage = 65; item.shootSpeed *= 1.25f; break; @@ -322,25 +360,30 @@ namespace CalamityMod.Items break; case ItemID.CobaltNaginata: + trueMelee = true; item.damage = 90; break; case ItemID.Gungnir: + trueMelee = true; item.damage = 92; item.shootSpeed *= 1.25f; break; case ItemID.MythrilHalberd: + trueMelee = true; item.damage = 95; item.shootSpeed *= 1.25f; break; case ItemID.OrichalcumHalberd: + trueMelee = true; item.damage = 98; item.shootSpeed *= 1.25f; break; case ItemID.TitaniumTrident: + trueMelee = true; item.damage = 72; item.shootSpeed *= 1.25f; break; @@ -350,18 +393,22 @@ namespace CalamityMod.Items break; case ItemID.TheRottedFork: + trueMelee = true; item.damage = 20; break; case ItemID.Swordfish: + trueMelee = true; item.damage = 38; break; case ItemID.DarkLance: + trueMelee = true; item.damage = 68; break; case ItemID.MushroomSpear: + trueMelee = true; item.damage = 100; break; @@ -407,6 +454,7 @@ namespace CalamityMod.Items break; case ItemID.MonkStaffT1: + trueMelee = true; item.damage = 110; break; @@ -819,7 +867,7 @@ namespace CalamityMod.Items #region SavingAndLoading public override bool NeedsSaving(Item item) { - return rogue || canFirePointBlankShots || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; + return rogue || canFirePointBlankShots || trueMelee || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; } public override TagCompound Save(Item item) @@ -833,7 +881,8 @@ namespace CalamityMod.Items ["reforgeTier"] = reforgeTier, ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0, ["DischargeEnchantExhaustion"] = DischargeEnchantExhaustion, - ["canFirePointBlankShots"] = canFirePointBlankShots + ["canFirePointBlankShots"] = canFirePointBlankShots, + ["trueMelee"] = trueMelee }; } @@ -841,6 +890,7 @@ namespace CalamityMod.Items { rogue = tag.GetBool("rogue"); canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); + trueMelee = tag.GetBool("trueMelee"); timesUsed = tag.GetInt("timesUsed"); customRarity = (CalamityRarity)tag.GetInt("rarity"); @@ -874,6 +924,7 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); rogue = flags[0]; canFirePointBlankShots = flags[1]; + trueMelee = flags[2]; } else { @@ -886,6 +937,7 @@ namespace CalamityMod.Items BitsByte flags = new BitsByte(); flags[0] = rogue; flags[1] = canFirePointBlankShots; + flags[2] = trueMelee; writer.Write(flags); writer.Write((int)customRarity); @@ -901,6 +953,7 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); rogue = flags[0]; canFirePointBlankShots = flags[1]; + trueMelee = flags[2]; customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 9a9e187d7f..c71b0ab10a 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Items if (nameLine != null) ApplyRarityColor(item, nameLine); - // If the item is melee, add a true melee damage number adjacent to the standard damage number. - if (item.melee && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D) + // If the item is true melee, add a true melee damage number adjacent to the standard damage number. + if (item.melee && (item.shoot == ProjectileID.None || trueMelee) && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D) TrueMeleeDamageTooltip(item, tooltips); // Modify all vanilla tooltips before appending mod mechanics (if any). diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 15f438f125..7c47be1e83 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Tools item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 40f; - } + item.Calamity().trueMelee = true; + } public override void AddRecipes() { diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index a0733635b6..96311baab1 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.melee = true; item.channel = true; + modItem.trueMelee = true; modItem.UsesCharge = true; modItem.MaxCharge = 85f; modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 70de4755f0..f2220b17a8 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - } + item.Calamity().trueMelee = true; + } // Terraria seems to really dislike high crit values in SetDefaults public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index 81c28ce962..6f145669ee 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index 9ddc1e4168..85facd6e4d 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -36,7 +36,8 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Turquoise; item.Calamity().donorItem = true; - item.shoot = ModContent.ProjectileType(); + item.Calamity().trueMelee = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; } diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index 096fd9403f..a7988c2481 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 87d83b467d..3e2e7036c9 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Violet; - } + item.Calamity().trueMelee = true; + } } } diff --git a/Items/Weapons/Melee/ExsanguinationLance.cs b/Items/Weapons/Melee/ExsanguinationLance.cs index e142c93180..82160962de 100644 --- a/Items/Weapons/Melee/ExsanguinationLance.cs +++ b/Items/Weapons/Melee/ExsanguinationLance.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index 8a9059267d..9b4dd908ec 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.value = Item.buyPrice(0, 36, 0, 0); item.rare = ItemRarityID.Pink; item.shootSpeed = 8f; - } + item.Calamity().trueMelee = true; + } public override bool AltFunctionUse(Player player) { diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index e3892577bc..45e411a0e3 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Melee/MarniteSpear.cs b/Items/Weapons/Melee/MarniteSpear.cs index 0084cb1ec6..214bba9f81 100644 --- a/Items/Weapons/Melee/MarniteSpear.cs +++ b/Items/Weapons/Melee/MarniteSpear.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 49d498e579..24abe58de2 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.Violet; Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 14)); + item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 566097b9bd..39fae23d88 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.rare = ItemRarityID.Yellow; - } + item.Calamity().trueMelee = true; + } // Terraria seems to really dislike high crit values in SetDefaults public override void GetWeaponCrit(Player player, ref int crit) => crit += 45; diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.cs b/Items/Weapons/Melee/PhosphorescentGauntlet.cs index 8c977ce9b8..6c67ff0990 100644 --- a/Items/Weapons/Melee/PhosphorescentGauntlet.cs +++ b/Items/Weapons/Melee/PhosphorescentGauntlet.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().trueMelee = true; } // Terraria seems to really dislike high crit values in SetDefaults. diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index bcd63e15e9..47f2b94d96 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; - } + item.Calamity().trueMelee = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index a50307d9a7..c58001d435 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -45,7 +45,8 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = ShootSpeed; - } + item.Calamity().trueMelee = true; + } public override bool AltFunctionUse(Player player) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 95348faf79..20642a3efd 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1637,7 +1637,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num824 *= 0.5f; } @@ -1753,7 +1753,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num833 *= 0.5f; } @@ -2773,7 +2773,7 @@ namespace CalamityMod.NPCs // Increase defense npc.defense = npc.defDefense; - // Stop colliding with tiles + // Stop colliding with tiles npc.noTileCollide = true; // Set AI to next phase (Walk) and reset other AI @@ -2782,8 +2782,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.netUpdate = true; } - - CustomGravity(); + else + CustomGravity(); } // Walk @@ -2815,41 +2815,50 @@ namespace CalamityMod.NPCs npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; } - // Walk through tiles if colliding with tiles and player is out of reach - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); - - bool flag52 = false; - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) - flag52 = true; - - if (flag52) + if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height) { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; - - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; + CustomGravity(); + npc.noTileCollide = false; } else { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + npc.noTileCollide = true; + // Walk through tiles if colliding with tiles and player is out of reach + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); - if (npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else + bool flag52 = false; + if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) + flag52 = true; + + if (flag52) + { npc.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = 0f; + + if (npc.velocity.Y > -0.2) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; + + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; + + if (npc.velocity.Y < 0.1) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } } // Walk for a maximum of 6 seconds diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 2fdfc7d835..cbb87976d1 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -5401,7 +5401,7 @@ namespace CalamityMod.NPCs num422 = 0.175f; } // Reduce acceleration if target is holding a true melee weapon - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num421 *= 0.75f; num422 *= 0.5f; @@ -5512,7 +5512,7 @@ namespace CalamityMod.NPCs num431 = 0.25f; } // Reduce acceleration if target is holding a true melee weapon - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num430 *= 0.75f; num431 *= 0.5f; @@ -5974,7 +5974,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num399 *= 0.75f; num400 *= 0.5f; @@ -6084,7 +6084,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num409 *= 0.75f; num410 *= 0.5f; @@ -7409,7 +7409,7 @@ namespace CalamityMod.NPCs // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { acceleration *= 0.5f; } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index f3847667e7..3af7137de0 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -280,41 +280,49 @@ namespace CalamityMod.NPCs.Crabulon npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height) + { + npc.noGravity = false; + npc.noTileCollide = false; + } + else + { + npc.noGravity = true; + npc.noTileCollide = true; - bool fallDownOnTopOfTarget = npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f; - if (fallDownOnTopOfTarget) - { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (num854 / 2), npc.position.Y + npc.height - num855); - if (npc.velocity.Y > -0.2f) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; + bool fallDownOnTopOfTarget = npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f; + if (fallDownOnTopOfTarget) + { + npc.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y = 0f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + if (npc.velocity.Y > -0.2f) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < 0.1f) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; - if (npc.ai[1] % 25f == 24f) - npc.netUpdate = true; + if (npc.velocity.Y < 0.1f) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } + } npc.ai[1] += 1f; if (npc.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 778a105e52..3663b12bae 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -170,6 +170,8 @@ namespace CalamityMod.NPCs.Ravager bool immunePhase = headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive; bool finalPhase = !leftClawActive && !rightClawActive && !headActive && !leftLegActive && !rightLegActive && expertMode; + bool phase2 = npc.ai[0] == 2f; + bool reduceFallSpeed = npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y; if (immunePhase) { @@ -306,10 +308,16 @@ namespace CalamityMod.NPCs.Ravager } } - if (npc.ai[0] == 0f) - { - npc.noTileCollide = false; + if (npc.noTileCollide && !player.dead) + { + if (npc.velocity.Y > 0f && npc.Bottom.Y > player.Top.Y) + npc.noTileCollide = false; + else if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; + } + if (npc.ai[0] == 0f) + { if (npc.velocity.Y == 0f) { npc.velocity.X *= 0.8f; @@ -335,10 +343,14 @@ namespace CalamityMod.NPCs.Ravager float jumpGateValue = 180f; if (npc.ai[1] >= jumpGateValue) - npc.ai[1] = -20f; - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(); + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + npc.noTileCollide = true; + + npc.TargetClosest(); bool shouldFall = player.position.Y >= npc.Bottom.Y; float velocityXBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); @@ -353,7 +365,7 @@ namespace CalamityMod.NPCs.Ravager if (distanceBelowTarget > 0f) calamityGlobalNPC.newAI[1] += 1f + distanceBelowTarget * multiplier; - float speedMultLimit = malice ? 4f : 3f; + float speedMultLimit = malice ? 3f : 2f; if (calamityGlobalNPC.newAI[1] > speedMultLimit) calamityGlobalNPC.newAI[1] = speedMultLimit; @@ -363,7 +375,6 @@ namespace CalamityMod.NPCs.Ravager if (expertMode && !finalPhase) { - npc.noTileCollide = true; if (shouldFall) velocityY = 1f; @@ -382,19 +393,16 @@ namespace CalamityMod.NPCs.Ravager } if (finalPhase) - { - npc.noTileCollide = true; calamityGlobalNPC.newAI[2] = player.direction; - } float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; npc.velocity.X = velocityX * npc.direction; - npc.velocity.Y = velocityY; + npc.velocity.Y = velocityY; - npc.ai[0] = finalPhase ? 2f : 1f; - npc.ai[1] = 0f; + npc.ai[0] = finalPhase ? 2f : 1f; + npc.ai[1] = 0f; } } @@ -460,21 +468,12 @@ namespace CalamityMod.NPCs.Ravager } else { - // Fall through - if (!player.dead && expertMode) - { - if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; - } - Vector2 targetVector = player.position; float aimY = targetVector.Y - 640f; float distanceFromTargetPos = Math.Abs(npc.Top.Y - aimY); bool inRange = npc.Top.Y <= aimY + 160f && npc.Top.Y >= aimY - 16f; - if (npc.ai[0] == 2f && npc.ai[1] == 0f) + if (phase2 && npc.ai[1] == 0f) { calamityGlobalNPC.newAI[3] += 1f; @@ -492,7 +491,7 @@ namespace CalamityMod.NPCs.Ravager } float maxOffset = death ? 320f * (1f - lifeRatio) : 240f * (1f - lifeRatio); - float offset = npc.ai[0] == 2f ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; + float offset = phase2 ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; // Set offset to 0 if the target stops moving if (Math.Abs(player.velocity.X) < 0.5f) @@ -504,7 +503,7 @@ namespace CalamityMod.NPCs.Ravager { npc.damage = npc.defDamage; - if (npc.ai[0] == 2f) + if (phase2) { float stopBeforeFallTime = malice ? 25f : 30f; if (expertMode) @@ -565,7 +564,7 @@ namespace CalamityMod.NPCs.Ravager if (!leftLegActive) velocityX += 1f; - if (npc.ai[0] == 2f) + if (phase2) { npc.damage = 0; velocityXChange *= velocityMult; @@ -589,8 +588,8 @@ namespace CalamityMod.NPCs.Ravager void CustomGravity() { - float gravity = npc.ai[0] == 2f ? 0f : 0.45f; - float maxFallSpeed = npc.ai[0] == 2f ? 24f : 15f; + float gravity = phase2 ? 0f : 0.45f; + float maxFallSpeed = reduceFallSpeed ? 12f : phase2 ? 24f : 15f; if (malice) { gravity *= 1.25f; @@ -608,14 +607,14 @@ namespace CalamityMod.NPCs.Ravager player = Main.player[npc.target]; if (npc.target <= 0 || npc.target == 255 || player.dead || !player.active) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; } int distanceFromTarget = 5600; if (Vector2.Distance(npc.Center, player.Center) > distanceFromTarget) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (Vector2.Distance(npc.Center, player.Center) > distanceFromTarget) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index e41177f379..0682c18212 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1367,7 +1367,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num824 *= 0.5f; } @@ -1619,7 +1619,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num413 *= 0.5f; } @@ -1735,7 +1735,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.HeldItem; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num833 *= 0.5f; } @@ -2021,7 +2021,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num824 *= 0.5f; } @@ -2266,7 +2266,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num413 *= 0.5f; } @@ -2383,7 +2383,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num833 *= 0.5f; } diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index af55c1e4bf..d0e44b7c2f 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num677 *= 0.5f; } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 3f626975e3..c7e8334fa4 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { num677 *= 0.5f; } diff --git a/Projectiles/Boss/ArtemisLaserBeamStart.cs b/Projectiles/Boss/ArtemisLaserBeamStart.cs index 5c0a5627e7..0e1a085baf 100644 --- a/Projectiles/Boss/ArtemisLaserBeamStart.cs +++ b/Projectiles/Boss/ArtemisLaserBeamStart.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss // The direction of the host NPC. Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); - // Offset to move the beam forward so that it starts inside the NPC's mouth. + // Offset to move the beam forward so that it starts in Artemis' focus jewel thing. float beamStartForwardsOffset = -70f; // Set the starting location of the beam to the center of the NPC. diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index a6b5708cd6..4babe3c05d 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -128,11 +128,50 @@ namespace CalamityMod.Projectiles #region SetDefaults public override void SetDefaults(Projectile projectile) { - if (CalamityLists.trueMeleeProjectileList.Contains(projectile.type)) - trueMelee = true; - switch (projectile.type) { + case ProjectileID.Spear: + case ProjectileID.Trident: + case ProjectileID.TheRottedFork: + case ProjectileID.Swordfish: + case ProjectileID.DarkLance: + case ProjectileID.CobaltNaginata: + case ProjectileID.PalladiumPike: + case ProjectileID.MythrilHalberd: + case ProjectileID.OrichalcumHalberd: + case ProjectileID.AdamantiteGlaive: + case ProjectileID.TitaniumTrident: + case ProjectileID.MushroomSpear: + case ProjectileID.Gungnir: + case ProjectileID.ObsidianSwordfish: + case ProjectileID.CobaltDrill: + case ProjectileID.MythrilDrill: + case ProjectileID.AdamantiteDrill: + case ProjectileID.PalladiumDrill: + case ProjectileID.OrichalcumDrill: + case ProjectileID.TitaniumDrill: + case ProjectileID.ChlorophyteDrill: + case ProjectileID.CobaltChainsaw: + case ProjectileID.MythrilChainsaw: + case ProjectileID.AdamantiteChainsaw: + case ProjectileID.PalladiumChainsaw: + case ProjectileID.OrichalcumChainsaw: + case ProjectileID.TitaniumChainsaw: + case ProjectileID.ChlorophyteChainsaw: + case ProjectileID.VortexDrill: + case ProjectileID.VortexChainsaw: + case ProjectileID.NebulaDrill: + case ProjectileID.NebulaChainsaw: + case ProjectileID.SolarFlareDrill: + case ProjectileID.SolarFlareChainsaw: + case ProjectileID.StardustDrill: + case ProjectileID.StardustChainsaw: + case ProjectileID.Hamdrax: + case ProjectileID.ChlorophyteJackhammer: + case ProjectileID.SawtoothShark: + trueMelee = true; + break; + case ProjectileID.Bullet: case ProjectileID.MeteorShot: case ProjectileID.BulletHighVelocity: @@ -203,10 +242,12 @@ namespace CalamityMod.Projectiles case ProjectileID.Arkhalis: case ProjectileID.ButchersChainsaw: + trueMelee = true; projectile.scale = 1.5f; break; case ProjectileID.MonkStaffT1: + trueMelee = true; projectile.scale = 3f; break; @@ -227,6 +268,7 @@ namespace CalamityMod.Projectiles break; case ProjectileID.MonkStaffT2: + trueMelee = true; projectile.idStaticNPCHitCooldown = 18; break; diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 02b81cda59..16b2386702 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.ownerHitCheck = true; projectile.melee = true; projectile.scale = 1.75f; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 6f943b40c1..36b7919c34 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 57c21c93f0..8fa94959c9 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; + projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index ae875ee8fc..f685f7f62a 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.ownerHitCheck = true; projectile.melee = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 80058e9f6c..ef161d7879 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 21; projectile.frameCounter = 0; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index e6ed3edefe..3beca2fd09 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index 4a9f04712d..94ca091c53 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 90d4974778..3b95119831 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; projectile.alpha = 255; - //projectile.Calamity().trueMelee = true; } public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index 4d75f0be6e..e256a4389d 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index c320e0737f..5dad1b6d03 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index 6f70ba1bbd..7bb7360f06 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index ad14606432..52303501c0 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; diff --git a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs index 91551c48ee..67a26ee483 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 4526ffab88..a32f26c39c 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } // These numbers sure are common, huh? yeah, they are diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 49bd3f8949..784facd3d5 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index 2405eb9ebe..b7080ec2c9 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index ebca48c63d..dfec53513a 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 6cbde975c3..4f8192da22 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 61e4138a06..2c3ba98ec3 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 5.5f; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index c375b431af..d2f7c8499f 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index bd0454caaa..37cae1e3fa 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 7; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 2ffb51c4fb..083414ef43 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index 9096c3e3ee..c4a0b6fd58 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index 755b3b173d..1713ccaee7 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 15; } diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 1353d9b72c..7172dcf6ab 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index 0157170e2b..9401b5637c 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 5220848d6b..9da2f9ca74 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - //projectile.Calamity().trueMelee = true; + projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 52ada7ce59..e09d257afe 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -118,6 +118,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 90000; projectile.usesLocalNPCImmunity = true; projectile.noEnchantments = true; + projectile.Calamity().trueMelee = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index 346fbfc9d2..0ea7c02233 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -51,9 +51,6 @@ namespace CalamityMod.Projectiles.Typeless projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; - - // Not considered true melee to prevent Titan Scale from triggering. - // projectile.Calamity().trueMelee = true; } public override void AI()