From 27898f341ac9fe2c2d5a5d1c7b21605e281205f4 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sun, 11 Jan 2026 16:48:13 +0100 Subject: [PATCH] first successful calamity boss perk integration --- Buffs/ShroomGlowDebuff.cs | 18 ++++++++ Buffs/ShroomGlowDebuff.png | Bin 0 -> 1605 bytes Changes/BossKillListener.cs | 63 +++++++++++++++------------ Changes/SummonerOnHitEffects.cs | 9 +++- Items/SummonersAmbition.cs | 12 +++++ Localization/en-US_Mods.YHTMod.hjson | 15 ++++++- YHTMod.csproj | 5 +++ YhtPlayer.cs | 4 ++ build.txt | 1 + 9 files changed, 97 insertions(+), 30 deletions(-) create mode 100644 Buffs/ShroomGlowDebuff.cs create mode 100644 Buffs/ShroomGlowDebuff.png diff --git a/Buffs/ShroomGlowDebuff.cs b/Buffs/ShroomGlowDebuff.cs new file mode 100644 index 0000000..9c0bc7e --- /dev/null +++ b/Buffs/ShroomGlowDebuff.cs @@ -0,0 +1,18 @@ + +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace YHTMod.Buffs; + +public class ShroomGlowDebuff : ModBuff { + public override void SetStaticDefaults() { + Main.debuff[Type] = true; + } + + public override void Update(NPC npc, ref int buffIndex) { + if (Main.netMode == NetmodeID.MultiplayerClient || Main.netMode == NetmodeID.SinglePlayer) { // client-only + Lighting.AddLight(npc.Center, 0.1f, 0.3f, 0.6f); + } + } +} diff --git a/Buffs/ShroomGlowDebuff.png b/Buffs/ShroomGlowDebuff.png new file mode 100644 index 0000000000000000000000000000000000000000..8e27abd25ffe5a235cd453245f769665207c24f3 GIT binary patch literal 1605 zcmV-L2DCXyg~w8X4Jtb%_#arXV8H@SX2p^PtoRSu zfP@MX1>`XxN}GyJ8|6nsX&c#OJf2C$^XvV*k9%e`$cgQVs}{JL^X_}^+;hI)bMC$8 zzA^bfxBm%&*VY^5)8hQx35>y{AIl$ZFVy7zBod!1fukT^YE(pA#rD_N>(_vf-;G6)74@}3FpQxgzS5doH{Wq!THM8I>Y!D`cE z{V;_llu z(NB^y6Oe@^QQCI4?dHsiqbM)8UCswyW#y5}tF0m%%Hv^QadWv(oHuGMFDgr>J`(|n zTGAZn+4K{$Jlk-#to)*2>ok~E!Wv=bO zsI0au~@n4QG6bWj6ogt8;U_*@gNt|@lytNQVnc{*nS#tjn6Rx@=^|w#VA+F z87Xr*rPCL|Er|xwaMatn(z!Y_sm_2z9foRCGAAU)G8#GgdW?Xn50gUQDlbP4i@_AL zUxdO6*i)nQt90bBZ>M@!xJ+dhg~Z%0ICi<|B^9w3Icp|No@ldyTkH90Z4hU8p+VAP znEKot!^JoIG89dd3#rS6j!UU$laEaL&x@N8l8|UxGEg1uwL6OzY@Zx*^Z>EaroO&WMAX8H~?{vt+^4?jQS&jU=)xfp)u1 z{VfRFPr6FMSVIUx$^;C5kPBQj(AhdiaMHrP$dNUy@bn zPZRT~LZTOgC^0tY2M&9=n0uv^NJlS)r}Z9K9!%?EH1`z^{2F}e2O}aEFVAtloWr@E7pWFCo^1Y`q@5MaXG6 z{|&hMV_3ZGF&AVQHX`M0z_2zjp&cV2V`U-6rXsWy{esOyU6@+VArEiy9}>NPLQhYL z5V5Bi?hyaH-XSbuWKari5>q|3B%eq?NZ5*Mm}LZ{bUmA%qd0I{LlW=(1m5}KC>#5K z8D+#N!3*C8PjA_4YL?l2P$@nwTdk#OT-e7OqQ)?bR{_%)aX4 zGWM# zh$H`js~#k^=5);7OvoK?z^)Yy<>TU@x;qu}aVcQei)tN1ZHfID=(K(!0RbNy z%FdAc$Vzv*MpFINojF4Yz46ifu$Srj?cD_6`!n00v1!K~w_(OjopDbuN BossIds = new(); + + public override void Load() { + BossIds.Add(NPCID.KingSlime, "king_slime"); + BossIds.Add(NPCID.EyeofCthulhu, "eye_of_cthulhu"); + BossIds.Add(NPCID.EaterofWorldsHead, "eater_of_worlds"); + BossIds.Add(NPCID.EaterofWorldsBody, "eater_of_worlds"); + BossIds.Add(NPCID.EaterofWorldsTail, "eater_of_worlds"); + BossIds.Add(NPCID.BrainofCthulhu, "brain_of_cthulhu"); + BossIds.Add(NPCID.Deerclops, "deerclops"); + BossIds.Add(NPCID.QueenBee, "queen_bee"); + BossIds.Add(NPCID.SkeletronHead, "skeletron"); + BossIds.Add(NPCID.WallofFlesh, "wall_of_flesh"); + + if (ModLoader.HasMod("CalamityMod")) { + BossIds.Add(ModContent.NPCType(), "desert_scourge"); + BossIds.Add(ModContent.NPCType(), "crabulon"); + } + } + public override void OnKill(NPC npc) { - switch (npc.type) { - case NPCID.KingSlime: - HandleBossKill(npc, "king_slime"); - break; - case NPCID.EyeofCthulhu: - HandleBossKill(npc, "eye_of_cthulhu"); - break; - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: + string id = BossIds.GetValueOrDefault(npc.type, null); + switch (id) { + case null: + base.OnKill(npc); + return; + case "eater_of_worlds": { int foundEaterSegments = 0; foreach (NPC activeNpC in Main.ActiveNPCs) { if (activeNpC.friendly || activeNpC.townNPC) continue; @@ -28,26 +48,15 @@ public class BossKillListener : GlobalNPC { ) continue; if (++foundEaterSegments > 1) break; } - - HandleBossKill(npc, "eater_of_worlds"); - break; - case NPCID.BrainofCthulhu: - HandleBossKill(npc, "brain_of_cthulhu"); - break; - case NPCID.Deerclops: - HandleBossKill(npc, "deerclops"); - break; - case NPCID.QueenBee: - HandleBossKill(npc, "queen_bee"); - break; - case NPCID.SkeletronHead: - HandleBossKill(npc, "skeletron"); - break; - case NPCID.WallofFlesh: - HandleBossKill(npc, "wall_of_flesh"); + if (foundEaterSegments > 1) { + base.OnKill(npc); + return; + } break; + } } + HandleBossKill(npc, id); base.OnKill(npc); } diff --git a/Changes/SummonerOnHitEffects.cs b/Changes/SummonerOnHitEffects.cs index fb51202..442e000 100644 --- a/Changes/SummonerOnHitEffects.cs +++ b/Changes/SummonerOnHitEffects.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using YHTMod.Buffs; using Vector2 = Microsoft.Xna.Framework.Vector2; namespace YHTMod.Changes; @@ -40,10 +41,16 @@ public class SummonerOnHitEffects : GlobalProjectile { } // Whips - if (projectile.WhipSettings.Segments > 0) { + if (ProjectileID.Sets.IsAWhip[projectile.type]) { if (modPlayer.SummonerAmbitions.Contains("eye_of_cthulhu")) { projectile.damage = (int)(projectile.damage * 1.1); } + + if (ModLoader.HasMod("CalamityMod")) { + if (modPlayer.SummonerAmbitions.Contains("crabulon")) { + target.AddBuff(ModContent.BuffType(), 5 * 60); + } + } } base.OnHitNPC(projectile, target, hit, damageDone); diff --git a/Items/SummonersAmbition.cs b/Items/SummonersAmbition.cs index 05d3f68..1c397dd 100644 --- a/Items/SummonersAmbition.cs +++ b/Items/SummonersAmbition.cs @@ -39,11 +39,23 @@ public class SummonersAmbition : ModItem { tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionKingSlime", Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.KingSlime"))); } + + if (ModLoader.HasMod("CalamityMod") && player.SummonerAmbitions.Contains("desert_scourge")) { + int id = ModContent.ItemType(); + tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionDesertScourge", + Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.DesertScourge", "[i:" + id + "]"))); + } if (player.SummonerAmbitions.Contains("eye_of_cthulhu")) { tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionEyeOfCthulhu", Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.EyeOfCthulhu"))); } + + if (ModLoader.HasMod("CalamityMod") && player.SummonerAmbitions.Contains("crabulon")) { + int id = ModContent.ItemType(); + tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionCrabulon", + Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.Crabulon", "[i:" + id + "]"))); + } if (player.SummonerAmbitions.Contains("deerclops")) { tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionDeerclops", diff --git a/Localization/en-US_Mods.YHTMod.hjson b/Localization/en-US_Mods.YHTMod.hjson index 8dd4196..4cff70c 100644 --- a/Localization/en-US_Mods.YHTMod.hjson +++ b/Localization/en-US_Mods.YHTMod.hjson @@ -6,18 +6,27 @@ Recipes: { Buffs: { ToclafaneMinionBuff: { DisplayName: Summon Toclafane - Description: It came from a parallel world to fight for its Master. + Description: It came from a parallel world to fight for its Master } SummonerAmbitionBuff: { DisplayName: Summoner's Ambition Description: ''' - Your power grows with your ambition. + Your power grows with your ambition Essences absorbed: {0} ''' } + + ShroomGlowDebuff: { + DisplayName: Shroom Glow + Description: + ''' + You are emitting a faint glow... + And smell like mushrooms. + ''' + } } Items: { @@ -74,7 +83,9 @@ Items: { {$CommonItemTooltip.IncreasesMaxMinionsBy@0} ''' KingSlime: "[i:560] 20% increased whip size" + DesertScourge: "{0} Increases maximum life by 5" EyeOfCthulhu: "[i:43] Increases whip damage by 10%" + Crabulon: "{0} Enemies struck by whips glow slightly" EaterOfWorlds: "[i:70] Summon damage penetrates 5 armor" BrainOfCthulhu: "[i:1331] 5% increased minion damage" QueenBee: "[i:1133] Minion hits can inflict poison" diff --git a/YHTMod.csproj b/YHTMod.csproj index ce365bb..6bcd61d 100644 --- a/YHTMod.csproj +++ b/YHTMod.csproj @@ -5,4 +5,9 @@ YHTMod latest + + + ..\ModAssemblies\CalamityMod_v2.0.7.2.dll + + \ No newline at end of file diff --git a/YhtPlayer.cs b/YhtPlayer.cs index 81f99e9..fc4544d 100644 --- a/YhtPlayer.cs +++ b/YhtPlayer.cs @@ -33,6 +33,10 @@ public class YhtPlayer : ModPlayer { Player.whipRangeMultiplier += 0.2f; } + if (ModLoader.HasMod("CalamityMod") && SummonerAmbitions.Contains("desert_scourge")) { + Player.statLifeMax2 += 5; + } + if (SummonerAmbitions.Contains("eater_of_worlds")) { Player.GetArmorPenetration(DamageClass.Summon) += 5; } diff --git a/build.txt b/build.txt index 3df63f9..956aa5a 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,4 @@ displayName = YHT Mod author = YouHaveTrouble version = 1.2.1 +weakReferences = CalamityMod@2.0.0.0