From 08bddf36c30ac01e3cfa4f2a5fefa90ca04695f8 Mon Sep 17 00:00:00 2001 From: Dreitone Date: Mon, 22 Dec 2025 21:36:02 -0600 Subject: [PATCH 1/3] small cleanup pr --- .../Mods.CalamityMod.Projectiles.Magic.hjson | 3 +- Utilities/CollisionUtils.cs | 24 +++++-------- Utilities/EntityUtils.cs | 35 +++---------------- Utilities/ItemUtils.cs | 12 +------ Utilities/MiscUtils.cs | 8 ++--- 5 files changed, 19 insertions(+), 63 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index f14db8b5fa..51c9ca8cb7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -59,7 +59,7 @@ CosmicTentacle.DisplayName: Dark Tentacle CryoBlast.DisplayName: Cryo Blast DarkSparkBeam.DisplayName: Dark Spark Beam DarkSparkPrism.DisplayName: Dark Crystal -HyperdeathRiftScepterBeam.DisplayName: Hypderdeath Rift Ripper +HyperdeathRiftScepterBeam.DisplayName: Hyperdeath Rift Ripper DeathValleyDusterProjectile.DisplayName: Death Valley Duster DeathhailBeam.DisplayName: Deathhail Beam EelDrop.DisplayName: Acid Eel Drop @@ -101,7 +101,6 @@ HellfireExplosionFriendly.DisplayName: Explosion HellwingBat.DisplayName: Ashen Hellwing HolyFlame.DisplayName: Holy Flame HolyLaser.DisplayName: Holy Laser -HyperdeathRiftScepterBeam.DisplayName: Hyperdeath Rift Scepter Beam IceBarrageMain.DisplayName: Ice Barrage IceBlock.DisplayName: Ice Barrage Block IceBlockIcicle.DisplayName: Ice Barrage Icicle diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index 1ffaa9d7da..5788363cb0 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -41,25 +41,17 @@ namespace CalamityMod /// The hitbox of the target to check. public static bool CircularHitboxCollision(Vector2 centerCheckPosition, float radius, Rectangle targetHitbox) { - // If the center intersects the hitbox, return true immediately - Rectangle center = new Rectangle((int)centerCheckPosition.X, (int)centerCheckPosition.Y, 1, 1); - if (center.Intersects(targetHitbox)) - return true; - float topLeftDistance = Vector2.Distance(centerCheckPosition, targetHitbox.TopLeft()); - float topRightDistance = Vector2.Distance(centerCheckPosition, targetHitbox.TopRight()); - float bottomLeftDistance = Vector2.Distance(centerCheckPosition, targetHitbox.BottomLeft()); - float bottomRightDistance = Vector2.Distance(centerCheckPosition, targetHitbox.BottomRight()); + if (radius <= 0f) + return false; - float distanceToClosestPoint = topLeftDistance; - if (topRightDistance < distanceToClosestPoint) - distanceToClosestPoint = topRightDistance; - if (bottomLeftDistance < distanceToClosestPoint) - distanceToClosestPoint = bottomLeftDistance; - if (bottomRightDistance < distanceToClosestPoint) - distanceToClosestPoint = bottomRightDistance; + float closestX = MathHelper.Clamp(centerCheckPosition.X, targetHitbox.Left, targetHitbox.Right); + float closestY = MathHelper.Clamp(centerCheckPosition.Y, targetHitbox.Top, targetHitbox.Bottom); - return distanceToClosestPoint <= radius; + float dx = centerCheckPosition.X - closestX; + float dy = centerCheckPosition.Y - closestY; + + return (dx * dx + dy * dy) <= (radius * radius); } /// diff --git a/Utilities/EntityUtils.cs b/Utilities/EntityUtils.cs index ae032240f7..6d02c92f68 100644 --- a/Utilities/EntityUtils.cs +++ b/Utilities/EntityUtils.cs @@ -69,60 +69,35 @@ namespace CalamityMod /// /// whoAmI index to check /// true if index is in valid range [0 <= index < Main.maxNPCs] - public static bool IndexInRange(this NPC[] _, int index) - { - if (index >= 0) - return index < Main.maxNPCs; - return false; - } + public static bool IndexInRange(this NPC[] _, int index) => (uint)index < Main.maxNPCs; /// /// Fallback method for Main.player.IndexInRange which provide accurate range check (0 <= index < Main.maxPlayers) /// /// whoAmI index to check /// true if index is in valid range [0 <= index < Main.maxPlayers] - public static bool IndexInRange(this Player[] _, int index) - { - if (index >= 0) - return index < Main.maxPlayers; - return false; - } + public static bool IndexInRange(this Player[] _, int index) => (uint)index < Main.maxPlayers; /// /// Fallback method for Main.projectile.IndexInRange which provide accurate range check (0 <= index < Main.maxProjectiles) /// /// whoAmI index to check /// true if index is in valid range [0 <= index < Main.maxProjectiles] - public static bool IndexInRange(this Projectile[] _, int index) - { - if (index >= 0) - return index < Main.maxProjectiles; - return false; - } + public static bool IndexInRange(this Projectile[] _, int index) => (uint)index < Main.maxProjectiles; /// /// Fallback method for Main.gore.IndexInRange which provide accurate range check (0 <= index < Main.maxGore) /// /// whoAmI index to check /// true if index is in valid range [0 <= index < Main.maxGore] - public static bool IndexInRange(this Gore[] _, int index) - { - if (index >= 0) - return index < Main.maxGore; - return false; - } + public static bool IndexInRange(this Gore[] _, int index) => (uint)index < Main.maxGore; /// /// Fallback method for Main.npc.IndexInRange which provide accurate range check (0 <= index < Main.maxDust) /// /// whoAmI index to check /// true if index is in valid range [0 <= index < Main.maxDust] - public static bool IndexInRange(this Dust[] _, int index) - { - if (index >= 0) - return index < Main.maxDust; - return false; - } + public static bool IndexInRange(this Dust[] _, int index) => (uint)index < Main.maxDust; #endregion } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 5cf69ae0cc..3c29818724 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -90,17 +90,7 @@ namespace CalamityMod public static void FindAndReplaceAll(this List tooltips, string replacedKey, string newKey) { foreach (TooltipLine line in tooltips) - { - if (!line.Text.Contains(replacedKey)) - continue; - //loops only 100 times at max per tooltip line to prevent any infinite loops - for (var i = 0; i < 100; i++) - { - line.Text = line.Text.Replace(replacedKey, newKey); - if (!line.Text.Contains(replacedKey)) - break; - } - } + line.Text = line.Text.Replace(replacedKey, newKey); } /// diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index e9829beb6f..d1eab75448 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -140,7 +140,7 @@ namespace CalamityMod /// The base type of the collection. /// The collection. /// The type to search for. - public static bool ContainsType(this IEnumerable collection, Type type) => collection.Any(entry => entry.GetType() == type.GetType()); + public static bool ContainsType(this IEnumerable collection, Type type) => collection.Any(entry => entry.GetType() == type); /// /// Calculates the sound volume and panning for a sound which is played at the specified location in the game world.
@@ -156,7 +156,7 @@ namespace CalamityMod if (soundPos.X == -1f || soundPos.Y == -1f) volume = 1f; - else if (WorldGen.gen || Main.dedServ || Main.dedServ) + else if (WorldGen.gen || Main.dedServ) volume = 0f; else { @@ -273,12 +273,12 @@ namespace CalamityMod for (int i = 0; i < originalText.Length; i++) { for (int j = 0; j < 37; j++) - { + { if (TextKeys[j] == originalText[i]) { morseText += MorseKeys[j]; break; - } + } } } From c8bd44b1749cff043e0be25be35dac5b4b3b23dd Mon Sep 17 00:00:00 2001 From: Nathanael Overton Date: Tue, 23 Dec 2025 15:21:06 -0500 Subject: [PATCH 2/3] Pumpkaboom recipe consistent w/ Pumpler --- Items/Weapons/Rogue/Pumpkaboom.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/Pumpkaboom.cs b/Items/Weapons/Rogue/Pumpkaboom.cs index 0d9dfefe4a..e72b5b5b02 100644 --- a/Items/Weapons/Rogue/Pumpkaboom.cs +++ b/Items/Weapons/Rogue/Pumpkaboom.cs @@ -63,7 +63,8 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(ItemID.Grenade, 15). - AddIngredient(ItemID.Pumpkin, 10). + AddIngredient(ItemID.Pumpkin, 30). + AddIngredient(ItemID.PumpkinSeed, 5). AddTile(TileID.Anvils). Register(); } From fdf37f73897dd49b4ec14ae47bbf8bca435d717f Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 24 Dec 2025 06:34:18 +0700 Subject: [PATCH 3/3] Frostcrush Valari resprite --- Gores/FrostcrushValariGore1.png | Bin 496 -> 385 bytes Gores/FrostcrushValariGore2.png | Bin 348 -> 443 bytes Gores/FrostcrushValariGore3.png | Bin 0 -> 192 bytes Gores/FrostcrushValariGore4.png | Bin 0 -> 199 bytes Gores/FrostcrushValariGore5.png | Bin 0 -> 231 bytes Items/Weapons/Rogue/FrostcrushValari.cs | 4 ++-- Items/Weapons/Rogue/FrostcrushValari.png | Bin 678 -> 867 bytes Projectiles/Rogue/ValariBoomerang.cs | 5 +++-- 8 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 Gores/FrostcrushValariGore3.png create mode 100644 Gores/FrostcrushValariGore4.png create mode 100644 Gores/FrostcrushValariGore5.png diff --git a/Gores/FrostcrushValariGore1.png b/Gores/FrostcrushValariGore1.png index dd5419f07c19660a22eb488d042650ab59e81502..f3e39318e52f5b66fa573748c754fdb65aeefbd8 100644 GIT binary patch delta 365 zcmV-z0h0dk1Azk}iBL{Q4GJ0x0000DNk~Le0000Q0000Q2nGNE0I5n$&XFM>e*r5= zL_t(YOJii95|9m^{vXN&gU4$#QOst7(liGY`v~R}_nZtc9|m?#nE|F@J{$Z#g878o zH4@DKef$QPR(;hCrZYO%fa%;uh|h+QkHjE8`ub`)nAZNb2TWh(asktWKaOzu#F+6R znEvtgHkdx~Tpmn+xX?GqeI#H|e+2dsud*tbFZXginC9i>1=F8z{|3`X?`%Rbd+_JgNf$~0gk9hCy@$19c1ggi6qVIo!}~( z#={rV-M>K6G&_b%P7Uk1avnK4hOkOQIpp1^ZxF}pi=Q-2-0=5?Vn(~ah?$I-(N557 z6WcR63`xF2T2&8D@B%4J4g^=x#C59e*H&C)db?EbPS5lFy!XHP*6t#bfAAO3rY6!i zBs3i_hffmQwvjY16=#tP>*21oDZ4$ar1U@RG9;!>H5I3bG9KRU229s-%!kCWVdq13VfZ2nau5F2cyZ}E*%`+z?vsb`|TY`E86PkrtXepuR}4D z5i=RxWg$O;5i=Qi!t*H~Gevef?3Lrj2fF5&YU+;sKSM&(`q3WNk56Y=Ftn^6v|pq6 TtbmzWe*tAl zL_t(YOJih!0@>i{|DjA2@OW(|Tn#p$k@*3v@5Xcitm>GcG|d2p4-PEK0Q0>|K7wg< zm%-F=i$#L@TYLDyv_sqsFpchGn)`qSO2a|>DF}Ui8pLIq43IGX`f53t5A)&WyI=}V z;{x=H16XRX34^%YM;J^o`0GMwe;By;4MM|wx^oKlu!jNK`v8_I+;bpdiw=(5gruhH z=@6g6d;kmkgt%fb{oz92!1#dW^WED}CIrA-Y@-fwF~da&m3ja|SDHa+U1bO@VOa;J zd6iYcAprxhIH7$U2pANh*bH+K2GEDnPyq8GEVaP^%xAEiO}~5q1L$Q9eY(p#tROCj zxfGU~w!DSVYYI_Q75#kx18|?XLVSYmav1Pl3`uogcSFi5x|gOneEZYu{5=_Iu+l#Bf^njH`MEd|2z~yonps^1a7yy>=dV?f9 Rc)tJu002ovPDHLkV1l{2xC;OP delta 328 zcmV-O0k{6U1Ka{3iBL{Q4GJ0x0000DNk~Le0000M0000O2nGNE0RFxWOOYWTe*g(^ zNLh0L01m?d01m?e$8V@)0002-Nkl zm0DNstOwJ?x)cUz=VCASB`9IZrXc~QEzOO=G0dWqfaz^JV+Mzd;Rc`B^9+pd-(vt{kV`=ry3j(xH$FQ)Lm2n319?5YfGN6%* a85jUnOjm5LcWQ$G0000f4F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl|#@^o2yaPL|#DZ$|XR$lA*;jo85TNylE{an^LB{Ts5kNQ80 literal 0 HcmV?d00001 diff --git a/Gores/FrostcrushValariGore4.png b/Gores/FrostcrushValariGore4.png new file mode 100644 index 0000000000000000000000000000000000000000..94f39153c58af3242a0ae5ca8ea0447c997aa861 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl`<^mK6y(FjgXX<)kf;N^cu6X|}%8TI80S!4KEW-KsqJfM^iz+%>U+f+zr zgXuJRpWTLY7`hMpsNHkXIGeDT&+ugRM|Xq0*|RKXl>J~Tw7#fzsFtmGwTqkV41Q+) tG?T{6OTI0PGfoVM%xNb!1@J z*w6hZkrl|F=;`7Zq7j^&(!g}{!OQ;(eGDr0m*2@Uh&3}K7?XrPGjfGPtTSUd71MS?kPmY)} bGc)K+R{8i??)NjG;}|?${an^LB{Ts5!X{1h literal 0 HcmV?d00001 diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index d76782aaf8..39545494e2 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 32; - Item.height = 46; + Item.width = 34; + Item.height = 58; Item.damage = 81; Item.DamageType = RogueDamageClass.Instance; Item.useTime = Item.useAnimation = 19; diff --git a/Items/Weapons/Rogue/FrostcrushValari.png b/Items/Weapons/Rogue/FrostcrushValari.png index a22a47651bc7648291e501c8ce59b4e3417255d9..06928cd5eb858c7fe0b3e95d7a6ffb5870642dc8 100644 GIT binary patch literal 867 zcmV-p1DyPcP)GP% z5hUWp9D;&^0Urlf5phFs@qro>gvh!fD56+3|6q5fGc!ArbkC)CyQh=CzOJgS?zOFu z&$3?CnCm9JE2~7=s}Fpq4ptsu}*RriU zn_lLhZzhOPqp>V_TUBlf}uvLumgq}JVq6(ry*h@QLOm_+|!F^U2cF-C~D zLs*tu7IbiZ0-unh=G-&>3#tqon27O0AW$YVu$MC|NPtjm^+-@M+JqqC)uuX0>--H( z)Itypm~|q?2tjx+N}m#l^llU@G-TA)bcK0D+(I`eIr-# zDl#BqoDj>|d)#`(so>_Eh&CYz-zD9rdG%g8i|CL+^r&jr$a@WZ#uy=Tas8n0sgO@p zz5zpGBcff1yzBmYTp%MG$Ier`^mzY_bx3SP%oF0=AmQAycJe+M`?_kgXC{>sV`LwZ zZ;<9(h)O`K{ho}SDvwb6r#32y&_uKgQ3-%0 zpFWRQ0A$KisYJ%aMZ(udvQIHF()#%$Peb$a*JFte6&c$&A@Yqf&LvZWn`V`S8#SsMW$i+6L+tl!f?pJb9d~^M tOQTH)l*>-*S7U~?*zbKekLVWi7ly@7W&4wSIRF3v07*qoM6N<$f&dn{h6exu literal 678 zcmV;X0$KfuP)}y*LV0*ZrL{0#0Z<;5q=Thavz>Ogj!hIajQ50?!ThC+JbB1I7UG z;>i4pATH2UoHe|voZya09WV|6nE*lTZQG_U`^3ri@tN+74sj=BwrS^pF#zsFZCI>y zmSs7Pd^yt*3exYcAu(5Y>@iCg$DE3&T?dQ-sB(hGcq|&CTe4h0?6ubd&j6@EFgrR& z8fhrjjL9}}tw8K^cEEE0NJ`9x!>ub~w1SReo(riRaUYSl1Fi$0GM1DN3zaba@Fdg& zIKuZ0JoX5wvJUXr8wbEDDN`QsR|*x8?|^dN6>|rS0jSmn^z$`A7W|!lr!fVe0zUc4`i)#RQF)u{Oet@Wy7c2)*c#Huc>vL6JFb7-%KIuH3Zj@SBuN!lo%-XZSGXPKkC!SL`S?4)doVNq6190o17$C9=r&6vx3ycBq&+|gX zTssGh0q{lU{C1O|^UZcyPW-9^t^@Fc$dZOCf<=k_YlYLE1;zpRK_tFvmluvn#M|{F zwR|_Lt57x0=NSNg5XsMURZ9Na|LuS=0FWaTR-pG^V=k?PrT{(xT;$qH!#ecy00000 MNkvXXu0mjf02L-H*8l(j diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index 85490be844..40790b782c 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -223,8 +223,9 @@ namespace CalamityMod.Projectiles.Rogue { SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); Vector2 splinterVel = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 12f); - Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find("FrostcrushValariGore1").Type); - Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find("FrostcrushValariGore2").Type); + + for (int i = 1; i <= 5; i++) + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, splinterVel, Mod.Find($"FrostcrushValariGore{i}").Type); } }