From 6c1bc0e7009d1834d58e207d41200007e95fb809 Mon Sep 17 00:00:00 2001 From: fryzahh Date: Thu, 23 Apr 2026 22:04:21 -0400 Subject: [PATCH] Vomit up miscellaneous upgrades * Disgusting Meat can now remove the following upgrades from the player: * Demon Heart * Celestial Onion * Vital Crystal * Aegis Fruit * Arcane Crystal * Ambrosia * Galaxy Pearl * Gummy Worm * Advanced Combat Techniques * Advanced Combat Techniques: Volume Two * Peddler's Satchel * Artisan Loaf * Torch God's Favor * Minecart Upgrade Kit * Adjusted the tooltip of Disgusting Meat slightly * Adjusted some of Horrible Hog's projectile names --- Items/Tools/DisgustingMeat.cs | 181 +++++++++++------- .../en-US/Mods.CalamityMod.Items.Tools.hjson | 2 +- .../Mods.CalamityMod.Projectiles.Enemy.hjson | 4 +- NPCs/NormalNPCs/HorribleHog.cs | 2 +- 4 files changed, 119 insertions(+), 70 deletions(-) diff --git a/Items/Tools/DisgustingMeat.cs b/Items/Tools/DisgustingMeat.cs index 0e00d1d788..3bebdc00ed 100644 --- a/Items/Tools/DisgustingMeat.cs +++ b/Items/Tools/DisgustingMeat.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Tools { DisgustingMeatAnimationPlayer modPlayer = player.GetModPlayer(); if (player.altFunctionUse == 2) - modPlayer.EjectRevengeanceModeUpgrades = true; + modPlayer.EjectMiscUpgrades = true; modPlayer.DoingVomitAnimation = true; return true; } @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Tools public static int VomitMaxTime => 130; - public bool EjectRevengeanceModeUpgrades = false; + public bool EjectMiscUpgrades = false; public bool DoingVomitAnimation = false; @@ -53,78 +53,21 @@ namespace CalamityMod.Items.Tools public override void UpdateDead() { DoingVomitAnimation = false; - EjectRevengeanceModeUpgrades = false; + EjectMiscUpgrades = false; VomitTime = 0; } public override void PostUpdateMiscEffects() { + if (Player.whoAmI != Main.myPlayer) + return; + if (DoingVomitAnimation) { // Eject all necessary items at once. if (VomitTime == VomitEjectTime) { - var calPlayer = Player.Calamity(); - if (EjectRevengeanceModeUpgrades) - { - // Rage and Adrenaline upgrades. - TryDropBoosterItem(ref calPlayer.rageBoostOne, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.rageBoostTwo, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.rageBoostThree, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); - } - else - { - if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry) - { - // Calamity's health boosters. - TryDropBoosterItem(ref calPlayer.sTangerine, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.mFruit, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.tCloudberry, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.sStrawberry, ModContent.ItemType()); - } - else - { - // Vanilla health boosters. - for (int i = 0; i < Player.ConsumedLifeFruit; i++) - { - int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, ItemID.LifeFruit); - Main.item[drop].noGrabDelay = 100; - Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); - } - Player.ConsumedLifeFruit = 0; - - for (int j = 0; j < Player.ConsumedLifeCrystals; j++) - { - int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, ItemID.LifeCrystal); - Main.item[drop].noGrabDelay = 100; - Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); - } - Player.ConsumedLifeCrystals = 0; - } - - if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart) - { - // Calamity's mana boosters. - TryDropBoosterItem(ref calPlayer.cShard, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.eCore, ModContent.ItemType()); - TryDropBoosterItem(ref calPlayer.pHeart, ModContent.ItemType()); - } - else - { - // Vanilla mana boosters. - for (int k = 0; k < Player.ConsumedManaCrystals; k++) - { - int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, ItemID.ManaCrystal); - Main.item[drop].noGrabDelay = 100; - Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); - } - Player.ConsumedManaCrystals = 0; - } - } - + EjectPermanentUpgrades(); SoundEngine.PlaySound(SoundID.NPCDeath13, Player.Center); } @@ -159,7 +102,7 @@ namespace CalamityMod.Items.Tools { VomitTime = 0; DoingVomitAnimation = false; - EjectRevengeanceModeUpgrades = false; + EjectMiscUpgrades = false; } VomitTime++; @@ -182,12 +125,118 @@ namespace CalamityMod.Items.Tools } } + private void EjectPermanentUpgrades() + { + var calPlayer = Player.Calamity(); + if (EjectMiscUpgrades) + { + // Rage and Adrenaline upgrades. + TryDropBoosterItem(ref calPlayer.rageBoostOne, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.rageBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.rageBoostThree, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); + + // Celestal Onion. + TryDropBoosterItem(ref calPlayer.extraAccessoryML, ModContent.ItemType()); + + // Demon Heart. + TryDropBoosterItem(ref Player.extraAccessory, ItemID.DemonHeart); + + // Shimmer upgrades. + if (Player.usedAegisCrystal || Player.usedAegisFruit || Player.usedArcaneCrystal || Player.usedAmbrosia || Player.usedGalaxyPearl || Player.usedGummyWorm || NPC.peddlersSatchelWasUsed || NPC.combatBookWasUsed || NPC.combatBookVolumeTwoWasUsed) + { + TryDropBoosterItem(ref Player.usedAegisCrystal, ItemID.AegisCrystal); + TryDropBoosterItem(ref Player.usedAegisFruit, ItemID.AegisFruit); + TryDropBoosterItem(ref Player.usedAmbrosia, ItemID.Ambrosia); + TryDropBoosterItem(ref Player.usedGalaxyPearl, ItemID.GalaxyPearl); + TryDropBoosterItem(ref Player.usedGummyWorm, ItemID.GummyWorm); + + // Sync the world data immediately for these three specifically since they aren't fully player side. + if (NPC.peddlersSatchelWasUsed || NPC.combatBookWasUsed || NPC.combatBookVolumeTwoWasUsed) + { + TryDropBoosterItem(ref NPC.peddlersSatchelWasUsed, ItemID.PeddlersSatchel); + TryDropBoosterItem(ref NPC.combatBookWasUsed, ItemID.CombatBook); + TryDropBoosterItem(ref NPC.combatBookVolumeTwoWasUsed, ItemID.CombatBookVolumeTwo); + NetMessage.SendData(MessageID.WorldData); + } + } + + // Artisan Loaf. + TryDropBoosterItem(ref Player.ateArtisanBread, ItemID.ArtisanLoaf); + + // Torch God's Favor. + TryDropBoosterItem(ref Player.unlockedBiomeTorches, ItemID.TorchGodsFavor); + + // Minecart Upgrade Kit. + TryDropBoosterItem(ref Player.unlockedSuperCart, ItemID.MinecartPowerup); + } + else + { + // Calamity health booster fruits. + if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry) + { + TryDropBoosterItem(ref calPlayer.sTangerine, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.mFruit, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.tCloudberry, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.sStrawberry, ModContent.ItemType()); + } + + // Life fruit. + if (Player.ConsumedLifeFruit > 0) + { + for (int i = 0; i < Player.ConsumedLifeFruit; i++) + { + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), ItemID.LifeFruit); + Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); + } + Player.ConsumedLifeFruit = 0; + } + + // Heart crystals. + if (Player.ConsumedLifeCrystals > 0) + { + for (int j = 0; j < Player.ConsumedLifeCrystals; j++) + { + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), ItemID.LifeCrystal); + Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); + } + Player.ConsumedLifeCrystals = 0; + } + + // Calamity mana upgrades. + if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart) + { + TryDropBoosterItem(ref calPlayer.cShard, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.eCore, ModContent.ItemType()); + TryDropBoosterItem(ref calPlayer.pHeart, ModContent.ItemType()); + } + + // Mana Crystals. + if (Player.ConsumedManaCrystals > 0) + { + for (int k = 0; k < Player.ConsumedManaCrystals; k++) + { + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), ItemID.ManaCrystal); + Main.item[drop].noGrabDelay = 100; + Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); + } + Player.ConsumedManaCrystals = 0; + } + } + + NetMessage.SendData(MessageID.SyncPlayer, -1, -1, null, Player.whoAmI); + } + private void TryDropBoosterItem(ref bool condition, int itemType) { if (condition) { condition = false; - int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, itemType); + int drop = Player.QuickSpawnItem(Player.GetSource_DropAsItem(), itemType); Main.item[drop].noGrabDelay = 100; Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f)); } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 935171ee91..39322592bd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -166,7 +166,7 @@ DisgustingMeat: { Tooltip: ''' will remove health and mana upgrades, use with no Calamity upgrades to remove vanilla upgrades - will remove rage and adrenaline upgrades, plus other miscellaneous boosters + will remove Rage and Adrenaline upgrades, plus other miscellaneous boosters such as Demon Heart Removed boosters will be vomited out of you as items ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 722b7159f7..800b3e48a8 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -21,10 +21,10 @@ GammaRayBurst.DisplayName: G-FUEL BEAM GhostBellShock.DisplayName: Electrical Field HorribleHogChargeHitbox.DisplayName: Horrible Hog HorribleHogRubble.DisplayName: Rubble -HorribleHogShockwave.DisplayName: Horrible Shockwave +HorribleHogShockwave.DisplayName: Sinister Swine Shockwave HorribleHogShockwaveSpawner.DisplayName: Horrible Hog Shockwave Spawner HorribleHogVomitBomb.DisplayName: Barf Bomb -HorribleHogVomitChunk.DisplayName: Puked Gore +HorribleHogVomitChunk.DisplayName: Horrible Hog's Leftovers HorribleHogVomitEye.DisplayName: Regurgitated Demon Eye HorribleHogZombieSpawner.DisplayName: Horrible Hog Zombie Spawner HorsPoisonBlast.DisplayName: Poisonous Spit diff --git a/NPCs/NormalNPCs/HorribleHog.cs b/NPCs/NormalNPCs/HorribleHog.cs index 99c603650b..acaeff6720 100644 --- a/NPCs/NormalNPCs/HorribleHog.cs +++ b/NPCs/NormalNPCs/HorribleHog.cs @@ -1827,7 +1827,7 @@ namespace CalamityMod.NPCs.NormalNPCs spriteBatch.End(); } - //string attack = $"{DigTimer}"; + //string attack = $"{(BehaviorState)AIState}"; //Vector2 stringDrawPosition = drawPosition - Vector2.UnitY * 64f; //ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.MouseText.Value, attack, stringDrawPosition, Color.LawnGreen, 0f, Vector2.One, Vector2.One);