From 09a89e7ed5d03aad78c4e65606594a21c63d0c73 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sun, 25 Jan 2026 15:32:10 +0100 Subject: [PATCH] perforators bonus --- Changes/SummonerOnHitEffects.cs | 81 +++++++++++++++++++++++---------- Items/SummonersAmbition.cs | 42 +++++++++++++---- YhtPlayer.cs | 2 + 3 files changed, 93 insertions(+), 32 deletions(-) diff --git a/Changes/SummonerOnHitEffects.cs b/Changes/SummonerOnHitEffects.cs index 892ac91..fe9d916 100644 --- a/Changes/SummonerOnHitEffects.cs +++ b/Changes/SummonerOnHitEffects.cs @@ -10,33 +10,13 @@ public class SummonerOnHitEffects : GlobalProjectile { public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { Player player = Main.player[projectile.owner]; YhtPlayer modPlayer = player.GetModPlayer(); - + // Player's own minions if (projectile.minion && Main.myPlayer == projectile.owner) { if (modPlayer.SummonerAmbition) { - if ( - modPlayer.SummonerAmbitions.Contains("deerclops") - && modPlayer.SummonerAmbitionDeerclopsCooldown == 0 - && Main.rand.NextBool(10) - ) { - modPlayer.SummonerAmbitionDeerclopsCooldown = 5 * 60; - Vector2 direction = new(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); - direction.Normalize(); - direction *= Main.rand.NextFloat(4f, 8f); - Projectile.NewProjectile( - player.GetSource_OnHit(target), - target.Center, - direction, - ProjectileID.InsanityShadowFriendly, - projectile.damage / 2, - 0f, - projectile.owner - ); - } - - if (modPlayer.SummonerAmbitions.Contains("queen_bee") && Main.rand.NextBool(4)) { - target.AddBuff(BuffID.Poisoned, 5 * 60); - } + HandleDeerclopsEffect(modPlayer, target, projectile); + HandleQueenBeeEffect(modPlayer, target); + HandlePerforatorsEffect(modPlayer, target, projectile); } } @@ -55,4 +35,57 @@ public class SummonerOnHitEffects : GlobalProjectile { base.OnHitNPC(projectile, target, hit, damageDone); } + + private static void HandleDeerclopsEffect(YhtPlayer modPlayer, NPC target, Projectile projectile) { + Player player = modPlayer.Player; + if (!modPlayer.SummonerAmbitions.Contains("deerclops")) return; + if (modPlayer.SummonerAmbitionDeerclopsCooldown != 0) return; + if (!Main.rand.NextBool(10)) return; + + modPlayer.SummonerAmbitionDeerclopsCooldown = 5 * 60; + Vector2 direction = new(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + direction.Normalize(); + direction *= Main.rand.NextFloat(4f, 8f); + Projectile.NewProjectile( + player.GetSource_OnHit(target), + target.Center, + direction, + ProjectileID.InsanityShadowFriendly, + (int) (projectile.damage * 0.5), + 0f, + projectile.owner + ); + } + + private static void HandleQueenBeeEffect(YhtPlayer modPlayer, NPC target) { + if (!modPlayer.SummonerAmbitions.Contains("queen_bee")) return; + if (!Main.rand.NextBool(4)) return; + target.AddBuff(BuffID.Poisoned, 5 * 60); + } + + private static void HandlePerforatorsEffect(YhtPlayer modPlayer, NPC target, Projectile projectile) { + if (!ModLoader.HasMod("CalamityMod")) return; + if (!modPlayer.SummonerAmbitions.Contains("perforators")) return; + if (modPlayer.SummonerAmbitionPerforatorsCooldown != 0) return; + if (!Main.rand.NextBool(10)) return; + modPlayer.SummonerAmbitionPerforatorsCooldown = 3 * 60; + Vector2 direction = new(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + direction.Normalize(); + direction *= Main.rand.NextFloat(4f, 5f); + int projectileType = ModContent.ProjectileType(); + int projectileId = Projectile.NewProjectile( + modPlayer.Player.GetSource_OnHit(target), + target.Center, + direction, + projectileType, + (int) (projectile.damage * 0.75f), + 0f, + projectile.owner + ); + Projectile blob = Main.projectile[projectileId]; + blob.friendly = true; + blob.hostile = false; + blob.DamageType = DamageClass.Summon; + } + } diff --git a/Items/SummonersAmbition.cs b/Items/SummonersAmbition.cs index d139b1f..8dc528e 100644 --- a/Items/SummonersAmbition.cs +++ b/Items/SummonersAmbition.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.GameContent.Creative; using Terraria.ID; @@ -76,6 +77,18 @@ public class SummonersAmbition : ModItem { Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.BrainOfCthulhu"))); } + if (ModLoader.HasMod("CalamityMod") && player.SummonerAmbitions.Contains("perforators")) { + int id = ModContent.ItemType(); + tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionPerforators", + Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.Perforators", "[i:" + id + "]"))); + } + + if (ModLoader.HasMod("CalamityMod") && player.SummonerAmbitions.Contains("hive_mind")) { + int id = ModContent.ItemType(); + tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionHiveMind", + Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.HiveMind", "[i:" + id + "]"))); + } + if (player.SummonerAmbitions.Contains("queen_bee")) { tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionQueenBee", Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.QueenBee"))); @@ -109,13 +122,26 @@ public class SummonersAmbition : ModItem { public static bool IsPreHardmodeRealized(Player player) { YhtPlayer modPlayer = player.GetModPlayer(); - return modPlayer.SummonerAmbitions.Contains("king_slime") - && modPlayer.SummonerAmbitions.Contains("eye_of_cthulhu") - && modPlayer.SummonerAmbitions.Contains("deerclops") - && (modPlayer.SummonerAmbitions.Contains("eater_of_worlds") || - modPlayer.SummonerAmbitions.Contains("brain_of_cthulhu")) - && modPlayer.SummonerAmbitions.Contains("queen_bee") - && modPlayer.SummonerAmbitions.Contains("skeletron") - && modPlayer.SummonerAmbitions.Contains("wall_of_flesh"); + + HashSet bossesToCheck = [ + "king_slime", + "eye_of_cthulhu", + "deerclops", + "eater_of_worlds", + "brain_of_cthulhu", + "queen_bee", + "skeletron", + "wall_of_flesh" + ]; + + if (ModLoader.HasMod("CalamityMod")) { + bossesToCheck.Add("desert_scourge"); + bossesToCheck.Add("crabulon"); + bossesToCheck.Add("perforators"); + bossesToCheck.Add("hive_mind"); + bossesToCheck.Add("slime_god"); + } + + return bossesToCheck.All(boss => modPlayer.SummonerAmbitions.Contains(boss)); } } diff --git a/YhtPlayer.cs b/YhtPlayer.cs index 6a3066d..f06a025 100644 --- a/YhtPlayer.cs +++ b/YhtPlayer.cs @@ -10,6 +10,7 @@ public class YhtPlayer : ModPlayer { public int ArcaneMissile = 0; public int KatanaTeleportCooldown = 0; public int SummonerAmbitionDeerclopsCooldown = 0; + public int SummonerAmbitionPerforatorsCooldown = 0; public bool SummonerAmbition = false; @@ -22,6 +23,7 @@ public class YhtPlayer : ModPlayer { public override void PreUpdate() { KatanaTeleportCooldown = Math.Max(KatanaTeleportCooldown - 1, 0); SummonerAmbitionDeerclopsCooldown = Math.Max(SummonerAmbitionDeerclopsCooldown - 1, 0); + SummonerAmbitionPerforatorsCooldown = Math.Max(SummonerAmbitionPerforatorsCooldown - 1, 0); } public override void PostUpdateEquips() {