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 0000000..8e27abd Binary files /dev/null and b/Buffs/ShroomGlowDebuff.png differ diff --git a/Changes/BossKillListener.cs b/Changes/BossKillListener.cs index 5fd0275..b3a580f 100644 --- a/Changes/BossKillListener.cs +++ b/Changes/BossKillListener.cs @@ -1,3 +1,6 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.DesertScourge; using Microsoft.Xna.Framework; using Terraria; using Terraria.Chat; @@ -8,17 +11,34 @@ using Terraria.ModLoader; namespace YHTMod.Changes; public class BossKillListener : GlobalNPC { + + private static readonly Dictionary 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