From 598ceccce1c0961d252bb35afafaff97672b1ca0 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 10 Apr 2021 14:06:50 -0500 Subject: [PATCH 01/43] Added a martian madness summoning item --- .../Invasion/MartianDistressBeacon.cs | 38 ++++++++++++++++++ .../Invasion/MartianDistressBeacon.png | Bin 0 -> 985 bytes NPCs/CalamityGlobalTownNPC.cs | 2 + 3 files changed, 40 insertions(+) create mode 100644 Items/SummonItems/Invasion/MartianDistressBeacon.cs create mode 100644 Items/SummonItems/Invasion/MartianDistressBeacon.png diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.cs b/Items/SummonItems/Invasion/MartianDistressBeacon.cs new file mode 100644 index 0000000000..244d951c4c --- /dev/null +++ b/Items/SummonItems/Invasion/MartianDistressBeacon.cs @@ -0,0 +1,38 @@ +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.Invasion +{ + public class MartianDistressBeacon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Martian Distress Beacon"); + Tooltip.SetDefault("Summons the Martian Madness"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 60; + item.maxStack = 99; + item.rare = ItemRarityID.Yellow; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = ItemUseStyleID.HoldingUp; + item.consumable = true; + } + + public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; + + public override bool UseItem(Player player) + { + Main.StartInvasion(InvasionID.MartianMadness); + return true; + } + } +} diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.png b/Items/SummonItems/Invasion/MartianDistressBeacon.png new file mode 100644 index 0000000000000000000000000000000000000000..32afb9a520d69aed56680343a65bb10f412e2c44 GIT binary patch literal 985 zcmV;~119{5P)Px&lSxEDR9J=0nQv%KVI0Rl$IQKkZi~4ljMg$^tj$DNlrTlgUMUnsdpTKYNqZqL zY*7@=3z3pyFX-uRb+y(4z(aAj9_%Im){JufUQ z1Rx%dD@R@J?d^b<#ABDNFaSC#%&1%pmG+UkTEHUrj#z#;kvr+!r6;!Mby8hI?)^NL`4tG5RchMw90Q=g?^^<(x3?Ft zyxqKU5nz!^TU1qDn{r_9iABL+5U@xkYQ-BN4`-Y8x~j4Qu-=4RfAz9mdG6eKxk}qV z#7@$^?Cvykw2%ffLQ4Ox&Q<`XWX}PHz5)LbOI4BF>!zGpc>qM7KLe~cpzHRHvr5~4 z#CnyHjI_FZi*jDP6iHNzw?e8%z4y6VBsm*UabX9K=j-ZW?|TXg3e+17^VUEhVD7z= zUfXzVJBELWi;IiRV`&)xEl-G-DHK296^%wtxv?dEO#r}?GOdty;n=Lcn9e7eE>D%;a%|A4Hm!}E6B z_z4EU_kn)E55!Kp#KE2Xp@YECc`I`BR!IG`=E~1Eb8I{wPr%TsA``TtbxhyC|!&xn5mIg(%^1Tmxa00000NkvXX Hu0mjf!rkTU literal 0 HcmV?d00001 diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index e0031ee9c4..12927d26fb 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Placeables.Walls; using CalamityMod.Items.Potions; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; @@ -1217,6 +1218,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Cyborg) { SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25)); + SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPolterghast); } From 739a1a609094c81104cad1636d1e28315d3056fd Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 15:30:53 -0500 Subject: [PATCH 02/43] Made every single DirectionTo safe --- Items/CalamityGlobalItem.cs | 2 +- NPCs/AcidRain/BloodwormFleeing.cs | 9 +- NPCs/AcidRain/GammaSlime.cs | 2 +- NPCs/AcidRain/NuclearTerror.cs | 4 +- NPCs/AcidRain/Orthocera.cs | 2 +- NPCs/AcidRain/Skyfin.cs | 4 +- NPCs/AcidRain/SulfurousSkater.cs | 2 +- NPCs/AcidRain/Trilobite.cs | 4 +- NPCs/AcidRain/WaterLeech.cs | 6 +- NPCs/CalamityAI.cs | 2 +- NPCs/CalamityGlobalAI.cs | 103 +++++++++--------- NPCs/CalamityVanillaMinibossesAI.cs | 14 +-- NPCs/GreatSandShark/GreatSandShark.cs | 5 +- NPCs/NormalNPCs/WulfrumDrone.cs | 13 +-- NPCs/NormalNPCs/WulfrumHovercraft.cs | 4 +- NPCs/SulphurousSea/AnthozoanCrab.cs | 4 +- NPCs/Yharon/Yharon.cs | 28 ++--- .../BaseProjectiles/BaseSpearProjectile.cs | 5 +- Projectiles/Boss/BrimstoneGigaBlast.cs | 7 +- Projectiles/Boss/BrimstoneMonster.cs | 7 +- Projectiles/Boss/FlareBomb.cs | 8 +- Projectiles/Boss/ScavengerNuke.cs | 7 +- Projectiles/CalamityGlobalProjectile.cs | 9 +- .../FrequencyManipulatorEnergy.cs | 2 +- .../DraedonsArsenal/MountedScannerSummon.cs | 3 +- .../DraedonsArsenal/PhaseslayerBeam.cs | 5 +- .../DraedonsArsenal/PoleWarperSummon.cs | 6 +- .../DraedonsArsenal/PulseDragonProjectile.cs | 52 ++++----- Projectiles/DraedonsArsenal/PulseRifleShot.cs | 5 +- Projectiles/DraedonsArsenal/PulseTurret.cs | 8 +- .../DraedonsArsenal/PulseTurretShot.cs | 4 +- .../DraedonsArsenal/SnakeEyesSummon.cs | 15 +-- .../DraedonsArsenal/StarSwallowerSummon.cs | 2 +- .../DraedonsArsenal/SystemBaneProjectile.cs | 2 +- Projectiles/DraedonsArsenal/TaserHook.cs | 7 +- .../DraedonsArsenal/TeslaCannonShot.cs | 2 +- .../DraedonsArsenal/TrackingDiskProjectile.cs | 4 +- Projectiles/DraedonsArsenal/UnstableMatter.cs | 2 +- Projectiles/DraedonsArsenal/VoltageStream.cs | 5 +- Projectiles/Enemy/CragmawVibeCheckChain.cs | 16 +-- Projectiles/Enemy/NuclearBulletMedium.cs | 5 +- Projectiles/Magic/Crescent.cs | 8 +- Projectiles/Magic/DivineRetributionSpear.cs | 8 +- Projectiles/Magic/EnormousConsumingVortex.cs | 7 +- Projectiles/Magic/EternityCrystal.cs | 3 +- Projectiles/Magic/EternityHoming.cs | 5 +- Projectiles/Magic/EventHorizonStar.cs | 8 +- Projectiles/Magic/FatesRevealFlame.cs | 13 +-- Projectiles/Magic/LightBlade.cs | 2 +- Projectiles/Magic/StratusSphereProj.cs | 12 +- Projectiles/Magic/UndinesRetributionSpear.cs | 8 +- Projectiles/Melee/DragonRageFireball.cs | 8 +- Projectiles/Melee/DragonRageStaff.cs | 23 ++-- Projectiles/Melee/ElementalExcaliburBeam.cs | 8 +- Projectiles/Melee/ExoGladSpears.cs | 2 +- Projectiles/Melee/Exocomet.cs | 8 +- Projectiles/Melee/GaelSkull.cs | 12 +- Projectiles/Melee/GaelSkull2.cs | 11 +- Projectiles/Melee/GhastlySoulLarge.cs | 8 +- Projectiles/Melee/GhastlySoulMedium.cs | 8 +- Projectiles/Melee/GhastlySoulSmall.cs | 8 +- Projectiles/Melee/Spears/BansheeHookProj.cs | 6 +- Projectiles/Melee/TyphonsGreedBubble.cs | 8 +- Projectiles/Melee/TyphonsGreedStaff.cs | 19 +--- Projectiles/Ranged/BloodflareSoul.cs | 8 +- Projectiles/Ranged/ExoSpark.cs | 5 +- Projectiles/Ranged/ThePackMissile.cs | 3 +- Projectiles/Ranged/UltimaBowProjectile.cs | 4 +- Projectiles/Ranged/UltimaSpark.cs | 2 +- Projectiles/Ranged/VeriumBulletProj.cs | 7 +- .../Rogue/CelestialReaperAfterimage.cs | 2 +- .../Rogue/CelestialReaperProjectile.cs | 4 +- Projectiles/Rogue/DragonShit.cs | 4 +- .../Rogue/EpidemicShredderProjectile.cs | 4 +- Projectiles/Rogue/FinalDawnFireball.cs | 4 +- Projectiles/Rogue/FinalDawnProjectile.cs | 4 +- Projectiles/Rogue/FinalDawnThrow.cs | 2 +- Projectiles/Rogue/IceStarProjectile.cs | 7 +- Projectiles/Rogue/PhantasmalSoul.cs | 8 +- Projectiles/Rogue/RegulusEnergy.cs | 9 +- Projectiles/Rogue/ScarletDevilBullet.cs | 9 +- Projectiles/Rogue/SpearofDestinyProjectile.cs | 7 +- Projectiles/Rogue/StellarKnifeProj.cs | 7 +- Projectiles/Rogue/SupernovaHoming.cs | 9 +- .../Rogue/ToxicantTwisterTwoPointZero.cs | 6 +- Projectiles/Summon/AstralProbeRound.cs | 2 +- Projectiles/Summon/BelladonnaSpirit.cs | 2 +- Projectiles/Summon/CinderBlossom.cs | 2 +- Projectiles/Summon/CosmicBlast.cs | 2 +- Projectiles/Summon/CosmicBlastBig.cs | 2 +- Projectiles/Summon/CosmicViperHomingRocket.cs | 8 +- .../Summon/CosmicViperSplittingRocket.cs | 8 +- Projectiles/Summon/DazzlingStabber.cs | 5 +- Projectiles/Summon/DormantBrimseekerBab.cs | 10 +- Projectiles/Summon/EndoHydraHead.cs | 6 +- Projectiles/Summon/EnergyOrb.cs | 2 +- Projectiles/Summon/FlameBlast.cs | 2 +- Projectiles/Summon/FlameBurst.cs | 2 +- Projectiles/Summon/FlyingOrthocera.cs | 4 +- Projectiles/Summon/FrostBlossom.cs | 6 +- Projectiles/Summon/FungalClumpMinion.cs | 12 +- Projectiles/Summon/GammaCanister.cs | 2 +- Projectiles/Summon/GammaHead.cs | 5 +- Projectiles/Summon/GiantIbanRobotOfDoom.cs | 11 +- Projectiles/Summon/Hiveling.cs | 2 +- Projectiles/Summon/HomingGammaBullet.cs | 2 +- Projectiles/Summon/HowlsHeartFireball.cs | 7 +- Projectiles/Summon/LanternFlame.cs | 2 +- Projectiles/Summon/MK2RocketHoming.cs | 5 +- Projectiles/Summon/MechwormHead.cs | 6 +- Projectiles/Summon/MidnightSunUFO.cs | 10 +- Projectiles/Summon/PlaguebringerMK2.cs | 10 +- Projectiles/Summon/PowerfulRaven.cs | 6 +- Projectiles/Summon/RadiantResolutionAura.cs | 13 ++- Projectiles/Summon/RadiantResolutionFire.cs | 4 +- Projectiles/Summon/RadiantResolutionOrb.cs | 4 +- Projectiles/Summon/RustyDrone.cs | 4 +- Projectiles/Summon/SakuraBullet.cs | 7 +- Projectiles/Summon/SilvaCrystal.cs | 7 +- Projectiles/Summon/SkeletalDragonChild.cs | 7 +- Projectiles/Summon/SkeletalDragonMother.cs | 10 +- Projectiles/Summon/TacticalPlagueJet.cs | 14 +-- Projectiles/Summon/YoungDuke.cs | 13 +-- Projectiles/Typeless/GodSlayerPhantom.cs | 8 +- Projectiles/Typeless/KelvinCatalystStar.cs | 7 +- .../Typeless/RelicOfDeliveranceSpear.cs | 6 +- Utilities/DrawingUtils.cs | 2 +- Utilities/EntityUtils.cs | 24 ++++ 128 files changed, 423 insertions(+), 564 deletions(-) create mode 100644 Utilities/EntityUtils.cs diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index c98da34c74..5b70ea1952 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -849,7 +849,7 @@ namespace CalamityMod.Items if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f) { Main.projectile[i].rotation = MathHelper.PiOver2 + MathHelper.PiOver4; - Main.projectile[i].velocity = Main.projectile[i].DirectionTo(Main.MouseWorld) * 22f; + Main.projectile[i].velocity = Main.projectile[i].SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f; Main.projectile[i].rotation += Main.projectile[i].velocity.ToRotation(); Main.projectile[i].ai[0] = 180f; (Main.projectile[i].modProjectile as IgneousBlade).Firing = true; diff --git a/NPCs/AcidRain/BloodwormFleeing.cs b/NPCs/AcidRain/BloodwormFleeing.cs index 3c0567b6af..0421bac8d6 100644 --- a/NPCs/AcidRain/BloodwormFleeing.cs +++ b/NPCs/AcidRain/BloodwormFleeing.cs @@ -33,8 +33,13 @@ namespace CalamityMod.NPCs.AcidRain Player player = Main.player[Player.FindClosest(npc.Center, 1, 1)]; if (npc.velocity == Vector2.Zero) npc.velocity = Vector2.UnitY * 12f; + float intertia = 24f; - npc.velocity = (npc.velocity * intertia - npc.DirectionTo(player.Center) * 12f) / (intertia + 1f); + + // Attempt to flee from the nearest player. + npc.velocity = (npc.velocity * intertia - npc.SafeDirectionTo(player.Center) * 12f) / (intertia + 1f); + + // But always dig downward. npc.velocity.Y = Math.Abs(npc.velocity.Y); npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; } @@ -47,9 +52,7 @@ namespace CalamityMod.NPCs.AcidRain npc.frameCounter = 0; npc.frame.Y += frameHeight; if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - { npc.frame.Y = 0; - } } } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 48873cc830..817b571180 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.AcidRain if (GammaAcidShootTimer % 30f == 29f) { npc.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - npc.Center.Y) / 16f, 5f, 15f); - npc.velocity.X = npc.DirectionTo(Target.Center).X * 16f; + npc.velocity.X = npc.SafeDirectionTo(Target.Center).X * 16f; if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 1bf40d102f..a6f24d9caf 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -172,7 +172,7 @@ namespace CalamityMod.NPCs.AcidRain { JumpTimer = 0f; npc.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - npc.Center.Y) / 12.5f, 8f, 18f); - npc.velocity.X = npc.DirectionTo(Target.Center).X * 18f; + npc.velocity.X = npc.SafeDirectionTo(Target.Center).X * 18f; npc.netUpdate = true; } else @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.AcidRain // Otherwise walk towards the target if they're not super close. else if (Math.Abs(Target.Center.X - npc.Center.X) > 125f) { - npc.velocity.X += Math.Sign(npc.DirectionTo(Target.Center).X) * 3f; + npc.velocity.X += Math.Sign(npc.SafeDirectionTo(Target.Center).X) * 3f; npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -28f, 28f); } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 8157990f5e..2666daf81f 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.AcidRain // If close, simply resume current movement. if (!npc.WithinRange(player.Center, 150f)) { - npc.velocity = (npc.velocity * 17f + npc.DirectionTo(player.Center) * maxSpeed) / 18f; + npc.velocity = (npc.velocity * 17f + npc.SafeDirectionTo(player.Center, -Vector2.UnitY) * maxSpeed) / 18f; if (FallDelay != 12f) { FallDelay = 12f; diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 45df423cec..e7754f40b8 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.AcidRain chargeSpeed = 14f; if (CalamityWorld.downedPolterghast) chargeSpeed = 18f; - npc.velocity = npc.DirectionTo(Target.Center) * chargeSpeed; + npc.velocity = npc.SafeDirectionTo(Target.Center, Vector2.UnitY) * chargeSpeed; } } else @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.AcidRain if (Math.Abs(Target.Center.X - npc.Center.X) > 320f) npc.velocity.X = MathHelper.Lerp(npc.velocity.X, (Target.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f, 0.05f); if (Math.Abs(Target.Center.Y - npc.Center.Y) > 50f) - npc.velocity.Y = npc.DirectionTo(Target.Center).Y * 9f; + npc.velocity.Y = npc.SafeDirectionTo(Target.Center).Y * 9f; } } diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 930d5fdc27..485f11854c 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.AcidRain // Fly more sharply if close to the target. if (npc.WithinRange(Target.Center, 200f)) flyInertia *= 0.667f; - npc.velocity = (npc.velocity * flyInertia + npc.DirectionTo(Target.Center) * flySpeed) / (flyInertia + 1f); + npc.velocity = (npc.velocity * flyInertia + npc.SafeDirectionTo(Target.Center, Vector2.UnitY) * flySpeed) / (flyInertia + 1f); npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); // Have the bubble pop and stop flying if within the circular hitbox area of the player. diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 86cc206618..7ae8abb2cf 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.AcidRain npc.TargetClosest(); float lungeSpeed = CalamityWorld.downedPolterghast ? 18.5f : 15f; - npc.velocity = npc.DirectionTo(Target.Center) * lungeSpeed; + npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * lungeSpeed; npc.velocity.X *= 1.6f; npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; npc.netUpdate = true; @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.AcidRain speedX = 22f; speedY = 11f; } - npc.velocity = npc.DirectionTo(Target.Center) * new Vector2(speedX, speedY); + npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * new Vector2(speedX, speedY); npc.netUpdate = true; } npc.velocity.Y *= 0.98f; diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index c6f5ae2a28..9fa0b015fe 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.AcidRain swimSpeed *= 1.6f; swimIntertia = 17f; } - npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(Target.Center) * swimSpeed) / swimIntertia; + npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia; } // Rapidly slow down if the target is not in water. @@ -157,9 +157,11 @@ namespace CalamityMod.NPCs.AcidRain npc.netUpdate = true; return; } + Vector2 destination = (Target.gravDir == 1f ? Target.Top : Target.Bottom) + Target.direction * Vector2.UnitX * 4f; float speed = MathHelper.Lerp(7f, 23f, Utils.InverseLerp(10f, ChaseMaxDistance, npc.Distance(destination), true)); - npc.velocity = npc.DirectionTo(destination) * speed; + npc.velocity = npc.SafeDirectionTo(destination) * speed; + if (npc.WithinRange(destination, 45f)) { Target.AddBuff(BuffID.Bleeding, 180, true); diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 33279ea7a6..7dc4ac14fe 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -4585,7 +4585,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { Vector2 destination2 = player.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * 18f; + Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; npc.SimpleFlyMovement(desiredVelocity2, 1.5f); if (npc.velocity.X < 0f) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index f65e39521c..4f00ab3390 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -16066,9 +16066,10 @@ namespace CalamityMod.NPCs // If there's nothing in the way of the player, swim towards them if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1)) { - npc.velocity = (npc.velocity * 19f + npc.DirectionTo(Main.player[npc.target].Center) * 10f) / 20f; + npc.velocity = (npc.velocity * 19f + npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f) / 20f; return false; } + float velocityMultiplier = 10f; if (npc.velocity.Y > 0f) { @@ -16503,7 +16504,7 @@ namespace CalamityMod.NPCs for (int j = 0; j < 2; j++) { // Randomize and normalize. You know the drill - Vector2 dustVelocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + Vector2 dustVelocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); dustVelocity *= (float)Main.rand.Next(0, 100) * 0.1f; dustVelocity.Normalize(); dustVelocity *= (float)Main.rand.Next(50, 90) * 0.1f; @@ -16589,11 +16590,8 @@ namespace CalamityMod.NPCs { npc.ai[2] -= 1f; npc.TargetClosest(true); - Vector2 vectorToPlayer = npc.DirectionTo(Main.player[npc.target].Top + new Vector2(0f, -30f)); - if (vectorToPlayer.HasNaNs()) - { - vectorToPlayer = Vector2.Normalize(new Vector2((float)npc.spriteDirection, -1f)); - } + Vector2 vectorToPlayer = npc.SafeDirectionTo(Main.player[npc.target].Top - Vector2.UnitY * 30f, Vector2.Normalize(new Vector2(npc.spriteDirection, -1f))); + npc.velocity = vectorToPlayer * velocityMultiplier; npc.netUpdate = true; return false; @@ -16972,14 +16970,13 @@ namespace CalamityMod.NPCs } Vector2 velocityDelta = -Vector2.One; for (int j = 0; j < i; j++) - { - velocityDelta += npc.DirectionTo(Main.npc[players[j]].Center); - } + velocityDelta += npc.SafeDirectionTo(Main.npc[players[j]].Center); + velocityDelta.Normalize(); for (int j = 0; j < nailCount; j++) { - float velocityMultiplier = (float)Main.rand.Next(8, 13); - Vector2 nailVelocity = Vector2.One.RotatedByRandom(Math.PI * 2.0); + float velocityMultiplier = Main.rand.Next(8, 13); + Vector2 nailVelocity = Vector2.UnitY.RotatedByRandom(Math.PI * 2.0); if (i > 0) { nailVelocity += velocityDelta; @@ -16989,9 +16986,10 @@ namespace CalamityMod.NPCs if (i > 0) { i--; - nailVelocity = npc.DirectionTo(Main.npc[players[i]].Center) * velocityMultiplier; + nailVelocity = npc.SafeDirectionTo(Main.npc[players[i]].Center, -Vector2.UnitY) * velocityMultiplier; } - Projectile.NewProjectile(npc.Center + Vector2.UnitY * (float)(npc.width / 4), nailVelocity, ProjectileID.Nail, (int)(npc.damage * 0.15), 1f, 255, 0f, 0f); + + Projectile.NewProjectile(npc.Center + Vector2.UnitY * (npc.width / 4), nailVelocity, ProjectileID.Nail, (int)(npc.damage * 0.15), 1f, 255, 0f, 0f); } } } @@ -17854,21 +17852,19 @@ namespace CalamityMod.NPCs } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (float)(240 + Main.rand.Next(240)) && npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.DirectionTo(Main.player[npc.target].Center).Y) < 0.5f && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + npc.localAI[2]++; + bool closeToPlayer = npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.SafeDirectionTo(Main.player[npc.target].Center).Y) < 0.5f; + if (npc.localAI[2] >= Main.rand.Next(240, 480) && closeToPlayer && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) { npc.localAI[2] = 0f; - Vector2 spawnPos = npc.Center + new Vector2((float)(npc.direction * 30), 2f); - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * 9f; - if (velocity.HasNaNs()) - { - velocity = new Vector2((float)(npc.direction * 10), 0f); - } + Vector2 spawnPosition = npc.Center + new Vector2(npc.direction * 30f, 2f); + Vector2 baseLaserVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, Vector2.UnitX * npc.direction) * 9f; + int damage = Main.expertMode ? 50 : 75; for (int i = 0; i < 4; i++) { - Vector2 vector17 = velocity + Utils.RandomVector2(Main.rand, -0.8f, 0.8f); - Projectile.NewProjectile(spawnPos, vector17, ProjectileID.VortexLaser, damage, 1f, Main.myPlayer, 0f, 0f); + Vector2 randomizedVelocity = baseLaserVelocity + Utils.RandomVector2(Main.rand, -0.8f, 0.8f); + Projectile.NewProjectile(spawnPosition, randomizedVelocity, ProjectileID.VortexLaser, damage, 1f, Main.myPlayer, 0f, 0f); } } } @@ -18046,7 +18042,7 @@ namespace CalamityMod.NPCs 229 }); Dust dust = Main.dust[Dust.NewDust(npc.Center + new Vector2((float)((npc.spriteDirection == 1) ? 8 : -20), -20f), 8, 8, dustType, npc.velocity.X, npc.velocity.Y, 100, default, 1f)]; - dust.velocity = dust.velocity / 4f + npc.DirectionTo(Main.player[npc.target].Top); + dust.velocity = dust.velocity / 4f + npc.SafeDirectionTo(Main.player[npc.target].Top); dust.scale = 1.2f; dust.noLight = true; } @@ -18112,7 +18108,7 @@ namespace CalamityMod.NPCs if (npc.localAI[0] > (float)Main.rand.Next(120, 240)) { npc.localAI[0] = 0f; - Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); } } if (npcType == NPCID.IceGolem) @@ -18133,7 +18129,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 90f && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.netUpdate = true; - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * 15; + Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 15; Projectile.NewProjectile(npc.Center - Vector2.UnitY * 28 + velocity * 2f, velocity, ProjectileID.FrostBeam, 32, 0f, Main.myPlayer, 0f, 0f); npc.ai[2] = 0f; } @@ -21150,11 +21146,12 @@ namespace CalamityMod.NPCs { if (!Collision.SolidCollision(npc.position, npc.width, npc.height) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float speed = 12f; int damage = 17; int type = ProjectileID.CursedFlameHostile; - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 180; + Vector2 flameVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 12f; + + int flame = Projectile.NewProjectile(npc.Center, flameVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[flame].timeLeft = 180; npc.localAI[0] = 0f; } else @@ -21177,7 +21174,8 @@ namespace CalamityMod.NPCs { absoluteYDistance = 0f; } - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance) * speed; + + Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed; int idx = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore, 0, 0f, 0f, 0f, 0f, 255); Main.npc[idx].velocity = velocity; @@ -21424,11 +21422,12 @@ namespace CalamityMod.NPCs { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float speed = 6f; int damage = 15; int type = ProjectileID.HarpyFeather; - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 300; + Vector2 featherVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 6f; + + int feather = Projectile.NewProjectile(npc.Center, featherVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[feather].timeLeft = 300; } } else if (npc.ai[0] >= 400f + Main.rand.Next(200)) @@ -21443,11 +21442,12 @@ namespace CalamityMod.NPCs { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float speed = 0.2f; int damage = 21; int type = ProjectileID.DemonSickle; - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 300; + Vector2 sickleVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 0.2f; + + int sickle = Projectile.NewProjectile(npc.Center, sickleVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[sickle].timeLeft = 300; } } else if (npc.ai[0] >= 300f + Main.rand.Next(200)) @@ -21462,16 +21462,16 @@ namespace CalamityMod.NPCs { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float speed = 0.2f; Vector2 spawnPosition = npc.Center; - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed; + float tridentSpeed = 0.2f; + Vector2 tridentVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * tridentSpeed; + spawnPosition += npc.velocity * 5f; int damage = 80; int type = ProjectileID.UnholyTridentHostile; - spawnPosition += npc.velocity * 5f; - int idx = Projectile.NewProjectile(spawnPosition + velocity * 100f, velocity, type, damage, 3f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 300; + int trident = Projectile.NewProjectile(spawnPosition + tridentVelocity * 100f, tridentVelocity, type, damage, 3f, Main.myPlayer, 0f, 0f); + Main.projectile[trident].timeLeft = 300; } } else if (npc.ai[0] >= 250f + Main.rand.Next(200)) @@ -21882,12 +21882,9 @@ namespace CalamityMod.NPCs npc.localAI[0] = 1f; } npc.TargetClosest(true); - float speed = 14f; - if (npc.type == NPCID.GreenJellyfish) - { - speed = 18f; - } - npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed; + + float lungeSpeed = npc.type == NPCID.GreenJellyfish ? 18f : 14f; + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * lungeSpeed; } } // General floating around. @@ -22821,9 +22818,10 @@ namespace CalamityMod.NPCs // Charge if (npc.ai[0] == 0f) { - float speed = 12f; - npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed; + float chargeSpeed = 12f; + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * chargeSpeed; npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4; + // Slow down npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -24721,12 +24719,11 @@ namespace CalamityMod.NPCs float speed = 6f; float acceleration = 0.25f; - Vector2 idealVelocity = npc.DirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed; + Vector2 idealVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed; float playerDistance = npc.Distance(Main.player[npc.target].Center); if (playerDistance < 20f) - { idealVelocity = npc.velocity; - } + // Yes, I understand that npc.SimpleFlyMovement exists. However, the "acceleration * 2f" is not a part of that method. // It is not identical to what is being achieved here. if (npc.velocity.X < idealVelocity.X) diff --git a/NPCs/CalamityVanillaMinibossesAI.cs b/NPCs/CalamityVanillaMinibossesAI.cs index c3efcf9aee..1121e61b2f 100644 --- a/NPCs/CalamityVanillaMinibossesAI.cs +++ b/NPCs/CalamityVanillaMinibossesAI.cs @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs else if (distanceFromAboveTarget > 600f) { flyInertia = 30f; - idealFlyVelocity = npc.DirectionTo(destinationAboveTarget) * 15f; + idealFlyVelocity = npc.SafeDirectionTo(destinationAboveTarget, -Vector2.UnitY) * 15f; npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia; } @@ -168,7 +168,7 @@ namespace CalamityMod.NPCs float flySpeed = 18f + npc.Distance(target.Center) / 100f; flyInertia = 25f; - idealFlyVelocity = npc.DirectionTo(target.Center) * flySpeed; + idealFlyVelocity = npc.SafeDirectionTo(target.Center, -Vector2.UnitY) * flySpeed; npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia; break; @@ -210,7 +210,7 @@ namespace CalamityMod.NPCs flySpeed = 12f + flySpeedAdditive + npc.Distance(destination) / 120f; flyInertia = 20f; - idealFlyVelocity = npc.DirectionTo(destination) * flySpeed; + idealFlyVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed; npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia; aiTimer++; @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs flySpeedAdditive += 0.0333333351f; flySpeed = 24f + flySpeedAdditive; flyInertia = 4f; - idealVelocity = npc.DirectionTo(destination) * flySpeed; + idealVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed; npc.velocity = (npc.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia; break; case MothronAIState.ChargePreparation: @@ -267,7 +267,7 @@ namespace CalamityMod.NPCs destination = target.Center - Vector2.UnitY * 12f; float chargePreperationInertia = 8f; - Vector2 chargeVelocity = npc.DirectionTo(destination) * chargeSpeed; + Vector2 chargeVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * chargeSpeed; npc.velocity = (npc.velocity * (chargePreperationInertia - 1f) + chargeVelocity) / chargePreperationInertia; npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); @@ -394,7 +394,7 @@ namespace CalamityMod.NPCs } flyInertia = 10f; - npc.velocity = (npc.velocity * (flyInertia - 1f) + npc.DirectionTo(spotToLayEgg) * flySpeed) / flyInertia; + npc.velocity = (npc.velocity * (flyInertia - 1f) + npc.SafeDirectionTo(spotToLayEgg, -Vector2.UnitY) * flySpeed) / flyInertia; break; case MothronAIState.LayEgg: @@ -435,7 +435,7 @@ namespace CalamityMod.NPCs if (distanceFromSpot < hoverSpeed) hoverSpeed = distanceFromSpot; - Vector2 hoverVelocity = npc.DirectionTo(spotToLayEgg).SafeNormalize(Vector2.Zero) * hoverSpeed; + Vector2 hoverVelocity = npc.SafeDirectionTo(spotToLayEgg) * hoverSpeed; npc.velocity = (npc.velocity * (hoverInertia - 1f) + hoverVelocity) / hoverInertia; if (npc.velocity.HasNaNs()) npc.velocity = Vector2.Zero; diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index b0ef826df5..128392b785 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -413,8 +413,9 @@ namespace CalamityMod.NPCs.GreatSandShark (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 0f, 0f); } npc.ai[2] = -30f; - Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); - npc.velocity = vector261 * 18f; + + Vector2 upwardChargeDirection = npc.SafeDirectionTo(vector260 + new Vector2(0f, -80f), -Vector2.UnitY); + npc.velocity = upwardChargeDirection * 18f; } } else diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 65da9fa6dc..eea07039dc 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -118,8 +118,9 @@ namespace CalamityMod.NPCs.NormalNPCs { if (npc.direction == 0) npc.direction = 1; + Vector2 destination = player.Center + new Vector2(300f * npc.direction, -90f); - npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(destination) * 8f, 0.1f); + npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(destination) * 8f, 0.1f); if (npc.Distance(destination) < 40f) { Time++; @@ -134,13 +135,11 @@ namespace CalamityMod.NPCs.NormalNPCs else { if (HorizontalChargeTime < 25) - { - npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(player.Center) * 8f, 0.1f); - } + npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(player.Center) * 8f, 0.1f); + if (Supercharged && Main.netMode != NetmodeID.MultiplayerClient && HorizontalChargeTime % 30f == 29f) - { - Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.DirectionTo(player.Center) * 6f, ProjectileID.MartianTurretBolt, 14, 0f); - } + Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.MartianTurretBolt, 14, 0f); + HorizontalChargeTime++; if (HorizontalChargeTime > TotalHorizontalChargeTime) { diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index 01802fe5e9..7ca82fe54c 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -167,11 +167,11 @@ namespace CalamityMod.NPCs.NormalNPCs AIState == HovercraftAIState.Hover) { Vector2 destination = player.Center + new Vector2(SearchXOffset * SearchDirection, -160f); - npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 8.5f : 6f); + npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 8.5f : 6f); if (AIState == HovercraftAIState.Hover) { destination = player.Center + new Vector2(SearchXOffset * -SearchDirection, -160f); - npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 7f : 5f); + npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 7f : 5f); } npc.rotation = npc.velocity.X / 16f; diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 52109275aa..841ac5bf93 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -129,11 +129,9 @@ namespace CalamityMod.NPCs.SulphurousSea } else if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - npc.direction = npc.spriteDirection = (npc.DirectionTo(player.Center).X < 0).ToDirectionInt(); + npc.direction = npc.spriteDirection = (npc.SafeDirectionTo(player.Center).X < 0).ToDirectionInt(); if (Math.Abs(npc.velocity.X) < 14f && Math.Abs(player.Center.X - npc.Center.X) > 65f) - { npc.velocity.X += npc.spriteDirection * -0.08f; - } } } else diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 06afd5420e..d1fa1b6fc3 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1723,7 +1723,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; Vector2 destination = targetData.Center + new Vector2(-npc.ai[2], 0f); - Vector2 desiredVelocity = npc.DirectionTo(destination) * velocity; + Vector2 desiredVelocity = npc.SafeDirectionTo(destination) * velocity; if (!targetDead) { @@ -1882,7 +1882,7 @@ namespace CalamityMod.NPCs.Yharon if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { - float newRotation = npc.DirectionTo(targetData.Center).ToRotation(); + float newRotation = npc.AngleTo(targetData.Center); float amount = 0.04f; if (npc.spriteDirection == -1) @@ -1915,7 +1915,7 @@ namespace CalamityMod.NPCs.Yharon if (num28 == 7 && doFastChargeTelegraph) { - float newRotation = npc.DirectionTo(targetData.Center).ToRotation(); + float newRotation = npc.AngleTo(targetData.Center); float amount = 0.04f; if (npc.spriteDirection == -1) @@ -1989,7 +1989,7 @@ namespace CalamityMod.NPCs.Yharon { case 2: //charge { - Vector2 vector = npc.DirectionTo(targetData.Center); + Vector2 vector = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); npc.spriteDirection = (vector.X > 0f) ? 1 : -1; npc.rotation = vector.ToRotation(); @@ -2010,7 +2010,7 @@ namespace CalamityMod.NPCs.Yharon } case 5: //spin move { - Vector2 vector3 = npc.DirectionTo(targetData.Center); + Vector2 vector3 = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); npc.spriteDirection = (vector3.X > 0f) ? 1 : -1; npc.rotation = vector3.ToRotation(); @@ -2023,7 +2023,7 @@ namespace CalamityMod.NPCs.Yharon } case 7: //fast charge { - Vector2 vector = npc.DirectionTo(targetData.Center); + Vector2 vector = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); npc.spriteDirection = (vector.X > 0f) ? 1 : -1; npc.rotation = vector.ToRotation(); @@ -2066,7 +2066,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] < fireballBreathTimer) { Vector2 vector4 = targetData.Center + new Vector2(num29 * -750f, -300f); - Vector2 value = npc.DirectionTo(vector4) * 16f; + Vector2 value = npc.SafeDirectionTo(vector4) * 16f; if (npc.Distance(vector4) < 16f) npc.Center = vector4; @@ -2120,7 +2120,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] < splittingFireballBreathTimer) { Vector2 vector5 = targetData.Center + new Vector2(num31 * -750f, -300f); - Vector2 value2 = npc.DirectionTo(vector5) * splittingFireballBreathPhaseVelocity; + Vector2 value2 = npc.SafeDirectionTo(vector5) * splittingFireballBreathPhaseVelocity; npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); @@ -2132,7 +2132,7 @@ namespace CalamityMod.NPCs.Yharon } else if (npc.ai[1] == splittingFireballBreathTimer) { - Vector2 vector6 = npc.DirectionTo(targetData.Center); + Vector2 vector6 = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); vector6.Y *= 0.15f; vector6 = vector6.SafeNormalize(Vector2.UnitX * npc.direction); @@ -2146,8 +2146,8 @@ namespace CalamityMod.NPCs.Yharon } else { - npc.position.X += npc.DirectionTo(targetData.Center).X * 7f; - npc.position.Y += npc.DirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; + npc.position.X += npc.SafeDirectionTo(targetData.Center).X * 7f; + npc.position.Y += npc.SafeDirectionTo(targetData.Center + new Vector2(0f, -400f)).Y * 6f; float xOffset = 30f; Vector2 position = vectorCenter + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); @@ -2277,7 +2277,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] == 0f) { Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * velocity * 1.5f; + Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2) * velocity * 1.5f; npc.SimpleFlyMovement(desiredVelocity2, acceleration * 1.5f); int num35 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; @@ -2400,7 +2400,7 @@ namespace CalamityMod.NPCs.Yharon { npc.velocity *= 0.9f; - Vector2 vector = npc.DirectionTo(targetData.Center); + Vector2 vector = npc.SafeDirectionTo(targetData.Center, -Vector2.UnitY); npc.spriteDirection = (vector.X > 0f) ? 1 : -1; npc.rotation = vector.ToRotation(); @@ -2444,7 +2444,7 @@ namespace CalamityMod.NPCs.Yharon } } - float num42 = npc.DirectionTo(targetData.Center).ToRotation(); + float num42 = npc.AngleTo(targetData.Center); float num43 = 0.04f; switch ((int)npc.ai[0]) diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index e766d1ed90..fa3b703f08 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -123,15 +123,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles new Vector2(originalVelocitySpeed + TravelSpeed, 0f).RotatedBy(originalVelocityDirection); // Determine how to rotate. The larger the 40 value is, the more rapidly the projectile rotates. - Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(originalVelocityDirection) + - new Vector2(originalVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(originalVelocityDirection); + Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(originalVelocityDirection) + originalVelocityDirection.ToRotationVector2() * (originalVelocitySpeed + TravelSpeed + 40f); projectile.rotation = player.AngleTo(destination) + MathHelper.PiOver4 * player.direction; //or this // Rotate 180 degrees if facing to the right if (projectile.spriteDirection == -1) projectile.rotation += MathHelper.Pi; - - player.DirectionTo(projectile.Center); } // Kill the hook if the player's item use cycle is almost over and reset the reuseDelay diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 2d45188373..cf628bb7ae 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -68,11 +68,8 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); - if (targetVec.HasNaNs()) - targetVec = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * (inertia - 1f) + targetVec * homeSpeed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; } } else diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 441c96c88c..7573d1a257 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -116,11 +116,8 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); - if (targetVec.HasNaNs()) - targetVec = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * (inertia - 1f) + targetVec * speed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } else diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index b8e74f36c6..49c4f1dc9c 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -71,12 +71,8 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.Distance(Main.player[num959].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector102 * scaleFactor12) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; } } else diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 9ca45f8dca..26db926959 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -61,11 +61,8 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.Distance(Main.player[num959].Center) > 320f) { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - vector102 = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector102 * scaleFactor12) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; } } else diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index c8e93b1cb8..2853ace474 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -295,7 +295,7 @@ namespace CalamityMod.Projectiles // If the needle is not colliding with the target, attempt to move towards it while falling. if (!projectile.WithinRange(npcToHeal.Center, initialSpeed) && !projectile.Hitbox.Intersects(npcToHeal.Hitbox)) { - Vector2 flySpeed = projectile.DirectionTo(npcToHeal.Center) * initialSpeed; + Vector2 flySpeed = projectile.SafeDirectionTo(npcToHeal.Center) * initialSpeed; // Prevent the needle from ever violating its gravity. if (flySpeed.Y < projectile.velocity.Y) @@ -1158,11 +1158,8 @@ namespace CalamityMod.Projectiles if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 15f) / 21f; + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 15f) / 21f; } } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs index 9a73005d4d..0c031c9b1f 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float oldSpeed = projectile.velocity.Length(); float inertia = MathHelper.Lerp(15f, 4f, Utils.InverseLerp(Lifetime, Lifetime - 60f, projectile.timeLeft, true)); - projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(potentialTarget.Center) * oldSpeed) / (inertia + 1f); + projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * oldSpeed) / (inertia + 1f); projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * oldSpeed; } } diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index 8e1fb15626..7aa8217b05 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -110,12 +110,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.rotation = projectile.AngleTo(target.Center); if (!Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) return; + if (Time % 80f == 79f) { if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(target.Center), + projectile.SafeDirectionTo(target.Center, Vector2.UnitY), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs index be15c6b92f..b79472f354 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs @@ -36,9 +36,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; NPC potentialTarget = projectile.Center.ClosestNPCAt(1000f); if (potentialTarget != null && projectile.Distance(potentialTarget.Center) > 40f && projectile.timeLeft > Lifetime - 60) - { - projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(potentialTarget.Center) * 24f) / 8f; - } + projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * 24f) / 8f; + projectile.frameCounter++; } diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index dd6e6f73c3..61f235d734 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void PlayerMovement(Player player) { Vector2 destination = player.Center + Vector2.UnitY.RotatedBy(Time / 16f + AngularOffset + (!North).ToInt() * MathHelper.Pi) * 180f; - projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f; + projectile.velocity = (projectile.velocity * 4f + projectile.SafeDirectionTo(destination) * 10f) / 5f; projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 10f; projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float offsetAngle = AngularOffset * 0.5f + (!North).ToInt() * MathHelper.Pi; Vector2 destination = npc.Center + Vector2.UnitY.RotatedBy(offsetAngle) * 180f; - projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f; + projectile.velocity = (projectile.velocity * 4f + projectile.SafeDirectionTo(destination) * 10f) / 5f; projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 25f; projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } else if (Time % 60f == 35f) { - projectile.velocity = projectile.DirectionTo(npc.Center) * 29f; + projectile.velocity = projectile.SafeDirectionTo(npc.Center, -Vector2.UnitY) * 29f; projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } } diff --git a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs index 63cf0f7931..820a4a8edd 100644 --- a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs @@ -20,22 +20,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.timeLeft = ReelbackTime; } } + + public Player Owner => Main.player[projectile.owner]; public float Outwardness => OutwardnessMax * (float)Math.Sin(projectile.timeLeft / (float)Lifetime * MathHelper.Pi); - public float InitialRotation - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } - public float OutwardnessMax - { - get => projectile.ai[1]; - set => projectile.ai[1] = value; - } - public float SwingDirection - { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; - } + public ref float InitialRotation => ref projectile.ai[0]; + public ref float OutwardnessMax => ref projectile.ai[1]; + public ref float SwingDirection => ref projectile.localAI[0]; public const int ChargeTime = 25; public const int ReelbackTime = 25; public const int Lifetime = ChargeTime + ReelbackTime; @@ -74,17 +64,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.rotation = projectile.AngleTo(player.Center) - MathHelper.PiOver2; - if (player.dead) + projectile.rotation = projectile.AngleTo(Owner.Center) - MathHelper.PiOver2; + if (Owner.dead) { projectile.Kill(); return; } - projectile.direction = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); + projectile.direction = (Owner.Center.X - projectile.Center.X > 0).ToDirectionInt(); projectile.spriteDirection = projectile.direction; - ManipulatePlayer(player); + + ManipulateOwnerFields(); if (projectile.timeLeft >= Lifetime - ChargeTime) { @@ -95,30 +85,30 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.velocity = InitialRotation.ToRotationVector2().RotatedBy(offsetAngle) * 29f; // Adjust the velocity to go along with the player's if the velocity directions are similar so that the player's movement doesn't hinder the projectile's movement. - if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), player.velocity.SafeNormalize(Vector2.Zero)) > 0.45f) + if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), Owner.velocity.SafeNormalize(Vector2.Zero)) > 0.45f) { - projectile.velocity += player.velocity; + projectile.velocity += Owner.velocity; } } else { - projectile.velocity = projectile.DirectionTo(player.Center) * 43f; + projectile.velocity = projectile.SafeDirectionTo(Owner.Center, Vector2.UnitX * Owner.direction) * 43f; projectile.timeLeft = ReelbackTime; - if (projectile.Distance(player.Center) < 45f) + if (projectile.WithinRange(Owner.Center, 45f)) projectile.Kill(); } GenerateIdleDust(); - if (projectile.timeLeft % 3 == 2 && projectile.Distance(player.Center) > 40f) + if (projectile.timeLeft % 3 == 2 && projectile.Distance(Owner.Center) > 40f) SpawnElectricFields(); } - public void ManipulatePlayer(Player player) + public void ManipulateOwnerFields() { - player.itemAnimation = 4; - player.itemTime = 4; - player.ChangeDir(-projectile.direction); - player.itemRotation = projectile.rotation + (projectile.spriteDirection == -1).ToInt() * MathHelper.TwoPi; + Owner.itemAnimation = 4; + Owner.itemTime = 4; + Owner.ChangeDir(-projectile.direction); + Owner.itemRotation = projectile.rotation + (projectile.spriteDirection == -1).ToInt() * MathHelper.TwoPi; } public void GenerateIdleDust() @@ -166,7 +156,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Vector2 offset = Vector2.UnitX * -SwingDirection; offset *= Outwardness * (float)Math.Sin(i / 20f * MathHelper.Pi); - offset *= Utils.InverseLerp(0f, 300f, player.Distance(Vector2.Lerp(mountedCenter, projectile.Center, i / 20f) + offset), true); + offset *= Utils.InverseLerp(0f, 300f, Owner.Distance(Vector2.Lerp(mountedCenter, projectile.Center, i / 20f) + offset), true); bezierPoints.Add(Vector2.Lerp(mountedCenter, projectile.Center, i / 20f) + offset); } bezierPoints.Add(projectile.Center); diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index db0e21a7cf..375366e4ae 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -100,10 +100,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (!Main.npc[i].CanBeChasedBy(projectile, false) || !Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) continue; - if (alreadyTargetedNPCType != Main.npc[i].whoAmI && - projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) + if (alreadyTargetedNPCType != Main.npc[i].whoAmI && projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(Main.npc[i].Center) * 5f, projectile.type, projectile.damage / 2, 0f, projectile.owner, Main.npc[i].whoAmI, projectile.ai[1] + 1f); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(Main.npc[i].Center) * 5f, projectile.type, projectile.damage / 2, 0f, projectile.owner, Main.npc[i].whoAmI, projectile.ai[1] + 1f); break; } } diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index 527b191ef7..e01f1347e2 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = -1; i <= 1; i += 2) { Projectile.NewProjectile(shootPosition, - Vector2.Normalize(potentialTarget.Center - shootPosition).RotatedBy(i * MathHelper.ToRadians(28f)) * 7f, + (potentialTarget.Center - shootPosition).SafeNormalize(Vector2.UnitY).RotatedBy(i * MathHelper.ToRadians(28f)) * 7f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, @@ -100,15 +100,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 1f); } } + if (!Main.dedServ) { for (int i = 0; i < 12; i++) - { Dust.NewDustPerfect(shootPosition, 173).scale = Main.rand.NextFloat(1.4f, 1.8f); - } } + projectile.ai[1] = 15f; - projectile.localAI[0] = Math.Sign(projectile.DirectionTo(potentialTarget.Center).X); + projectile.localAI[0] = Math.Sign(projectile.SafeDirectionTo(potentialTarget.Center).X); } } } diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.cs b/Projectiles/DraedonsArsenal/PulseTurretShot.cs index ae3ede808c..88f051de21 100644 --- a/Projectiles/DraedonsArsenal/PulseTurretShot.cs +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float speed = projectile.velocity.Length(); float inertia = MathHelper.Lerp(18f, 6f, 1f - projectile.timeLeft / 300f); - projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); + projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * speed; } } @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(projectile.Center + Vector2.UnitY.RotatedBy(j / (float)SpiralRings * MathHelper.TwoPi * direction).RotatedBy(i / (float)SpiralPrecision * MathHelper.TwoPi / SpiralRings * direction) * 36f * i / SpiralPrecision, 173); - dust.velocity = projectile.DirectionTo(dust.position) * 2.4f; + dust.velocity = projectile.SafeDirectionTo(dust.position) * 2.4f; dust.scale = 1.6f; dust.noGravity = true; diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index 9253d9304b..5be2791c08 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -201,14 +201,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (projectile.ai[1] > 0 && Main.myPlayer == projectile.owner) { - Projectile laser = Projectile.NewProjectileDirect(projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness), - projectile.DirectionTo(npc.Center) * 4f, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner); - if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) + Vector2 shootPosition = projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness); + Vector2 shootVelocity = projectile.SafeDirectionTo(npc.Center, Main.rand.NextVector2Unit()) * 4f; + int laser = Projectile.NewProjectile(shootPosition, shootVelocity, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner); + if (laser.WithinBounds(Main.maxProjectiles)) { - laser.timeLeft *= 2; - laser.tileCollide = false; - laser.netUpdate = true; - laser.Calamity().forceMinion = true; + Main.projectile[laser].timeLeft *= 2; + Main.projectile[laser].tileCollide = false; + Main.projectile[laser].netUpdate = true; + Main.projectile[laser].Calamity().forceMinion = true; } } projectile.ai[1]++; diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 01eaccc70e..648aaa1eb4 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal minimumFrame = 7; maximumFrame = 11; float inertia = 30f; - projectile.velocity = (projectile.velocity * (inertia - 1) + projectile.DirectionTo(player.Center) * 18f) / inertia; + projectile.velocity = (projectile.velocity * (inertia - 1) + projectile.SafeDirectionTo(player.Center) * 18f) / inertia; } // Otherwise hop around when on the ground. else if (projectile.oldPosition.Y == projectile.position.Y) diff --git a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs index 4ecab38d9c..bdac20c2e8 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { NPC potentialTarget = projectile.Center.ClosestNPCAt(900f); if (potentialTarget != null) - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 15f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 15f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } // Sometimes generate lightning from the outside of the energy field if the projectile was spawned by a stealth strike. diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index 59940763fd..c81d074aca 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return; } projectile.tileCollide = false; - projectile.velocity = projectile.DirectionTo(player.Center) * ReelbackSpeed; + projectile.velocity = projectile.SafeDirectionTo(player.Center) * ReelbackSpeed; break; } @@ -136,9 +136,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(target.Center + angle.ToRotationVector2() * 10f, 226); dust.velocity = Vector2.Zero; if (Main.rand.NextBool(6)) - { - dust.velocity = target.DirectionTo(dust.position) * 4.5f; - } + dust.velocity = target.SafeDirectionTo(dust.position) * 4.5f; + dust.noGravity = true; } } diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs index 0287414264..954725406c 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (projectile.Center.ManhattanDistance(Main.npc[i].Center) < num474) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(Main.npc[i].Center) * 2f, projectile.type, (int)(projectile.damage * 0.6), projectile.knockBack * 0.6f, projectile.owner, 0f, -1f); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(Main.npc[i].Center) * 2f, projectile.type, (int)(projectile.damage * 0.6), projectile.knockBack * 0.6f, projectile.owner, 0f, -1f); projectile.ai[1] = 60f; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index dcfd2bacee..36394ba750 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (targetCount >= MaxLaserCountPerShot) break; Projectile laser = Projectile.NewProjectileDirect(projectile.Center, - projectile.DirectionTo(target.Center) * 4f, + projectile.SafeDirectionTo(target.Center) * 4f, ModContent.ProjectileType(), damage, projectile.knockBack, @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetSearchDistance); if (potentialTarget != null) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 3f, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 3f, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner); } } } diff --git a/Projectiles/DraedonsArsenal/UnstableMatter.cs b/Projectiles/DraedonsArsenal/UnstableMatter.cs index 63fcc2d8f1..59e15d27cb 100644 --- a/Projectiles/DraedonsArsenal/UnstableMatter.cs +++ b/Projectiles/DraedonsArsenal/UnstableMatter.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // And bounce off the tile. Or towards a nearby enemy, if there is one. NPC potentialTarget = projectile.Center.ClosestNPCAt(700f, false); if (potentialTarget != null) - projectile.velocity = projectile.DirectionTo(potentialTarget.Center); + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center); else { if (projectile.velocity.X != oldVelocity.X) diff --git a/Projectiles/DraedonsArsenal/VoltageStream.cs b/Projectiles/DraedonsArsenal/VoltageStream.cs index 59b66142a3..a3d39e2e4a 100644 --- a/Projectiles/DraedonsArsenal/VoltageStream.cs +++ b/Projectiles/DraedonsArsenal/VoltageStream.cs @@ -80,9 +80,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(Target.Center + angle.ToRotationVector2() * radius, 226); dust.velocity = Vector2.Zero; if (Main.rand.NextBool(6)) - { - dust.velocity = Target.DirectionTo(dust.position) * 4.5f; - } + dust.velocity = Target.SafeDirectionTo(dust.position) * 4.5f; + dust.noGravity = true; } } diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index 8aca72cbba..0f194414d8 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Enemy projectile.rotation = (Main.npc[(int)projectile.ai[0]].Top - projectile.Center + offsetDrawVector).ToRotation() + MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { - projectile.velocity = (projectile.velocity * 10f + projectile.DirectionTo(Main.player[toTarget].Center) * 9f) / 11f; + projectile.velocity = (projectile.velocity * 10f + projectile.SafeDirectionTo(Main.player[toTarget].Center) * 9f) / 11f; if (projectile.timeLeft <= 180f) { projectile.localAI[0] = 1f; projectile.netUpdate = true; } - if (projectile.Distance(Main.player[toTarget].Center) < 16f) + if (projectile.WithinRange(Main.player[toTarget].Center, 16f)) { projectile.localAI[0] = 1f; ReelingPlayer = true; @@ -64,17 +64,13 @@ namespace CalamityMod.Projectiles.Enemy else { if (ReelingPlayer) - { Main.player[toTarget].Center = projectile.Center; - } + if (Main.player[toTarget].dead) - { ReelingPlayer = false; - } - if (projectile.Distance(Main.npc[(int)projectile.ai[0]].Center) > 6f) - { - projectile.velocity = (projectile.velocity * 16f + projectile.DirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 19f) / 17f; - } + + if (!projectile.WithinRange(Main.npc[(int)projectile.ai[0]].Center, 6f)) + projectile.velocity = (projectile.velocity * 16f + projectile.SafeDirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 19f) / 17f; } } diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs index 71ab545c3c..b3c5df79b6 100644 --- a/Projectiles/Enemy/NuclearBulletMedium.cs +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -40,9 +40,8 @@ namespace CalamityMod.Projectiles.Enemy Player player = Main.player[(int)projectile.ai[1]]; float inertia = 10f; if (projectile.Distance(player.Center) > 70f) - { - projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(player.Center) * 18.5f) / (inertia + 1f); - } + projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(player.Center) * 18.5f) / (inertia + 1f); + projectile.tileCollide = true; } else diff --git a/Projectiles/Magic/Crescent.cs b/Projectiles/Magic/Crescent.cs index bbf98cea75..5205767607 100644 --- a/Projectiles/Magic/Crescent.cs +++ b/Projectiles/Magic/Crescent.cs @@ -38,7 +38,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile parent = Main.projectile[(int)projectile.ai[0]]; - if (!parent.active) projectile.Kill(); + if (!parent.active) + projectile.Kill(); projectile.rotation += 0.7f; @@ -46,8 +47,9 @@ namespace CalamityMod.Projectiles.Magic if (projectile.ai[1] > 20) { - projectile.velocity += projectile.DirectionTo(parent.Center) * 2.5f; - if (projectile.Distance(parent.Center) < 75f) projectile.active = false; + projectile.velocity += projectile.SafeDirectionTo(parent.Center) * 2.5f; + if (projectile.WithinRange(parent.Center, 75f)) + projectile.Kill(); } } } diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index 494b174ae1..58e84f49c5 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -52,12 +52,8 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index fda7befb91..f1e79ff552 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -113,9 +113,7 @@ namespace CalamityMod.Projectiles.Magic { NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true, true); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 5f + projectile.DirectionTo(potentialTarget.Center) * 7f) / 6f; - } + projectile.velocity = (projectile.velocity * 5f + projectile.SafeDirectionTo(potentialTarget.Center) * 7f) / 6f; } public void PulseEffect() { @@ -162,7 +160,8 @@ namespace CalamityMod.Projectiles.Magic float rotation = Main.rand.NextFloat(MathHelper.TwoPi); Vector2 velocity = Vector2.UnitY.RotatedBy(rotation); if (closestTarget != null) - velocity = projectile.DirectionTo(closestTarget.Center).RotatedByRandom(0.4f); + velocity = projectile.SafeDirectionTo(closestTarget.Center, -Vector2.UnitY).RotatedByRandom(0.4f); + velocity *= Main.rand.NextFloat(3f, 5f); Projectile.NewProjectileDirect(projectile.Center, diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs index 18d8d23858..d42866dc1c 100644 --- a/Projectiles/Magic/EternityCrystal.cs +++ b/Projectiles/Magic/EternityCrystal.cs @@ -90,9 +90,10 @@ namespace CalamityMod.Projectiles.Magic projectile.localAI[0] += 1f; if (projectile.timeLeft == 1 && !Collapsing) { - projectile.velocity = projectile.DirectionTo(target.Center) * 2f; + projectile.velocity = projectile.SafeDirectionTo(target.Center) * 2f; projectile.timeLeft = InwardCollapseTime; Collapsing = true; + projectile.netUpdate = true; } SpinAngle -= MathHelper.ToRadians(DegreesToSpin); diff --git a/Projectiles/Magic/EternityHoming.cs b/Projectiles/Magic/EternityHoming.cs index 4fe3a17bce..a208ef02a9 100644 --- a/Projectiles/Magic/EternityHoming.cs +++ b/Projectiles/Magic/EternityHoming.cs @@ -48,9 +48,8 @@ namespace CalamityMod.Projectiles.Magic } } if (target != null) - { - projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(target.Center) * 10f) / 8f; - } + projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(target.Center) * 10f) / 8f; + projectile.ai[0] += 0.18f; float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; float pulse = (float)Math.Sin(projectile.ai[0]); diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index 1b6fa190c2..115e28862e 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 center = projectile.Center; float homingRange = 800f; bool homeIn = false; - float N = 30f; + float inertia = 30f; float homingVelocity = 20f; for (int i = 0; i < Main.maxNPCs; i++) @@ -110,11 +110,9 @@ namespace CalamityMod.Projectiles.Magic if (homeIn) { projectile.extraUpdates = 1; - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 homeInVector = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * N + homeInVector * homingVelocity) / (N + 1f); + projectile.velocity = (projectile.velocity * inertia + homeInVector * homingVelocity) / (inertia + 1f); } else projectile.extraUpdates = 0; diff --git a/Projectiles/Magic/FatesRevealFlame.cs b/Projectiles/Magic/FatesRevealFlame.cs index 84963b257b..99c3278896 100644 --- a/Projectiles/Magic/FatesRevealFlame.cs +++ b/Projectiles/Magic/FatesRevealFlame.cs @@ -95,9 +95,8 @@ namespace CalamityMod.Projectiles.Magic Dust dust13 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 60, 0f, -2f, 0, default, 1f)]; dust13.noGravity = true; if (dust13.position != projectile.Center) - { - dust13.velocity = projectile.DirectionTo(dust13.position) * 3f; - } + dust13.velocity = projectile.SafeDirectionTo(dust13.position) * 3f; + num3 = num955; } } @@ -105,12 +104,8 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.Distance(Main.player[projectile.owner].Center) > num950) { - Vector2 vector118 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector118.HasNaNs()) - { - vector118 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num949 - 1f) + moveDirection * scaleFactor11) / num949; } } else diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs index e7f1972e26..d6c225ead4 100644 --- a/Projectiles/Magic/LightBlade.cs +++ b/Projectiles/Magic/LightBlade.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = 0f; else { - Vector2 homingVec = projectile.DirectionTo(paired.Center) * projectile.ai[0]; + Vector2 homingVec = projectile.SafeDirectionTo(paired.Center) * projectile.ai[0]; projectile.velocity = (projectile.velocity * (SwordHomingStrength - 1f) + homingVec) / SwordHomingStrength; } } diff --git a/Projectiles/Magic/StratusSphereProj.cs b/Projectiles/Magic/StratusSphereProj.cs index 07e0488fad..07d03804aa 100644 --- a/Projectiles/Magic/StratusSphereProj.cs +++ b/Projectiles/Magic/StratusSphereProj.cs @@ -54,20 +54,22 @@ namespace CalamityMod.Projectiles.Magic { projectile.velocity.X = projectile.velocity.X * 10 / 11; projectile.velocity.Y = projectile.velocity.Y * 10 / 11; - if (roundsGone <= 4) projectile.ai[1]++; + if (roundsGone <= 4) + projectile.ai[1]++; + int rand = Main.rand.Next(-50, 51); int rand2 = Main.rand.Next(-50, 51); Vector2 targetDir = projectile.Center + new Vector2(rand, rand2); if (projectile.ai[1] > 40) - { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); - } + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); + if (projectile.ai[1] > 46) { projectile.ai[1] = 0; roundsGone++; } - if (roundsGone > 4 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] == 0) projectile.Kill(); + if (roundsGone > 4 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] == 0) + projectile.Kill(); } projectile.frameCounter++; diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index fc5566674c..5701975589 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -61,12 +61,8 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 8338673f60..2635b5f79b 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -55,12 +55,8 @@ namespace CalamityMod.Projectiles.Melee { float inertia = projectile.ai[0]; float speed = projectile.ai[1]; - Vector2 targetPos = projectile.DirectionTo(target.Center); - if (targetPos.HasNaNs()) - { - targetPos = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (inertia - 1f) + targetPos * speed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(target.Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 5a252533b9..cefe9f0692 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -68,21 +68,15 @@ namespace CalamityMod.Projectiles.Melee } else if (halfWay) { - int direction2 = (player.DirectionTo(Main.MouseWorld).X > 0f) ? 1 : -1; - if ((float)direction2 != projectile.velocity.X) + int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); + if (expectedDirection != projectile.velocity.X) { - player.ChangeDir(direction2); - projectile.velocity = new Vector2(direction2, 0f); - projectile.netUpdate = true; + player.ChangeDir(expectedDirection); + projectile.velocity = Vector2.UnitX * expectedDirection; projectile.rotation -= MathHelper.Pi; + projectile.netUpdate = true; } } - if ((projectile.ai[0] == 1f || (halfWay && projectile.active)) && projectile.owner == Main.myPlayer) - { - Vector2 mouse = player.DirectionTo(Main.MouseWorld) * 0f; - player.DirectionTo(mouse); - } - SpawnDust(player, direction); PositionAndRotation(player); VisibilityAndLight(); @@ -90,14 +84,15 @@ namespace CalamityMod.Projectiles.Melee private void SpawnDust(Player player, int direction) { - float num12 = projectile.rotation - MathHelper.PiOver4 * (float)direction; + float num12 = projectile.rotation - MathHelper.PiOver4 * direction; Vector2 value3 = projectile.Center + (num12 + ((direction == -1) ? MathHelper.Pi : 0f)).ToRotationVector2() * 30f; Vector2 vector2 = num12.ToRotationVector2(); - Vector2 value4 = vector2.RotatedBy((double)(MathHelper.PiOver2 * projectile.spriteDirection), default); + Vector2 value4 = vector2.RotatedBy(MathHelper.PiOver2 * projectile.spriteDirection); + if (Main.rand.NextBool(2)) { Dust dust = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 244, player.velocity.X, player.velocity.Y, 150, default, 1f); - dust.velocity = projectile.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f; + dust.velocity = projectile.SafeDirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f; } for (int j = 0; j < 4; j++) { diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 6edb8209b4..133a483495 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -135,12 +135,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > minDist) { - Vector2 vecToPlayer = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vecToPlayer.HasNaNs()) - { - vecToPlayer = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (inertia - 1f) + vecToPlayer * homingSpeed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; } } else diff --git a/Projectiles/Melee/ExoGladSpears.cs b/Projectiles/Melee/ExoGladSpears.cs index c5e4ef00e9..c392e743ff 100644 --- a/Projectiles/Melee/ExoGladSpears.cs +++ b/Projectiles/Melee/ExoGladSpears.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee NPC potentialTarget = projectile.Center.ClosestNPCAt(1000f); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 8f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 8f) / 21f; else if (projectile.Distance(Main.player[projectile.owner].Center) > 1000f) { float inertia = 25f * FlySpeedMultiplier; diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index a461e4dfdd..8c94e17a19 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -75,12 +75,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; } } } diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index 7cb8df1cf1..7479a2121a 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -39,14 +39,16 @@ namespace CalamityMod.Projectiles.Melee { NPC target = projectile.Center.ClosestNPCAt(GaelsGreatsword.SearchDistance); projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC + if (target != null) { - float velocityMagnitude = projectile.velocity.Length(); - Vector2 distanceNorm = projectile.DirectionTo(target.Center) * velocityMagnitude * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); - float inverseTurnSpeed = (projectile.Distance(target.Center) < 240f ? 4f : 13f); - projectile.velocity = (projectile.velocity * inverseTurnSpeed + distanceNorm) / (inverseTurnSpeed + 0.4f); + float homingSpeed = projectile.velocity.Length() * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); + Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center) * homingSpeed; + + float inertia = projectile.Distance(target.Center) < 240f ? 4f : 13f; + projectile.velocity = (projectile.velocity * inertia + idealVelocity) / (inertia + 0.4f); projectile.velocity.Normalize(); - projectile.velocity *= velocityMagnitude; + projectile.velocity *= homingSpeed; } } diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index 1ff16e72b5..8c914d33fd 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -60,12 +60,13 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC if (target != null) { - float velocityMagnitude = projectile.velocity.Length(); - Vector2 distanceNorm = projectile.DirectionTo(target.Center) * velocityMagnitude * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); - float inverseTurnSpeed = (projectile.Distance(target.Center) < 240f ? 4f : 13f); - projectile.velocity = (projectile.velocity * inverseTurnSpeed + distanceNorm) / (inverseTurnSpeed + 0.4f); + float homingSpeed = projectile.velocity.Length() * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); + Vector2 idealVelocity = projectile.SafeDirectionTo(target.Center) * homingSpeed; + + float inertia = projectile.Distance(target.Center) < 240f ? 4f : 13f; + projectile.velocity = (projectile.velocity * inertia + idealVelocity) / (inertia + 0.4f); projectile.velocity.Normalize(); - projectile.velocity *= velocityMagnitude; + projectile.velocity *= homingSpeed; } //Dust circle diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 6c5ccf01de..fcbb58ea43 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -59,12 +59,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 5f6b4a2bc1..ace5640990 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -59,12 +59,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index dcac84ab6f..6b8e6d04ba 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -58,12 +58,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index f7c4378fe3..40853f457b 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(startingVelocityRotation) + new Vector2(startingVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(startingVelocityRotation); - Vector2 directionTowardsEnd = player.DirectionTo(destination); + Vector2 directionTowardsEnd = player.SafeDirectionTo(destination, Vector2.UnitX * player.direction); Vector2 initalVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY); float dustCount = 2f; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee.Spears while (i < dustCount) { Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); - dust.velocity = player.DirectionTo(dust.position) * 2f; + dust.velocity = player.SafeDirectionTo(dust.position) * 2f; dust.position = projectile.Center + initalVelocity.RotatedBy(completionAsAngle * 2f + i / dustCount * MathHelper.TwoPi) * 10f; dust.scale = 1f + Main.rand.NextFloat(0.6f); @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee.Spears if (Main.rand.NextBool(3)) { Dust dust = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f); - dust.velocity = player.DirectionTo(dust.position) * 2f; + dust.velocity = player.SafeDirectionTo(dust.position) * 2f; dust.position = projectile.Center + directionTowardsEnd * -110f; dust.scale = 0.45f + Main.rand.NextFloat(0.4f); dust.fadeIn = 0.7f + Main.rand.NextFloat(0.4f); diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index b15fa59403..cc451323ca 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -54,12 +54,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(player.Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(player.Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector102 * speed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(player.Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } else diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 2b213b2620..2ae51421bc 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -72,22 +72,15 @@ namespace CalamityMod.Projectiles.Melee } else if (flag2) { - Vector2 mouseWorld2 = Main.MouseWorld; - int num11 = (player.DirectionTo(mouseWorld2).X > 0f) ? 1 : -1; - if ((float)num11 != projectile.velocity.X) + int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); + if (expectedDirection != projectile.velocity.X) { - player.ChangeDir(num11); - projectile.velocity = new Vector2((float)num11, 0f); + player.ChangeDir(expectedDirection); + projectile.velocity = Vector2.UnitX * expectedDirection; + projectile.rotation -= MathHelper.Pi; projectile.netUpdate = true; - projectile.rotation -= 3.14159274f; } } - if ((projectile.ai[0] == num10 || (projectile.ai[0] == (float)(int)(num / 2f) && projectile.active)) && projectile.owner == Main.myPlayer) - { - Vector2 mouseWorld3 = Main.MouseWorld; - Vector2 mouse = player.DirectionTo(mouseWorld3) * 0f; - player.DirectionTo(mouse); - } float num12 = projectile.rotation - 0.7853982f * (float)num9; value2 = (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * (projectile.ai[0] / num) * scaleFactor; Vector2 value3 = projectile.Center + (num12 + ((num9 == -1) ? 3.14159274f : 0f)).ToRotationVector2() * 30f; @@ -96,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) { Dust dust3 = Dust.NewDustDirect(value3 - new Vector2(5f), 10, 10, 33, player.velocity.X, player.velocity.Y, 150, default, 1f); - dust3.velocity = projectile.DirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; + dust3.velocity = projectile.SafeDirectionTo(dust3.position) * 0.1f + dust3.velocity * 0.1f; } for (int j = 0; j < 4; j++) { diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index 1357fc2f7a..f92cb1023e 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -58,12 +58,8 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 11f, 20f); diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs index 776391ca03..c698b23d06 100644 --- a/Projectiles/Ranged/ExoSpark.cs +++ b/Projectiles/Ranged/ExoSpark.cs @@ -46,9 +46,8 @@ namespace CalamityMod.Projectiles.Ranged } NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetDistance); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.DirectionTo(potentialTarget.Center) * 16f) / HomingInertia; - } + projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / HomingInertia; + projectile.rotation = projectile.velocity.ToRotation(); if (!Main.dedServ) { diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 87580ef43f..b25734ad75 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -64,9 +64,10 @@ namespace CalamityMod.Projectiles.Ranged } if (homeIn) { - projectile.velocity = (projectile.velocity * 15f + projectile.DirectionTo(targetCenter) * 30f) / 16f; + projectile.velocity = (projectile.velocity * 15f + projectile.SafeDirectionTo(targetCenter) * 30f) / 16f; return; } + projectile.frameCounter++; if (projectile.frameCounter > 3) { diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs index 665a92b47e..22c7f00099 100644 --- a/Projectiles/Ranged/UltimaBowProjectile.cs +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); shotPosition += projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * projectile.spriteDirection) * 42f; - projectile.velocity = projectile.DirectionTo(Main.MouseWorld); + projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld); Vector2 shotVelocity = projectile.velocity * shotSpeed; // The velocity should always be a unit vector. @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Ranged { // To ensure that the sparks don't spawn on top of the laser itself. float offsetAngle = Main.rand.NextFloat(0.2f, 0.5f) * Main.rand.NextBool(2).ToDirectionInt(); - Vector2 sparkVelocity = projectile.DirectionTo(Main.MouseWorld).RotatedByRandom(0.5f) * 13f; + Vector2 sparkVelocity = projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).RotatedByRandom(0.5f) * 13f; sparkVelocity = sparkVelocity.RotatedBy(offsetAngle); Projectile.NewProjectile(shotPosition, sparkVelocity, ModContent.ProjectileType(), damage / 3, knockBack, projectile.owner); } diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs index 3601f50e2d..7cc133ac60 100644 --- a/Projectiles/Ranged/UltimaSpark.cs +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxHomingDistance); if (potentialTarget != null) { - projectile.velocity = (projectile.velocity * 8f + projectile.DirectionTo(potentialTarget.Center) * 18f) / 9f; + projectile.velocity = (projectile.velocity * 8f + projectile.SafeDirectionTo(potentialTarget.Center) * 18f) / 9f; return; } diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 855bdf7477..64d9a5ded7 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -108,11 +108,8 @@ namespace CalamityMod.Projectiles.Ranged if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * inertia + homeInVector * speed) / (inertia + 1f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * inertia + moveDirection * speed) / (inertia + 1f); } return false; } diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index e80b6480e8..1d4a0f8317 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue { NPC target = projectile.Center.ClosestNPCAt(640f); if (target != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(target.Center) * 20f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(target.Center) * 20f) / 21f; } projectile.alpha += 5; diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index b90bd6f5d3..88c5a20002 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -40,9 +40,7 @@ namespace CalamityMod.Projectiles.Rogue { NPC target = projectile.Center.ClosestNPCAt(640f); if (target != null) - { - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(target.Center) * 20f) / 21f; - } + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(target.Center) * 20f) / 21f; } // This code is only run on stealth strikes and periodically spawns damaging afterimages. diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 6bf9f3b120..837bcfe9d7 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -53,9 +53,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity *= 1.07f; } else if (target != null) - { - projectile.velocity = (projectile.velocity * 23f + projectile.DirectionTo(target.Center) * 14.975f) / 24f; - } + projectile.velocity = (projectile.velocity * 23f + projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; else { projectile.timeLeft = Math.Min(projectile.timeLeft, 15); diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.cs b/Projectiles/Rogue/EpidemicShredderProjectile.cs index ef94713d2b..10c8b6aa9d 100644 --- a/Projectiles/Rogue/EpidemicShredderProjectile.cs +++ b/Projectiles/Rogue/EpidemicShredderProjectile.cs @@ -38,11 +38,9 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.timeLeft < 580f) { - projectile.velocity = (projectile.velocity * 18f + projectile.DirectionTo(Main.player[projectile.owner].Center) * 18f) / 19f; + projectile.velocity = (projectile.velocity * 18f + projectile.SafeDirectionTo(Main.player[projectile.owner].Center) * 18f) / 19f; if (Main.player[projectile.owner].Hitbox.Intersects(projectile.Hitbox)) - { projectile.Kill(); - } } if (projectile.timeLeft % 5 == 0 && projectile.Calamity().stealthStrike) { diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs index 0a4feb1c58..1a4e9bc4c9 100644 --- a/Projectiles/Rogue/FinalDawnFireball.cs +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -41,11 +41,11 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[idx].noLight = true; projectile.ai[0]++; - if(projectile.ai[0] >= 20) + if (projectile.ai[0] >= 20) { projectile.friendly = true; NPC npc = Main.npc[(int)projectile.ai[1]]; - Vector2 desiredVelocity = projectile.DirectionTo(npc.Center) * DesiredSpeed; + Vector2 desiredVelocity = projectile.SafeDirectionTo(npc.Center) * DesiredSpeed; projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); if(!npc.active) projectile.Kill(); diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index 2680d6ee8d..c80923555b 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Rogue if (player.Calamity().StealthStrikeAvailable() && projectile.ai[1] != 1f) { int stealth = Projectile.NewProjectile(player.Center, - player.DirectionTo(Main.MouseWorld) * 38f, + player.SafeDirectionTo(Main.MouseWorld) * 38f, ModContent.ProjectileType(), (int)(projectile.damage * 1.5f), projectile.knockBack, @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue else { Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(Main.MouseWorld) * 38f, + projectile.SafeDirectionTo(Main.MouseWorld) * 38f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); if (projectile.ai[1] != 1f) diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index 9a339a2ba1..0487ae533b 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0]++; if (projectile.ai[0] >= 30) { - Vector2 desiredVelocity = projectile.DirectionTo(player.Center) * DesiredSpeed; + Vector2 desiredVelocity = projectile.SafeDirectionTo(player.Center) * DesiredSpeed; projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); float distance = projectile.Distance(player.Center); diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 3e40d45b3e..a86c008cc6 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -70,11 +70,8 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 14f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 14f) / (21f); } projectile.velocity = initStealth && !homeIn ? initialVelocity : projectile.velocity; } diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index 400206f294..6ec8979684 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue // Make sure the soul is always facing forwards projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - float playerHomingStrength = 40f * projectile.ai[1]; // ranges from 20 to 60 + float inertia = 40f * projectile.ai[1]; // ranges from 20 to 60 float homingSpeed = 8f * projectile.ai[1]; // ranges from 4 to 12 float playerHomingRange = 900f; @@ -83,10 +83,8 @@ namespace CalamityMod.Projectiles.Rogue // If you are too far away from the projectiles, they home in on you. if (projectile.Distance(Main.player[projectile.owner].Center) > playerHomingRange) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - vector102 = Vector2.UnitY; - projectile.velocity = (projectile.velocity * (playerHomingStrength - 1f) + vector102 * homingSpeed) / playerHomingStrength; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; return; } diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index a7cde511ea..6610c60468 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -73,12 +73,9 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } else projectile.Kill(); diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index c896663b37..84663dc8f2 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -51,12 +51,9 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (11f); + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 10f + moveDirection * 30f) / (11f); } else { diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index dbec1dfcd9..e059580d91 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -74,11 +74,8 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { projectile.extraUpdates = 2; - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } } diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 820749f241..5f9598ffcd 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -89,11 +89,8 @@ namespace CalamityMod.Projectiles.Rogue { projectile.timeLeft = 600; //when homing in, the projectile cannot run out of timeLeft, but synthesized timeLeft still runs - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (10f + 1f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 10f + moveDirection * 30f) / (10f + 1f); } else { diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index ac86eb7a62..eee05e5b13 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -68,12 +68,9 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } else projectile.Kill(); diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index df551d8071..2f332ec106 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -117,11 +117,9 @@ namespace CalamityMod.Projectiles.Rogue targetIndex = closestTarget.whoAmI; float inertia = 20f; float homingVelocity = projectile.Calamity().stealthStrike ? 30f : 20f; - Vector2 homeInVector = projectile.DirectionTo(closestTarget.Center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 moveDirection = projectile.SafeDirectionTo(closestTarget.Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * inertia + homeInVector * homingVelocity) / (inertia + 1f); + projectile.velocity = (projectile.velocity * inertia + moveDirection * homingVelocity) / (inertia + 1f); } } else diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index 4367a44f85..e246811fec 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon } NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 17f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 17f) / 21f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 1b4c9423fd..7eaa0c7ad6 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Summon { float angle = Main.rand.NextFloat(-0.1f, 0.1f) + i * 0.05f; Projectile.NewProjectile(projectile.Center + new Vector2(0f, -6f), - projectile.DirectionTo(target.Center).RotatedBy(angle) * 7.5f, + projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 7.5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index 7b037d1901..91ae28461b 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon { if (Time++ % 35f == 34f && Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { - Vector2 velocity = projectile.DirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); + Vector2 velocity = projectile.SafeDirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } } diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index 428ef918ba..68346087f4 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Summon } NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 40f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 40f) / 21f; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 8cce76312d..f8eda30ca8 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon } NPC potentialTarget = projectile.Center.MinionHoming(600f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 45f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 45f) / 21f; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index 31c43114e3..3f3490836b 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -105,13 +105,11 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - float homingRatio = 20f; + float homingInertia = 20f; float homingVelocity = 20f; - projectile.velocity = (projectile.velocity * homingRatio + homeInVector * homingVelocity) / (homingRatio + 1f); + projectile.velocity = (projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); } } diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index 96eb17d447..f14ab583da 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -151,13 +151,11 @@ namespace CalamityMod.Projectiles.Summon } if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - float homingRatio = 15f; + float homingInertia = 15f; float homingVelocity = 30f; - projectile.velocity = (projectile.velocity * homingRatio + homeInVector * homingVelocity) / (homingRatio + 1f); + projectile.velocity = (projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); } projectile.frameCounter++; if (projectile.frameCounter > 3) diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index 1a5af418d3..62b6114e16 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -123,10 +123,11 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity = projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * projectile.velocity.Length(); // If not super close to the target but the target is very much in the line of sight of the summon, charge. - if (!projectile.WithinRange(target.Center, 75f) && Vector2.Dot(projectile.DirectionTo(target.Center), projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.85f) + if (!projectile.WithinRange(target.Center, 75f) && Vector2.Dot(projectile.SafeDirectionTo(target.Center), projectile.velocity.SafeNormalize(Vector2.Zero)) > 0.85f) { - projectile.velocity = projectile.DirectionTo(target.Center) * 36f; + projectile.velocity = projectile.SafeDirectionTo(target.Center) * 36f; AttackDelay = 15f; + projectile.netUpdate = true; } diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index e9c08e0989..4b4ed9b1f2 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon } Vector2 destination = player.Center + projectile.ai[1].ToRotationVector2() * new Vector2(1f, (float)Math.Cos(projectile.ai[1])) * 200f; - projectile.velocity = (projectile.velocity * 18f + projectile.DirectionTo(destination) * 14f) / 20f; + projectile.velocity = (projectile.velocity * 18f + projectile.SafeDirectionTo(destination) * 14f) / 20f; projectile.frameCounter++; if (projectile.frameCounter >= 6) @@ -109,8 +109,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = (projectile.localAI[1] == 1f).ToInt() * 4; } - - projectile.MinionAntiClump(0.1f); + + projectile.MinionAntiClump(0.1f); if (projectile.Distance(player.Center) > 2700f) { projectile.Center = player.Center; @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon float acceleration = (projectile.localAI[1] == 1f) ? 1.6f : 0.8f; float minSpeed = (projectile.localAI[1] == 1f) ? 13f : 8f; float maxSpeed = (projectile.localAI[1] == 1f) ? 21f : 18f; - projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); projectile.rotation = projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == 1).ToInt() * MathHelper.Pi; } else if (projectile.ai[0] > 0) @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon else if (projectile.Distance(potentialTarget.Center) >= 1100f) { projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); - projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + 2f, 6f, 15f); + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + 2f, 6f, 15f); SeekingTarget = true; projectile.ai[0] = 0f; } diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 664a2756cc..6352c75f0e 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -119,9 +119,7 @@ namespace CalamityMod.Projectiles.Summon if (targetAliveAndInLineOfSight && target.CanBeChasedBy() && Main.myPlayer == projectile.owner) { if (Time % 40f == 24f) - { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(target.Center) * 6f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - } + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); if (Time % 40f >= 33f) projectile.frame = Main.projFrames[projectile.type] - 1; @@ -155,7 +153,7 @@ namespace CalamityMod.Projectiles.Summon if (distanceFromTarget > 7f) { float speed = MathHelper.Lerp(2f, 17f, Utils.InverseLerp(10f, 70f, distanceFromTarget, true)); - projectile.velocity = (projectile.velocity * 9f + projectile.DirectionTo(returnPosition) * speed) / 10f; + projectile.velocity = (projectile.velocity * 9f + projectile.SafeDirectionTo(returnPosition) * speed) / 10f; } if (projectile.Center.Y > body.Center.Y - 50f) diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 99a5a385df..aa64f7219c 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon } NPC potentialTarget = projectile.Center.MinionHoming(400f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 10f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 21f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index d011320652..1269feae56 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon } NPC potentialTarget = projectile.Center.MinionHoming(300f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 25f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 183098f5bf..00d7233e4d 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon } NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 20f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 21f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/FlyingOrthocera.cs b/Projectiles/Summon/FlyingOrthocera.cs index 423efb030a..f77650b307 100644 --- a/Projectiles/Summon/FlyingOrthocera.cs +++ b/Projectiles/Summon/FlyingOrthocera.cs @@ -68,9 +68,7 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0]++ % 30f == 29f) { if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 11f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); - } + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY) * 11f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); } } else diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index 6f0b771a20..53a6441b6d 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -87,11 +87,9 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = projectile.Center.MinionHoming(500f, player); if (potentialTarget != null) { - if (projectile.ai[1]++ % 35f == 34f && - Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) + if (projectile.ai[1]++ % 35f == 34f && Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 20f, - ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 20f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } } } diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index 12c480bc43..842e6d5847 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -219,18 +219,12 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; float minionSpeed = amalgam ? 20f : 8f; float turnSpeed = 14f; - Vector2 targetLocation = targetVec - projectile.Center; - float targetDist = targetLocation.Length(); + float targetDist = projectile.Distance(targetVec); if (targetDist < 100f) minionSpeed = amalgam ? 25f : 10f; - Vector2 homeInVector = projectile.DirectionTo(targetLocation); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - targetLocation.Normalize(); - targetLocation *= minionSpeed; - projectile.velocity = (projectile.velocity * turnSpeed + targetLocation) / (turnSpeed + 1f); + Vector2 homingVelocity = projectile.SafeDirectionTo(targetVec) * minionSpeed; + projectile.velocity = (projectile.velocity * turnSpeed + homingVelocity) / (turnSpeed + 1f); } else { diff --git a/Projectiles/Summon/GammaCanister.cs b/Projectiles/Summon/GammaCanister.cs index 7c45c9affb..4e73e67f94 100644 --- a/Projectiles/Summon/GammaCanister.cs +++ b/Projectiles/Summon/GammaCanister.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Summon else if (potentialTarget != null) { // This looks quite stupid but the weapon is going to be useless otherwise and I'm not reworking this thing a 3rd time. - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(potentialTarget.Center) * 18f, 0.18f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * 18f, 0.18f); } projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; projectile.alpha = Utils.Clamp(projectile.alpha - 22, 0, 255); diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 39baa1a432..726153072c 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -143,7 +143,8 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = projectile.Center; float shootSpeed = MathHelper.Lerp(8f, 20f, Utils.InverseLerp(90f, 850f, target.Distance(spawnPosition), true)); - Vector2 shootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, target.Center, GammaCanister.Gravity, shootSpeed, projectile.DirectionTo(target.Center)); + Vector2 shootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, target.Center, GammaCanister.Gravity, shootSpeed, projectile.SafeDirectionTo(target.Center)); + float fireAngle = shootVelocity.ToRotation(); // Direction affecting. @@ -162,7 +163,7 @@ namespace CalamityMod.Projectiles.Summon if (distanceFromTarget > 7f) { float flySpeed = MathHelper.Lerp(2f, 17f, Utils.InverseLerp(10f, 70f, distanceFromTarget, true)); - projectile.velocity = (projectile.velocity * 9f + projectile.DirectionTo(returnPosition) * flySpeed) / 10f; + projectile.velocity = (projectile.velocity * 9f + projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f; } int totalHeads = CalamityUtils.CountProjectiles(projectile.type); diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index e07cd41eb6..3ae46abad2 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -152,10 +152,13 @@ namespace CalamityMod.Projectiles.Summon { ExitChargeModeEarly(player); } - player.velocity = Vector2.Lerp(player.velocity, projectile.DirectionTo(Main.MouseWorld) * RightIconLungeSpeed, 0.225f); + + player.velocity = Vector2.Lerp(player.velocity, projectile.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * RightIconLungeSpeed, 0.225f); projectile.rotation = player.velocity.ToRotation() + MathHelper.PiOver2; } - else projectile.rotation = 0f; + else + projectile.rotation = 0f; + if (player.mount != null) // Kill any mounts { player.mount.Dismount(player); @@ -439,13 +442,13 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; dust.scale = 1.6f; dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(angle); - dust.velocity = player.DirectionTo(dust.position) * 8f * speedSign; + dust.velocity = player.SafeDirectionTo(dust.position) * 8f * speedSign; dust = Dust.NewDustPerfect(projectile.Center, 221); dust.noGravity = true; dust.scale = 1.6f; dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(-angle); - dust.velocity = player.DirectionTo(dust.position) * 8f * speedSign; + dust.velocity = player.SafeDirectionTo(dust.position) * 8f * speedSign; } } } diff --git a/Projectiles/Summon/Hiveling.cs b/Projectiles/Summon/Hiveling.cs index 8088c8ebc9..f8b7788367 100644 --- a/Projectiles/Summon/Hiveling.cs +++ b/Projectiles/Summon/Hiveling.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 30f + projectile.DirectionTo(potentialTarget.Center) * 10f) / 31f; + projectile.velocity = (projectile.velocity * 30f + projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 31f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs index 61e6d97f7b..933b4065ff 100644 --- a/Projectiles/Summon/HomingGammaBullet.cs +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = projectile.Center.MinionHoming(1000f, Main.player[projectile.owner]); if (potentialTarget != null && !projectile.WithinRange(potentialTarget.Center, 100f) && projectile.timeLeft < 290) - projectile.velocity = (projectile.velocity * 6f + projectile.DirectionTo(potentialTarget.Center) * 15f) / 7f; + projectile.velocity = (projectile.velocity * 6f + projectile.SafeDirectionTo(potentialTarget.Center) * 15f) / 7f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs index 8dc31d65be..bea3cb6f03 100644 --- a/Projectiles/Summon/HowlsHeartFireball.cs +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -106,11 +106,8 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 21f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 21f) / (21f); } int blueT = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 0.6f); diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index 34d85d07a6..89bd124696 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon { NPC potentialTarget = projectile.Center.MinionHoming(700f, Main.player[projectile.owner]); if (potentialTarget != null) - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(potentialTarget.Center) * 16f) / 21f; + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / 21f; } } diff --git a/Projectiles/Summon/MK2RocketHoming.cs b/Projectiles/Summon/MK2RocketHoming.cs index 29d7cf5828..3472cab2ef 100644 --- a/Projectiles/Summon/MK2RocketHoming.cs +++ b/Projectiles/Summon/MK2RocketHoming.cs @@ -35,9 +35,8 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = projectile.Center.MinionHoming(1000f, player); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 24f + projectile.DirectionTo(potentialTarget.Center) * 14f) / 25f; - } + projectile.velocity = (projectile.velocity * 24f + projectile.SafeDirectionTo(potentialTarget.Center) * 14f) / 25f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; projectile.frameCounter++; if (projectile.frameCounter > 6) diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 55877e94eb..987d15575b 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -292,7 +292,7 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(target.Center), angularTurnSpeed).ToRotationVector2() * newSpeed; // If the worm is very close to aiming directly at the target, immediately switch from redirecting to charging. - if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), projectile.DirectionTo(target.Center)) > 0.86f) + if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), projectile.SafeDirectionTo(target.Center)) > 0.86f) { AttackStateTimer += LaserRedirectFrames - (AttackStateTimer % LaserChargeFrames); projectile.netUpdate = true; @@ -303,7 +303,7 @@ namespace CalamityMod.Projectiles.Summon if (AttackStateTimer % (LaserChargeFrames + LaserRedirectFrames) == LaserChargeFrames) { // Charge and fire three lasers. - projectile.velocity = projectile.DirectionTo(target.Center) * MaxAttackFlySpeed; + projectile.velocity = projectile.SafeDirectionTo(target.Center) * MaxAttackFlySpeed; if (Main.myPlayer == projectile.owner) { @@ -379,7 +379,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.alpha = 0; - projectile.velocity = projectile.DirectionTo(TeleportEndingPoint) * (MaxAttackFlySpeed + target.velocity.Length() * 0.45f); + projectile.velocity = projectile.SafeDirectionTo(TeleportEndingPoint) * (MaxAttackFlySpeed + target.velocity.Length() * 0.45f); projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index f3132eea99..b4b30c730c 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -95,12 +95,12 @@ namespace CalamityMod.Projectiles.Summon } float angle = MathHelper.ToRadians(2f * projectile.ai[0] % 180f); Vector2 destination = potentialTarget.Center - new Vector2((float)Math.Cos(angle) * potentialTarget.width * 0.65f, 250f); - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(destination) * 24f, 0.03f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 24f, 0.03f); + if (projectile.ai[0] % 3f == 2f && potentialTarget.Top.Y > projectile.Bottom.Y) { - Projectile.NewProjectile(projectile.Bottom, projectile.DirectionTo(potentialTarget.Center).RotatedByRandom(0.15f) * 25f, - ModContent.ProjectileType(), - projectile.damage, projectile.knockBack, projectile.owner); + Vector2 laserVelocity = projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.15f) * 25f; + Projectile.NewProjectile(projectile.Bottom, laserVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } projectile.MinionAntiClump(0.35f); } @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.velocity = (projectile.velocity * 15f + projectile.DirectionTo(player.Center - new Vector2(player.direction * -80f, 160f)) * 19f) / 16f; + projectile.velocity = (projectile.velocity * 15f + projectile.SafeDirectionTo(player.Center - new Vector2(player.direction * -80f, 160f)) * 19f) / 16f; Vector2 distanceVector = player.Center - projectile.Center; if (distanceVector.Length() > DistanceToCheck * 1.5f) diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs index 559121220d..77a5bf8b73 100644 --- a/Projectiles/Summon/PlaguebringerMK2.cs +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -76,21 +76,19 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity *= 0.9f; } else - { - Vector2 velocity = projectile.DirectionTo(destination) * projectile.Distance(destination) / 36f; - projectile.velocity = velocity; - } + projectile.velocity = projectile.SafeDirectionTo(destination) * projectile.Distance(destination) / 36f; + int timeNeeded = (int)MathHelper.Lerp(60f, 18f, MathHelper.Clamp(projectile.localAI[1] / 320f, 0f, 1f)); if (projectile.ai[0] >= timeNeeded && Main.myPlayer == projectile.owner) { Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(potentialTarget.Center) * 14f, + projectile.SafeDirectionTo(potentialTarget.Center) * 14f, ModContent.ProjectileType(), (int)(projectile.damage * 0.9), 3f, projectile.owner); Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(potentialTarget.Center) * 11.5f, + projectile.SafeDirectionTo(potentialTarget.Center) * 11.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.9), 3f, diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs index c04550dbc3..d946a9477b 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -151,10 +151,8 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity = Utils.NextVector2Unit(Main.rand) * 12f; projectile.netUpdate = true; } - else if (projectile.Distance(player.Center) > 90f) - { - projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(player.Center) * 12f) / 20f; - } + else if (!projectile.WithinRange(player.Center, 90f)) + projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(player.Center) * 12f) / 20f; } projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); } diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index 718b0202de..6bcaedbc13 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -99,19 +99,20 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 2; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(20f), MathHelper.ToRadians(20f), i / 2f); - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f, - ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); + Vector2 fireVelocity = projectile.SafeDirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f; + Projectile.NewProjectile(projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } } if (projectile.ai[1] % radiantOrbAppearRate == radiantOrbAppearRate - 1) { - Projectile.NewProjectile(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(100f, 360f), - projectile.DirectionTo(potentialTarget.Center) * 2f, ModContent.ProjectileType(), radiantOrbDamage, projectile.knockBack * 4f, projectile.owner); + Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(100f, 360f); + Vector2 bootlegRadianceOrbVelocity = projectile.SafeDirectionTo(potentialTarget.Center) * 2f; + Projectile.NewProjectile(spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, projectile.knockBack * 4f, projectile.owner); for (int i = 0; i < 3; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f, - ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); + Vector2 fireVelocity = projectile.SafeDirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f; + Projectile.NewProjectile(projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } } } diff --git a/Projectiles/Summon/RadiantResolutionFire.cs b/Projectiles/Summon/RadiantResolutionFire.cs index e4dc3ff43d..78487162b3 100644 --- a/Projectiles/Summon/RadiantResolutionFire.cs +++ b/Projectiles/Summon/RadiantResolutionFire.cs @@ -33,9 +33,7 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; NPC potentialTarget = projectile.Center.MinionHoming(1750f, player); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(potentialTarget.Center) * 20f) / 20f; - } + projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 20f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/RadiantResolutionOrb.cs b/Projectiles/Summon/RadiantResolutionOrb.cs index 3fb5706260..a511f4f07b 100644 --- a/Projectiles/Summon/RadiantResolutionOrb.cs +++ b/Projectiles/Summon/RadiantResolutionOrb.cs @@ -55,9 +55,7 @@ namespace CalamityMod.Projectiles.Summon { NPC potentialTarget = projectile.Center.MinionHoming(2000f, player); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(potentialTarget.Center) * 19f) / 8f; - } + projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 8f; } } } diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 042137dfe4..1cdc716486 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.Distance(player.Center) > 120f) { - projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.DirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); + projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.SafeDirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); } if (projectile.frame >= 8) { @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon { // A bit above the target, and always on the opposite side of the target's sprite direction. Vector2 destination = potentialTarget.Top + Vector2.UnitX * -potentialTarget.spriteDirection * Main.rand.NextFloat(50f, 75f) - Vector2.UnitY * 42f; - projectile.velocity = (projectile.velocity * NPCHomingInertia + projectile.DirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); + projectile.velocity = (projectile.velocity * NPCHomingInertia + projectile.SafeDirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); if (projectile.frame < 8) { projectile.frame = 8; diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index 06852ff327..5e68028f20 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -86,11 +86,8 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 11f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 11f) / (21f); } int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.6f); diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index b6261124df..2190db47b7 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -164,12 +164,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] += 1f; if (projectile.ai[0] >= 5f) { - Vector2 vector154 = projectile.DirectionTo(Main.npc[num1079].Center); - if (vector154.HasNaNs()) - { - vector154 = Vector2.UnitY; - } - int num1082 = (vector154.X > 0f) ? 1 : -1; + int num1082 = (projectile.SafeDirectionTo(Main.npc[num1079].Center, Vector2.UnitY).X > 0f) ? 1 : -1; projectile.direction = num1082; projectile.ai[0] = -20f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index 1f3fba5610..248134b6c1 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -68,10 +68,9 @@ namespace CalamityMod.Projectiles.Summon if (target != null) { projectile.ai[1]++; - if (projectile.ai[1] % 55f == 54f && - Main.myPlayer == projectile.owner) + if (projectile.ai[1] % 55f == 54f && Main.myPlayer == projectile.owner) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); } } @@ -86,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(mother.Center) * 18f) / 20f; + projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(mother.Center) * 18f) / 20f; } } else diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index 754738a80f..094a4c4d8a 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon (modulo >= 90 && modulo < 120f)) { if (projectile.velocity.Length() == 0f) - projectile.velocity = projectile.DirectionTo(target.Center).RotatedByRandom(0.5f) * -8f; + projectile.velocity = projectile.SafeDirectionTo(target.Center).RotatedByRandom(0.5f) * -8f; float angleToTarget = projectile.AngleTo(target.Center); float velocityAngle = projectile.velocity.ToRotation(); float resultantAngle = velocityAngle.AngleLerp(angleToTarget, 0.08f); @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.velocity = (projectile.velocity * 44f + projectile.DirectionTo(player.Center) * 24f) / 45f; + projectile.velocity = (projectile.velocity * 44f + projectile.SafeDirectionTo(player.Center) * 24f) / 45f; projectile.ai[0] += 30 - projectile.ai[0] % 30f; } projectile.ai[1] = 1f; @@ -104,9 +104,9 @@ namespace CalamityMod.Projectiles.Summon } if ((modulo >= 30f && modulo <= 60f) || (modulo >= 90f && modulo <= 120f)) { - if (projectile.owner == player.whoAmI && projectile.spriteDirection == (projectile.DirectionTo(target.Center).X > 0).ToDirectionInt()) + if (projectile.owner == player.whoAmI && projectile.spriteDirection == (projectile.SafeDirectionTo(target.Center).X > 0).ToDirectionInt()) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); } } } @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.extraUpdates = 0; projectile.ai[1] = 0f; - projectile.velocity = (projectile.velocity * 24f + projectile.DirectionTo(player.Center) * 16f) / 25f; + projectile.velocity = (projectile.velocity * 24f + projectile.SafeDirectionTo(player.Center) * 16f) / 25f; if (projectile.Distance(player.Center) > 3250f) { projectile.Center = player.Center; diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index f7f7155084..977589f42e 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -161,8 +161,7 @@ namespace CalamityMod.Projectiles.Summon else { projectile.spriteDirection = 1; - Vector2 idealVelocity = projectile.DirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f; - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, 0.035f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f, 0.035f); projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(potentialTarget.Center), 0.1f); if (projectile.ai[0]++ % 75f == 24f) @@ -185,15 +184,12 @@ namespace CalamityMod.Projectiles.Summon { int rocketDamage = (int)(damage * 1.5f); float rocketKB = kb + 5f; - projIndex = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), - rocketDamage, rocketKB, projectile.owner); + projIndex = Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), rocketDamage, rocketKB, projectile.owner); } + + // Fire the selected bullet, nothing special. else - { - // Fire the selected bullet, nothing special. - projIndex = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, projID, - damage, kb, projectile.owner); - } + projIndex = Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, projectile.owner); // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. if (projIndex.WithinBounds(Main.maxProjectiles)) diff --git a/Projectiles/Summon/YoungDuke.cs b/Projectiles/Summon/YoungDuke.cs index b33f6107c1..1cb73ca6aa 100644 --- a/Projectiles/Summon/YoungDuke.cs +++ b/Projectiles/Summon/YoungDuke.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon float chargeSpeed = playerHalfLife ? 25f : 20f; if (projectile.ai[0] >= timePerCharge) { - projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * chargeSpeed; + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * chargeSpeed; projectile.ai[0] = 0f; } else @@ -112,15 +112,12 @@ namespace CalamityMod.Projectiles.Summon { float intertia = 0.94f; float homeSpeed = playerHalfLife ? 38f : 32f; - projectile.velocity = Vector2.Lerp(projectile.velocity, - projectile.DirectionTo(potentialTarget.Center) * homeSpeed, - 1f - intertia); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * homeSpeed, 1f - intertia); } } - else if (projectile.Distance(player.Center) > 140f) - { - projectile.velocity = (projectile.velocity * 30f + projectile.DirectionTo(player.Center) * 16f) / 31f; - } + else if (!projectile.WithinRange(player.Center, 140f)) + projectile.velocity = (projectile.velocity * 30f + projectile.SafeDirectionTo(player.Center) * 16f) / 31f; + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); } } diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index 2c7aa3b98a..e0742c3f11 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -53,12 +53,8 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; return; } CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index 1610ad77a6..a364b5756e 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -59,11 +59,8 @@ namespace CalamityMod.Projectiles.Typeless if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } else projectile.Kill(); diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index c6fab199e7..0db00af1bd 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Typeless float chargeSpeed = MathHelper.Lerp(MinChargeSpeed, MaxChargeSpeed, (projectile.ai[0] - WaitTimeRequiredForCharge) / WaitTimeRequiredForMaximumCharge); if (chargeSpeed > MaxChargeSpeed) chargeSpeed = MaxChargeSpeed; - projectile.velocity = projectile.DirectionTo(Main.MouseWorld) * chargeSpeed; + projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld) * chargeSpeed; IdealVelocity = projectile.velocity; projectile.ai[1] = chargeSpeed; Main.PlaySound(SoundID.Item73, projectile.Center); @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Typeless { Vector2 dustPosition = Utils.NextVector2Circular(Main.rand, projectile.width * 1.6f, projectile.height * 2.3f) / 2f + projectile.Center; Dust dust = Dust.NewDustPerfect(dustPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = projectile.DirectionFrom(dust.position) * projectile.Distance(dust.position) / 11f; + dust.velocity = projectile.SafeDirectionTo(dust.position) * projectile.Distance(dust.position) / -11f; dust.velocity += player.velocity; dust.noGravity = true; dust.fadeIn = 1.6f; @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.localAI[0] <= MaxCharges && projectile.localAI[1] <= 0f) { - IdealVelocity = projectile.DirectionTo(Main.MouseWorld) * projectile.ai[1]; + IdealVelocity = projectile.SafeDirectionTo(Main.MouseWorld) * projectile.ai[1]; projectile.localAI[0]++; projectile.localAI[1] = 40f; Main.PlaySound(SoundID.Item73, projectile.Center); diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index b1c56729ec..eec2416998 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -158,7 +158,7 @@ namespace CalamityMod } else { - center += projectile.DirectionTo(player.MountedCenter) * hookTexture.Height; + center += projectile.SafeDirectionTo(player.MountedCenter) * hookTexture.Height; Color tileAtCenterColor = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); Main.spriteBatch.Draw(hookTexture, center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, hookTexture.Width, hookTexture.Height)), diff --git a/Utilities/EntityUtils.cs b/Utilities/EntityUtils.cs new file mode 100644 index 0000000000..bcd867859c --- /dev/null +++ b/Utilities/EntityUtils.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Gets a unit direction towards an arbitrary destination for an entity based on its center. Has safety in the form of a fallback vector. + /// + /// The entity to check from. + /// The destination to get the direction to. + /// A fallback value to use in the event of an unsafe normalization. + public static Vector2 SafeDirectionTo(this Entity entity, Vector2 destination, Vector2? fallback = null) + { + // Fall back to zero by default. default(Vector2) could be used in the parameter definition, but + // this is more clear. + if (!fallback.HasValue) + fallback = Vector2.Zero; + + return (destination - entity.Center).SafeNormalize(fallback.Value); + } + } +} From 7a62e5fef77e8cb815088a57fa6d6d4f1146e24a Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:50:02 -0500 Subject: [PATCH 03/43] Adjusted Yharon projectile resists --- NPCs/Yharon/Yharon.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index d1fa1b6fc3..8fb1f483d5 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2949,8 +2949,12 @@ namespace CalamityMod.NPCs.Yharon public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (projectile.type == ModContent.ProjectileType()) + damage = (int)(damage * 0.7); + if (projectile.type == ModContent.ProjectileType()) damage = (int)(damage * 0.85); - } + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + damage = (int)(damage * 0.95); + } #endregion #region HP Bar Cooldown Slot and Stats From 9968693c81344b56f53687c8d84699c622fc74e2 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:50:40 -0500 Subject: [PATCH 04/43] Nerfed Phantasmal Ruin damage to 955 --- Items/Weapons/Rogue/PhantasmalRuin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index 08ab914385..edb6b28409 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -19,7 +19,7 @@ Stealth strikes continuously leave spectral clones in their wake"); public override void SafeSetDefaults() { - item.damage = 1060; + item.damage = 955; item.knockBack = 8f; item.width = 102; From 72254a4b501db46170345ba450bc1af835a62fcb Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:51:10 -0500 Subject: [PATCH 05/43] Buffed Executioner's Blade damage to 181 --- Items/Weapons/Rogue/ExecutionersBlade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 43ea6ac838..4a23b4dd1d 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 64; - item.damage = 168; + item.damage = 181; item.noMelee = true; item.noUseGraphic = true; item.useTime = 3; From 91accfb21828cac3ddf71d57fcd10ec7f4977081 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:51:38 -0500 Subject: [PATCH 06/43] Buffed God's Paranoia damage to 70 --- Items/Weapons/Rogue/GodsParanoia.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index c6c7f4f6aa..8509185fcf 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GodsParanoia : RogueWeapon { - private static int damage = 66; + private static int damage = 70; private static int knockBack = 5; public override void SetStaticDefaults() From f5f84acf4cf6abaa3a8449c4d5514d2aa1b38353 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:51:59 -0500 Subject: [PATCH 07/43] Buffed Penumbra's damage to 1008 --- Items/Weapons/Rogue/Penumbra.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index 288bb9377e..afb2183f5e 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(1, 80, 0, 0); item.rare = ItemRarityID.Red; - item.damage = 806; + item.damage = 1008; item.useAnimation = 40; item.useTime = 40; item.knockBack = 8f; From 523bccf5e2c2575aff45275d54efc1f875688219 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:52:30 -0500 Subject: [PATCH 08/43] Buffed Eclipse's Fall damage to 512 --- Items/Weapons/Rogue/EclipsesFall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 71290a0580..7cb2780183 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 487; + item.damage = 512; item.knockBack = 3.5f; item.useAnimation = item.useTime = 21; item.autoReuse = true; From 9083b2907552cc7b2d53d9bab8e7c9ca08dd1e79 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:52:54 -0500 Subject: [PATCH 09/43] Buffed Hypothermia damage to 216 --- Items/Weapons/Rogue/Hypothermia.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 88d540ac4c..a4fecafe3e 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(1, 80, 0, 0); item.rare = ItemRarityID.Red; - item.damage = 176; + item.damage = 216; item.useAnimation = 21; item.useTime = 3; item.reuseDelay = 1; From 59e4c501ee6aa85f49c843bb12510db89819457c Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:53:20 -0500 Subject: [PATCH 10/43] Nerfed Plasma Grenade's damage to 1312 --- Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index e7f50a0060..8c494e15b1 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.width = 22; item.height = 28; - item.damage = 1640; + item.damage = 1312; item.noMelee = true; item.noUseGraphic = true; item.consumable = true; From ee7e30f62fe293ac66a85fba8b690216ef8e1eaf Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:53:39 -0500 Subject: [PATCH 11/43] Nerfed Pole Warper damage to 310 --- Items/Weapons/DraedonsArsenal/PoleWarper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 8a993c2ab7..709fd95d9e 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal CalamityGlobalItem modItem = item.Calamity(); item.shootSpeed = 10f; - item.damage = 356; + item.damage = 310; item.mana = 12; item.width = 38; item.height = 24; From dc593e7f62cffea5fcf9210326d5d607b0c63f02 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:54:10 -0500 Subject: [PATCH 12/43] Nerfed T1000 damage to 142 --- Items/Weapons/Magic/T1000.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 47b6607b42..872b6fc0b6 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 150; + item.damage = 142; item.magic = true; item.mana = 10; item.width = 20; From de4141aa041438ebf7bb35f7e57e5eddca9eddbf Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:54:53 -0500 Subject: [PATCH 13/43] Net nerfed Light God's Brilliance --- Items/Weapons/Magic/LightGodsBrilliance.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index 6ab86a9318..daeda0ae41 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -17,13 +17,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 62; + item.damage = 64; item.magic = true; item.mana = 4; item.width = 34; item.height = 36; - item.useTime = 3; - item.useAnimation = 3; + item.useTime = item.useAnimation = 4; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; @@ -40,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int totalBeads = Main.rand.Next(2, 3 + 1); + int totalBeads = 2; for (int index = 0; index < totalBeads; index++) { float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; From 9f69f9ffcc83ce6e09ecba6f09dd093e07163b9f Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:55:25 -0500 Subject: [PATCH 14/43] Buffed Primordial Ancient damage to 170 --- Items/Weapons/Magic/PrimordialAncient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 6b380c6aa8..ccbfe09aee 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 122; + item.damage = 170; item.magic = true; item.mana = 20; item.width = 36; From 4deaff5e77c62b532574b48a61f93e379aa8a0f6 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:55:47 -0500 Subject: [PATCH 15/43] Buffed Recitation of the Beast's damage to 128 --- Items/Weapons/Magic/RecitationoftheBeast.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index f014d1daf6..70c73c1e1d 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 24; item.width = 38; item.height = 34; - item.damage = 125; + item.damage = 128; item.noMelee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.HoldingOut; From 08b052d91e221cf98a54c9dc4f9f5df085ddd7f2 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:56:14 -0500 Subject: [PATCH 16/43] Nerfed Event Horizon's damage to 130 --- Items/Weapons/Magic/EventHorizon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 042c4eaadd..c33df0cf97 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 28; item.height = 30; - item.damage = 148; + item.damage = 130; item.knockBack = 3.5f; item.noMelee = true; item.magic = true; From 0dc914792a8e4a823856ca4ae22e04bcb79744ed Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:57:01 -0500 Subject: [PATCH 17/43] Buffed Alluvion damage to 120 --- Items/Weapons/Ranged/Alluvion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index ffd2dc81aa..6555f98a72 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; + item.damage = 120; item.ranged = true; item.width = 60; item.height = 90; From 05a3486bef57a710258a15f42cd6ed38e6485856 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 11 Apr 2021 18:57:29 -0500 Subject: [PATCH 18/43] Buffed Starmada damage to 145 --- Items/Weapons/Ranged/StarfleetMK2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index 7809144154..cd793b98fd 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 130; + item.damage = 145; item.knockBack = 15f; item.shootSpeed = 16f; item.useStyle = ItemUseStyleID.HoldingOut; From 10492787856e63c040e67f4f21b77af54f7718c5 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Mon, 12 Apr 2021 15:47:10 -0500 Subject: [PATCH 19/43] Nerfed Phaseslayer damage to 980 --- Items/Weapons/DraedonsArsenal/Phaseslayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index b003af15b7..9ac5070780 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class Phaseslayer : ModItem { - public const int Damage = 1080; + public const int Damage = 980; // When below this percentage of charge, the sword is small instead of big. public const float SizeChargeThreshold = 0.25f; // The small sword barely affects damage on its own because damage is already dropping significantly at low charge. From 2c259a6f8e6878da28d6e00a540f8c31ae7a7f94 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Mon, 12 Apr 2021 15:47:38 -0500 Subject: [PATCH 20/43] Nerfed the Obliterator damage to 255 --- Items/Weapons/Melee/TheObliterator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 308b48f679..3ad17f6554 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 42; item.height = 40; item.melee = true; - item.damage = 276; + item.damage = 255; item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; From 3adb4750b01841f4d2c2ec86a65b78a95cded452 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 14:22:27 -0400 Subject: [PATCH 21/43] Refactored PSC & Andromecha's code to be in their own files --- Items/Accessories/ProfanedSoulCrystal.cs | 149 +++++++++- Items/CalamityGlobalItem.cs | 260 +----------------- .../Weapons/Summon/PrototypeAndromechaRing.cs | 93 +++++++ 3 files changed, 244 insertions(+), 258 deletions(-) diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 5cf0b4f0c4..a72cf2a678 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -1,7 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.World; +using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -123,6 +125,152 @@ namespace CalamityMod.Items.Accessories modPlayer.profanedCrystalHide = true; } + // Moved from CalamityGlobalItem since it's just a function called in one place. + internal static bool TransformItemUsage(Item item, Player player) + { + if (player.whoAmI != Main.myPlayer) + return false; + int weaponType = item.melee ? 1 : item.ranged ? 2 : item.magic ? 3 : item.Calamity().rogue ? 4 : -1; + if (weaponType > 0) + { + if (player.Calamity().profanedSoulWeaponType != weaponType || player.Calamity().profanedSoulWeaponUsage >= 300) + { + player.Calamity().profanedSoulWeaponType = weaponType; + player.Calamity().profanedSoulWeaponUsage = 0; + } + Vector2 correctedVelocity = Main.MouseWorld - player.Center; + correctedVelocity.Normalize(); + bool shouldNerf = player.Calamity().endoCooper || player.Calamity().magicHat; //No bonkers damage memes thank you very much. + bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); + if (item.melee) + { + if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 4 : 6) == 0) + { + if (player.Calamity().profanedSoulWeaponUsage > 0 && player.Calamity().profanedSoulWeaponUsage % (enrage ? 20 : 30) == 0) //every 5 shots is a shotgun spread + { + int numProj = 5; + + correctedVelocity *= 12f; + int spread = 3; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); + + Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 350 : 700) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + spread -= Main.rand.Next(2, 4); + Main.PlaySound(SoundID.Item20, player.Center); + } + player.Calamity().profanedSoulWeaponUsage = 0; + } + else + { + Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 250 : 500) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + Main.PlaySound(SoundID.Item20, player.Center); + } + + } + player.Calamity().profanedSoulWeaponUsage++; + + } + else if (item.ranged) + { + if (enrage || Main.rand.NextBool(2)) //100% chance if 50% or lower, else 1 in 2 chance + { + correctedVelocity *= 20f; + Vector2 perturbedspeed = new Vector2(correctedVelocity.X + Main.rand.Next(-3, 4), correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(3)); + bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. + bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% + int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; + int dam = (int)((shouldNerf ? 200 : 400) * player.MinionDamage()); + switch (projType) + { + case 1: //big boomer + case 2: //boomer + int proj = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, projType == 1 ? 1f : 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; + break; + case 3: //bab boomer + int proj2 = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f); + if (proj2.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj2].Calamity().forceMinion = true; + break; + } + if (projType > 1) + { + Main.PlaySound(SoundID.Item20, player.Center); + } + } + } + else if (item.magic) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + player.Calamity().profanedSoulWeaponUsage = 0; + } + int manaCost = (int)(100 * player.manaCost); + if (player.statMana < manaCost && player.Calamity().profanedSoulWeaponUsage == 0) + { + if (player.manaFlower) + { + player.QuickMana(); + } + } + if (player.statMana >= manaCost && player.Calamity().profanedSoulWeaponUsage == 0 && !player.silence) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= manaCost; + correctedVelocity *= 25f; + Main.PlaySound(SoundID.Item20, player.Center); + int dam = (int)((shouldNerf ? 900 : 1800) * player.MinionDamage()); + if (player.HasBuff(BuffID.ManaSickness)) + { + int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); + dam -= sickPenalty; + } + int proj = Projectile.NewProjectile(player.position, correctedVelocity, ModContent.ProjectileType(), dam, 1f, player.whoAmI, enrage ? 1f : 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; + player.Calamity().profanedSoulWeaponUsage = enrage ? 20 : 25; + } + if (player.Calamity().profanedSoulWeaponUsage > 0) + player.Calamity().profanedSoulWeaponUsage--; + } + else if (item.Calamity().rogue) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + player.Calamity().profanedSoulWeaponUsage = 0; + } + if (player.Calamity().profanedSoulWeaponUsage >= (enrage ? 69 : 180)) + { + float crystalCount = 36f; + for (float i = 0; i < crystalCount; i++) + { + float angle = MathHelper.TwoPi / crystalCount * i; + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 175 : 350) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; + Main.PlaySound(SoundID.Item20, player.Center); + } + player.Calamity().profanedSoulWeaponUsage = 0; + } + else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) + { + float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 440) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; + Main.PlaySound(SoundID.Item20, player.Center); + } + player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2; + if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0) + player.Calamity().profanedSoulWeaponUsage--; + } + } + return false; + } + public override void AddRecipes() { PSCRecipe recipe = new PSCRecipe(mod); @@ -142,7 +290,6 @@ namespace CalamityMod.Items.Accessories public class PSCRecipe : ModRecipe { - public PSCRecipe(Mod mod) : base(mod) { } public override int ConsumeItem(int type, int numRequired) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 5b70ea1952..582bf2342f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -555,248 +555,6 @@ namespace CalamityMod.Items } #endregion - #region Profaned Soul Crystal Attacks - - private bool HandleAttackTransforms(Item item, Player player) - { - if (player.whoAmI != Main.myPlayer) - return false; - int weaponType = item.melee ? 1 : item.ranged ? 2 : item.magic ? 3 : item.Calamity().rogue ? 4 : -1; - if (weaponType > 0) - { - if (player.Calamity().profanedSoulWeaponType != weaponType || player.Calamity().profanedSoulWeaponUsage >= 300) - { - player.Calamity().profanedSoulWeaponType = weaponType; - player.Calamity().profanedSoulWeaponUsage = 0; - } - Vector2 correctedVelocity = Main.MouseWorld - player.Center; - correctedVelocity.Normalize(); - bool shouldNerf = player.Calamity().endoCooper || player.Calamity().magicHat; //No bonkers damage memes thank you very much. - bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); - if (item.melee) - { - if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 4 : 6) == 0) - { - if (player.Calamity().profanedSoulWeaponUsage > 0 && player.Calamity().profanedSoulWeaponUsage % (enrage ? 20 : 30) == 0) //every 5 shots is a shotgun spread - { - int numProj = 5; - - correctedVelocity *= 12f; - int spread = 3; - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - - Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 350 : 700) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); - spread -= Main.rand.Next(2, 4); - Main.PlaySound(SoundID.Item20, player.Center); - } - player.Calamity().profanedSoulWeaponUsage = 0; - } - else - { - Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 250 : 500) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); - Main.PlaySound(SoundID.Item20, player.Center); - } - - } - player.Calamity().profanedSoulWeaponUsage++; - - } - else if (item.ranged) - { - if (enrage || Main.rand.NextBool(2)) //100% chance if 50% or lower, else 1 in 2 chance - { - correctedVelocity *= 20f; - Vector2 perturbedspeed = new Vector2(correctedVelocity.X + Main.rand.Next(-3, 4), correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(3)); - bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. - bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% - int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; - int dam = (int)((shouldNerf ? 200 : 400) * player.MinionDamage()); - switch (projType) - { - case 1: //big boomer - case 2: //boomer - int proj = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, projType == 1 ? 1f : 0f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().forceMinion = true; - break; - case 3: //bab boomer - int proj2 = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f); - if (proj2.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj2].Calamity().forceMinion = true; - break; - } - if (projType > 1) - { - Main.PlaySound(SoundID.Item20, player.Center); - } - } - } - else if (item.magic) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - { - player.Calamity().profanedSoulWeaponUsage = 0; - } - int manaCost = (int)(100 * player.manaCost); - if (player.statMana < manaCost && player.Calamity().profanedSoulWeaponUsage == 0) - { - if (player.manaFlower) - { - player.QuickMana(); - } - } - if (player.statMana >= manaCost && player.Calamity().profanedSoulWeaponUsage == 0 && !player.silence) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= manaCost; - correctedVelocity *= 25f; - Main.PlaySound(SoundID.Item20, player.Center); - int dam = (int)((shouldNerf ? 900 : 1800) * player.MinionDamage()); - if (player.HasBuff(BuffID.ManaSickness)) - { - int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); - dam -= sickPenalty; - } - int proj = Projectile.NewProjectile(player.position, correctedVelocity, ModContent.ProjectileType(), dam, 1f, player.whoAmI, enrage ? 1f : 0f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().forceMinion = true; - player.Calamity().profanedSoulWeaponUsage = enrage ? 20 : 25; - } - if (player.Calamity().profanedSoulWeaponUsage > 0) - player.Calamity().profanedSoulWeaponUsage--; - } - else if (item.Calamity().rogue) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - { - player.Calamity().profanedSoulWeaponUsage = 0; - } - if (player.Calamity().profanedSoulWeaponUsage >= (enrage ? 69 : 180)) - { - float crystalCount = 36f; - for (float i = 0; i < crystalCount; i++) - { - float angle = MathHelper.TwoPi / crystalCount * i; - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 175 : 350) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().forceMinion = true; - Main.PlaySound(SoundID.Item20, player.Center); - } - player.Calamity().profanedSoulWeaponUsage = 0; - } - else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) - { - float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 440) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().forceMinion = true; - Main.PlaySound(SoundID.Item20, player.Center); - } - player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2; - if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0) - player.Calamity().profanedSoulWeaponUsage--; - } - } - return false; - } - #endregion - - #region Andromeda Dev Item Attacks - private bool PerformAndromedaAttacks(Item item, Player player) - { - if (player.whoAmI != Main.myPlayer) - return false; - - int robotIndex = -1; - - for (int i = 0; i < Main.projectile.Length; i++) - { - if (Main.projectile[i].active && - Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == player.whoAmI) - { - robotIndex = i; - break; - } - } - if (robotIndex != -1) - { - Projectile robot = Main.projectile[robotIndex]; - GiantIbanRobotOfDoom robotModProjectile = ((GiantIbanRobotOfDoom)robot.modProjectile); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && - robotModProjectile.TopIconActive && - (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || - !robotModProjectile.RightIconActive)) // "Melee" attack - { - int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge; - if (item.Calamity().rogue) - { - damage = (int)(damage * player.RogueDamage()); - } - if (item.melee) - { - damage = (int)(damage * player.MeleeDamage()); - } - if (item.ranged) - { - damage = (int)(damage * player.RangedDamage()); - } - if (item.magic) - { - damage = (int)(damage * player.MagicDamage()); - } - if (item.summon) - { - damage = (int)(damage * player.MinionDamage()); - } - Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, - Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); - - if (blade.whoAmI.WithinBounds(Main.maxProjectiles)) - { - if (item.Calamity().rogue) - { - blade.Calamity().forceRogue = true; - } - if (item.melee) - { - blade.Calamity().forceMelee = true; - } - if (item.ranged) - { - blade.Calamity().forceRanged = true; - } - if (item.magic) - { - blade.Calamity().forceMagic = true; - } - if (item.summon) - { - blade.Calamity().forceMinion = true; - } - } - } - - if (!robotModProjectile.TopIconActive && - (robotModProjectile.LeftBracketActive || robotModProjectile.RightBracketActive) && - !robotModProjectile.BottomBracketActive && - robotModProjectile.LaserCooldown <= 0 && - (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || - !robotModProjectile.RightIconActive)) // "Ranged" attack - { - robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft * 2; - if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) - { - robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft + 1; - } - } - } - return false; - } - #endregion - #region Use Item Changes public override bool UseItem(Item item, Player player) { @@ -933,26 +691,14 @@ namespace CalamityMod.Items return false; if (item.pick > 0 || item.axe > 0 || item.hammer > 0 || item.fishingPole > 0) return false; + // compiler optimization: && short-circuits, so if altFunctionUse != 0, Andromeda code is never called. if (item.Calamity().rogue || item.magic || item.ranged || item.melee) - { - if (player.altFunctionUse == 0) - return PerformAndromedaAttacks(item, player); - else return false; - } + return player.altFunctionUse == 0 && PrototypeAndromechaRing.TransformItemUsage(item, player); } // Conversion for Profaned Soul Crystal if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (modItem.rogue || item.magic || item.ranged || item.melee)) - { - if (player.altFunctionUse == 0) - { - return HandleAttackTransforms(item, player); - } - else - { - return AltFunctionUse(item, player); - } - } + return player.altFunctionUse == 0 ? ProfanedSoulCrystal.TransformItemUsage(item, player) : AltFunctionUse(item, player); // Check for sufficient charge if this item uses charge. if (item.type >= ItemID.Count && modItem.UsesCharge) diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 2308e0f276..91f015d49e 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -88,5 +88,98 @@ namespace CalamityMod.Items.Weapons.Summon // Otherwise create one. return true; } + + // Moved from CalamityGlobalItem since it's just a function called in one place. + internal static bool TransformItemUsage(Item item, Player player) + { + if (player.whoAmI != Main.myPlayer) + return false; + + int robotIndex = -1; + + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == player.whoAmI) + { + robotIndex = i; + break; + } + } + if (robotIndex != -1) + { + Projectile robot = Main.projectile[robotIndex]; + GiantIbanRobotOfDoom robotModProjectile = ((GiantIbanRobotOfDoom)robot.modProjectile); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && + robotModProjectile.TopIconActive && + (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || + !robotModProjectile.RightIconActive)) // "Melee" attack + { + int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge; + if (item.Calamity().rogue) + { + damage = (int)(damage * player.RogueDamage()); + } + if (item.melee) + { + damage = (int)(damage * player.MeleeDamage()); + } + if (item.ranged) + { + damage = (int)(damage * player.RangedDamage()); + } + if (item.magic) + { + damage = (int)(damage * player.MagicDamage()); + } + if (item.summon) + { + damage = (int)(damage * player.MinionDamage()); + } + Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, + Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); + + if (blade.whoAmI.WithinBounds(Main.maxProjectiles)) + { + if (item.Calamity().rogue) + { + blade.Calamity().forceRogue = true; + } + if (item.melee) + { + blade.Calamity().forceMelee = true; + } + if (item.ranged) + { + blade.Calamity().forceRanged = true; + } + if (item.magic) + { + blade.Calamity().forceMagic = true; + } + if (item.summon) + { + blade.Calamity().forceMinion = true; + } + } + } + + if (!robotModProjectile.TopIconActive && + (robotModProjectile.LeftBracketActive || robotModProjectile.RightBracketActive) && + !robotModProjectile.BottomBracketActive && + robotModProjectile.LaserCooldown <= 0 && + (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || + !robotModProjectile.RightIconActive)) // "Ranged" attack + { + robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft * 2; + if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) + { + robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft + 1; + } + } + } + return false; + } } } From ad4e60ebabed7521a9d3c8e068169e8e4f144b74 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 16:37:31 -0400 Subject: [PATCH 22/43] 1 - Partialed out all GlobalItem tooltip code into its own class. 2 - Added modular tooltip editing system. 3 - Set up Calamity's standard rarities and rarity colors to use constant integers/colors and a single utility function. 4 - In-progress usage of the modular tooltip editing system on all vanilla tooltips. --- Enums/CalamityRarity.cs | 14 +- Items/CalamityGlobalItem.cs | 2051 +--------------------------- Items/CalamityGlobalItemLoot.cs | 2 - Items/CalamityGlobalItemTooltip.cs | 1926 ++++++++++++++++++++++++++ Utilities/ItemUtils.cs | 42 + 5 files changed, 1976 insertions(+), 2059 deletions(-) create mode 100644 Items/CalamityGlobalItemTooltip.cs diff --git a/Enums/CalamityRarity.cs b/Enums/CalamityRarity.cs index bd92f19ca9..6c28e8ed3a 100644 --- a/Enums/CalamityRarity.cs +++ b/Enums/CalamityRarity.cs @@ -3,12 +3,12 @@ public enum CalamityRarity { NoEffect = 0, - Turquoise = 12, - PureGreen = 13, - DarkBlue = 14, - Violet = 15, - HotPink = 16, - Rainbow = 30, - DraedonRust = 33, + Turquoise = CalamityUtils.TurquoiseRarityValue, + PureGreen = CalamityUtils.PureGreenRarityValue, + DarkBlue = CalamityUtils.DarkBlueRarityValue, + Violet = CalamityUtils.VioletRarityValue, + HotPink = CalamityUtils.HotPinkRarityValue, + Rainbow = CalamityUtils.RainbowRarityValue, + DraedonRust = CalamityUtils.DraedonRustRarityValue, } } \ No newline at end of file diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 582bf2342f..8514f0ff90 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -3,14 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor; -using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Potions; -using CalamityMod.Items.Tools; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; @@ -24,9 +17,7 @@ using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +25,7 @@ using Terraria.ModLoader.IO; namespace CalamityMod.Items { - public class CalamityGlobalItem : GlobalItem + public partial class CalamityGlobalItem : GlobalItem { public override bool InstancePerEntity => true; public override bool CloneNewInstances => true; @@ -821,2046 +812,6 @@ namespace CalamityMod.Items } #endregion - #region Modify Tooltips - public override void ModifyTooltips(Item item, List tooltips) - { - #region Rarity Coloration - TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); - if (nameLine != null) - { - #region Standard Post-ML Rarities - // TODO -- these should be handled automatically with a separate function and the colors should be tied to the rarity definitions - switch (customRarity) - { - default: - break; - case CalamityRarity.Turquoise: - nameLine.overrideColor = new Color(0, 255, 200); - break; - case CalamityRarity.PureGreen: - nameLine.overrideColor = new Color(0, 255, 0); - break; - case CalamityRarity.DarkBlue: - nameLine.overrideColor = new Color(43, 96, 222); - break; - case CalamityRarity.Violet: - nameLine.overrideColor = new Color(108, 45, 199); - break; - case CalamityRarity.HotPink: - nameLine.overrideColor = new Color(255, 0, 255); - break; - - case CalamityRarity.Rainbow: - nameLine.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - break; - case CalamityRarity.DraedonRust: - nameLine.overrideColor = new Color(204, 71, 35); - break; - } - #endregion - - #region Uniquely Colored Dev Items - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(Main.DiscoR, 100, 255); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(0, 0, 255); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = Judgement.GetSyncedLightColor(); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = ShatteredCommunity.GetRarityColor(); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 4f); //alternates between emerald green and amber (BanditHueh) - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(146, 0, 0); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(129, 29, 149); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(220, 20, 60); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(254, 253, 235); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(207, 17, 117); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = new Color(227, 226, 180); - if (item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); - - // TODO -- for cleanliness, ALL color math should either be a one-line ColorSwap or inside the item's own file - // The items that currently violate this are all below: - // Eternity, Flamsteed Ring, Earth - if (item.type == ModContent.ItemType()) - { - List colorSet = new List() - { - new Color(188, 192, 193), // white - new Color(157, 100, 183), // purple - new Color(249, 166, 77), // honey-ish orange - new Color(255, 105, 234), // pink - new Color(67, 204, 219), // sky blue - new Color(249, 245, 99), // bright yellow - new Color(236, 168, 247), // purplish pink - }; - if (nameLine != null) - { - int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); - Color currentColor = colorSet[colorIndex]; - Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; - nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); - } - } - if (item.type == ModContent.ItemType()) - { - if (Main.GlobalTime % 1f < 0.6f) - { - nameLine.overrideColor = new Color(89, 229, 255); - } - else if (Main.GlobalTime % 1f < 0.8f) - { - nameLine.overrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTime % 1f - 0.6f) / 0.2f); - } - else - { - nameLine.overrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTime % 1f - 0.8f) / 0.2f); - } - } - if (item.type == ModContent.ItemType()) - { - List earthColors = new List() - { - new Color(255, 99, 146), - new Color(255, 228, 94), - new Color(127, 200, 248) - }; - if (nameLine != null) - { - int colorIndex = (int)(Main.GlobalTime / 2 % earthColors.Count); - Color currentColor = earthColors[colorIndex]; - Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; - nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); - } - } - #endregion - } - #endregion - - #region Stealth Accessory Prefixes Display - if (item.accessory) - { - if (!item.social && item.prefix > 0) - { - float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; - if (stealthGenBoost > 0) - { - TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") - { - isModifier = true - }; - tooltips.Add(StealthGen); - } - } - } - #endregion - - #region Vanilla Item Tooltip Edits - if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) - { - foreach (TooltipLine line2 in tooltips) - { - bool editLine = item.type == ItemID.CellPhone ? line2.Name == "Tooltip1" : line2.Name == "Tooltip0"; - if (line2.mod == "Terraria" && editLine) - line2.text += "\nCannot be used while a boss is alive"; - } - } - if (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text += "\nDemon Altars no longer spawn ores when destroyed"; - } - } - if (item.type == ItemID.BlackBelt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text = "Grants the ability to dodge attacks\n" + - "The dodge has a 60 second cooldown which is shared with all other dodges and reflects"; - - } - } - if (item.type == ItemID.MasterNinjaGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - line2.text = "Grants the ability to dodge attacks\n" + - "The dodge has a 60 second cooldown which is shared with all other dodges and reflects"; - } - } - if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nDecreases enemy defense by 10% on hit"; - } - } - if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nIncreases life regen on hit"; - } - } - if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nDecreases enemy contact damage by 10% on hit"; - } - } - if (item.type == ItemID.OrichalcumSword || item.type == ItemID.OrichalcumHalberd) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nIncreases how frequently the Orichalcum set bonus triggers on hit"; - } - } - if (item.type == ItemID.AdamantiteSword || item.type == ItemID.AdamantiteGlaive) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nSlows enemies on hit"; - } - } - if (item.type == ItemID.TitaniumSword || item.type == ItemID.TitaniumTrident) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nDeals increased damage to enemies with high knockback resistance"; - } - } - if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nInflicts Holy Flames\n" + - "Deals double damage to enemies above 75% life"; - } - } - if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nHeals you on hit"; - } - } - if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber)) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nIgnores 100% of enemy defense"; - } - } - if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nIgnores 50% of enemy defense"; - } - } - if (item.type == ItemID.LightsBane || item.type == ItemID.NightsEdge || item.type == ItemID.TrueNightsEdge) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nInflicts Shadowflame"; - } - } - if (item.type == ItemID.BloodButcherer || item.type == ItemID.TheRottedFork) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Knockback") - line2.text += "\nInflicts Burning Blood"; - } - } - if (item.type == ItemID.BottledHoney) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "HealLife") - line2.text += "\nGrants the Honey buff for 2 minutes"; - } - } - if (item.type == ItemID.RodofDiscord) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text += "\nTeleportation is disabled while Chaos State is active"; - } - } - if (item.type == ItemID.SuperAbsorbantSponge) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text += "\nCannot be used in the Abyss"; - } - } - if (item.type == ItemID.EmptyBucket) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - line2.text += "\nCannot be used in the Abyss"; - } - } - if (item.type == ItemID.CrimsonHeart) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - if (item.type == ItemID.ShadowOrb) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - if (item.type == ItemID.MagicLantern) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - if (item.type == ItemID.ArcticDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishNecklace) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.FairyBell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.DD2PetGhost) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShinePotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text += "\nProvides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.WispinaBottle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.SuspiciousLookingTentacle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.GillsPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.DivingHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nModerately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.CelestialShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.WarmthPotion) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + - "Provides cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; - } - } - } - } - if (item.type == ItemID.FlaskofVenom) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks inflict Venom on enemies"; - } - } - } - if (item.type == ItemID.FlaskofCursedFlames) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks inflict enemies with cursed flames"; - } - } - } - if (item.type == ItemID.FlaskofFire) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks set enemies on fire"; - } - } - } - if (item.type == ItemID.FlaskofGold) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks make enemies drop more gold"; - } - } - } - if (item.type == ItemID.FlaskofIchor) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks decrease enemy defense"; - } - } - } - if (item.type == ItemID.FlaskofNanites) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks confuse enemies"; - } - } - } - if (item.type == ItemID.FlaskofParty) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "All attacks cause confetti to appear"; - } - } - } - if (item.type == ItemID.FlaskofPoison) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks poison enemies"; - } - } - } - if (item.type == ItemID.WormScarf) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage taken by 10%"; - } - } - } - if (item.type == ItemID.TitanGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.PowerGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.MechanicalGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.FireGauntlet) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "10% increased true melee damage\n" + - "Provides heat and cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "10% increased true melee damage"; - } - } - } - } - if (item.type == ItemID.SpectreHood) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% decreased magic damage"; - } - } - } - if (item.type == ItemID.ObsidianSkinPotion) - { - string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to direct damage from touching lava\n" + - "Provides temporary immunity to lava burn damage\n" + - "Greatly increases lava immunity time regeneration\n" + - "Reduces lava burn damage" + heatImmunity; - } - } - } - if (item.type == ItemID.ObsidianRose) - { - string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduced direct damage from touching lava\n" + - "Greatly reduces lava burn damage" + heatImmunity; - } - } - } - if (item.type == ItemID.MagmaStone && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides heat and cold protection in Death Mode"; - } - } - } - if (item.type == ItemID.LavaCharm && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides heat protection in Death Mode"; - } - } - } - if (item.type == ItemID.LavaWaders && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides heat protection in Death Mode"; - } - } - } - if (item.type == ItemID.InvisibilityPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nBoosts certain stats when holding certain types of rogue weapons"; - } - } - } - if (item.type == ItemID.GoldenFishingRod) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "NeedsBait") - { - line2.text = "Requires bait to catch fish\n" + - "The line will never break"; - } - } - } - if (item.type == ItemID.Picksaw) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - // I'm leaving this intentionally ambiguous so that people have to search for Scoria Ore - line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; - } - } - } - if (item.type == ItemID.SolarFlarePickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.VortexPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.NebulaPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.StardustPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - - if (Main.player[Main.myPlayer].Calamity().trueMeleeDamage > 0D) - { - if (item.melee && item.damage > 0) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Damage") - { - line2.text += " : " + string.Concat((int)(Main.player[Main.myPlayer].Calamity().actualMeleeDamageStat * item.damage * - (1D + Main.player[Main.myPlayer].Calamity().trueMeleeDamage) + 5E-06f)) + " true melee damage"; - } - } - } - } - - if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; - } - } - } - if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; - } - } - } - if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; - } - } - } - if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; - } - } - } - if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; - } - } - } - if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientGoldHelmet || item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; - } - } - } - if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) - { - if (!Main.player[Main.myPlayer].Calamity().forbiddenCirclet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nThe minion damage nerf is reduced while wielding magic weapons"; - } - } - } - } - if (item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of minions"; - } - } - } - if (item.type == ItemID.StardustHelmet || item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nIncreases your max number of minions by 2"; - } - } - } - if (item.type == ItemID.GladiatorHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "3 defense\n" + - "3% increased rogue damage"; - } - } - } - if (item.type == ItemID.GladiatorBreastplate) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "3% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.GladiatorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue velocity"; - } - } - } - if (item.type == ItemID.ObsidianHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue damage"; - } - } - } - if (item.type == ItemID.ObsidianShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "3% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.ObsidianPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue velocity"; - } - } - } - if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage -20% extra true melee damage -Grants immunity to fire blocks, and temporary immunity to lava -Provides heat and cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage -20% extra true melee damage -Grants immunity to fire blocks, and temporary immunity to lava"; - } - } - } - } - if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nProvides heat and cold protection in Death Mode"; - } - } - } - } - if (item.type == ItemID.DD2ElderCrystal) - tooltips.FirstOrDefault(line => line.mod == "Terraria" && line.Name == "Tooltip0").text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"; - - if (item.type == ItemID.MagicQuiver) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; - } - } - } - if (item.type == ItemID.MiningHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides light when worn\n" + - "Provides a small amount of light in the Abyss"; - } - } - } - if (item.type == ItemID.HandWarmer) - { - string coldImmunity = CalamityWorld.death ? "\nProvides cold protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to chilling and freezing effects\n" + - "Provides a regeneration boost while wearing the Eskimo armor" + coldImmunity; - } - } - } - if (item.type == ItemID.AngelWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "+20 max life, +10 defense and +2 life regen"; - } - } - } - if (item.type == ItemID.DemonWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "5% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.Jetpack) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 115"; - } - } - } - if (item.type == ItemID.ButterflyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+20 max mana, 5% decreased mana usage,\n" + - "5% increased magic damage and magic critical strike chance"; - } - } - } - if (item.type == ItemID.FairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+60 max life"; - } - } - } - if (item.type == ItemID.BeeWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "Honey buff at all times"; - } - } - } - if (item.type == ItemID.HarpyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "20% increased movement speed\n" + - "Most attacks have a chance to fire a feather on swing if Harpy Ring or Angel Treads are equipped"; - } - } - } - if (item.type == ItemID.BoneWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "10% increased movement speed, ranged damage and critical strike chance\n" + - "and +30 defense while wearing the Necro Armor"; - } - } - } - if (item.type == ItemID.FlameWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "5% increased melee damage and critical strike chance"; - } - } - } - if (item.type == ItemID.FrozenWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "2% increased melee and ranged damage\n" + - "and 1% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor"; - } - } - } - if (item.type == ItemID.GhostWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense and 5% increased damage reduction while wearing the Spectre Armor and Hood\n" + - "5% increased magic damage and critical strike chance while wearing the Spectre Armor and Mask"; - } - } - } - if (item.type == ItemID.BeetleWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense and 5% increased damage reduction while wearing the Beetle Armor and Shell\n" + - "5% increased melee damage and critical strike chance while wearing the Beetle Armor and Scale Mail"; - } - } - } - if (item.type == ItemID.FinWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "Gills effect and you can move freely through liquids\n" + - "You fall faster while submerged in liquid\n" + - "15% increased movement speed and 18% increased jump speed"; - } - } - } - if (item.type == ItemID.FishronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 8\n" + - "Acceleration multiplier: 2\n" + - "Good vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.SteampunkWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "+8 defense, 10% increased movement speed,\n" + - "4% increased damage, and 2% increased critical strike chance"; - } - } - } - if (item.type == ItemID.LeafWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+5 defense, 5% increased damage reduction,\n" + - "and the Dryad's permanent blessing while wearing the Tiki Armor"; - } - } - } - if (item.type == ItemID.BatWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "At night or during an eclipse, you will gain the following boosts:\n" + - "10% increased movement speed, 10% increased jump speed,\n" + - "7% increased damage and 3% increased critical strike chance"; - } - } - } - if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || - item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || - item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || - item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "'Great for impersonating devs!'\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.type == ItemID.TatteredFairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "5% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.SpookyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"; - } - } - } - if (item.type == ItemID.Hoverboard) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "10% increased damage to bows, guns, rocket launchers, and flamethrowers while wearing the Shroomite Armor\n" + - "Boosted weapon type depends on the Shroomite Helmet worn"; - } - } - } - if (item.type == ItemID.FestiveWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "+40 max life\n" + - "Ornaments rain down as you fly"; - } - } - } - if (item.type == ItemID.MothronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+5 defense, 5% increased damage,\n" + - "10% increased movement speed and 12% increased jump speed"; - } - } - } - if (item.type == ItemID.WingsSolar) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "7% increased melee damage and 3% increased melee critical strike chance\n" + - "while wearing the Solar Flare Armor"; - } - } - } - if (item.type == ItemID.WingsStardust) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"; - } - } - } - if (item.type == ItemID.WingsVortex) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "3% increased ranged damage and 7% increased ranged critical strike chance\n" + - "while wearing the Vortex Armor"; - } - } - } - if (item.type == ItemID.WingsNebula) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Nebula Armor"; - } - } - } - if (item.type == ItemID.BetsyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6\n" + - "Acceleration multiplier: 2.5\n" + - "Good vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.type == ItemID.GrapplingHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.AmethystHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 10\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.TopazHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 20.625\n" + - "Launch Velocity: 10.5\n" + - "Pull Velocity: 11.75"; - } - } - } - if (item.type == ItemID.SapphireHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 22.5\n" + - "Launch Velocity: 11\n" + - "Pull Velocity: 12.5"; - } - } - } - if (item.type == ItemID.EmeraldHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 24.375\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 13.25"; - } - } - } - if (item.type == ItemID.RubyHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 26.25\n" + - "Launch Velocity: 12\n" + - "Pull Velocity: 14"; - } - } - } - if (item.type == ItemID.DiamondHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 28.125\n" + - "Launch Velocity: 12.5\n" + - "Pull Velocity: 14.75"; - } - } - } - if (item.type == ItemID.WebSlinger) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 15.625\n" + - "Launch Velocity: 10\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.SkeletronHand) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 21.875\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.SlimeHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.FishHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.IvyWhip) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 15"; - } - } - } - if (item.type == ItemID.BatHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 31.25\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 20"; - } - } - } - if (item.type == ItemID.CandyCaneHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.DualHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 27.5\n" + - "Launch Velocity: 14\n" + - "Pull Velocity: 17"; - } - } - } - if (item.type == ItemID.ThornHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.WormHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.TendonHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.IlluminantHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.AntiGravityHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 31.25\n" + - "Launch Velocity: 14\n" + - "Pull Velocity: 20"; - } - } - } - if (item.type == ItemID.SpookyHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 22"; - } - } - } - if (item.type == ItemID.ChristmasHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 17"; - } - } - } - if (item.type == ItemID.LunarHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } - if (item.type == ItemID.StaticHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 37.5\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } - if (item.type == ItemID.StaticHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 37.5\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } - if (item.accessory) - { - if (item.prefix == PrefixID.Brisk) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+2% movement speed"; - } - } - if (item.prefix == PrefixID.Fleeting) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+4% movement speed"; - } - } - if (item.prefix == PrefixID.Hasty2) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+6% movement speed"; - } - } - if (item.prefix == PrefixID.Quick2) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+8% movement speed"; - } - } - if (item.prefix == PrefixID.Precise || item.prefix == PrefixID.Lucky) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - line2.text += "\n+1 armor penetration"; - } - } - if (item.prefix == PrefixID.Hard) - { - string defenseBoost = "+1 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+4 defense\n"; - else if (CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast) - defenseBoost = "+3 defense\n"; - else if (NPC.downedGolemBoss || NPC.downedMoonlord) - defenseBoost = "+2 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+0.25% damage reduction"; - } - } - if (item.prefix == PrefixID.Guarding) - { - string defenseBoost = "+2 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+8 defense\n"; - else if (CalamityWorld.downedPolterghast) - defenseBoost = "+7 defense\n"; - else if (CalamityWorld.downedProvidence) - defenseBoost = "+6 defense\n"; - else if (NPC.downedMoonlord) - defenseBoost = "+5 defense\n"; - else if (NPC.downedGolemBoss) - defenseBoost = "+4 defense\n"; - else if (Main.hardMode) - defenseBoost = "+3 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+0.5% damage reduction"; - } - } - if (item.prefix == PrefixID.Armored) - { - string defenseBoost = "+3 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+12 defense\n"; - else if (CalamityWorld.downedPolterghast) - defenseBoost = "+10 defense\n"; - else if (CalamityWorld.downedProvidence) - defenseBoost = "+9 defense\n"; - else if (NPC.downedMoonlord) - defenseBoost = "+7 defense\n"; - else if (NPC.downedGolemBoss) - defenseBoost = "+6 defense\n"; - else if (Main.hardMode) - defenseBoost = "+4 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+0.75% damage reduction"; - } - } - if (item.prefix == PrefixID.Warding) - { - string defenseBoost = "+4 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+16 defense\n"; - else if (CalamityWorld.downedPolterghast) - defenseBoost = "+14 defense\n"; - else if (CalamityWorld.downedProvidence) - defenseBoost = "+12 defense\n"; - else if (NPC.downedMoonlord) - defenseBoost = "+10 defense\n"; - else if (NPC.downedGolemBoss) - defenseBoost = "+8 defense\n"; - else if (Main.hardMode) - defenseBoost = "+6 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+1% damage reduction"; - } - } - } - #endregion - - #region Mod Mechanic Tooltips - if (item.type < ItemID.Count) - return; - - // TODO -- mod references should be kept statically - // Adds tooltips to Calamity fountains which match Fargo's fountain tooltips. - Mod fargos = ModLoader.GetMod("Fargowiltas"); - if (fargos != null) - { - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sunken Sea upon activation"); - tooltips.Add(line); - } - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sulphurous Sea upon activation"); - tooltips.Add(line); - } - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Astral upon activation"); - tooltips.Add(line); - } - } - - // Adds a Current Charge tooltip to all items which use charge. - CalamityGlobalItem modItem = item.Calamity(); - if (modItem?.UsesCharge ?? false) - { - // Convert current charge ratio into a percentage. - float displayedPercent = ChargeRatio * 100f; - TooltipLine line = new TooltipLine(mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); - tooltips.Add(line); - } - - // Adds "Donor Item" and "Developer Item" to donor items and developer items respectively. - if (donorItem) - { - TooltipLine line = new TooltipLine(mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", new Color(139, 0, 0))); - tooltips.Add(line); - } - if (devItem) - { - TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", new Color(255, 0, 255))); - tooltips.Add(line); - } - - // Adds "Challenge Drop" or "Legendary Challenge Drop" to malice mode drops. - if (challengeDrop) - { - Color lineColor = default; - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(255, Main.DiscoG, 53); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(Main.DiscoR, 203, 103); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(53, Main.DiscoG, 255); - if (item.type == ModContent.ItemType()) - lineColor = new Color(150, Main.DiscoG, 255); - if (item.type == ModContent.ItemType()) - lineColor = new Color(60, Main.DiscoG, 190); - if (item.type == ModContent.ItemType()) - lineColor = new Color(255, Main.DiscoG, 155); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(255, Main.DiscoG, 0); - if (item.type == ModContent.ItemType()) - lineColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); - if (item.type == ModContent.ItemType()) - lineColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); - if (item.type == ModContent.ItemType()) - lineColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - - if (lineColor != default) - { - TooltipLine line = new TooltipLine(mod, "LegendaryChallengeDrop", CalamityUtils.ColorMessage("- Legendary Challenge Drop -", lineColor)); - tooltips.Add(line); - return; - } - - TooltipLine line2 = new TooltipLine(mod, "ChallengeDrop", CalamityUtils.ColorMessage("- Challenge Drop -", new Color(255, 140, 0))); - tooltips.Add(line2); - } - #endregion - } - #endregion - #region Armor Set Changes public override string IsArmorSet(Item head, Item body, Item legs) { diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index fcf9741e0e..b8051353f5 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -3,8 +3,6 @@ using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Potions; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs new file mode 100644 index 0000000000..093a641800 --- /dev/null +++ b/Items/CalamityGlobalItemTooltip.cs @@ -0,0 +1,1926 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; +using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public partial class CalamityGlobalItem : GlobalItem + { + #region Main ModifyTooltips Function + public override void ModifyTooltips(Item item, List tooltips) + { + // Apply rarity coloration to the item's name. + TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); + if (nameLine != null) + ApplyRarityColors(item, nameLine); + + // Modify all vanilla tooltips before appending mod mechanics (if any). + ModifyVanillaTooltips(item, tooltips); + + // If the item has a stealth generation prefix, show that on the tooltip. + // This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items. + StealthGenAccessoryTooltip(item, tooltips); + + // Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency. + if (item.type < ItemID.Count) + return; + + // TODO -- mod references should be kept statically + // Adds tooltips to Calamity fountains which match Fargo's fountain tooltips. + Mod fargos = ModLoader.GetMod("Fargowiltas"); + if (fargos != null) + { + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sunken Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sulphurous Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Astral upon activation"); + tooltips.Add(line); + } + } + + // Adds a Current Charge tooltip to all items which use charge. + CalamityGlobalItem modItem = item.Calamity(); + if (modItem?.UsesCharge ?? false) + { + // Convert current charge ratio into a percentage. + float displayedPercent = ChargeRatio * 100f; + TooltipLine line = new TooltipLine(mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%"); + tooltips.Add(line); + } + + // Adds "Donor Item" and "Developer Item" to donor items and developer items respectively. + if (donorItem) + { + TooltipLine line = new TooltipLine(mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", new Color(139, 0, 0))); + tooltips.Add(line); + } + if (devItem) + { + TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", new Color(255, 0, 255))); + tooltips.Add(line); + } + + // Adds "Challenge Drop" or "Legendary Challenge Drop" to malice mode drops. + if (challengeDrop) + { + Color lineColor = default; + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + lineColor = new Color(255, Main.DiscoG, 53); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + lineColor = new Color(Main.DiscoR, 203, 103); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + lineColor = new Color(53, Main.DiscoG, 255); + if (item.type == ModContent.ItemType()) + lineColor = new Color(150, Main.DiscoG, 255); + if (item.type == ModContent.ItemType()) + lineColor = new Color(60, Main.DiscoG, 190); + if (item.type == ModContent.ItemType()) + lineColor = new Color(255, Main.DiscoG, 155); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + lineColor = new Color(255, Main.DiscoG, 0); + if (item.type == ModContent.ItemType()) + lineColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); + if (item.type == ModContent.ItemType()) + lineColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); + if (item.type == ModContent.ItemType()) + lineColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + if (lineColor != default) + { + TooltipLine line = new TooltipLine(mod, "LegendaryChallengeDrop", CalamityUtils.ColorMessage("- Legendary Challenge Drop -", lineColor)); + tooltips.Add(line); + return; + } + + TooltipLine line2 = new TooltipLine(mod, "ChallengeDrop", CalamityUtils.ColorMessage("- Challenge Drop -", new Color(255, 140, 0))); + tooltips.Add(line2); + } + } + #endregion + + #region Rarity Coloration + private void ApplyRarityColors(Item item, TooltipLine nameLine) + { + // Apply standard post-ML rarities to the item's color first. + Color? standardRarityColor = CalamityUtils.GetRarityColor(customRarity); + if (standardRarityColor.HasValue) + nameLine.overrideColor = standardRarityColor.Value; + + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(Main.DiscoR, 100, 255); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(0, 0, 255); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = Judgement.GetSyncedLightColor(); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = ShatteredCommunity.GetRarityColor(); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 4f); //alternates between emerald green and amber (BanditHueh) + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(146, 0, 0); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(129, 29, 149); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(220, 20, 60); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(254, 253, 235); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(207, 17, 117); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(227, 226, 180); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); + + // TODO -- for cleanliness, ALL color math should either be a one-line color swap or inside the item's own file + // The items that currently violate this are all below: + // Eternity, Flamsteed Ring, Earth + if (item.type == ModContent.ItemType()) + { + List colorSet = new List() + { + new Color(188, 192, 193), // white + new Color(157, 100, 183), // purple + new Color(249, 166, 77), // honey-ish orange + new Color(255, 105, 234), // pink + new Color(67, 204, 219), // sky blue + new Color(249, 245, 99), // bright yellow + new Color(236, 168, 247), // purplish pink + }; + if (nameLine != null) + { + int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); + Color currentColor = colorSet[colorIndex]; + Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; + nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); + } + } + if (item.type == ModContent.ItemType()) + { + if (Main.GlobalTime % 1f < 0.6f) + { + nameLine.overrideColor = new Color(89, 229, 255); + } + else if (Main.GlobalTime % 1f < 0.8f) + { + nameLine.overrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTime % 1f - 0.6f) / 0.2f); + } + else + { + nameLine.overrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTime % 1f - 0.8f) / 0.2f); + } + } + if (item.type == ModContent.ItemType()) + { + List earthColors = new List() + { + new Color(255, 99, 146), + new Color(255, 228, 94), + new Color(127, 200, 248) + }; + if (nameLine != null) + { + int colorIndex = (int)(Main.GlobalTime / 2 % earthColors.Count); + Color currentColor = earthColors[colorIndex]; + Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; + nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); + } + } + } + #endregion + + #region Vanilla Item Tooltip Modification + private void ModifyVanillaTooltips(Item item, IList tooltips) + { + #region Modular Tooltip Editing Code + // This is a modular tooltip editor which loops over all tooltip lines of an item, + // selects all those which match an arbitrary function you provide, + // then edits them using another arbitrary function you provide. + void ApplyTooltipEdits(IList lines, Func predicate, Action action) + { + foreach (TooltipLine line in lines) + if (predicate.Invoke(item, line)) + action.Invoke(line); + } + + // This function produces simple predicates to match a specific line of a tooltip, by number/index. + Func LineNum(int n) => (Item i, TooltipLine l) => l.mod == "Terraria" && l.Name == $"Tooltip{n}"; + // This function produces simple predicates to match a specific line of a tooltip, by name. + Func LineName(string s) => (Item i, TooltipLine l) => l.mod == "Terraria" && l.Name == s; + + // These functions are shorthand to invoke ApplyTooltipEdits using the above predicates. + void EditTooltipByNum(int lineNum, Action action) => ApplyTooltipEdits(tooltips, LineNum(lineNum), action); + void EditTooltipByName(string lineName, Action action) => ApplyTooltipEdits(tooltips, LineName(lineName), action); + #endregion + + // 1) Mirrors and Recall Potions cannot be used while a boss is alive. + if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) + ApplyTooltipEdits(tooltips, + (i, l) => l.mod == "Terraria" && l.Name == (i.type == ItemID.CellPhone ? "Tooltip1" : "Tooltip0"), + (line) => line.text += "\nCannot be used while a boss is alive"); + + // 2) If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) + EditTooltipByNum(0, (line) => line.text += "\nDemon Altars no longer spawn ores when destroyed"); + + // 3) Black Belt and Master Ninja Gear have guaranteed dodges on a 60 second cooldown. + string beltDodgeLine = "Grants the ability to dodge attacks\n" + + $"The dodge has a {CalamityPlayer.BeltDodgeCooldown} second cooldown which is shared with all other dodges and reflects"; + if (item.type == ItemID.BlackBelt) + EditTooltipByNum(0, (line) => line.text = beltDodgeLine); + if (item.type == ItemID.MasterNinjaGear) + EditTooltipByNum(1, (line) => line.text = beltDodgeLine); + + // 4) Early Hardmode ore melee weapons have new on-hit effects. + #region Early Hardmode Melee Tooltips + + // Cobalt + if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata) + EditTooltipByName("Knockback", (line) => line.text += "\nDecreases enemy defense by 10% on hit"); + + // Palladium + if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike) + EditTooltipByName("Knockback", (line) => line.text += "\nIncreases life regen on hit"); + + // Mythril + if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd) + EditTooltipByName("Knockback", (line) => line.text += "\nDecreases enemy contact damage by 10% on hit"); + + // Orichalcum + if (item.type == ItemID.OrichalcumSword || item.type == ItemID.OrichalcumHalberd) + EditTooltipByName("Knockback", (line) => line.text += "\nIncreases how frequently the Orichalcum set bonus triggers on hit"); + + // Adamantite + if (item.type == ItemID.AdamantiteSword || item.type == ItemID.AdamantiteGlaive) + EditTooltipByName("Knockback", (line) => line.text += "\nSlows enemies on hit"); + + // Titanium + if (item.type == ItemID.TitaniumSword || item.type == ItemID.TitaniumTrident) + EditTooltipByName("Knockback", (line) => line.text += "\nDeals increased damage to enemies with high knockback resistance"); + + // Hallowed (and True Excalibur) + if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur) + EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Holy Flames\nDeals double damage to enemies above 75% life"); + #endregion + + // 5) Other melee weapon tooltips + #region Other Melee Tooltips + + if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram) + EditTooltipByName("Knockback", (line) => line.text += "\nHeals you on hit"); + + // Stylish Scissors, all Phaseblades, and all Phasesabers + if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber)) + EditTooltipByName("Knockback", (line) => line.text += "\nIgnores 100% of enemy defense"); + + if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) + EditTooltipByName("Knockback", (line) => line.text += "\nIgnores 50% of enemy defense"); + + if (item.type == ItemID.LightsBane || item.type == ItemID.NightsEdge || item.type == ItemID.TrueNightsEdge) + EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Shadowflame on hit"); + + if (item.type == ItemID.BloodButcherer || item.type == ItemID.TheRottedFork) + EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Burning Blood on hit"); + #endregion + + // 6) Bottled Honey gives the Honey buff + if (item.type == ItemID.BottledHoney) + EditTooltipByName("HealLife", (line) => line.text += "\nGrants the Honey buff for 2 minutes"); + + // 7) Rod of Discord cannot be used multiple times to hurt yourself + if (item.type == ItemID.RodofDiscord) + EditTooltipByNum(0, (line) => line.text += "\nTeleportation is disabled while Chaos State is active"); + + // 8) Water removing items cannot be used in the Abyss + string noAbyssLine = "\nCannot be used in the Abyss"; + if (item.type == ItemID.SuperAbsorbantSponge) + EditTooltipByNum(0, (line) => line.text += noAbyssLine); + if (item.type == ItemID.EmptyBucket) + EditTooltipByName("Defense", (line) => line.text += noAbyssLine); + + // 9) Light pets, accessories, and other items which boost the player's Abyss light stat + #region Abyss Light Tooltips + + // +1 to Abyss light level + string abyssSmallLightLine = "\nProvides a small amount of light in the abyss"; + + if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace) + EditTooltipByNum(0, (line) => line.text += abyssSmallLightLine); + if (item.type == ItemID.JellyfishDivingGear) + EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine); + + // +2 to Abyss light level + string abyssMediumLightLine = "\nProvides a moderate amount of light in the abyss"; + + if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost) + EditTooltipByNum(0, (line) => line.text += abyssMediumLightLine); + + if (item.type == ItemID.ShinePotion) + EditTooltipByName("BuffTime", (line) => line.text += abyssMediumLightLine); + + // +3 to Abyss light level + string abyssLargeLightLine = "\nProvides a large amount of light in the abyss"; + + if (item.type == ItemID.WispinaBottle) + EditTooltipByNum(0, (line) => line.text += abyssLargeLightLine); + if (item.type == ItemID.SuspiciousLookingTentacle) + EditTooltipByNum(1, (line) => line.text += abyssLargeLightLine); + + if (item.type == ItemID.ArcticDivingGear) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\nProvides a small amount of light in the abyss\n" + + "Moderately reduces breath loss in the abyss"; + } + } + } + #endregion + + if (item.type == ItemID.GillsPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "BuffTime") + { + line2.text += "\nGreatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.DivingHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nModerately reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nGreatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.CelestialShell) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\nGreatly reduces breath loss in the abyss"; + } + } + } + if (item.type == ItemID.WarmthPotion) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + + "Provides cold protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; + } + } + } + } + if (item.type == ItemID.FlaskofVenom) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks inflict Venom on enemies"; + } + } + } + if (item.type == ItemID.FlaskofCursedFlames) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks inflict enemies with cursed flames"; + } + } + } + if (item.type == ItemID.FlaskofFire) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks set enemies on fire"; + } + } + } + if (item.type == ItemID.FlaskofGold) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks make enemies drop more gold"; + } + } + } + if (item.type == ItemID.FlaskofIchor) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks decrease enemy defense"; + } + } + } + if (item.type == ItemID.FlaskofNanites) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks confuse enemies"; + } + } + } + if (item.type == ItemID.FlaskofParty) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "All attacks cause confetti to appear"; + } + } + } + if (item.type == ItemID.FlaskofPoison) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Melee and rogue attacks poison enemies"; + } + } + } + if (item.type == ItemID.WormScarf) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduces damage taken by 10%"; + } + } + } + if (item.type == ItemID.TitanGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\n10% increased true melee damage"; + } + } + } + if (item.type == ItemID.PowerGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\n10% increased true melee damage"; + } + } + } + if (item.type == ItemID.MechanicalGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\n10% increased true melee damage"; + } + } + } + if (item.type == ItemID.FireGauntlet) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "14% increased melee damage and speed\n" + + "10% increased true melee damage\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "14% increased melee damage and speed\n" + + "10% increased true melee damage"; + } + } + } + } + if (item.type == ItemID.SpectreHood) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "20% decreased magic damage"; + } + } + } + if (item.type == ItemID.ObsidianSkinPotion) + { + string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Greatly increases lava immunity time regeneration\n" + + "Reduces lava burn damage" + heatImmunity; + } + } + } + if (item.type == ItemID.ObsidianRose) + { + string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduced direct damage from touching lava\n" + + "Greatly reduces lava burn damage" + heatImmunity; + } + } + } + if (item.type == ItemID.MagmaStone && CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nProvides heat and cold protection in Death Mode"; + } + } + } + if (item.type == ItemID.LavaCharm && CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nProvides heat protection in Death Mode"; + } + } + } + if (item.type == ItemID.LavaWaders && CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\nProvides heat protection in Death Mode"; + } + } + } + if (item.type == ItemID.InvisibilityPotion) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nBoosts certain stats when holding certain types of rogue weapons"; + } + } + } + if (item.type == ItemID.GoldenFishingRod) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "NeedsBait") + { + line2.text = "Requires bait to catch fish\n" + + "The line will never break"; + } + } + } + if (item.type == ItemID.Picksaw) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + // I'm leaving this intentionally ambiguous so that people have to search for Scoria Ore + line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; + } + } + } + if (item.type == ItemID.SolarFlarePickaxe) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Material") + { + line2.text = "Material\n" + + "Can mine Uelibloom Ore"; + } + } + } + if (item.type == ItemID.VortexPickaxe) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Material") + { + line2.text = "Material\n" + + "Can mine Uelibloom Ore"; + } + } + } + if (item.type == ItemID.NebulaPickaxe) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Material") + { + line2.text = "Material\n" + + "Can mine Uelibloom Ore"; + } + } + } + if (item.type == ItemID.StardustPickaxe) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Material") + { + line2.text = "Material\n" + + "Can mine Uelibloom Ore"; + } + } + } + + if (Main.player[Main.myPlayer].Calamity().trueMeleeDamage > 0D) + { + if (item.melee && item.damage > 0) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Damage") + { + line2.text += " : " + string.Concat((int)(Main.player[Main.myPlayer].Calamity().actualMeleeDamageStat * item.damage * + (1D + Main.player[Main.myPlayer].Calamity().trueMeleeDamage) + 5E-06f)) + " true melee damage"; + } + } + } + } + + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; + } + } + } + if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; + } + } + } + if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; + } + } + } + if (item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; + } + } + } + if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; + } + } + } + if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; + } + } + } + if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; + } + } + } + if (item.type == ItemID.AncientGoldHelmet || item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; + } + } + } + if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; + } + } + } + if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) + { + if (!Main.player[Main.myPlayer].Calamity().forbiddenCirclet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text += "\nThe minion damage nerf is reduced while wielding magic weapons"; + } + } + } + } + if (item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases your max number of minions"; + } + } + } + if (item.type == ItemID.StardustHelmet || item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text += "\nIncreases your max number of minions by 2"; + } + } + } + if (item.type == ItemID.GladiatorHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "3 defense\n" + + "3% increased rogue damage"; + } + } + } + if (item.type == ItemID.GladiatorBreastplate) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "5 defense\n" + + "3% increased rogue critical strike chance"; + } + } + } + if (item.type == ItemID.GladiatorLeggings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "3% increased rogue velocity"; + } + } + } + if (item.type == ItemID.ObsidianHelm) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "3% increased rogue damage"; + } + } + } + if (item.type == ItemID.ObsidianShirt) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "5 defense\n" + + "3% increased rogue critical strike chance"; + } + } + } + if (item.type == ItemID.ObsidianPants) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Defense") + { + line2.text = "4 defense\n" + + "3% increased rogue velocity"; + } + } + } + if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = @"Set Bonus: 17% extra melee damage +20% extra true melee damage +Grants immunity to fire blocks, and temporary immunity to lava +Provides heat and cold protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = @"Set Bonus: 17% extra melee damage +20% extra true melee damage +Grants immunity to fire blocks, and temporary immunity to lava"; + } + } + } + } + if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text += "\nProvides heat and cold protection in Death Mode"; + } + } + } + } + if (item.type == ItemID.DD2ElderCrystal) + tooltips.FirstOrDefault(line => line.mod == "Terraria" && line.Name == "Tooltip0").text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"; + + if (item.type == ItemID.MagicQuiver) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; + } + } + } + if (item.type == ItemID.MiningHelmet) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides light when worn\n" + + "Provides a small amount of light in the Abyss"; + } + } + } + if (item.type == ItemID.HandWarmer) + { + string coldImmunity = CalamityWorld.death ? "\nProvides cold protection in Death Mode" : ""; + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides immunity to chilling and freezing effects\n" + + "Provides a regeneration boost while wearing the Eskimo armor" + coldImmunity; + } + } + } + if (item.type == ItemID.AngelWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "+20 max life, +10 defense and +2 life regen"; + } + } + } + if (item.type == ItemID.DemonWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "5% increased damage and critical strike chance"; + } + } + } + if (item.type == ItemID.Jetpack) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 115"; + } + } + } + if (item.type == ItemID.ButterflyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130\n" + + "+20 max mana, 5% decreased mana usage,\n" + + "5% increased magic damage and magic critical strike chance"; + } + } + } + if (item.type == ItemID.FairyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130\n" + + "+60 max life"; + } + } + } + if (item.type == ItemID.BeeWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 130\n" + + "Honey buff at all times"; + } + } + } + if (item.type == ItemID.HarpyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 140\n" + + "20% increased movement speed\n" + + "Most attacks have a chance to fire a feather on swing if Harpy Ring or Angel Treads are equipped"; + } + } + } + if (item.type == ItemID.BoneWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 140\n" + + "10% increased movement speed, ranged damage and critical strike chance\n" + + "and +30 defense while wearing the Necro Armor"; + } + } + } + if (item.type == ItemID.FlameWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "5% increased melee damage and critical strike chance"; + } + } + } + if (item.type == ItemID.FrozenWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "2% increased melee and ranged damage\n" + + "and 1% increased melee and ranged critical strike chance\n" + + "while wearing the Frost Armor"; + } + } + } + if (item.type == ItemID.GhostWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+10 defense and 5% increased damage reduction while wearing the Spectre Armor and Hood\n" + + "5% increased magic damage and critical strike chance while wearing the Spectre Armor and Mask"; + } + } + } + if (item.type == ItemID.BeetleWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+10 defense and 5% increased damage reduction while wearing the Beetle Armor and Shell\n" + + "5% increased melee damage and critical strike chance while wearing the Beetle Armor and Scale Mail"; + } + } + } + if (item.type == ItemID.FinWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 100\n" + + "Gills effect and you can move freely through liquids\n" + + "You fall faster while submerged in liquid\n" + + "15% increased movement speed and 18% increased jump speed"; + } + } + } + if (item.type == ItemID.FishronWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 8\n" + + "Acceleration multiplier: 2\n" + + "Good vertical speed\n" + + "Flight time: 180"; + } + } + } + if (item.type == ItemID.SteampunkWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "+8 defense, 10% increased movement speed,\n" + + "4% increased damage, and 2% increased critical strike chance"; + } + } + } + if (item.type == ItemID.LeafWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 6.75\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+5 defense, 5% increased damage reduction,\n" + + "and the Dryad's permanent blessing while wearing the Tiki Armor"; + } + } + } + if (item.type == ItemID.BatWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 140\n" + + "At night or during an eclipse, you will gain the following boosts:\n" + + "10% increased movement speed, 10% increased jump speed,\n" + + "7% increased damage and 3% increased critical strike chance"; + } + } + } + if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || + item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || + item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || + item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "'Great for impersonating devs!'\n" + + "Horizontal speed: 7\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 150"; + } + } + } + if (item.type == ItemID.TatteredFairyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "5% increased damage and critical strike chance"; + } + } + } + if (item.type == ItemID.SpookyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 180\n" + + "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"; + } + } + } + if (item.type == ItemID.Hoverboard) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Hold DOWN and JUMP to hover\n" + + "Horizontal speed: 6.25\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 170\n" + + "10% increased damage to bows, guns, rocket launchers, and flamethrowers while wearing the Shroomite Armor\n" + + "Boosted weapon type depends on the Shroomite Helmet worn"; + } + } + } + if (item.type == ItemID.FestiveWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 7.5\n" + + "Acceleration multiplier: 1\n" + + "Average vertical speed\n" + + "Flight time: 170\n" + + "+40 max life\n" + + "Ornaments rain down as you fly"; + } + } + } + if (item.type == ItemID.MothronWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 0\n" + + "Acceleration multiplier: 0\n" + + "Average vertical speed\n" + + "Flight time: 160\n" + + "+5 defense, 5% increased damage,\n" + + "10% increased movement speed and 12% increased jump speed"; + } + } + } + if (item.type == ItemID.WingsSolar) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 180\n" + + "7% increased melee damage and 3% increased melee critical strike chance\n" + + "while wearing the Solar Flare Armor"; + } + } + } + if (item.type == ItemID.WingsStardust) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Horizontal speed: 9\n" + + "Acceleration multiplier: 2.5\n" + + "Great vertical speed\n" + + "Flight time: 180\n" + + "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"; + } + } + } + if (item.type == ItemID.WingsVortex) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1.5\n" + + "Good vertical speed\n" + + "Flight time: 160\n" + + "3% increased ranged damage and 7% increased ranged critical strike chance\n" + + "while wearing the Vortex Armor"; + } + } + } + if (item.type == ItemID.WingsNebula) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + + "Horizontal speed: 6.5\n" + + "Acceleration multiplier: 1.5\n" + + "Good vertical speed\n" + + "Flight time: 160\n" + + "+20 max mana, 5% increased magic damage and critical strike chance,\n" + + "and 5% decreased mana usage while wearing the Nebula Armor"; + } + } + } + if (item.type == ItemID.BetsyWings) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + + "Horizontal speed: 6\n" + + "Acceleration multiplier: 2.5\n" + + "Good vertical speed\n" + + "Flight time: 150"; + } + } + } + if (item.type == ItemID.GrapplingHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 18.75\n" + + "Launch Velocity: 11.5\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.AmethystHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 18.75\n" + + "Launch Velocity: 10\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.TopazHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 20.625\n" + + "Launch Velocity: 10.5\n" + + "Pull Velocity: 11.75"; + } + } + } + if (item.type == ItemID.SapphireHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 22.5\n" + + "Launch Velocity: 11\n" + + "Pull Velocity: 12.5"; + } + } + } + if (item.type == ItemID.EmeraldHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 24.375\n" + + "Launch Velocity: 11.5\n" + + "Pull Velocity: 13.25"; + } + } + } + if (item.type == ItemID.RubyHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 26.25\n" + + "Launch Velocity: 12\n" + + "Pull Velocity: 14"; + } + } + } + if (item.type == ItemID.DiamondHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 28.125\n" + + "Launch Velocity: 12.5\n" + + "Pull Velocity: 14.75"; + } + } + } + if (item.type == ItemID.WebSlinger) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 15.625\n" + + "Launch Velocity: 10\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.SkeletronHand) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 21.875\n" + + "Launch Velocity: 15\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.SlimeHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 18.75\n" + + "Launch Velocity: 13\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.FishHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 25\n" + + "Launch Velocity: 13\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.IvyWhip) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 25\n" + + "Launch Velocity: 13\n" + + "Pull Velocity: 15"; + } + } + } + if (item.type == ItemID.BatHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 31.25\n" + + "Launch Velocity: 15.5\n" + + "Pull Velocity: 20"; + } + } + } + if (item.type == ItemID.CandyCaneHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 25\n" + + "Launch Velocity: 11.5\n" + + "Pull Velocity: 11"; + } + } + } + if (item.type == ItemID.DualHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 27.5\n" + + "Launch Velocity: 14\n" + + "Pull Velocity: 17"; + } + } + } + if (item.type == ItemID.ThornHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 30\n" + + "Launch Velocity: 15\n" + + "Pull Velocity: 18"; + } + } + } + if (item.type == ItemID.WormHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 30\n" + + "Launch Velocity: 15\n" + + "Pull Velocity: 18"; + } + } + } + if (item.type == ItemID.TendonHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 30\n" + + "Launch Velocity: 15\n" + + "Pull Velocity: 18"; + } + } + } + if (item.type == ItemID.IlluminantHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 30\n" + + "Launch Velocity: 15\n" + + "Pull Velocity: 18"; + } + } + } + if (item.type == ItemID.AntiGravityHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 31.25\n" + + "Launch Velocity: 14\n" + + "Pull Velocity: 20"; + } + } + } + if (item.type == ItemID.SpookyHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 34.375\n" + + "Launch Velocity: 15.5\n" + + "Pull Velocity: 22"; + } + } + } + if (item.type == ItemID.ChristmasHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 34.375\n" + + "Launch Velocity: 15.5\n" + + "Pull Velocity: 17"; + } + } + } + if (item.type == ItemID.LunarHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 34.375\n" + + "Launch Velocity: 16\n" + + "Pull Velocity: 24"; + } + } + } + if (item.type == ItemID.StaticHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 37.5\n" + + "Launch Velocity: 16\n" + + "Pull Velocity: 24"; + } + } + } + if (item.type == ItemID.StaticHook) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Equipable") + { + line2.text = "Equipable\n" + + "Reach: 37.5\n" + + "Launch Velocity: 16\n" + + "Pull Velocity: 24"; + } + } + } + if (item.accessory) + { + if (item.prefix == PrefixID.Brisk) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") + line2.text = "+2% movement speed"; + } + } + if (item.prefix == PrefixID.Fleeting) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") + line2.text = "+4% movement speed"; + } + } + if (item.prefix == PrefixID.Hasty2) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") + line2.text = "+6% movement speed"; + } + } + if (item.prefix == PrefixID.Quick2) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") + line2.text = "+8% movement speed"; + } + } + if (item.prefix == PrefixID.Precise || item.prefix == PrefixID.Lucky) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") + line2.text += "\n+1 armor penetration"; + } + } + if (item.prefix == PrefixID.Hard) + { + string defenseBoost = "+1 defense\n"; + if (CalamityWorld.downedDoG) + defenseBoost = "+4 defense\n"; + else if (CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast) + defenseBoost = "+3 defense\n"; + else if (NPC.downedGolemBoss || NPC.downedMoonlord) + defenseBoost = "+2 defense\n"; + + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + line2.text = defenseBoost + "+0.25% damage reduction"; + } + } + if (item.prefix == PrefixID.Guarding) + { + string defenseBoost = "+2 defense\n"; + if (CalamityWorld.downedDoG) + defenseBoost = "+8 defense\n"; + else if (CalamityWorld.downedPolterghast) + defenseBoost = "+7 defense\n"; + else if (CalamityWorld.downedProvidence) + defenseBoost = "+6 defense\n"; + else if (NPC.downedMoonlord) + defenseBoost = "+5 defense\n"; + else if (NPC.downedGolemBoss) + defenseBoost = "+4 defense\n"; + else if (Main.hardMode) + defenseBoost = "+3 defense\n"; + + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + line2.text = defenseBoost + "+0.5% damage reduction"; + } + } + if (item.prefix == PrefixID.Armored) + { + string defenseBoost = "+3 defense\n"; + if (CalamityWorld.downedDoG) + defenseBoost = "+12 defense\n"; + else if (CalamityWorld.downedPolterghast) + defenseBoost = "+10 defense\n"; + else if (CalamityWorld.downedProvidence) + defenseBoost = "+9 defense\n"; + else if (NPC.downedMoonlord) + defenseBoost = "+7 defense\n"; + else if (NPC.downedGolemBoss) + defenseBoost = "+6 defense\n"; + else if (Main.hardMode) + defenseBoost = "+4 defense\n"; + + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + line2.text = defenseBoost + "+0.75% damage reduction"; + } + } + if (item.prefix == PrefixID.Warding) + { + string defenseBoost = "+4 defense\n"; + if (CalamityWorld.downedDoG) + defenseBoost = "+16 defense\n"; + else if (CalamityWorld.downedPolterghast) + defenseBoost = "+14 defense\n"; + else if (CalamityWorld.downedProvidence) + defenseBoost = "+12 defense\n"; + else if (NPC.downedMoonlord) + defenseBoost = "+10 defense\n"; + else if (NPC.downedGolemBoss) + defenseBoost = "+8 defense\n"; + else if (Main.hardMode) + defenseBoost = "+6 defense\n"; + + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") + line2.text = defenseBoost + "+1% damage reduction"; + } + } + } + } + #endregion + + #region Stealth Generation Prefix Accessory Tooltip + private void StealthGenAccessoryTooltip(Item item, IList tooltips) + { + if (!item.accessory || item.social || item.prefix <= 0) + return; + + float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; + if (stealthGenBoost > 0) + { + TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") + { + isModifier = true + }; + tooltips.Add(StealthGen); + } + } + #endregion + } +} diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index a96224be03..40a3f708f6 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -10,6 +10,22 @@ namespace CalamityMod { public static partial class CalamityUtils { + #region Item Rarity Utilities + internal const int TurquoiseRarityValue = 12; + internal static readonly Color TurquoiseRarityColor = new Color(0, 255, 200); + internal const int PureGreenRarityValue = 13; + internal static readonly Color PureGreenRarityColor = new Color(0, 255, 0); + internal const int DarkBlueRarityValue = 14; + internal static readonly Color DarkBlueRarityColor = new Color(43, 96, 222); + internal const int VioletRarityValue = 15; + internal static readonly Color VioletRarityColor = new Color(108, 45, 199); + internal const int HotPinkRarityValue = 16; + internal static readonly Color HotPinkRarityColor = new Color(255, 0, 255); + internal const int RainbowRarityValue = 30; + // The rainbow rarity has an ever-shifting color, not a stored constant + internal const int DraedonRustRarityValue = 33; + internal static readonly Color DraedonRustRarityColor = new Color(204, 71, 35); + public static readonly CalamityRarity[] postMLRarities = { CalamityRarity.Turquoise, @@ -18,6 +34,7 @@ namespace CalamityMod CalamityRarity.Violet, CalamityRarity.HotPink }; + public static bool IsPostML(this CalamityRarity calrare) { for(int i = 0; i < postMLRarities.Length; ++i) @@ -26,6 +43,31 @@ namespace CalamityMod return false; } + public static Color? GetRarityColor(CalamityRarity calrare) + { + switch (calrare) + { + default: + return null; + case CalamityRarity.Turquoise: + return TurquoiseRarityColor; + case CalamityRarity.PureGreen: + return PureGreenRarityColor; + case CalamityRarity.DarkBlue: + return DarkBlueRarityColor; + case CalamityRarity.Violet: + return VioletRarityColor; + case CalamityRarity.HotPink: + return HotPinkRarityColor; + + case CalamityRarity.Rainbow: + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + case CalamityRarity.DraedonRust: + return DraedonRustRarityColor; + } + } + #endregion + /// /// Converts the given ModHotKey into a string for insertion into item tooltips.

/// This allows the user's actual keybind choices to be shown to them in tooltips. From 6691cd1ea31951d6fddd4ec85ba546b088be2f1a Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 18:30:39 -0400 Subject: [PATCH 23/43] Removed old broken code from Endogenesis beams --- Projectiles/Summon/EndoBeam.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Projectiles/Summon/EndoBeam.cs b/Projectiles/Summon/EndoBeam.cs index f37d040193..6f234bf436 100644 --- a/Projectiles/Summon/EndoBeam.cs +++ b/Projectiles/Summon/EndoBeam.cs @@ -3,9 +3,10 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.ID; using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class EndoBeam : ModProjectile @@ -38,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = timeToExist; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.coldDamage = true; + projectile.coldDamage = true; } // Netcode for sending and receiving shit @@ -201,10 +202,5 @@ namespace CalamityMod.Projectiles.Summon } return false; } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModLoader.GetMod("CalamityMod").BuffType("GodSlayerInferno"), 300); - } } } From 33ba777195c1c6bf18647759093fa12eb992b147 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 18:34:31 -0400 Subject: [PATCH 24/43] All other mods are cached in CalamityMod for efficiency. This includes Music Mod. --- Buffs/Mounts/AndromedaBuff.cs | 16 ++-- CalamityMod.cs | 81 +++++++++++++------ Items/Fishing/GlimmeringGemfish.cs | 2 +- Items/Fishing/StuffedFish.cs | 18 +++-- Items/TreasureBags/StarterBag.cs | 2 +- ModSupport/WeakReferenceSupport.cs | 14 ++-- NPCs/AquaticScourge/AquaticScourgeHead.cs | 2 +- NPCs/AstrumAureus/AstrumAureus.cs | 2 +- NPCs/AstrumDeus/AstrumDeusBodySpectral.cs | 2 +- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 2 +- NPCs/AstrumDeus/AstrumDeusTailSpectral.cs | 2 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 2 +- NPCs/Bumblebirb/Bumblefuck.cs | 4 +- NPCs/Calamitas/CalamitasRun.cs | 2 +- NPCs/Calamitas/CalamitasRun2.cs | 2 +- NPCs/Calamitas/CalamitasRun3.cs | 2 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 2 +- NPCs/Crabulon/CrabulonIdle.cs | 2 +- NPCs/Cryogen/Cryogen.cs | 2 +- NPCs/DesertScourge/DesertScourgeBody.cs | 2 +- NPCs/DesertScourge/DesertScourgeHead.cs | 2 +- NPCs/DesertScourge/DesertScourgeTail.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsBody.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsBodyS.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsTail.cs | 2 +- NPCs/DevourerofGods/DevourerofGodsTailS.cs | 2 +- NPCs/HiveMind/HiveMind.cs | 2 +- NPCs/HiveMind/HiveMindP2.cs | 2 +- NPCs/Leviathan/Leviathan.cs | 2 +- NPCs/Leviathan/LeviathanStart.cs | 2 +- NPCs/Leviathan/Siren.cs | 6 +- NPCs/OldDuke/OldDuke.cs | 4 +- NPCs/Perforator/PerforatorHive.cs | 4 +- .../PlaguebringerGoliath.cs | 2 +- NPCs/Polterghast/Polterghast.cs | 4 +- .../ProfanedGuardians/ProfanedGuardianBoss.cs | 2 +- .../ProfanedGuardianBoss2.cs | 2 +- .../ProfanedGuardianBoss3.cs | 2 +- NPCs/Providence/Providence.cs | 4 +- NPCs/Ravager/RavagerBody.cs | 2 +- NPCs/Signus/Signus.cs | 2 +- NPCs/SlimeGod/SlimeGod.cs | 2 +- NPCs/SlimeGod/SlimeGodCore.cs | 4 +- NPCs/SlimeGod/SlimeGodRun.cs | 2 +- NPCs/SlimeGod/SlimeGodRunSplit.cs | 2 +- NPCs/SlimeGod/SlimeGodSplit.cs | 2 +- NPCs/StormWeaver/StormWeaverBody.cs | 2 +- NPCs/StormWeaver/StormWeaverBodyNaked.cs | 2 +- NPCs/StormWeaver/StormWeaverHead.cs | 2 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 2 +- NPCs/StormWeaver/StormWeaverTail.cs | 2 +- NPCs/StormWeaver/StormWeaverTailNaked.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 8 +- NPCs/Yharon/Yharon.cs | 4 +- World/DraedonStructures.cs | 4 +- World/Planets/Planetoid.cs | 2 +- World/WorldGenerationMethods.cs | 2 +- 59 files changed, 146 insertions(+), 119 deletions(-) diff --git a/Buffs/Mounts/AndromedaBuff.cs b/Buffs/Mounts/AndromedaBuff.cs index f6ee2e2f68..87e673f814 100644 --- a/Buffs/Mounts/AndromedaBuff.cs +++ b/Buffs/Mounts/AndromedaBuff.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Mounts { - public class AndromedaBuff : ModBuff + public class AndromedaBuff : ModBuff { public override void SetDefaults() { @@ -15,15 +15,15 @@ namespace CalamityMod.Buffs.Mounts public override void Update(Player player, ref int buffIndex) { - //Disables crouching with the Crouch, Crawl, and Roll Mod - Mod crouchMod = ModLoader.GetMod("CrouchMod"); + // Disables crouching with the Crouch, Crawl, and Roll Mod + Mod crouchMod = CalamityMod.Instance.crouchMod; if (crouchMod != null) { - //Mod Call inputs - //"CanCrouch" //string which is required - //p //int for the player's index - //canCrouch //bool whether the player can input crouch (point being to set this to false) - //forceUnCrouch //bool which, if true, forces the player to uncrouch (forcing their head into the ceiling) + // Mod Call inputs + // 1) "CanCrouch" -- name of operation + // 2) int for the player's index + // 3) bool for whether the player can use the crouch input this frame + // 4) bool for whether the player should be force-uncrouched this frame crouchMod.Call("CanCrouch", player.whoAmI, false, true); } } diff --git a/CalamityMod.cs b/CalamityMod.cs index 544e28d565..6f28e75e10 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -48,7 +48,6 @@ using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Dyes; -using Terraria.GameContent.Events; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -101,16 +100,37 @@ namespace CalamityMod public const float velocityScaleMin = 0.5f; public const float bitingEnemeyVelocityScale = 0.8f; - // TODO -- Calamity should check for other mods existing in exactly one place - public bool fargosMutant = false; - internal static CalamityMod Instance; + internal Mod musicMod = null; // this is Calamity's official music mod, CalamityModMusic + internal Mod ancientsAwakened = null; + internal Mod bossChecklist = null; + internal Mod census = null; + internal Mod crouchMod = null; + internal Mod fargos = null; + internal Mod redemption = null; + internal Mod soa = null; + internal Mod summonersAssociation = null; + internal Mod thorium = null; + internal Mod varia = null; #region Load public override void Load() { Instance = this; + // If any of these mods aren't loaded, it will simply keep them as null. + musicMod = ModLoader.GetMod("CalamityModMusic"); + ancientsAwakened = ModLoader.GetMod("AAMod"); + bossChecklist = ModLoader.GetMod("BossChecklist"); + census = ModLoader.GetMod("Census"); + crouchMod = ModLoader.GetMod("CrouchMod"); + fargos = ModLoader.GetMod("Fargowiltas"); + redemption = ModLoader.GetMod("Redemption"); + soa = ModLoader.GetMod("SacredTools"); + summonersAssociation = ModLoader.GetMod("SummonersAssociation"); + thorium = ModLoader.GetMod("ThoriumMod"); + varia = ModLoader.GetMod("Varia"); + // Initialize the BossStats struct as early as it is safe to do so NPCStats.Load(); @@ -236,6 +256,18 @@ namespace CalamityMod #region Unload public override void Unload() { + musicMod = null; + ancientsAwakened = null; + bossChecklist = null; + census = null; + crouchMod = null; + fargos = null; + redemption = null; + soa = null; + summonersAssociation = null; + thorium = null; + varia = null; + NormalityRelocatorHotKey = null; RageHotKey = null; AdrenalineHotKey = null; @@ -262,8 +294,6 @@ namespace CalamityMod CalamityLists.UnloadLists(); NPCStats.Unload(); - fargosMutant = false; - PopupGUIManager.UnloadGUIs(); InvasionProgressUIManager.UnloadGUIs(); BossRushEvent.Unload(); @@ -647,7 +677,6 @@ namespace CalamityMod #region Music public override void UpdateMusic(ref int music, ref MusicPriority priority) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (Main.musicVolume != 0) { if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) @@ -657,8 +686,8 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); + if (musicMod != null) + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); else music = MusicID.Eerie; priority = MusicPriority.Environment; @@ -668,8 +697,8 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); + if (musicMod != null) + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); else music = MusicID.Temple; priority = MusicPriority.Environment; @@ -679,9 +708,9 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) + if (musicMod != null) { - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); } else music = MusicID.Space; @@ -692,9 +721,9 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) + if (musicMod != null) { - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstralUnderground"); + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstralUnderground"); } else music = MusicID.Space; @@ -705,8 +734,8 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); + if (musicMod != null) + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); else music = MusicID.Hell; priority = MusicPriority.BiomeHigh; @@ -716,8 +745,8 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); + if (musicMod != null) + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); else music = MusicID.Hell; priority = MusicPriority.BiomeHigh; @@ -727,8 +756,8 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); + if (musicMod != null) + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); else music = MusicID.Hell; priority = MusicPriority.BiomeHigh; @@ -739,11 +768,11 @@ namespace CalamityMod if (!CalamityPlayer.areThereAnyDamnBosses) { bool acidRain = CalamityWorld.rainingAcid; - if (calamityModMusic != null) + if (musicMod != null) { string rainMusic = "Sounds/Music/AcidRain"; string musicChoice = acidRain ? rainMusic + (CalamityWorld.downedPolterghast ? "2" : "1") : "Sounds/Music/Sulphur"; //replace first acidrain1 once second theme is added. - music = calamityModMusic.GetSoundSlot(SoundType.Music, musicChoice); + music = musicMod.GetSoundSlot(SoundType.Music, musicChoice); } else @@ -755,8 +784,8 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + if (musicMod != null) + music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); else music = MusicID.LunarBoss; priority = MusicPriority.BossMedium; @@ -767,7 +796,7 @@ namespace CalamityMod } #endregion - #region ModSupport + #region Mod Support public override void PostSetupContent() => WeakReferenceSupport.Setup(); public override object Call(params object[] args) => ModCalls.Call(args); diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index 19d07620da..bc5867add3 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Fishing DropHelper.DropItemChance(player, ItemID.Ruby, 0.15f, gemMin, gemMax); DropHelper.DropItemChance(player, ItemID.Diamond, 0.1f, gemMin, gemMax); DropHelper.DropItemChance(player, ItemID.Amber, 0.25f, gemMin, gemMax); - Mod thorium = ModLoader.GetMod("ThoriumMod"); + Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) { DropHelper.DropItemChance(player, thorium.ItemType("Pearl"), 0.25f, gemMin, gemMax); diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 701afa63d0..503018b1ac 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -54,20 +54,22 @@ namespace CalamityMod.Items.Fishing DropHelper.DropItemCondition(player, ItemID.CorruptSeeds, !WorldGen.crimson, 0.05f, seedMin, seedMax); DropHelper.DropItemCondition(player, ItemID.CrimsonSeeds, WorldGen.crimson, 0.05f, seedMin, seedMax); DropHelper.DropItemCondition(player, ItemID.HallowedSeeds, Main.hardMode, 0.05f, seedMin, seedMax); - Mod thorium = ModLoader.GetMod("ThoriumMod"); + Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) { DropHelper.DropItemChance(player, thorium.ItemType("MarineKelp"), 0.25f, herbMin, herbMax); DropHelper.DropItemChance(player, thorium.ItemType("MarineKelpSeeds"), 0.1f, seedMin, seedMax); } - Mod shadowsOfAbaddon = ModLoader.GetMod("SacredTools"); - if (shadowsOfAbaddon != null) + Mod soa = CalamityMod.Instance.soa; + if (soa != null) { - DropHelper.DropItemChance(player, shadowsOfAbaddon.ItemType("Welkinbell"), 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(player, shadowsOfAbaddon.ItemType("WelkinbellSeeds"), 0.1f, seedMin, seedMax); - DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("Illumifern"), Main.hardMode, 0.25f, herbMin, herbMax); - DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("IllumifernSeeds"), Main.hardMode, 0.1f, seedMin, seedMax); - //There's no mod call for Abaddon being dead + DropHelper.DropItemChance(player, soa.ItemType("Welkinbell"), 0.25f, herbMin, herbMax); + DropHelper.DropItemChance(player, soa.ItemType("WelkinbellSeeds"), 0.1f, seedMin, seedMax); + DropHelper.DropItemCondition(player, soa.ItemType("Illumifern"), Main.hardMode, 0.25f, herbMin, herbMax); + DropHelper.DropItemCondition(player, soa.ItemType("IllumifernSeeds"), Main.hardMode, 0.1f, seedMin, seedMax); + + // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. + // Dan Yami has confirmed that downed calls will be added to SoA eventually. //DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("Enduflora"), SacredTools.ModdedWorld.downedAbaddon, 0.25f, herbMin, herbMax); //DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("EndufloraSeeds"), SacredTools.ModdedWorld.downedAbaddon, 0.1f, seedMin, seedMax); } diff --git a/Items/TreasureBags/StarterBag.cs b/Items/TreasureBags/StarterBag.cs index 885bd33912..afeb433019 100644 --- a/Items/TreasureBags/StarterBag.cs +++ b/Items/TreasureBags/StarterBag.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemCondition(player, ModContent.ItemType(), player.name == "Aleksh" || player.name == "Shark Lad"); // Music box (if music mod installed) - Mod musicMod = ModLoader.GetMod("CalamityModMusic"); + Mod musicMod = CalamityMod.Instance.musicMod; if (musicMod != null) DropHelper.DropItem(player, musicMod.ItemType("CalamityMusicbox")); } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 748971b1d2..b5809c6b10 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -225,9 +225,8 @@ namespace CalamityMod ///
private static void BossChecklistSupport() { - Mod bossChecklist = ModLoader.GetMod("BossChecklist"); - Mod calamity = GetInstance(); - + CalamityMod calamity = GetInstance(); + Mod bossChecklist = calamity.bossChecklist; if (bossChecklist is null) return; @@ -798,13 +797,10 @@ namespace CalamityMod private static void FargosSupport() { - Mod fargos = ModLoader.GetMod("Fargowiltas"); + Mod fargos = GetInstance().fargos; if (fargos is null) return; - // Mark Fargo's Mutant Mod as loaded so that Calamity doesn't add ANY boss summons to vanilla NPCs, even for its own bosses - GetInstance().fargosMutant = true; - void AddToMutantShop(string bossName, string summonItemName, Func downed, int price) { BossDifficulty.TryGetValue(bossName, out float order); @@ -838,7 +834,7 @@ namespace CalamityMod private static void CensusSupport() { - Mod censusMod = ModLoader.GetMod("Census"); + Mod censusMod = GetInstance().census; if (censusMod != null) { censusMod.Call("TownNPCCondition", NPCType(), "Defeat a Giant Clam after defeating the Desert Scourge"); @@ -850,7 +846,7 @@ namespace CalamityMod private static void SummonersAssociationSupport() { - Mod sAssociation = ModLoader.GetMod("SummonersAssociation"); + Mod sAssociation = GetInstance().summonersAssociation; if (sAssociation is null) return; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 6d680bf3da..890fdb2e7c 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.AquaticScourge { if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); else diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index a48ef86a06..5c3fd7f69c 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.value = Item.buyPrice(0, 15, 0, 0); npc.boss = true; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); else diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index ca698e163b..cc9ca555e8 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); npc.netAlways = true; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); else diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index e397f16129..fdb8e2e10d 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.HitSound = SoundID.NPCHit4; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); else diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 1ea03efe87..34527b9bea 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); npc.netAlways = true; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); else diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index c941dd699b..1f2045a690 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.netAlways = true; npc.HitSound = SoundID.NPCHit23; npc.DeathSound = SoundID.NPCDeath39; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); else diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 1fbba45016..7a81f3edb1 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -53,8 +53,8 @@ namespace CalamityMod.NPCs.Bumblebirb npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); else music = MusicID.Boss4; diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 7038986beb..e5c9326a84 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Calamitas npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); else diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 949da6fc25..f4fe36a3e2 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Calamitas npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); else diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index d105c254ae..bef9d6b164 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Calamitas npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); else diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 61c77d6c3a..621ca28d4d 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.CeaselessVoid CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.5f; npc.lifeMax = 25000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 2f9fa798f8..078b02ea12 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Crabulon aiType = -1; npc.noGravity = false; npc.noTileCollide = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); else diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index b541ecb015..c22c467fdd 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Cryogen npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath15; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); else diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 109bfde2fd..f93a6fc0e7 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.knockBackResist = 0f; npc.alpha = 255; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); else diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 1baadfbd3e..83f8312f44 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; bossBag = ModContent.ItemType(); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); else diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 1f86623a32..9b4403dd18 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.knockBackResist = 0f; npc.alpha = 255; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); else diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 862deda1f5..4f4a8e9e56 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index 09dd81d7df..1a210c14a6 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); else diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index e94685fede..eaa49220fb 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.noTileCollide = true; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 91507c5091..366fd50305 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.noTileCollide = true; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); else diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index e220819830..2fa3f688d2 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.netAlways = true; npc.boss = true; npc.takenDamageMultiplier = 1.25f; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 7c00707ebd..49587254e0 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); else diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 37431ecdb3..6b122faa69 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.HiveMind npc.value = 0f; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); else diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 1f151d0f59..c21872e673 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.HiveMind npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); else diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index f6317bb048..a68fc5d86c 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.Leviathan npc.noGravity = true; npc.boss = true; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); else diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 85b16709f7..5956cff4c0 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Leviathan npc.HitSound = SoundID.NPCHit1; npc.DeathSound = null; npc.rarity = 2; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure"); } diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 6682548e91..7b0b0a0541 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -49,8 +49,8 @@ namespace CalamityMod.NPCs.Leviathan npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); else music = MusicID.Boss3; @@ -145,7 +145,7 @@ namespace CalamityMod.NPCs.Leviathan { if (!spawnedLevi) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); else diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index ec42550fd6..cf5fbcb238 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -55,8 +55,8 @@ namespace CalamityMod.NPCs.OldDuke npc.boss = true; npc.netAlways = true; npc.timeLeft = NPC.activeTime * 30; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BoomerDuke"); else music = MusicID.Boss1; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 79938668ea..b90ba70037 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -57,8 +57,8 @@ namespace CalamityMod.NPCs.Perforator npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath19; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); else music = MusicID.Boss2; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 28c3f05a32..7cd203eb0f 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); else diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index ce54dd99df..8ac69715f1 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -76,8 +76,8 @@ namespace CalamityMod.NPCs.Polterghast npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); else music = MusicID.Plantera; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 285eae2e47..8b3cd1ce1e 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.noTileCollide = true; aiType = -1; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); else diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index 334fa0ce6a..8442dda34b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.canGhostHeal = false; aiType = -1; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); else diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 044f546538..d0ce8cf6fe 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.canGhostHeal = false; aiType = -1; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); else diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 19b09cbd30..3eb58c8144 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -104,8 +104,8 @@ namespace CalamityMod.NPCs.Providence npc.netAlways = true; npc.chaseable = true; npc.canGhostHeal = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); else music = MusicID.LunarBoss; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 46ef60e755..2de8c36f7a 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Ravager npc.alpha = 255; npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); else diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 9f40f27a4e..b162273c6d 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Signus npc.width = 130; npc.height = 130; npc.defense = 60; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 0805f8f3f1..54ce5f0b0d 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.alpha = 55; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 5a8452a602..eab46f5a02 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -56,8 +56,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) + Mod calamityModMusic = CalamityMod.Instance.musicMod; + if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else music = MusicID.Boss1; diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 579c832150..b9d12b9f1e 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index d13dd5b3ca..93d7ab0195 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 2c21aff441..5dae4e75f3 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); else diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0a831e39ad..d6ccf72dfc 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.StormWeaver global.unbreakableDR = true; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 170000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 855f41bfb9..bdab186bb3 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.lifeMax = 100000; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 585000 : 97500, notDoGFight ? 585000 : 97500, 3500000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index ca0dba0b22..0aa90d6cea 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.StormWeaver global.unbreakableDR = true; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 170000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index fd8c86f702..2cd6c028c3 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.height = 74; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 585000 : 97500, notDoGFight ? 585000 : 97500, 3500000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 5476f18879..62c186a6c9 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.takenDamageMultiplier = 3f; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 170000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 7d8e0ffa83..d19d16c24b 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.height = 80; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 585000 : 97500, notDoGFight ? 585000 : 97500, 3500000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 811e217227..1a82cfbbbd 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCG"); else @@ -586,7 +586,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (!startThirdAttack && (npc.life <= npc.lifeMax * 0.5)) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCL"); else @@ -652,7 +652,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (!startFourthAttack && (npc.life <= npc.lifeMax * 0.3)) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCE"); else @@ -732,7 +732,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (gettingTired5) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCA"); else diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 8fb1f483d5..c07231acc8 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.Yharon npc.noTileCollide = true; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); else @@ -1552,7 +1552,7 @@ namespace CalamityMod.NPCs.Yharon if (!moveCloser) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + Mod calamityModMusic = CalamityMod.Instance.musicMod; if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); else diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 3402eab80b..f10e8a59d7 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -23,7 +23,7 @@ namespace CalamityMod.World IList avoid = new List(16); // Mod of Redemption's labs use modded blocks, but must still be avoided. - Mod mor = ModLoader.GetMod("Redemption"); + Mod mor = CalamityMod.Instance.redemption; if (mor != null) { // Thanks to Hallam to providing these tile names. @@ -534,7 +534,7 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; - Mod thorium = ModLoader.GetMod("ThoriumMod"); + Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) contents.Add(new ChestItem(thorium.ItemType("MarineKelpPlanterBox"), WorldGen.genRand.Next(5, 9 + 1))); diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index ada543be6b..8a50a06157 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -13,7 +13,7 @@ namespace CalamityMod.World.Planets public static bool InvalidSkyPlacementArea(Rectangle area) { - Mod varia = ModLoader.GetMod("Varia"); + Mod varia = CalamityMod.Instance.varia; for (int i = area.Left; i < area.Right; i++) { for (int j = area.Top; j < area.Bottom; j++) diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index d71c9035bb..63d04c4e68 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -337,7 +337,7 @@ namespace CalamityMod.World public static void PlaceAstralMeteor() { - Mod ancientsAwakened = ModLoader.GetMod("AAMod"); + Mod ancientsAwakened = CalamityMod.Instance.ancientsAwakened; // This flag is also used to determine whether players are nearby. bool meteorDropped = true; From 903c6d4f95c9f21f8965f0f8fb3cb51be33d48a1 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 19:58:39 -0400 Subject: [PATCH 25/43] 1 - Ongoing tooltip reworking. 2 - Removed an unnecessary tracked stat for "actual melee damage". --- CalPlayer/CalamityPlayer.cs | 3 +- CalPlayer/CalamityPlayerMiscEffects.cs | 1 - Items/CalamityGlobalItemTooltip.cs | 607 ++++++++++--------------- Utilities/ItemUtils.cs | 4 + 4 files changed, 242 insertions(+), 373 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5cf0890c55..e0d394afb2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -155,7 +155,6 @@ namespace CalamityMod.CalPlayer #region Stat Meter public int[] damageStats = new int[6]; public int[] critStats = new int[4]; - public float actualMeleeDamageStat = 0f; public int defenseStat = 0; public int DRStat = 0; public int meleeSpeedStat = 0; @@ -2529,7 +2528,7 @@ namespace CalamityMod.CalPlayer if (Main.snowTiles > 300) player.ZoneSnow = true; - Mod fargos = ModLoader.GetMod("Fargowiltas"); + Mod fargos = CalamityMod.Instance.fargos; if (fargos != null) { //Fargo's fountain effects diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 9f61959bb8..c7245767a4 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3984,7 +3984,6 @@ namespace CalamityMod.CalPlayer private static void UpdateStatMeter(Player player, CalamityPlayer modPlayer) { float allDamageStat = player.allDamage - 1f; - modPlayer.actualMeleeDamageStat = player.meleeDamage + allDamageStat; modPlayer.damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f); diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 093a641800..fd5e298fb2 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -13,6 +13,7 @@ using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; +using System.Text; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +28,11 @@ namespace CalamityMod.Items // Apply rarity coloration to the item's name. TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); if (nameLine != null) - ApplyRarityColors(item, nameLine); + ApplyRarityColor(item, nameLine); + + // If the item is melee, add a true melee damage number adjacent to the standard damage number. + if (item.melee && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D) + TrueMeleeDamageTooltip(item, tooltips); // Modify all vanilla tooltips before appending mod mechanics (if any). ModifyVanillaTooltips(item, tooltips); @@ -40,27 +45,8 @@ namespace CalamityMod.Items if (item.type < ItemID.Count) return; - // TODO -- mod references should be kept statically // Adds tooltips to Calamity fountains which match Fargo's fountain tooltips. - Mod fargos = ModLoader.GetMod("Fargowiltas"); - if (fargos != null) - { - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sunken Sea upon activation"); - tooltips.Add(line); - } - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sulphurous Sea upon activation"); - tooltips.Add(line); - } - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Astral upon activation"); - tooltips.Add(line); - } - } + FargoFountainTooltip(item, tooltips); // Adds a Current Charge tooltip to all items which use charge. CalamityGlobalItem modItem = item.Calamity(); @@ -75,61 +61,31 @@ namespace CalamityMod.Items // Adds "Donor Item" and "Developer Item" to donor items and developer items respectively. if (donorItem) { - TooltipLine line = new TooltipLine(mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", new Color(139, 0, 0))); + TooltipLine line = new TooltipLine(mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor)); tooltips.Add(line); } if (devItem) { - TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", new Color(255, 0, 255))); + TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.HotPinkRarityColor)); tooltips.Add(line); } - // Adds "Challenge Drop" or "Legendary Challenge Drop" to malice mode drops. + // Adds "Challenge Drop" or "Legendary Challenge Drop" to Malice Mode drops. + // For Legendary Challenge Drops, this tooltip matches their unique rarity color. if (challengeDrop) - { - Color lineColor = default; - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(255, Main.DiscoG, 53); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(Main.DiscoR, 203, 103); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(53, Main.DiscoG, 255); - if (item.type == ModContent.ItemType()) - lineColor = new Color(150, Main.DiscoG, 255); - if (item.type == ModContent.ItemType()) - lineColor = new Color(60, Main.DiscoG, 190); - if (item.type == ModContent.ItemType()) - lineColor = new Color(255, Main.DiscoG, 155); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - lineColor = new Color(255, Main.DiscoG, 0); - if (item.type == ModContent.ItemType()) - lineColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); - if (item.type == ModContent.ItemType()) - lineColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); - if (item.type == ModContent.ItemType()) - lineColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - - if (lineColor != default) - { - TooltipLine line = new TooltipLine(mod, "LegendaryChallengeDrop", CalamityUtils.ColorMessage("- Legendary Challenge Drop -", lineColor)); - tooltips.Add(line); - return; - } - - TooltipLine line2 = new TooltipLine(mod, "ChallengeDrop", CalamityUtils.ColorMessage("- Challenge Drop -", new Color(255, 140, 0))); - tooltips.Add(line2); - } + ChallengeDropTooltip(item, tooltips); } #endregion #region Rarity Coloration - private void ApplyRarityColors(Item item, TooltipLine nameLine) + private void ApplyRarityColor(Item item, TooltipLine nameLine) { // Apply standard post-ML rarities to the item's color first. Color? standardRarityColor = CalamityUtils.GetRarityColor(customRarity); if (standardRarityColor.HasValue) nameLine.overrideColor = standardRarityColor.Value; + #region Uniquely Colored Developer Items if (item.type == ModContent.ItemType()) nameLine.overrideColor = new Color(Main.DiscoR, 100, 255); if (item.type == ModContent.ItemType()) @@ -223,6 +179,42 @@ namespace CalamityMod.Items nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); } } + #endregion + } + #endregion + + #region Challenge Drop Tooltip + private void ChallengeDropTooltip(Item item, IList tooltips) + { + Color? legendaryColor = null; + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(255, Main.DiscoG, 53); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(Main.DiscoR, 203, 103); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(53, Main.DiscoG, 255); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(150, Main.DiscoG, 255); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(60, Main.DiscoG, 190); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(255, Main.DiscoG, 155); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(255, Main.DiscoG, 0); + if (item.type == ModContent.ItemType()) + legendaryColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); + if (item.type == ModContent.ItemType()) + legendaryColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + Color lineColor = legendaryColor.GetValueOrDefault(CalamityUtils.ChallengeDropColor); + string text = legendaryColor.HasValue ? "- Legendary Challenge Drop -" : "- Challenge Drop"; + TooltipLine line = new TooltipLine(mod, "CalamityChallengeDrop", text) + { + overrideColor = lineColor + }; + tooltips.Add(line); } #endregion @@ -250,25 +242,81 @@ namespace CalamityMod.Items void EditTooltipByName(string lineName, Action action) => ApplyTooltipEdits(tooltips, LineName(lineName), action); #endregion - // 1) Mirrors and Recall Potions cannot be used while a boss is alive. + // Numerous random tooltip edits which don't fit into another category + #region Various Tooltip Edits + + // Mirrors and Recall Potions cannot be used while a boss is alive. if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) ApplyTooltipEdits(tooltips, (i, l) => l.mod == "Terraria" && l.Name == (i.type == ItemID.CellPhone ? "Tooltip1" : "Tooltip0"), (line) => line.text += "\nCannot be used while a boss is alive"); - // 2) If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. + // Rod of Discord cannot be used multiple times to hurt yourself + if (item.type == ItemID.RodofDiscord) + EditTooltipByNum(0, (line) => line.text += "\nTeleportation is disabled while Chaos State is active"); + + // Water removing items cannot be used in the Abyss + string noAbyssLine = "\nCannot be used in the Abyss"; + if (item.type == ItemID.SuperAbsorbantSponge) + EditTooltipByNum(0, (line) => line.text += noAbyssLine); + if (item.type == ItemID.EmptyBucket) + EditTooltipByName("Defense", (line) => line.text += noAbyssLine); + + // If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) EditTooltipByNum(0, (line) => line.text += "\nDemon Altars no longer spawn ores when destroyed"); - // 3) Black Belt and Master Ninja Gear have guaranteed dodges on a 60 second cooldown. + // Bottled Honey gives the Honey buff + if (item.type == ItemID.BottledHoney) + EditTooltipByName("HealLife", (line) => line.text += "\nGrants the Honey buff for 2 minutes"); + + // Warmth Potion provides debuff immunities and Death Mode cold protection + if (item.type == ItemID.WarmthPotion) + { + string immunityLine = "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; + if (CalamityWorld.death) + immunityLine += "\nProvides cold protection in Death Mode"; + EditTooltipByNum(0, (line) => line.text += immunityLine); + } + + // Hand Warmer provides Death Mode cold protection and has a side bonus with Eskimo armor + if (item.type == ItemID.HandWarmer) + { + string extraLine = "\nProvides a regeneration boost while wearing the Eskimo armor"; + if (CalamityWorld.death) + extraLine += "\nProvides cold protection in Death Mode"; + EditTooltipByNum(0, (line) => line.text += extraLine); + } + + // Invisibility Potion provides various rogue boosts + if (item.type == ItemID.InvisibilityPotion) + EditTooltipByNum(0, (line) => line.text += "\nBoosts various rogue stats depending on held weapon"); + + // Golden Fishing Rod inherently contains High Test Fishing Line + if (item.type == ItemID.GoldenFishingRod) + EditTooltipByName("NeedsBait", (line) => line.text += "\nIts fishing line will never break"); + + // Eternity Crystal notifies the player that they can accelerate the invasion + if (item.type == ItemID.DD2ElderCrystal) + EditTooltipByNum(0, (line) => line.text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"); + + // Fix a vanilla mistake in Magic Quiver's tooltip + // TODO -- in 1.4 this mistake is already corrected + if (item.type == ItemID.MagicQuiver) + EditTooltipByNum(0, (line) => line.text = line.text.Replace(" damage", " arrow damage")); + #endregion + + // Black Belt and Master Ninja Gear have guaranteed dodges on a 60 second cooldown. + #region Dodging Belt Tooltips string beltDodgeLine = "Grants the ability to dodge attacks\n" + $"The dodge has a {CalamityPlayer.BeltDodgeCooldown} second cooldown which is shared with all other dodges and reflects"; if (item.type == ItemID.BlackBelt) EditTooltipByNum(0, (line) => line.text = beltDodgeLine); if (item.type == ItemID.MasterNinjaGear) EditTooltipByNum(1, (line) => line.text = beltDodgeLine); + #endregion - // 4) Early Hardmode ore melee weapons have new on-hit effects. + // Early Hardmode ore melee weapons have new on-hit effects. #region Early Hardmode Melee Tooltips // Cobalt @@ -300,7 +348,7 @@ namespace CalamityMod.Items EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Holy Flames\nDeals double damage to enemies above 75% life"); #endregion - // 5) Other melee weapon tooltips + // Other melee weapon tooltips #region Other Melee Tooltips if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram) @@ -320,28 +368,13 @@ namespace CalamityMod.Items EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Burning Blood on hit"); #endregion - // 6) Bottled Honey gives the Honey buff - if (item.type == ItemID.BottledHoney) - EditTooltipByName("HealLife", (line) => line.text += "\nGrants the Honey buff for 2 minutes"); - - // 7) Rod of Discord cannot be used multiple times to hurt yourself - if (item.type == ItemID.RodofDiscord) - EditTooltipByNum(0, (line) => line.text += "\nTeleportation is disabled while Chaos State is active"); - - // 8) Water removing items cannot be used in the Abyss - string noAbyssLine = "\nCannot be used in the Abyss"; - if (item.type == ItemID.SuperAbsorbantSponge) - EditTooltipByNum(0, (line) => line.text += noAbyssLine); - if (item.type == ItemID.EmptyBucket) - EditTooltipByName("Defense", (line) => line.text += noAbyssLine); - - // 9) Light pets, accessories, and other items which boost the player's Abyss light stat + // Light pets, accessories, and other items which boost the player's Abyss light stat #region Abyss Light Tooltips // +1 to Abyss light level string abyssSmallLightLine = "\nProvides a small amount of light in the abyss"; - if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace) + if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace || item.type == ItemID.MiningHelmet) EditTooltipByNum(0, (line) => line.text += abyssSmallLightLine); if (item.type == ItemID.JellyfishDivingGear) EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine); @@ -349,12 +382,12 @@ namespace CalamityMod.Items // +2 to Abyss light level string abyssMediumLightLine = "\nProvides a moderate amount of light in the abyss"; - if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost) - EditTooltipByNum(0, (line) => line.text += abyssMediumLightLine); - if (item.type == ItemID.ShinePotion) EditTooltipByName("BuffTime", (line) => line.text += abyssMediumLightLine); + if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost) + EditTooltipByNum(0, (line) => line.text += abyssMediumLightLine); + // +3 to Abyss light level string abyssLargeLightLine = "\nProvides a large amount of light in the abyss"; @@ -362,240 +395,78 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.text += abyssLargeLightLine); if (item.type == ItemID.SuspiciousLookingTentacle) EditTooltipByNum(1, (line) => line.text += abyssLargeLightLine); - - if (item.type == ItemID.ArcticDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } #endregion - if (item.type == ItemID.GillsPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } + // Accessories and other items which boost the player's ability to breathe in the Abyss + #region Abyss Breath Tooltips + + // Moderate breath boost + string abyssModerateBreathLine = "\nModerately reduces breath loss in the abyss"; + if (item.type == ItemID.DivingHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nModerately reduces breath loss in the abyss"; - } - } - } + EditTooltipByNum(0, (line) => line.text += abyssModerateBreathLine); + if (item.type == ItemID.ArcticDivingGear) + EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine + abyssModerateBreathLine); + + // Great breath boost + string abyssGreatBreathLine = "\nGreatly reduces breath loss in the abyss"; + + if (item.type == ItemID.GillsPotion) + EditTooltipByName("BuffTime", (line) => line.text += abyssGreatBreathLine); + if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } + EditTooltipByNum(0, (line) => line.text += abyssGreatBreathLine); if (item.type == ItemID.CelestialShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.WarmthPotion) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + - "Provides cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; - } - } - } - } - if (item.type == ItemID.FlaskofVenom) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks inflict Venom on enemies"; - } - } - } + EditTooltipByNum(1, (line) => line.text += abyssModerateBreathLine); + #endregion + + // Flasks apply to Rogue weapons + #region Rogue Flask Tooltips if (item.type == ItemID.FlaskofCursedFlames) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks inflict enemies with cursed flames"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks inflict enemies with cursed flames"); if (item.type == ItemID.FlaskofFire) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks set enemies on fire"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks set enemies on fire"); if (item.type == ItemID.FlaskofGold) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks make enemies drop more gold"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks make enemies drop more gold"); if (item.type == ItemID.FlaskofIchor) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks decrease enemy defense"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks decrease enemy defense"); if (item.type == ItemID.FlaskofNanites) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks confuse enemies"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks confuse enemies"); + // party flask is unique because it affects ALL projectiles in Calamity, not just "also rogue ones" if (item.type == ItemID.FlaskofParty) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "All attacks cause confetti to appear"; - } - } - } + EditTooltipByNum(0, (line) => line.text = "All attacks cause confetti to appear"); if (item.type == ItemID.FlaskofPoison) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks poison enemies"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks poison enemies"); + if (item.type == ItemID.FlaskofVenom) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks inflict Venom on enemies"); + #endregion + + // Rebalances to vanilla item stats + #region Vanilla Item Rebalance Tooltips + + // Worm Scarf only gives 10% DR instead of 17% if (item.type == ItemID.WormScarf) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage taken by 10%"; - } - } - } + EditTooltipByNum(0, (line) => line.text = line.text = line.text.Replace("17%", "10%")); + if (item.type == ItemID.TitanGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.PowerGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.MechanicalGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\n10% increased true melee damage"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\n10% increased true melee damage"); + if (item.type == ItemID.PowerGlove || item.type == ItemID.MechanicalGlove) + EditTooltipByNum(1, (line) => line.text += "\n10% increased true melee damage"); if (item.type == ItemID.FireGauntlet) { + string extraLine = "\n10% increased true melee damage"; if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "10% increased true melee damage\n" + - "Provides heat and cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "10% increased true melee damage"; - } - } - } + extraLine += "\nProvides heat and cold protection in Death Mode"; + EditTooltipByNum(1, (line) => line.text = line.text.Replace("12%", "14%") + extraLine); } + + // Spectre Hood's lifesteal is heavily nerfed, so it only reduces magic damage by 20% instead of 40% if (item.type == ItemID.SpectreHood) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% decreased magic damage"; - } - } - } + EditTooltipByNum(0, (line) => line.text = line.text.Replace("40%", "20%")); + #endregion + + // Items which provide immunity to either heat or cold in Death Mode + #region Death Mode Environmental Immunity Tooltips if (item.type == ItemID.ObsidianSkinPotion) { string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; @@ -652,34 +523,16 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.InvisibilityPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nBoosts certain stats when holding certain types of rogue weapons"; - } - } - } - if (item.type == ItemID.GoldenFishingRod) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "NeedsBait") - { - line2.text = "Requires bait to catch fish\n" + - "The line will never break"; - } - } - } + #endregion + + // Add mentions of what Calamity ores vanilla pickaxes can mine + #region Pickaxe New Ore Tooltips if (item.type == ItemID.Picksaw) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - // I'm leaving this intentionally ambiguous so that people have to search for Scoria Ore line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; } } @@ -728,22 +581,10 @@ namespace CalamityMod.Items } } } + #endregion - if (Main.player[Main.myPlayer].Calamity().trueMeleeDamage > 0D) - { - if (item.melee && item.damage > 0) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Damage") - { - line2.text += " : " + string.Concat((int)(Main.player[Main.myPlayer].Calamity().actualMeleeDamageStat * item.damage * - (1D + Main.player[Main.myPlayer].Calamity().trueMeleeDamage) + 5E-06f)) + " true melee damage"; - } - } - } - } - + // Rebalances and information about vanilla set bonuses + #region Vanilla Set Bonus Tooltips if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) { foreach (TooltipLine line2 in tooltips) @@ -974,42 +815,10 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } } } - if (item.type == ItemID.DD2ElderCrystal) - tooltips.FirstOrDefault(line => line.mod == "Terraria" && line.Name == "Tooltip0").text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"; + #endregion - if (item.type == ItemID.MagicQuiver) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; - } - } - } - if (item.type == ItemID.MiningHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides light when worn\n" + - "Provides a small amount of light in the Abyss"; - } - } - } - if (item.type == ItemID.HandWarmer) - { - string coldImmunity = CalamityWorld.death ? "\nProvides cold protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to chilling and freezing effects\n" + - "Provides a regeneration boost while wearing the Eskimo armor" + coldImmunity; - } - } - } + // Provide the full, raw stats of every vanilla set of wings + #region Wing Stat Tooltips if (item.type == ItemID.AngelWings) { foreach (TooltipLine line2 in tooltips) @@ -1452,6 +1261,9 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } } } + #endregion + + #region Grappling Hook Stat Tooltips if (item.type == ItemID.GrapplingHook) { foreach (TooltipLine line2 in tooltips) @@ -1777,6 +1589,9 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } } } + #endregion + + #region Accessory Prefix Rebalance Tooltips if (item.accessory) { if (item.prefix == PrefixID.Brisk) @@ -1902,6 +1717,34 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } } } + #endregion + } + #endregion + + #region True Melee Damage Tooltip + private void TrueMeleeDamageTooltip(Item item, IList tooltips) + { + TooltipLine line = tooltips.FirstOrDefault((l) => l.mod == "Terraria" && l.Name == "Damage"); + + // If there somehow isn't a damage tooltip line, do not try to perform any edits. + if (line is null) + return; + + // Start with the existing line of melee damage. + StringBuilder sb = new StringBuilder(64); + sb.Append(line.text).Append(" : "); + + Player p = Main.LocalPlayer; + float itemCurrentDamage = item.damage * p.MeleeDamage(); + double trueMeleeBoost = 1D + p.Calamity().trueMeleeDamage; + double imprecisionRoundingCorrection = 5E-06D; + int damageToDisplay = (int)(itemCurrentDamage * trueMeleeBoost + imprecisionRoundingCorrection); + sb.Append(damageToDisplay); + + // These two pieces are split apart for ease of translation + sb.Append(' '); + sb.Append("true melee damage"); + line.text = sb.ToString(); } #endregion @@ -1922,5 +1765,29 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } } #endregion + + #region Fargo Biome Fountain Tooltip + private void FargoFountainTooltip(Item item, IList tooltips) + { + if (CalamityMod.Instance.fargos is null) + return; + + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sunken Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sulphurous Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Astral upon activation"); + tooltips.Add(line); + } + } + #endregion } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 40a3f708f6..014fe00f1f 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -25,6 +25,10 @@ namespace CalamityMod // The rainbow rarity has an ever-shifting color, not a stored constant internal const int DraedonRustRarityValue = 33; internal static readonly Color DraedonRustRarityColor = new Color(204, 71, 35); + // The donator rarity isn't technically a rarity, but is a constant color used in tooltips + internal static readonly Color DonatorItemColor = new Color(139, 0, 0); + // The Challenge Drop rarity isn't technically a rarity, but is a constant color used in tooltips + internal static readonly Color ChallengeDropColor = new Color(255, 140, 0); public static readonly CalamityRarity[] postMLRarities = { From 9219fccde35bd6d9094e15ff635b71343aa2bbaf Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 22:50:25 -0400 Subject: [PATCH 26/43] Ongoing tooltip work. Everything but grapple hooks is done. --- Items/CalamityGlobalItemTooltip.cs | 937 +++++++---------------------- 1 file changed, 215 insertions(+), 722 deletions(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index fd5e298fb2..1bef8abfe3 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -465,802 +465,295 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.text = line.text.Replace("40%", "20%")); #endregion - // Items which provide immunity to either heat or cold in Death Mode - #region Death Mode Environmental Immunity Tooltips + // Items which provide immunity to either heat or cold in Death Mode, or interact with Lethal Lava + #region Lava and Death Mode Environmental Immunity Tooltips + string heatProtectionLine = "\nProvides heat protection in Death Mode"; + string bothProtectionLine = "\nProvides heat and cold protection in Death Mode"; + if (item.type == ItemID.ObsidianSkinPotion) { - string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) + // If Lethal Lava is enabled, Obsidian Skin Potions work very differently. + if (CalamityConfig.Instance.LethalLava) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to direct damage from touching lava\n" + - "Provides temporary immunity to lava burn damage\n" + - "Greatly increases lava immunity time regeneration\n" + - "Reduces lava burn damage" + heatImmunity; - } + string lethalLavaReplacement = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Greatly increases the speed at which lava immunity recharges\n" + + "Reduces lava burn damage"; + if (CalamityWorld.death) + lethalLavaReplacement += heatProtectionLine; + EditTooltipByNum(0, (line) => line.text = lethalLavaReplacement); } + + // Otherwise, changes are only made on Death Mode, where heat immunity is mentioned. + else if (CalamityWorld.death) + EditTooltipByNum(0, (line) => line.text += heatProtectionLine); } + if (item.type == ItemID.ObsidianRose) { - string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduced direct damage from touching lava\n" + - "Greatly reduces lava burn damage" + heatImmunity; - } - } + StringBuilder sb = new StringBuilder(128); + // If Lethal Lava is enabled, Obsidian Rose reduces the damage from the debuff. + if (CalamityConfig.Instance.LethalLava) + sb.Append("\nGreatly reduces lava burn damage"); + if (CalamityWorld.death) + sb.Append(heatProtectionLine); + EditTooltipByNum(0, (line) => line.text += sb.ToString()); } - if (item.type == ItemID.MagmaStone && CalamityWorld.death) + + if (CalamityWorld.death) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides heat and cold protection in Death Mode"; - } - } - } - if (item.type == ItemID.LavaCharm && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides heat protection in Death Mode"; - } - } - } - if (item.type == ItemID.LavaWaders && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides heat protection in Death Mode"; - } - } + if (item.type == ItemID.MagmaStone) + EditTooltipByNum(0, (line) => line.text += bothProtectionLine); + if (item.type == ItemID.LavaCharm) + EditTooltipByNum(0, (line) => line.text += heatProtectionLine); + if (item.type == ItemID.LavaWaders) + EditTooltipByNum(1, (line) => line.text += heatProtectionLine); + if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) + EditTooltipByName("SetBonus", (line) => line.text += bothProtectionLine); } #endregion // Add mentions of what Calamity ores vanilla pickaxes can mine #region Pickaxe New Ore Tooltips if (item.type == ItemID.Picksaw) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; - } - } - } - if (item.type == ItemID.SolarFlarePickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.VortexPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.NebulaPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.StardustPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } + EditTooltipByNum(0, (line) => line.text += "\nCan mine Scoria Ore"); + + if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe) + EditTooltipByName("Material", (line) => line.text += "\nCan mine Uelibloom Ore"); #endregion // Rebalances and information about vanilla set bonuses #region Vanilla Set Bonus Tooltips - if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; - } - } - } + + string MiningSpeedString(int percent) => $"\n{percent}% increased mining speed"; + + // Copper if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(15)); + + // Tin if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(10)); + + // Iron if (item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(25)); + + // Lead if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(20)); + + // Silver if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(35)); + + // Tungsten if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(30)); + + // Gold if (item.type == ItemID.AncientGoldHelmet || item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(45)); + + // Platinum if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) - { - if (!Main.player[Main.myPlayer].Calamity().forbiddenCirclet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nThe minion damage nerf is reduced while wielding magic weapons"; - } - } - } - } - if (item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases your max number of minions"; - } - } - } - if (item.type == ItemID.StardustHelmet || item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nIncreases your max number of minions by 2"; - } - } - } + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(40)); + + // Gladiator if (item.type == ItemID.GladiatorHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "3 defense\n" + - "3% increased rogue damage"; - } - } - } + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue damage"); if (item.type == ItemID.GladiatorBreastplate) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "3% increased rogue critical strike chance"; - } - } - } + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue critical strike chance"); if (item.type == ItemID.GladiatorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue velocity"; - } - } - } + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue velocity"); + + // Obsidian if (item.type == ItemID.ObsidianHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue damage"; - } - } - } + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue damage"); if (item.type == ItemID.ObsidianShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "3% increased rogue critical strike chance"; - } - } - } + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue critical strike chance"); if (item.type == ItemID.ObsidianPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue velocity"; - } - } - } + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue velocity"); + + // Meteor Armor only makes space gun cost 50% instead of zero mana + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + EditTooltipByName("SetBonus", (line) => line.text = line.text.Replace("0", "50%")); + + // Molten if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) { + string extraLine = "\n20% extra true melee damage\nGrants immunity to fire blocks and temporary immunity to lava"; if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage -20% extra true melee damage -Grants immunity to fire blocks, and temporary immunity to lava -Provides heat and cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage -20% extra true melee damage -Grants immunity to fire blocks, and temporary immunity to lava"; - } - } - } - } - if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nProvides heat and cold protection in Death Mode"; - } - } - } + extraLine += bothProtectionLine; + EditTooltipByName("SetBonus", (line) => line.text += extraLine); } + + // Forbidden (UNLESS you are wearing the Circlet, which is Summon/Rogue and does not get this line) + if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants + && !Main.LocalPlayer.Calamity().forbiddenCirclet) + EditTooltipByName("SetBonus", (line) => line.text += "\nThe minion damage nerf is reduced while wielding magic weapons"); + + // Stardust + // 1) Chest and Legs only give 1 minion slot each instead of 2 each. + if (item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) + EditTooltipByNum(0, (line) => line.text = line.text.Replace('2', '1')); + // 2) Set bonus gives 2 minions instead of 0. + if (item.type == ItemID.StardustHelmet || item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) + EditTooltipByName("SetBonus", (line) => line.text += "\nIncreases your max number of minions by 2"); #endregion // Provide the full, raw stats of every vanilla set of wings #region Wing Stat Tooltips + + // This function produces a "stat sheet" for a pair of wings from the raw stats. + // For "vertical speed", 0 = Average, 1 = Good, 2 = Great. + string[] vertSpeedStrings = new string[] { "Average vertical speed", "Good vertical speed", "Great vertical speed" }; + string WingStatsTooltip(float hSpeed, float accelMult, int vertSpeed, int flightTime, string extraTooltip = null) + { + StringBuilder sb = new StringBuilder(512); + sb.Append('\n'); + sb.Append($"Horizontal speed: {hSpeed:N2}\n"); + sb.Append($"Acceleration multiplier: {accelMult:N1}\n"); + sb.Append(vertSpeedStrings[vertSpeed]); + sb.Append('\n'); + sb.Append($"Flight time: {flightTime}"); + if (extraTooltip != null) + { + sb.Append('\n'); + sb.Append(extraTooltip); + } + return sb.ToString(); + } + if (item.type == ItemID.AngelWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "+20 max life, +10 defense and +2 life regen"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.25f, 1f, 0, 100, + "+20 max life, +10 defense and +2 life regen")); + if (item.type == ItemID.DemonWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "5% increased damage and critical strike chance"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.25f, 1f, 0, 100, + "5% increased damage and critical strike chance")); + if (item.type == ItemID.Jetpack) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 115"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.5f, 1f, 0, 115)); + if (item.type == ItemID.ButterflyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+20 max mana, 5% decreased mana usage,\n" + - "5% increased magic damage and magic critical strike chance"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 130, + "+20 max mana, 5% decreased mana usage,\n" + + "5% increased magic damage and magic critical strike chance")); + if (item.type == ItemID.FairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+60 max life"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 130, "+60 max life")); + if (item.type == ItemID.BeeWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "Honey buff at all times"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 130, "Permanently gives the Honey buff")); + if (item.type == ItemID.HarpyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "20% increased movement speed\n" + - "Most attacks have a chance to fire a feather on swing if Harpy Ring or Angel Treads are equipped"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7f, 1f, 0, 140, + "20% increased movement speed\n" + + "Most attacks have a chance to fire a feather on swing if Harpy Ring or Angel Treads are equipped")); + if (item.type == ItemID.BoneWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "10% increased movement speed, ranged damage and critical strike chance\n" + - "and +30 defense while wearing the Necro Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7f, 1f, 0, 140, + "10% increased movement speed, ranged damage and critical strike chance\n" + + "and +30 defense while wearing the Necro Armor")); + if (item.type == ItemID.FlameWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "5% increased melee damage and critical strike chance"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, + "5% increased melee damage and critical strike chance")); + if (item.type == ItemID.FrozenWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "2% increased melee and ranged damage\n" + - "and 1% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, + "2% increased melee and ranged damage\n" + + "and 1% increased melee and ranged critical strike chance\n" + + "while wearing the Frost Armor")); + if (item.type == ItemID.GhostWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense and 5% increased damage reduction while wearing the Spectre Armor and Hood\n" + - "5% increased magic damage and critical strike chance while wearing the Spectre Armor and Mask"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, + "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + + "5% increased magic damage and critical strike chance while wearing the Spectre Mask set")); + if (item.type == ItemID.BeetleWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense and 5% increased damage reduction while wearing the Beetle Armor and Shell\n" + - "5% increased melee damage and critical strike chance while wearing the Beetle Armor and Scale Mail"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, + "+10 defense and 5% increased damage reduction while wearing the Beetle Shell set\n" + + "5% increased melee damage and critical strike chance while wearing the Beetle Scale Mail set")); + if (item.type == ItemID.FinWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "Gills effect and you can move freely through liquids\n" + - "You fall faster while submerged in liquid\n" + - "15% increased movement speed and 18% increased jump speed"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(0f, 0f, 0, 100, + "Gills effect and you can move freely through liquids\n" + + "You fall faster while submerged in liquid\n" + + "15% increased movement speed and 18% increased jump speed")); + if (item.type == ItemID.FishronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 8\n" + - "Acceleration multiplier: 2\n" + - "Good vertical speed\n" + - "Flight time: 180"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(8f, 2f, 1, 180)); + if (item.type == ItemID.SteampunkWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "+8 defense, 10% increased movement speed,\n" + - "4% increased damage, and 2% increased critical strike chance"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.75f, 1f, 0, 180, + "+8 defense, 10% increased movement speed,\n" + + "4% increased damage, and 2% increased critical strike chance")); + if (item.type == ItemID.LeafWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+5 defense, 5% increased damage reduction,\n" + - "and the Dryad's permanent blessing while wearing the Tiki Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 160, + "+5 defense, 5% increased damage reduction,\n" + + "and permanent Dryad's Blessing while wearing the Tiki Armor")); + if (item.type == ItemID.BatWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "At night or during an eclipse, you will gain the following boosts:\n" + - "10% increased movement speed, 10% increased jump speed,\n" + - "7% increased damage and 3% increased critical strike chance"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(0f, 0f, 0, 140, + "At night or during an eclipse, you will gain the following boosts:\n" + + "10% increased movement speed, 10% increased jump speed,\n" + + "7% increased damage and 3% increased critical strike chance")); + + // All developer wings have identical stats and no special effects if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "'Great for impersonating devs!'\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 150"; - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7f, 1f, 0, 150)); } + if (item.type == ItemID.TatteredFairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "5% increased damage and critical strike chance"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 180, + "5% increased damage and critical strike chance")); + if (item.type == ItemID.SpookyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 180, + "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor")); + if (item.type == ItemID.Hoverboard) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "10% increased damage to bows, guns, rocket launchers, and flamethrowers while wearing the Shroomite Armor\n" + - "Boosted weapon type depends on the Shroomite Helmet worn"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.25f, 1f, 0, 170, + "10% increased weapon-type damage while wearing the Shroomite Armor\n" + + "The weapon type boosted matches which Shroomite helmet is worn")); + if (item.type == ItemID.FestiveWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "+40 max life\n" + - "Ornaments rain down as you fly"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 170, + "+40 max life\nOrnaments rain down as you fly")); + if (item.type == ItemID.MothronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+5 defense, 5% increased damage,\n" + - "10% increased movement speed and 12% increased jump speed"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(0f, 0f, 0, 160, + "+5 defense, 5% increased damage,\n" + + "10% increased movement speed and 12% increased jump speed")); + if (item.type == ItemID.WingsSolar) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "7% increased melee damage and 3% increased melee critical strike chance\n" + - "while wearing the Solar Flare Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(9f, 2.5f, 2, 180, + "7% increased melee damage and 3% increased melee critical strike chance\n" + + "while wearing the Solar Flare Armor")); + if (item.type == ItemID.WingsStardust) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(9f, 2.5f, 2, 180, + "+1 max minion and 5% increased minion damage while wearing the Stardust Armor")); + if (item.type == ItemID.WingsVortex) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "3% increased ranged damage and 7% increased ranged critical strike chance\n" + - "while wearing the Vortex Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.5f, 1.5f, 1, 160, + "3% increased ranged damage and 7% increased ranged critical strike chance\n" + + "while wearing the Vortex Armor")); + if (item.type == ItemID.WingsNebula) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Nebula Armor"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.5f, 1.5f, 1, 160, + "+20 max mana, 5% increased magic damage and critical strike chance,\n" + + "and 5% decreased mana usage while wearing the Nebula Armor")); + if (item.type == ItemID.BetsyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6\n" + - "Acceleration multiplier: 2.5\n" + - "Good vertical speed\n" + - "Flight time: 150"; - } - } - } + EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6f, 2.5f, 1, 150)); #endregion #region Grappling Hook Stat Tooltips From 0c617164082f7cb93d70aa9f61511a488ef15857 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 11 Apr 2021 23:30:06 -0400 Subject: [PATCH 27/43] Grappling hook tooltips improved. --- Items/CalamityGlobalItemTooltip.cs | 344 ++++------------------------- 1 file changed, 42 insertions(+), 302 deletions(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 1bef8abfe3..23f2b1cd34 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -756,332 +756,72 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6f, 2.5f, 1, 150)); #endregion + // Provide the full, raw stats of every vanilla grappling hook #region Grappling Hook Stat Tooltips + + // This function produces a "stat sheet" for a grappling hook from the raw stats. + string HookStatsTooltip(float reach, float launch, float pull) + { + StringBuilder sb = new StringBuilder(128); + sb.Append('\n'); + sb.Append($"Reach: {reach:N3}\n"); + sb.Append($"Launch Velocity: {launch:N2}\n"); + sb.Append($"Pull Velocity: {pull:N2}"); + return sb.ToString(); + } + + // This function is shorthand for appending a stat sheet to a grappling hook. + void AddGrappleStats(float r, float l, float p) => EditTooltipByName("Equipable", (line) => line.text += HookStatsTooltip(r, l, p)); + + // TODO -- Some of these stats are probably wrong, but finding them is so difficult I don't want to do it right now. if (item.type == ItemID.GrapplingHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(18.75f, 11.5f, 11f); if (item.type == ItemID.AmethystHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 10\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(18.75f, 10f, 11f); if (item.type == ItemID.TopazHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 20.625\n" + - "Launch Velocity: 10.5\n" + - "Pull Velocity: 11.75"; - } - } - } + AddGrappleStats(20.625f, 10.5f, 11.75f); if (item.type == ItemID.SapphireHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 22.5\n" + - "Launch Velocity: 11\n" + - "Pull Velocity: 12.5"; - } - } - } + AddGrappleStats(22.5f, 11f, 12.5f); if (item.type == ItemID.EmeraldHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 24.375\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 13.25"; - } - } - } + AddGrappleStats(24.375f, 11.5f, 13.25f); if (item.type == ItemID.RubyHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 26.25\n" + - "Launch Velocity: 12\n" + - "Pull Velocity: 14"; - } - } - } + AddGrappleStats(26.25f, 12f, 14f); if (item.type == ItemID.DiamondHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 28.125\n" + - "Launch Velocity: 12.5\n" + - "Pull Velocity: 14.75"; - } - } - } + AddGrappleStats(28.125f, 12.5f, 14.75f); if (item.type == ItemID.WebSlinger) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 15.625\n" + - "Launch Velocity: 10\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(15.625f, 10f, 11f); if (item.type == ItemID.SkeletronHand) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 21.875\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(21.875f, 15f, 11f); if (item.type == ItemID.SlimeHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(18.75f, 13f, 11f); if (item.type == ItemID.FishHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(25f, 13f, 11f); if (item.type == ItemID.IvyWhip) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 15"; - } - } - } - if (item.type == ItemID.BatHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 31.25\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 20"; - } - } - } + AddGrappleStats(25f, 13f, 15f); + if (item.type == ItemID.BatHook) // TODO -- This item should be dropped by Vampires in the Eclipse. It is very overpowered. + AddGrappleStats(31.25f, 15.5f, 20f); if (item.type == ItemID.CandyCaneHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 11"; - } - } - } + AddGrappleStats(25f, 11.5f, 11f); if (item.type == ItemID.DualHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 27.5\n" + - "Launch Velocity: 14\n" + - "Pull Velocity: 17"; - } - } - } + AddGrappleStats(27.5f, 14f, 17f); if (item.type == ItemID.ThornHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } + AddGrappleStats(30f, 15f, 18f); if (item.type == ItemID.WormHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } + AddGrappleStats(30f, 15f, 18f); if (item.type == ItemID.TendonHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } + AddGrappleStats(30f, 15f, 18f); if (item.type == ItemID.IlluminantHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } + AddGrappleStats(30f, 15f, 18f); if (item.type == ItemID.AntiGravityHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 31.25\n" + - "Launch Velocity: 14\n" + - "Pull Velocity: 20"; - } - } - } + AddGrappleStats(31.25f, 14f, 20f); if (item.type == ItemID.SpookyHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 22"; - } - } - } + AddGrappleStats(34.375f, 15.5f, 22f); if (item.type == ItemID.ChristmasHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 17"; - } - } - } + AddGrappleStats(34.375f, 15.5f, 17f); if (item.type == ItemID.LunarHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } + AddGrappleStats(34.375f, 16f, 24f); if (item.type == ItemID.StaticHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 37.5\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } - if (item.type == ItemID.StaticHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 37.5\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } + AddGrappleStats(37.5f, 16f, 0f); #endregion #region Accessory Prefix Rebalance Tooltips From ebb035aa12e55c82cedf5a58161dba5447b40fef Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 12 Apr 2021 00:26:42 -0400 Subject: [PATCH 28/43] Grapple hook stats are triple checked and include reelback speed. --- Items/CalamityGlobalItemTooltip.cs | 59 ++++++++++++++---------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 23f2b1cd34..29a6e1d88f 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -760,68 +760,63 @@ namespace CalamityMod.Items #region Grappling Hook Stat Tooltips // This function produces a "stat sheet" for a grappling hook from the raw stats. - string HookStatsTooltip(float reach, float launch, float pull) + string HookStatsTooltip(float reach, float launch, float reel, float pull) { StringBuilder sb = new StringBuilder(128); sb.Append('\n'); - sb.Append($"Reach: {reach:N3}\n"); + sb.Append($"Reach: {reach:N3} tiles\n"); sb.Append($"Launch Velocity: {launch:N2}\n"); + sb.Append($"Reelback Velocity: {reel:N2}\n"); sb.Append($"Pull Velocity: {pull:N2}"); return sb.ToString(); } // This function is shorthand for appending a stat sheet to a grappling hook. - void AddGrappleStats(float r, float l, float p) => EditTooltipByName("Equipable", (line) => line.text += HookStatsTooltip(r, l, p)); + void AddGrappleStats(float r, float l, float e, float p) => EditTooltipByName("Equipable", (line) => line.text += HookStatsTooltip(r, l, e, p)); - // TODO -- Some of these stats are probably wrong, but finding them is so difficult I don't want to do it right now. if (item.type == ItemID.GrapplingHook) - AddGrappleStats(18.75f, 11.5f, 11f); + AddGrappleStats(18.75f, 11.5f, 11f, 11f); if (item.type == ItemID.AmethystHook) - AddGrappleStats(18.75f, 10f, 11f); + AddGrappleStats(18.75f, 10f, 11f, 11f); if (item.type == ItemID.TopazHook) - AddGrappleStats(20.625f, 10.5f, 11.75f); + AddGrappleStats(20.625f, 10.5f, 11.75f, 11f); if (item.type == ItemID.SapphireHook) - AddGrappleStats(22.5f, 11f, 12.5f); + AddGrappleStats(22.5f, 11f, 12.5f, 11f); if (item.type == ItemID.EmeraldHook) - AddGrappleStats(24.375f, 11.5f, 13.25f); + AddGrappleStats(24.375f, 11.5f, 13.25f, 11f); if (item.type == ItemID.RubyHook) - AddGrappleStats(26.25f, 12f, 14f); + AddGrappleStats(26.25f, 12f, 14f, 11f); if (item.type == ItemID.DiamondHook) - AddGrappleStats(28.125f, 12.5f, 14.75f); + AddGrappleStats(28.125f, 12.5f, 14.75f, 11f); if (item.type == ItemID.WebSlinger) - AddGrappleStats(15.625f, 10f, 11f); + AddGrappleStats(15.625f, 10f, 11f, 11f); if (item.type == ItemID.SkeletronHand) - AddGrappleStats(21.875f, 15f, 11f); + AddGrappleStats(21.875f, 15f, 11f, 11f); if (item.type == ItemID.SlimeHook) - AddGrappleStats(18.75f, 13f, 11f); + AddGrappleStats(18.75f, 13f, 11f, 11f); if (item.type == ItemID.FishHook) - AddGrappleStats(25f, 13f, 11f); + AddGrappleStats(25f, 13f, 11f, 11f); if (item.type == ItemID.IvyWhip) - AddGrappleStats(25f, 13f, 15f); + AddGrappleStats(25f, 13f, 15f, 11f); if (item.type == ItemID.BatHook) // TODO -- This item should be dropped by Vampires in the Eclipse. It is very overpowered. - AddGrappleStats(31.25f, 15.5f, 20f); + AddGrappleStats(31.25f, 15.5f, 20f, 16f); if (item.type == ItemID.CandyCaneHook) - AddGrappleStats(25f, 11.5f, 11f); + AddGrappleStats(25f, 11.5f, 11f, 11f); if (item.type == ItemID.DualHook) - AddGrappleStats(27.5f, 14f, 17f); - if (item.type == ItemID.ThornHook) - AddGrappleStats(30f, 15f, 18f); - if (item.type == ItemID.WormHook) - AddGrappleStats(30f, 15f, 18f); - if (item.type == ItemID.TendonHook) - AddGrappleStats(30f, 15f, 18f); - if (item.type == ItemID.IlluminantHook) - AddGrappleStats(30f, 15f, 18f); + AddGrappleStats(27.5f, 14f, 17f, 11f); + // these four grapple hooks are all functionally identical + if (item.type == ItemID.ThornHook || item.type == ItemID.WormHook || item.type == ItemID.TendonHook || item.type == ItemID.IlluminantHook) + AddGrappleStats(30f, 15f, 18f, 11f); if (item.type == ItemID.AntiGravityHook) - AddGrappleStats(31.25f, 14f, 20f); + AddGrappleStats(31.25f, 14f, 20f, 11f); if (item.type == ItemID.SpookyHook) - AddGrappleStats(34.375f, 15.5f, 22f); + AddGrappleStats(34.375f, 15.5f, 22f, 11f); if (item.type == ItemID.ChristmasHook) - AddGrappleStats(34.375f, 15.5f, 17f); + AddGrappleStats(34.375f, 15.5f, 17f, 11f); if (item.type == ItemID.LunarHook) - AddGrappleStats(34.375f, 16f, 24f); + AddGrappleStats(34.375f, 16f, 24f, 13f); if (item.type == ItemID.StaticHook) - AddGrappleStats(37.5f, 16f, 0f); + AddGrappleStats(37.5f, 16f, 24f, 0f); #endregion #region Accessory Prefix Rebalance Tooltips From 77db526474f33f6a33fa269344707a928d94be6c Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 12 Apr 2021 12:03:53 -0400 Subject: [PATCH 29/43] 1 - Accessory stat edit tooltips optimized. 2 - Added a helper function for the scaling defense prefixes. 3 - Further improved the wing stat sheet code. --- Items/CalamityGlobalItemTooltip.cs | 281 +++++++++-------------------- Utilities/ItemUtils.cs | 56 ++++++ 2 files changed, 146 insertions(+), 191 deletions(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 29a6e1d88f..e6b3df9f97 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -525,6 +525,7 @@ namespace CalamityMod.Items // Rebalances and information about vanilla set bonuses #region Vanilla Set Bonus Tooltips + // Turns a number into a string of increased mining speed. string MiningSpeedString(int percent) => $"\n{percent}% increased mining speed"; // Copper @@ -602,7 +603,7 @@ namespace CalamityMod.Items EditTooltipByName("SetBonus", (line) => line.text += "\nIncreases your max number of minions by 2"); #endregion - // Provide the full, raw stats of every vanilla set of wings + // Provide the full stats of every vanilla set of wings #region Wing Stat Tooltips // This function produces a "stat sheet" for a pair of wings from the raw stats. @@ -625,82 +626,70 @@ namespace CalamityMod.Items return sb.ToString(); } + // This function is shorthand for appending a stat sheet to a pair of wings. + void AddWingStats(float h, float a, int v, int f, string s = null) => EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(h, a, v, f, s)); + if (item.type == ItemID.AngelWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.25f, 1f, 0, 100, - "+20 max life, +10 defense and +2 life regen")); + AddWingStats(6.25f, 1f, 0, 100, "+20 max life, +10 defense and +2 life regen"); if (item.type == ItemID.DemonWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.25f, 1f, 0, 100, - "5% increased damage and critical strike chance")); + AddWingStats(6.25f, 1f, 0, 100, "5% increased damage and critical strike chance"); if (item.type == ItemID.Jetpack) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.5f, 1f, 0, 115)); + AddWingStats(6.5f, 1f, 0, 115); if (item.type == ItemID.ButterflyWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 130, - "+20 max mana, 5% decreased mana usage,\n" - + "5% increased magic damage and magic critical strike chance")); + AddWingStats(6.75f, 1f, 0, 130, "+20 max mana, 5% decreased mana usage,\n" + + "5% increased magic damage and magic critical strike chance"); if (item.type == ItemID.FairyWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 130, "+60 max life")); + AddWingStats(6.75f, 1f, 0, 130, "+60 max life"); if (item.type == ItemID.BeeWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 130, "Permanently gives the Honey buff")); + AddWingStats(6.75f, 1f, 0, 130, "Permanently gives the Honey buff"); if (item.type == ItemID.HarpyWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7f, 1f, 0, 140, - "20% increased movement speed\n" + - "Most attacks have a chance to fire a feather on swing if Harpy Ring or Angel Treads are equipped")); + AddWingStats(7f, 1f, 0, 140, "20% increased movement speed\n" + + "With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers"); if (item.type == ItemID.BoneWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7f, 1f, 0, 140, - "10% increased movement speed, ranged damage and critical strike chance\n" + - "and +30 defense while wearing the Necro Armor")); + AddWingStats(7f, 1f, 0, 140, "10% increased movement speed, ranged damage and critical strike chance\n" + + "and +30 defense while wearing the Necro Armor"); if (item.type == ItemID.FlameWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, - "5% increased melee damage and critical strike chance")); + AddWingStats(7.5f, 1f, 0, 160, "5% increased melee damage and critical strike chance"); if (item.type == ItemID.FrozenWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, - "2% increased melee and ranged damage\n" + + AddWingStats(7.5f, 1f, 0, 160, "2% increased melee and ranged damage\n" + "and 1% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor")); + "while wearing the Frost Armor"); if (item.type == ItemID.GhostWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, - "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + - "5% increased magic damage and critical strike chance while wearing the Spectre Mask set")); + AddWingStats(7.5f, 1f, 0, 160, "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + + "5% increased magic damage and critical strike chance while wearing the Spectre Mask set"); if (item.type == ItemID.BeetleWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 160, - "+10 defense and 5% increased damage reduction while wearing the Beetle Shell set\n" + - "5% increased melee damage and critical strike chance while wearing the Beetle Scale Mail set")); + AddWingStats(7.5f, 1f, 0, 160, "+10 defense and 5% increased damage reduction while wearing the Beetle Shell set\n" + + "5% increased melee damage and critical strike chance while wearing the Beetle Scale Mail set"); if (item.type == ItemID.FinWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(0f, 0f, 0, 100, - "Gills effect and you can move freely through liquids\n" + + AddWingStats(0f, 0f, 0, 100, "Gills effect and you can move freely through liquids\n" + "You fall faster while submerged in liquid\n" + - "15% increased movement speed and 18% increased jump speed")); + "15% increased movement speed and 18% increased jump speed"); if (item.type == ItemID.FishronWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(8f, 2f, 1, 180)); + AddWingStats(8f, 2f, 1, 180); if (item.type == ItemID.SteampunkWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.75f, 1f, 0, 180, - "+8 defense, 10% increased movement speed,\n" + - "4% increased damage, and 2% increased critical strike chance")); + AddWingStats(7.75f, 1f, 0, 180, "+8 defense, 10% increased movement speed,\n" + "4% increased damage, and 2% increased critical strike chance"); if (item.type == ItemID.LeafWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.75f, 1f, 0, 160, - "+5 defense, 5% increased damage reduction,\n" + - "and permanent Dryad's Blessing while wearing the Tiki Armor")); + AddWingStats(6.75f, 1f, 0, 160, "+5 defense, 5% increased damage reduction,\n" + "and permanent Dryad's Blessing while wearing the Tiki Armor"); if (item.type == ItemID.BatWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(0f, 0f, 0, 140, - "At night or during an eclipse, you will gain the following boosts:\n" - + "10% increased movement speed, 10% increased jump speed,\n" - + "7% increased damage and 3% increased critical strike chance")); + AddWingStats(0f, 0f, 0, 140, "At night or during an eclipse, you will gain the following boosts:\n" + + "10% increased movement speed, 10% increased jump speed,\n" + + "7% increased damage and 3% increased critical strike chance"); // All developer wings have identical stats and no special effects if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || @@ -708,55 +697,46 @@ namespace CalamityMod.Items item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) { - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7f, 1f, 0, 150)); + AddWingStats(7f, 1f, 0, 150); } if (item.type == ItemID.TatteredFairyWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 180, - "5% increased damage and critical strike chance")); + AddWingStats(7.5f, 1f, 0, 180, "5% increased damage and critical strike chance"); if (item.type == ItemID.SpookyWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 180, - "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor")); + AddWingStats(7.5f, 1f, 0, 180, "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"); if (item.type == ItemID.Hoverboard) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.25f, 1f, 0, 170, - "10% increased weapon-type damage while wearing the Shroomite Armor\n" + - "The weapon type boosted matches which Shroomite helmet is worn")); + AddWingStats(6.25f, 1f, 0, 170, "10% increased weapon-type damage while wearing the Shroomite Armor\n" + + "The weapon type boosted matches which Shroomite helmet is worn"); if (item.type == ItemID.FestiveWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(7.5f, 1f, 0, 170, - "+40 max life\nOrnaments rain down as you fly")); + AddWingStats(7.5f, 1f, 0, 170, "+40 max life\nOrnaments rain down as you fly"); if (item.type == ItemID.MothronWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(0f, 0f, 0, 160, - "+5 defense, 5% increased damage,\n" + - "10% increased movement speed and 12% increased jump speed")); + AddWingStats(0f, 0f, 0, 160, "+5 defense, 5% increased damage,\n" + + "10% increased movement speed and 12% increased jump speed"); if (item.type == ItemID.WingsSolar) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(9f, 2.5f, 2, 180, - "7% increased melee damage and 3% increased melee critical strike chance\n" + - "while wearing the Solar Flare Armor")); + AddWingStats(9f, 2.5f, 2, 180, "7% increased melee damage and 3% increased melee critical strike chance\n" + + "while wearing the Solar Flare Armor"); if (item.type == ItemID.WingsStardust) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(9f, 2.5f, 2, 180, - "+1 max minion and 5% increased minion damage while wearing the Stardust Armor")); + AddWingStats(9f, 2.5f, 2, 180, "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"); if (item.type == ItemID.WingsVortex) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.5f, 1.5f, 1, 160, - "3% increased ranged damage and 7% increased ranged critical strike chance\n" + - "while wearing the Vortex Armor")); + AddWingStats(6.5f, 1.5f, 1, 160, "3% increased ranged damage and 7% increased ranged critical strike chance\n" + + "while wearing the Vortex Armor"); if (item.type == ItemID.WingsNebula) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6.5f, 1.5f, 1, 160, - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Nebula Armor")); + AddWingStats(6.5f, 1.5f, 1, 160, "+20 max mana, 5% increased magic damage and critical strike chance,\n" + + "and 5% decreased mana usage while wearing the Nebula Armor"); if (item.type == ItemID.BetsyWings) - EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(6f, 2.5f, 1, 150)); + AddWingStats(6f, 2.5f, 1, 150); #endregion - // Provide the full, raw stats of every vanilla grappling hook + // Provide the full stats of every vanilla grappling hook #region Grappling Hook Stat Tooltips // This function produces a "stat sheet" for a grappling hook from the raw stats. @@ -819,131 +799,50 @@ namespace CalamityMod.Items AddGrappleStats(37.5f, 16f, 24f, 0f); #endregion + // Beyond this point all code only applies to accessories. Skip it all if the item is not an accessory. + if (!item.accessory) + return; + + // Display the stat changes to vanilla prefixes #region Accessory Prefix Rebalance Tooltips - if (item.accessory) + + // Turns a number into a string of increased DR. + string DRString(float percent) => $"\n+{percent:N2}% damage reduction"; + + switch (item.prefix) { - if (item.prefix == PrefixID.Brisk) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+2% movement speed"; - } - } - if (item.prefix == PrefixID.Fleeting) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+4% movement speed"; - } - } - if (item.prefix == PrefixID.Hasty2) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+6% movement speed"; - } - } - if (item.prefix == PrefixID.Quick2) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccMoveSpeed") - line2.text = "+8% movement speed"; - } - } - if (item.prefix == PrefixID.Precise || item.prefix == PrefixID.Lucky) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - line2.text += "\n+1 armor penetration"; - } - } - if (item.prefix == PrefixID.Hard) - { - string defenseBoost = "+1 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+4 defense\n"; - else if (CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast) - defenseBoost = "+3 defense\n"; - else if (NPC.downedGolemBoss || NPC.downedMoonlord) - defenseBoost = "+2 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+0.25% damage reduction"; - } - } - if (item.prefix == PrefixID.Guarding) - { - string defenseBoost = "+2 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+8 defense\n"; - else if (CalamityWorld.downedPolterghast) - defenseBoost = "+7 defense\n"; - else if (CalamityWorld.downedProvidence) - defenseBoost = "+6 defense\n"; - else if (NPC.downedMoonlord) - defenseBoost = "+5 defense\n"; - else if (NPC.downedGolemBoss) - defenseBoost = "+4 defense\n"; - else if (Main.hardMode) - defenseBoost = "+3 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+0.5% damage reduction"; - } - } - if (item.prefix == PrefixID.Armored) - { - string defenseBoost = "+3 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+12 defense\n"; - else if (CalamityWorld.downedPolterghast) - defenseBoost = "+10 defense\n"; - else if (CalamityWorld.downedProvidence) - defenseBoost = "+9 defense\n"; - else if (NPC.downedMoonlord) - defenseBoost = "+7 defense\n"; - else if (NPC.downedGolemBoss) - defenseBoost = "+6 defense\n"; - else if (Main.hardMode) - defenseBoost = "+4 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+0.75% damage reduction"; - } - } - if (item.prefix == PrefixID.Warding) - { - string defenseBoost = "+4 defense\n"; - if (CalamityWorld.downedDoG) - defenseBoost = "+16 defense\n"; - else if (CalamityWorld.downedPolterghast) - defenseBoost = "+14 defense\n"; - else if (CalamityWorld.downedProvidence) - defenseBoost = "+12 defense\n"; - else if (NPC.downedMoonlord) - defenseBoost = "+10 defense\n"; - else if (NPC.downedGolemBoss) - defenseBoost = "+8 defense\n"; - else if (Main.hardMode) - defenseBoost = "+6 defense\n"; - - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - line2.text = defenseBoost + "+1% damage reduction"; - } - } + case PrefixID.Brisk: + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("1%", "2%")); + return; + case PrefixID.Fleeting: + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("2%", "4%")); + return; + case PrefixID.Hasty2: // Hasty2 is the "Hasty" for accessories + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("3%", "6%")); + return; + case PrefixID.Quick2: // Quick2 is the "Quick" for accessories + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("4%", "8%")); + return; + case PrefixID.Precise: + case PrefixID.Lucky: + EditTooltipByName("PrefixAccCritChance", (line) => line.text += "\n+1 armor penetration"); + return; + case PrefixID.Hard: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("1", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.25f)); + return; + case PrefixID.Guarding: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("2", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.5f)); + return; + case PrefixID.Armored: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("3", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.75f)); + return; + case PrefixID.Warding: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("4", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(1f)); + return; } #endregion } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 014fe00f1f..d743b3f451 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -72,6 +72,62 @@ namespace CalamityMod } #endregion + // TODO -- This probably isn't the best place to put this but it needs to be somewhere easily accessible. + #region Accessory Prefix Stats + internal static int GetScalingDefense(int prefixID) + { + switch (prefixID) + { + default: + return 0; + case PrefixID.Hard: + return CalamityWorld.downedDoG ? 4 : CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast ? 3 : NPC.downedMoonlord || NPC.downedGolemBoss ? 2 : 1; + case PrefixID.Guarding: + if (CalamityWorld.downedDoG) + return 8; + else if (CalamityWorld.downedPolterghast) + return 7; + else if (CalamityWorld.downedProvidence) + return 6; + else if (NPC.downedMoonlord) + return 5; + else if (NPC.downedGolemBoss) + return 4; + else if (Main.hardMode) + return 3; + return 2; + case PrefixID.Armored: + if (CalamityWorld.downedDoG) + return 12; + else if (CalamityWorld.downedPolterghast) + return 10; + else if (CalamityWorld.downedProvidence) + return 9; + else if (NPC.downedMoonlord) + return 7; + else if (NPC.downedGolemBoss) + return 6; + else if (Main.hardMode) + return 4; + return 3; + case PrefixID.Warding: + if (CalamityWorld.downedDoG) + return 16; + else if (CalamityWorld.downedPolterghast) + return 14; + else if (CalamityWorld.downedProvidence) + return 12; + else if (NPC.downedMoonlord) + return 10; + else if (NPC.downedGolemBoss) + return 8; + else if (Main.hardMode) + return 6; + return 4; + } + } + #endregion + /// /// Converts the given ModHotKey into a string for insertion into item tooltips.

/// This allows the user's actual keybind choices to be shown to them in tooltips. From cb6b42f43f144447132a0427d64feea50d5a8386 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 13 Apr 2021 00:19:56 -0500 Subject: [PATCH 30/43] 1 - Highest tier accessory reforges now reforge into other highest tier accessory reforges. 2 - Nerfed Amalgam extra projectile damage values. 3 - Arma bags now only drop on first boss kills. 4 - Nerfed Conference Call extra bullet damage by 30%. 5 - Cal Clone dashes are no longer predictive. 6 - Old Duke looks in the direction he's about to dash instead of directly at the player, if he's going to dash. 7 - Updated pillar spawn code a bit more. 8 - Pulse Rifle now works like it should and doesn't hit 4 times on a single target. 9 - Adjusted HomeInOnNPC calls to use projectile.tileCollide to decide homing through tiles or not. --- CalPlayer/CalamityPlayer.cs | 8 +- Items/Accessories/TheAmalgam.cs | 6 +- Items/CalamityGlobalItem.cs | 160 +++++++++++++++--- Items/DifficultyItems/Armageddon.cs | 3 +- Items/Weapons/Melee/PrismaticBreaker.cs | 4 +- Items/Weapons/Ranged/ConferenceCall.cs | 2 +- Items/Weapons/Ranged/TrueConferenceCall.cs | 7 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 1 - NPCs/CalamityAI.cs | 74 +++++--- NPCs/CalamityGlobalNPC.cs | 89 +++++----- NPCs/CalamityGlobalNPCLoot.cs | 110 ++++++------ NPCs/Yharon/Yharon.cs | 8 +- Projectiles/DraedonsArsenal/PulseRifleShot.cs | 7 +- Projectiles/Magic/AstralachneaFang.cs | 2 +- Projectiles/Magic/BeamingBolt2.cs | 2 +- Projectiles/Magic/BlueBubble.cs | 2 +- Projectiles/Magic/BrimstoneHomer.cs | 7 +- Projectiles/Magic/ForbiddenAxeBlade.cs | 2 +- Projectiles/Magic/GhastlyExplosionShard.cs | 2 +- Projectiles/Magic/GraniteEnergy.cs | 2 +- Projectiles/Magic/IceSpike.cs | 2 +- Projectiles/Magic/LightBead.cs | 2 +- Projectiles/Magic/Phantom.cs | 2 +- Projectiles/Magic/PoseidonTyphoon.cs | 2 +- Projectiles/Magic/VividLaser2.cs | 2 +- Projectiles/Melee/Blood.cs | 2 +- Projectiles/Melee/Blood2.cs | 2 +- Projectiles/Melee/Brimlash2.cs | 2 +- Projectiles/Melee/DepthOrb2.cs | 2 +- Projectiles/Melee/ElementalExcaliburBeam.cs | 2 +- Projectiles/Melee/EmpyreanKnife.cs | 2 +- Projectiles/Melee/Flarefrost.cs | 2 +- Projectiles/Melee/GhastlySoulLarge.cs | 2 +- Projectiles/Melee/GhastlySoulMedium.cs | 2 +- Projectiles/Melee/GhastlySoulSmall.cs | 2 +- Projectiles/Melee/IllustriousKnife.cs | 2 +- Projectiles/Melee/JudgementBlah.cs | 2 +- Projectiles/Melee/JudgementProj.cs | 2 +- Projectiles/Melee/Leech.cs | 2 +- .../Melee/MeldGreatswordBigProjectile.cs | 2 +- .../Melee/MeldGreatswordMediumProjectile.cs | 2 +- .../Melee/MeldGreatswordSmallProjectile.cs | 2 +- Projectiles/Melee/OmegaBiomeOrb.cs | 2 +- Projectiles/Melee/PlagueSeeker.cs | 2 +- Projectiles/Melee/RainBolt.cs | 2 +- Projectiles/Melee/Razorwind.cs | 2 +- Projectiles/Melee/TerraBall.cs | 2 +- Projectiles/Melee/TinyCrystal.cs | 2 +- Projectiles/Ranged/AquashardSplit.cs | 2 +- Projectiles/Ranged/AstralRound.cs | 2 +- Projectiles/Ranged/AstrealFlame.cs | 2 +- Projectiles/Ranged/BigNuke.cs | 2 +- Projectiles/Ranged/BloodfireArrowProj.cs | 2 +- Projectiles/Ranged/CardClubSplit.cs | 2 +- Projectiles/Ranged/ClamorRifleProj.cs | 2 +- Projectiles/Ranged/ClamorRifleProjSplit.cs | 2 +- Projectiles/Ranged/FishronRPG.cs | 2 +- Projectiles/Ranged/FungiOrb2.cs | 2 +- Projectiles/Ranged/MiniRocket.cs | 2 +- Projectiles/Ranged/Minibirb.cs | 2 +- .../Ranged/PlanetaryAnnihilationProj.cs | 2 +- Projectiles/Ranged/PolarStar.cs | 2 +- Projectiles/Ranged/RainbowBlast.cs | 2 +- Projectiles/Ranged/SeaDragonRocket.cs | 2 +- Projectiles/Ranged/SicknessRound2.cs | 2 +- Projectiles/Ranged/SputterCometBig.cs | 2 +- Projectiles/Ranged/TerraArrowSplit.cs | 2 +- Projectiles/Ranged/TerraBulletSplit.cs | 2 +- Projectiles/Ranged/ThePackMinissile.cs | 2 +- Projectiles/Rogue/CobaltEnergy.cs | 2 +- Projectiles/Rogue/Crushax.cs | 2 +- Projectiles/Rogue/DeepSeaDumbbell2.cs | 2 +- Projectiles/Rogue/DeepSeaDumbbell3.cs | 2 +- Projectiles/Rogue/GacruxianHome.cs | 2 +- Projectiles/Rogue/LostSoulFriendly.cs | 2 +- Projectiles/Rogue/LunarKunaiProj.cs | 2 +- Projectiles/Rogue/MoonSigil.cs | 2 +- Projectiles/Rogue/Prismalline3.cs | 8 +- Projectiles/Rogue/ProfanedPartisanSpear.cs | 2 +- Projectiles/Rogue/RadiantStar2.cs | 10 +- Projectiles/Rogue/SkyfinNuke.cs | 2 +- Projectiles/Rogue/TurbulanceWindSlash.cs | 2 +- Projectiles/Typeless/ChaosFlare.cs | 12 +- Projectiles/Typeless/ChaosFlare2.cs | 9 +- Projectiles/Typeless/GodSlayerPhantom.cs | 2 +- Projectiles/Typeless/VanquisherArrowSplit.cs | 2 +- Utilities/DropHelper.cs | 5 +- 87 files changed, 416 insertions(+), 250 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5cf0890c55..364cf3002c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -108,6 +108,7 @@ namespace CalamityMod.CalPlayer public bool noLifeRegen = false; public int itemTypeLastReforged = 0; public int reforgeTierSafety = 0; + public bool finalTierAccessoryReforge = false; public int defenseDamage = 0; public float rangedAmmoCost = 1f; public bool heldGaelsLastFrame = false; @@ -1062,6 +1063,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("bossHPBar", drawBossHPBar); boost.AddWithCondition("drawSmallText", shouldDrawSmallText); boost.AddWithCondition("fullHPRespawn", healToFull); + boost.AddWithCondition("finalTierAccessoryReforge", finalTierAccessoryReforge); boost.AddWithCondition("newMerchantInventory", newMerchantInventory); boost.AddWithCondition("newPainterInventory", newPainterInventory); @@ -1136,8 +1138,9 @@ namespace CalamityMod.CalPlayer drawBossHPBar = boost.Contains("bossHPBar"); shouldDrawSmallText = boost.Contains("drawSmallText"); healToFull = boost.Contains("fullHPRespawn"); + finalTierAccessoryReforge = boost.Contains("finalTierAccessoryReforge"); - newMerchantInventory = boost.Contains("newMerchantInventory"); + newMerchantInventory = boost.Contains("newMerchantInventory"); newPainterInventory = boost.Contains("newPainterInventory"); newDyeTraderInventory = boost.Contains("newDyeTraderInventory"); newPartyGirlInventory = boost.Contains("newPartyGirlInventory"); @@ -1293,7 +1296,8 @@ namespace CalamityMod.CalPlayer BitsByte flags6 = reader.ReadByte(); newBanditInventory = flags6[0]; - } + finalTierAccessoryReforge = flags6[1]; + } else { ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index ffb6057df0..f145ce960b 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Accessories public const int FireProjectiles = 2; public const float FireAngleSpread = 120; public int counter = 0; - public const int ProjectileDamage = 1000; - public const int FungalClumpDamage = 500; - public const int AuraDamage = 150; + public const int ProjectileDamage = 300; + public const int FungalClumpDamage = 150; + public const int AuraDamage = 100; public override void SetStaticDefaults() { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index c98da34c74..13129350b0 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -497,7 +497,7 @@ namespace CalamityMod.Items { BitsByte flags = reader.ReadByte(); rogue = flags[0]; - } + } else { ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); @@ -509,7 +509,7 @@ namespace CalamityMod.Items BitsByte flags = new BitsByte(); flags[0] = rogue; - writer.Write(flags); + writer.Write(flags); writer.Write((int)customRarity); writer.Write(timesUsed); writer.Write(Charge); @@ -521,7 +521,7 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); rogue = flags[0]; - customRarity = (CalamityRarity)reader.ReadInt32(); + customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); Charge = reader.ReadSingle(); reforgeTier = reader.ReadInt32(); @@ -3754,7 +3754,118 @@ Grants immunity to fire blocks, and temporary immunity to lava"; private int NewPrefixType(Item item) { int prefix = -2; - if (item.melee) + if (item.accessory) + { + if (Main.player[Main.myPlayer].Calamity().finalTierAccessoryReforge) + { + // Warding = 18, Menacing = 19, Quick = 20, Violent = 21, Lucky = 22, Silent = 23 + prefix = Main.rand.Next(18, 24); + } + else + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Hard = 1, Jagged = 2, Brisk = 3, Wild = 4, Quiet = 5 + prefix = Main.rand.Next(1, 6); + break; + case 2: + // Guarding = 6, Spiked = 7, Fleeting = 8, Rash = 9, Cloaked = 10 + prefix = Main.rand.Next(6, 11); + break; + case 3: + // Precise = 11, Arcane = 12 + prefix = Main.rand.Next(11, 13); + break; + case 4: + // Armored = 13, Angry = 14, Hasty = 15, Intrepid = 16, Camouflaged = 17 + prefix = Main.rand.Next(13, 18); + break; + case 5: + case 6: + // Warding = 18, Menacing = 19, Quick = 20, Violent = 21, Lucky = 22, Silent = 23 + prefix = Main.rand.Next(18, 24); + break; + } + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Hard; + break; + case 2: + prefix = PrefixID.Jagged; + break; + case 3: + prefix = PrefixID.Brisk; + break; + case 4: + prefix = PrefixID.Wild; + break; + case 5: + prefix = mod.PrefixType("Quiet"); + break; + case 6: + prefix = PrefixID.Guarding; + break; + case 7: + prefix = PrefixID.Spiked; + break; + case 8: + prefix = PrefixID.Fleeting; + break; + case 9: + prefix = PrefixID.Rash; + break; + case 10: + prefix = mod.PrefixType("Cloaked"); + break; + case 11: + prefix = PrefixID.Precise; + break; + case 12: + prefix = PrefixID.Arcane; + break; + case 13: + prefix = PrefixID.Armored; + break; + case 14: + prefix = PrefixID.Angry; + break; + case 15: + prefix = PrefixID.Hasty2; + break; + case 16: + prefix = PrefixID.Intrepid; + break; + case 17: + prefix = mod.PrefixType("Camouflaged"); + break; + case 18: + prefix = PrefixID.Warding; + break; + case 19: + prefix = PrefixID.Menacing; + break; + case 20: + prefix = PrefixID.Quick2; + break; + case 21: + prefix = PrefixID.Violent; + break; + case 22: + prefix = PrefixID.Lucky; + break; + case 23: + prefix = mod.PrefixType("Silent"); + break; + } + } + else if (item.melee) { if (item.knockBack == 0f) { @@ -4595,28 +4706,31 @@ Grants immunity to fire blocks, and temporary immunity to lava"; // Get cash from dickhead goblin fuck public override void PostReforge(Item item) { - if (!item.accessory) + CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); + if (modPlayer.itemTypeLastReforged != item.type) { - CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); - if (modPlayer.itemTypeLastReforged != item.type) - modPlayer.reforgeTierSafety = 0; - - modPlayer.itemTypeLastReforged = item.type; - - if (modPlayer.reforgeTierSafety > 6) - modPlayer.reforgeTierSafety = 0; - - modPlayer.reforgeTierSafety += 1; - reforgeTier = modPlayer.reforgeTierSafety; - - bool favorited = item.favorited; - item.netDefaults(item.netID); - item.Prefix(NewPrefixType(item)); - - item.Center = Main.player[Main.myPlayer].Center; - item.favorited = favorited; + modPlayer.reforgeTierSafety = 0; + modPlayer.finalTierAccessoryReforge = false; } + modPlayer.itemTypeLastReforged = item.type; + + if (modPlayer.reforgeTierSafety > 6) + { + modPlayer.reforgeTierSafety = 0; + modPlayer.finalTierAccessoryReforge = true; + } + + modPlayer.reforgeTierSafety++; + reforgeTier = modPlayer.reforgeTierSafety; + + bool favorited = item.favorited; + item.netDefaults(item.netID); + item.Prefix(NewPrefixType(item)); + + item.Center = Main.player[Main.myPlayer].Center; + item.favorited = favorited; + if (NPC.AnyNPCs(ModContent.NPCType())) { int value = item.value; diff --git a/Items/DifficultyItems/Armageddon.cs b/Items/DifficultyItems/Armageddon.cs index 99170c08c3..faf4f3c1e4 100644 --- a/Items/DifficultyItems/Armageddon.cs +++ b/Items/DifficultyItems/Armageddon.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Items.DifficultyItems DisplayName.SetDefault("Armageddon"); Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" + "Effect can be toggled on and off\n" + - "If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode"); + "If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode\n" + + "These extra bags will only drop if it's your first time killing the boss"); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 021b035518..e5ccfb9e7f 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -90,11 +90,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/ConferenceCall.cs b/Items/Weapons/Ranged/ConferenceCall.cs index d8987ebee9..fbe8e1ec2f 100644 --- a/Items/Weapons/Ranged/ConferenceCall.cs +++ b/Items/Weapons/Ranged/ConferenceCall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item38; item.autoReuse = true; - item.shootSpeed = 13f; + item.shootSpeed = 12f; item.shoot = ProjectileID.PurificationPowder; item.useAmmo = AmmoID.Bullet; } diff --git a/Items/Weapons/Ranged/TrueConferenceCall.cs b/Items/Weapons/Ranged/TrueConferenceCall.cs index 3ca06c3bf0..09768c5b75 100644 --- a/Items/Weapons/Ranged/TrueConferenceCall.cs +++ b/Items/Weapons/Ranged/TrueConferenceCall.cs @@ -78,6 +78,7 @@ namespace CalamityMod.Items.Weapons.Ranged return false; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + int extraBulletDamage = (int)(damage * 0.7); for (int j = 0; j < targetArrayIndex; j++) { @@ -87,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * item.shootSpeed; - int proj = Projectile.NewProjectile(vector2, velocity2, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -96,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (targetArrayIndex == 12) return false; - // Fire bullets at the same targets if + // Fire bullets at the same targets if 12 unique targets aren't found for (int k = 0; k < maxTargets - targetArrayIndex; k++) { int randomTarget = Main.rand.Next(targetArrayIndex); @@ -107,7 +108,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * item.shootSpeed; - int proj = Projectile.NewProjectile(vector2, velocity2, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 6d680bf3da..827d1ef9cf 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -17,7 +17,6 @@ using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using CalamityMod.Items.Armor.Vanity; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 33279ea7a6..0f4d54072a 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1666,7 +1666,7 @@ namespace CalamityMod.NPCs if (provy) chargeVelocity *= 1.25f; - Vector2 vector = Vector2.Normalize(player.Center + player.velocity * 10f - npc.Center); + Vector2 vector = Vector2.Normalize(player.Center - npc.Center); npc.velocity = vector * chargeVelocity; npc.ai[1] = 3f; @@ -1676,7 +1676,7 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; - float chargeTime = BossRushEvent.BossRushActive ? 56f : (70f - (death ? 6f * (1f - lifeRatio) : 0f)); + float chargeTime = BossRushEvent.BossRushActive ? 45f : (56f - (death ? 6f * (1f - lifeRatio) : 0f)); if (npc.ai[2] >= chargeTime) { npc.velocity *= 0.93f; @@ -1688,7 +1688,7 @@ namespace CalamityMod.NPCs else npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= chargeTime + 15f) + if (npc.ai[2] >= chargeTime + 12f) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -1706,7 +1706,7 @@ namespace CalamityMod.NPCs } else { - int num62 = 500; + int num62 = 400; float num63 = (calamityGlobalNPC.enraged > 0) ? 20f : 14f; float num64 = (calamityGlobalNPC.enraged > 0) ? 0.5f : 0.35f; @@ -1767,7 +1767,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= 45f) + if (npc.ai[2] >= 36f) { npc.TargetClosest(); npc.ai[1] = 2f; @@ -4902,7 +4902,47 @@ namespace CalamityMod.NPCs } // Rotation - float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); + // Phase switch + float rateOfRotation = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) + rateOfRotation = 0f; + if (npc.ai[0] == 3f || npc.ai[0] == 4f) + rateOfRotation = 0.01f; + if (npc.ai[0] == 8f || npc.ai[0] == 13f) + rateOfRotation = 0.05f; + + Vector2 playerCenter = player.Center; + if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) + { + // Rotate to show direction of predictive charge + Vector2 distanceVector = player.Center + player.velocity * 20f - vector; + if (npc.ai[0] == 0f && !phase2) + { + if (npc.ai[3] < 6f) + { + rateOfRotation = 0.1f; + playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity; + } + } + else if (npc.ai[0] == 5f && !phase3) + { + if (npc.ai[3] < 4f) + { + rateOfRotation = 0.1f; + playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity; + } + } + else if (npc.ai[0] == 10f) + { + if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) + { + rateOfRotation = 0.1f; + playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity; + } + } + } + + float num17 = (float)Math.Atan2(playerCenter.Y - vector.Y, playerCenter.X - vector.X); if (npc.spriteDirection == 1) num17 += pie; if (num17 < 0f) @@ -4912,42 +4952,32 @@ namespace CalamityMod.NPCs if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) num17 = 0f; if (npc.ai[0] == 8f || npc.ai[0] == 13f) - { num17 = pie * 0.1666666667f * npc.spriteDirection; - } - - float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) - num18 = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - num18 = 0.01f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - num18 = 0.05f; if (npc.rotation < num17) { if (num17 - npc.rotation > pie) - npc.rotation -= num18; + npc.rotation -= rateOfRotation; else - npc.rotation += num18; + npc.rotation += rateOfRotation; } if (npc.rotation > num17) { if (npc.rotation - num17 > pie) - npc.rotation += num18; + npc.rotation += rateOfRotation; else - npc.rotation -= num18; + npc.rotation -= rateOfRotation; } if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) { - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation) npc.rotation = num17; if (npc.rotation < 0f) npc.rotation += MathHelper.TwoPi; if (npc.rotation > MathHelper.TwoPi) npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation) npc.rotation = num17; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 21d5d1559e..ac29ce0773 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3161,12 +3161,11 @@ namespace CalamityMod.NPCs private void PillarEventProgressionEdit(NPC npc) { // Make pillars a bit more fun by forcing more difficult enemies based on progression. - int solarTowerShieldStrength = NPC.ShieldStrengthTowerSolar / 25; + int solarTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerSolar / 25D); switch (solarTowerShieldStrength) { case 4: - case 3: - // Possible spawns: Corite, Drakanian, Drakomire, Drakomire Rider + // Possible spawns: Drakanian, Drakomire, Drakomire Rider switch (npc.type) { case NPCID.SolarCrawltipedeHead: @@ -3174,22 +3173,33 @@ namespace CalamityMod.NPCs case NPCID.SolarCrawltipedeTail: case NPCID.SolarSolenian: case NPCID.SolarSroller: + case NPCID.SolarCorite: npc.active = false; npc.netUpdate = true; break; + default: + break; + } + break; + case 3: + // Possible spawns: Drakomire, Drakomire Rider, Sroller + switch (npc.type) + { + case NPCID.SolarCrawltipedeHead: + case NPCID.SolarCrawltipedeBody: + case NPCID.SolarCrawltipedeTail: + case NPCID.SolarSpearman: + case NPCID.SolarSolenian: case NPCID.SolarCorite: - if (NPC.CountNPCS(NPCID.SolarCorite) > 2) - { - npc.active = false; - npc.netUpdate = true; - } + npc.active = false; + npc.netUpdate = true; break; default: break; } break; case 2: - // Possible spawns: Corite, Drakomire Rider, Sroller + // Possible spawns: Drakomire Rider, Selenian, Sroller switch (npc.type) { case NPCID.SolarDrakomire: @@ -3197,17 +3207,10 @@ namespace CalamityMod.NPCs case NPCID.SolarCrawltipedeBody: case NPCID.SolarCrawltipedeTail: case NPCID.SolarSpearman: - case NPCID.SolarSolenian: + case NPCID.SolarCorite: npc.active = false; npc.netUpdate = true; break; - case NPCID.SolarCorite: - if (NPC.CountNPCS(NPCID.SolarCorite) > 3) - { - npc.active = false; - npc.netUpdate = true; - } - break; default: break; } @@ -3225,19 +3228,12 @@ namespace CalamityMod.NPCs npc.active = false; npc.netUpdate = true; break; - case NPCID.SolarCorite: - if (NPC.CountNPCS(NPCID.SolarCorite) > 4) - { - npc.active = false; - npc.netUpdate = true; - } - break; default: break; } break; case 0: - // Possible spawns: Corite, Selenian, Crawltipede + // Possible spawns: Corite, Crawltipede, Selenian switch (npc.type) { case NPCID.SolarDrakomire: @@ -3247,24 +3243,16 @@ namespace CalamityMod.NPCs npc.active = false; npc.netUpdate = true; break; - case NPCID.SolarCorite: - if (NPC.CountNPCS(NPCID.SolarCorite) > 5) - { - npc.active = false; - npc.netUpdate = true; - } - break; default: break; } break; } - int vortexTowerShieldStrength = NPC.ShieldStrengthTowerVortex / 25; + int vortexTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerVortex / 25D); switch (vortexTowerShieldStrength) { case 4: - case 3: // Possible spawns: Alien Larva, Alien Hornet, Alien Queen switch (npc.type) { @@ -3277,7 +3265,7 @@ namespace CalamityMod.NPCs break; } break; - case 2: + case 3: // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian if (npc.type == NPCID.VortexRifleman) { @@ -3285,7 +3273,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } break; - case 1: + case 2: // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Storm Diver if (npc.type == NPCID.VortexSoldier) { @@ -3293,16 +3281,16 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } break; + case 1: case 0: // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian, Storm Diver break; } - int nebulaTowerShieldStrength = NPC.ShieldStrengthTowerNebula / 25; + int nebulaTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerNebula / 25D); switch (nebulaTowerShieldStrength) { case 4: - case 3: // Possible spawns: Brain Suckler switch (npc.type) { @@ -3316,7 +3304,7 @@ namespace CalamityMod.NPCs break; } break; - case 2: + case 3: // Possible spawns: Brain Suckler, Predictor switch (npc.type) { @@ -3329,7 +3317,7 @@ namespace CalamityMod.NPCs break; } break; - case 1: + case 2: // Possible spawns: Brain Suckler, Predictor, Evolution Beast if (npc.type == NPCID.NebulaBrain) { @@ -3337,6 +3325,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } break; + case 1: case 0: // Possible spawns: Predictor, Evolution Beast, Nebula Floater if (npc.type == NPCID.NebulaHeadcrab) @@ -3347,11 +3336,10 @@ namespace CalamityMod.NPCs break; } - int stardustTowerShieldStrength = NPC.ShieldStrengthTowerStardust / 25; + int stardustTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerStardust / 25D); switch (stardustTowerShieldStrength) { case 4: - case 3: // Possible spawns: Milkyway Weaver, Star Cell switch (npc.type) { @@ -3365,7 +3353,7 @@ namespace CalamityMod.NPCs break; } break; - case 2: + case 3: // Possible spawns: Milkyway Weaver, Stargazer, Twinkle Popper switch (npc.type) { @@ -3378,7 +3366,7 @@ namespace CalamityMod.NPCs break; } break; - case 1: + case 2: // Possible spawns: Stargazer, Twinkle Popper, Flow Invader switch (npc.type) { @@ -3393,6 +3381,7 @@ namespace CalamityMod.NPCs break; } break; + case 1: case 0: // Possible spawns: Twinkle Popper, Flow Invader switch (npc.type) @@ -4066,6 +4055,16 @@ namespace CalamityMod.NPCs maxSpawns = (int)(maxSpawns * 10f); } + if (NPC.LunarApocalypseIsUp) + { + if ((player.ZoneTowerNebula && NPC.ShieldStrengthTowerNebula == 0) || (player.ZoneTowerStardust && NPC.ShieldStrengthTowerStardust == 0) || + (player.ZoneTowerVortex && NPC.ShieldStrengthTowerVortex == 0) || (player.ZoneTowerSolar && NPC.ShieldStrengthTowerSolar == 0)) + { + spawnRate = (int)(spawnRate * 0.85); + maxSpawns = (int)(maxSpawns * 1.25f); + } + } + if (CalamityWorld.revenge) spawnRate = (int)(spawnRate * 0.85); @@ -5174,7 +5173,7 @@ namespace CalamityMod.NPCs return CalamityWorld.downedSCal; } - return false; + return true; } #endregion diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index a7f6125f42..bd07a57cd5 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -50,13 +50,13 @@ namespace CalamityMod.NPCs return false; // Servants of Cthulhu and Probes do not provide free hearts in Rev+. - if (CalamityWorld.revenge && (npc.type == NPCID.ServantofCthulhu || npc.type == NPCID.Probe)) + if (CalamityWorld.revenge && (npc.type == NPCID.ServantofCthulhu || npc.type == NPCID.Probe)) NPCLoader.blockLoot.Add(ItemID.Heart); // // Ozzatron 17FEB2021: A NOTE about PreNPCLoot vs NPCLoot // PreNPCLoot runs before the boss is marked as dead. This means it is required for lore items and Resident Evil ammo. - // Because we already have clauses here for every boss, it is more convenient to drop everything here than it is + // Because we already have clauses here for every boss, it is more convenient to drop everything here than it is. // to iterate through all the bosses twice. // @@ -72,19 +72,18 @@ namespace CalamityMod.NPCs // Determine whether this NPC is the second Twin killed in a fight, regardless of which Twin it is. bool lastTwinStanding = false; if (npc.type == NPCID.Retinazer) - { lastTwinStanding = !NPC.AnyNPCs(NPCID.Spazmatism); - } else if (npc.type == NPCID.Spazmatism) - { lastTwinStanding = !NPC.AnyNPCs(NPCID.Retinazer); - } // Mechanical Bosses' combined lore item bool mechLore = !NPC.downedMechBossAny && (lastTwinStanding || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, mechLore); - if (npc.type == NPCID.KingSlime) + if (CalamityWorld.armageddon) + ArmageddonLoot(npc); + + if (npc.type == NPCID.KingSlime) { // Drop a huge spray of Gel items int minGel = Main.expertMode ? 90 : 60; @@ -663,10 +662,54 @@ namespace CalamityMod.NPCs return true; } - #endregion + #endregion - #region NPCLoot - public override void NPCLoot(NPC npc) + #region Armageddon Loot + private void ArmageddonLoot(NPC npc) + { + switch (npc.type) + { + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + if (npc.boss) // only drop from the 1 "boss" segment (redcode) + DropHelper.DropArmageddonBags(npc); + break; + + case NPCID.Retinazer: // only drop if spaz is already dead + if (!NPC.AnyNPCs(NPCID.Spazmatism)) + DropHelper.DropArmageddonBags(npc); + break; + + case NPCID.Spazmatism: // only drop if ret is already dead + if (!NPC.AnyNPCs(NPCID.Retinazer)) + DropHelper.DropArmageddonBags(npc); + break; + + case NPCID.KingSlime: + case NPCID.EyeofCthulhu: + case NPCID.BrainofCthulhu: + case NPCID.QueenBee: + case NPCID.SkeletronHead: + case NPCID.WallofFlesh: + case NPCID.TheDestroyer: + case NPCID.SkeletronPrime: + case NPCID.Plantera: + case NPCID.Golem: + case NPCID.DD2Betsy: + case NPCID.DukeFishron: + case NPCID.MoonLordCore: + DropHelper.DropArmageddonBags(npc); + break; + + default: + break; + } + } + #endregion + + #region NPCLoot + public override void NPCLoot(NPC npc) { // LATER -- keeping bosses alive lets draedon mayhem continue even after killing mechs // Reset Draedon Mayhem to false if no bosses are alive @@ -679,9 +722,6 @@ namespace CalamityMod.NPCs } } - if (CalamityWorld.armageddon) - ArmageddonLoot(npc); - // Miscellaneous on-enemy-kill effects. CheckBossSpawn(npc); if (CalamityWorld.rainingAcid) @@ -695,50 +735,6 @@ namespace CalamityMod.NPCs } #endregion - #region Armageddon Loot - private void ArmageddonLoot(NPC npc) - { - switch (npc.type) - { - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - if (npc.boss) // only drop from the 1 "boss" segment (redcode) - DropHelper.DropArmageddonBags(npc); - break; - - case NPCID.Retinazer: // only drop if spaz is already dead - if (!NPC.AnyNPCs(NPCID.Spazmatism)) - DropHelper.DropArmageddonBags(npc); - break; - - case NPCID.Spazmatism: // only drop if ret is already dead - if (!NPC.AnyNPCs(NPCID.Retinazer)) - DropHelper.DropArmageddonBags(npc); - break; - - case NPCID.KingSlime: - case NPCID.EyeofCthulhu: - case NPCID.BrainofCthulhu: - case NPCID.QueenBee: - case NPCID.SkeletronHead: - case NPCID.WallofFlesh: - case NPCID.TheDestroyer: - case NPCID.SkeletronPrime: - case NPCID.Plantera: - case NPCID.Golem: - case NPCID.DD2Betsy: - case NPCID.DukeFishron: - case NPCID.MoonLordCore: - DropHelper.DropArmageddonBags(npc); - break; - - default: - break; - } - } - #endregion - #region Check Boss Spawn // not really drop code private void CheckBossSpawn(NPC npc) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 06afd5420e..c99f5c7544 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -989,7 +989,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 10f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; @@ -1358,7 +1358,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 10f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; @@ -2214,7 +2214,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 10f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; @@ -2244,7 +2244,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 10f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index db0e21a7cf..38aeffea55 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -85,6 +85,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PulseBurst(4f, 5f); } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 280; + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (projectile.ai[1] < 5f && !hasHit && Main.myPlayer == projectile.owner) @@ -94,14 +96,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int alreadyTargetedNPCType = 0; if (projectile.ai[1] > 0f) alreadyTargetedNPCType = (int)projectile.ai[0]; + else + alreadyTargetedNPCType = target.whoAmI; for (int i = 0; i < Main.maxNPCs; i++) { if (!Main.npc[i].CanBeChasedBy(projectile, false) || !Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) continue; - if (alreadyTargetedNPCType != Main.npc[i].whoAmI && - projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) + if (alreadyTargetedNPCType != Main.npc[i].whoAmI && projectile.Center.ManhattanDistance(Main.npc[i].Center) < 600f) { Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(Main.npc[i].Center) * 5f, projectile.type, projectile.damage / 2, 0f, projectile.owner, Main.npc[i].whoAmI, projectile.ai[1] + 1f); break; diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index ca20db538b..be56475489 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = projectile.velocity.ToRotation(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 12f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 25f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 9000083e9c..227f53dfb4 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index e21fc693bd..0bbd4c9cc6 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 400f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index 9bc5233111..1a45c24fff 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -24,14 +24,17 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 180; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + + public override void AI() { projectile.rotation += 0.7f * projectile.direction; int brimstone = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); Main.dust[brimstone].noGravity = true; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 8f, 20f); + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 8f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index d755326aa6..91af3e6eb7 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) { projectile.velocity *= 1.25f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 10f, 20f); } else if (projectile.ai[1] == 40f) { diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index 65bc7dbc1b..44fc7c6fc9 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Magic } if (projectile.timeLeft < 50) - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index 817c590618..892578be7d 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f); if (projectile.timeLeft < 60) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } } } diff --git a/Projectiles/Magic/IceSpike.cs b/Projectiles/Magic/IceSpike.cs index 4e93b13dba..d9e96126e3 100644 --- a/Projectiles/Magic/IceSpike.cs +++ b/Projectiles/Magic/IceSpike.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 10f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index 107a5e21b3..72e26b74fc 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic return; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 18f, 10f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 18f, 10f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 154b30798a..b60d0e5070 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num458].noGravity = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } } } diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index 58757ecc35..438bc07c38 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic { projectile.rotation += projectile.velocity.X * 0.05f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 6f, 30f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 30f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index d26f4005d2..efe1637bcb 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0] = 1f; if (projectile.ai[0] >= 1f) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 400f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index b5c53cc385..8c2514c89b 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index a8bce41e60..d4cbfb19ee 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.timeLeft < 120) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); } } } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index dfdb00110a..93ea5af1fd 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 15f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 15f); int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 43369ecfee..b07f379930 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 6edb8209b4..8293bfe507 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Melee case 4: // Green, home in on enemies color = new Color(0, 255, 0, alpha); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 6f, 20f); break; diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 7448f1821a..14cc693be9 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee { projectile.rotation += 0.5f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 20f); if (Main.rand.NextBool(6)) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); } diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index 17b632fd01..adb064c5cf 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 6c5ccf01de..4a4b7b678f 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } else { diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 5f6b4a2bc1..af8ea96587 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } else { diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index dcac84ab6f..c6f608baf1 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } else { diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 865133ee30..68a7cfee06 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee { projectile.rotation += 0.5f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); if (Main.rand.NextBool(6)) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Melee/JudgementBlah.cs b/Projectiles/Melee/JudgementBlah.cs index 2bc5842d8f..66d9c390b0 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 10f, 20f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index c6d67131be..acea99dd2a 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity += projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 9f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index b803545516..28c6540f85 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs index b088bf77e0..1529447900 100644 --- a/Projectiles/Melee/MeldGreatswordBigProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs index b3aa5d6781..5935b9a6e3 100644 --- a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs index bf677cc1fc..6dc60f13e7 100644 --- a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/OmegaBiomeOrb.cs b/Projectiles/Melee/OmegaBiomeOrb.cs index 5d442703ee..b04dc85ebc 100644 --- a/Projectiles/Melee/OmegaBiomeOrb.cs +++ b/Projectiles/Melee/OmegaBiomeOrb.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index 9fbb1e59b9..0f8ddbac50 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index cdbe479b94..af92adcf1e 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num469].velocity *= 0f; if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 9960b690d1..f7f912a065 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Melee/TerraBall.cs b/Projectiles/Melee/TerraBall.cs index daa23c377f..f5525bf045 100644 --- a/Projectiles/Melee/TerraBall.cs +++ b/Projectiles/Melee/TerraBall.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index eae3462707..3fce8b2801 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.timeLeft < 75) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 9f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index ce79b796e3..40c8692781 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.velocity.Y += 0.01f; if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index a43f9b7e03..310dd83141 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged if (speed == 0f) speed = projectile.velocity.Length(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, speed, 12f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, speed, 12f); return false; } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index 41cfd23d61..1ad7677ee2 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.frame = 0; if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index 44b927fc07..b8e1367877 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num249].velocity *= 0.05f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 2caec238b0..675e8d329f 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[1] == 80f) //means it's from Arterial Assault's wooden arrow conversion - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index f91eef94a6..b32aa6aa96 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.alpha < 128) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } } diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index 5c4de46ac4..0f3bc0490e 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num155].velocity += projectile.velocity * 0.5f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 12f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 25f); } /*public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index ef578c3f60..14b6ffc0da 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 12f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 25f); } /* override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index 34993fbc0a..3a7e947ebd 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index 002a63cfc9..ec3d69c4d2 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index b81c11cf56..d832f23a71 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num249].velocity *= 0.05f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/Minibirb.cs b/Projectiles/Ranged/Minibirb.cs index 6a455c9bc7..99d25e0ba9 100644 --- a/Projectiles/Ranged/Minibirb.cs +++ b/Projectiles/Ranged/Minibirb.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.Pi : 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 10f, 20f); } } } diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index 2807ed41be..2efbf38199 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index 5adde0e561..1a1ad3f71b 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[1] == 2f) //Boost three { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } else if (projectile.ai[1] == 1f) //Boost two { diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 0baec808fa..159a069a2d 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].velocity = dspeed; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index e75b6b39b0..4e3592c4c7 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 7738a5519d..2b77b4363b 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; if (projectile.timeLeft < 150) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 12f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 25f); return false; } diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 2af8ba7525..019dc6374a 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item9, projectile.position); } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index 5bb98f459d..a44a9e22a7 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 0e7e763a9e..123160eef0 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged speed = projectile.velocity.Length(); if (projectile.timeLeft < 90) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, speed, 12f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, speed, 12f); } } } diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index 30a04d008e..aa9fe01b38 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 15f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 15f); projectile.frameCounter++; if (projectile.frameCounter > 3) { diff --git a/Projectiles/Rogue/CobaltEnergy.cs b/Projectiles/Rogue/CobaltEnergy.cs index 1fbe717762..3d8a030cb1 100644 --- a/Projectiles/Rogue/CobaltEnergy.cs +++ b/Projectiles/Rogue/CobaltEnergy.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue if (!hasHitEnemy && projectile.timeLeft < 575) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } else if (hasHitEnemy) { diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index da72366dbe..1381d861d5 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index 5d3799cc06..90c9672d52 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index 821e073b67..49758ee5e9 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 3af56fd1f7..f3502d90a7 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[proj].penetrate = 3; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 3de9a9002e..9aad503dc5 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); if (projectile.ai[0] != 1f && projectile.timeLeft < 210) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index c5c35db273..60fd36b6ce 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, lunarEnhance ? 300f : 150f, lunarEnhance ? 12f : 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, lunarEnhance ? 300f : 150f, lunarEnhance ? 12f : 8f, 20f); if (Main.rand.Next(6) == 0 && lunarEnhance) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index d4204923e6..af64e67075 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 945c21ea12..2484329355 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -25,10 +25,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + + public override void AI() { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 12f, 20f); + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index ef6b67cef4..fd54a84369 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; if (timer >= 10) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 7f, 20f); } } diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index f2f7c0d964..6b071842a8 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -31,7 +31,9 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270; + + public override void AI() { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (projectile.ai[0] == 1f) @@ -69,10 +71,8 @@ namespace CalamityMod.Projectiles.Rogue } } } - else - { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.Calamity().stealthStrike ? 300f : 150f, 12f, 20f); - } + else if (projectile.timeLeft < 270) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, projectile.Calamity().stealthStrike ? 900f : 450f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/SkyfinNuke.cs b/Projectiles/Rogue/SkyfinNuke.cs index 27a7a3c380..f8ce36f5f3 100644 --- a/Projectiles/Rogue/SkyfinNuke.cs +++ b/Projectiles/Rogue/SkyfinNuke.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue else { //More range - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, homingRange, speedMult, turnSpeed); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, homingRange, speedMult, turnSpeed); } } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 8870070baa..46223a9b51 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[1] == 1f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.ai[0] == 1f ? 900f : 450f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, projectile.ai[0] == 1f ? 900f : 450f, 8f, 20f); } } diff --git a/Projectiles/Typeless/ChaosFlare.cs b/Projectiles/Typeless/ChaosFlare.cs index 80bc7859d7..b3b6a248cf 100644 --- a/Projectiles/Typeless/ChaosFlare.cs +++ b/Projectiles/Typeless/ChaosFlare.cs @@ -25,14 +25,18 @@ namespace CalamityMod.Projectiles.Typeless projectile.extraUpdates = 1; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + + public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[0] += 1f; } + for (int num457 = 0; num457 < 6; num457++) { int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); @@ -40,7 +44,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 12f, 20f); + + if (projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/ChaosFlare2.cs b/Projectiles/Typeless/ChaosFlare2.cs index 43fd3163c8..efdc08d0b8 100644 --- a/Projectiles/Typeless/ChaosFlare2.cs +++ b/Projectiles/Typeless/ChaosFlare2.cs @@ -25,14 +25,19 @@ namespace CalamityMod.Projectiles.Typeless projectile.extraUpdates = 2; } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270; + public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 11f, 20f); + + if (projectile.timeLeft < 270) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 11f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index 2c7aa3b98a..9353b7572a 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } else { diff --git a/Projectiles/Typeless/VanquisherArrowSplit.cs b/Projectiles/Typeless/VanquisherArrowSplit.cs index 118b54c852..9f82647636 100644 --- a/Projectiles/Typeless/VanquisherArrowSplit.cs +++ b/Projectiles/Typeless/VanquisherArrowSplit.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index d7ea1e9509..52af1999df 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo.FiniteUse; +using CalamityMod.NPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; @@ -319,10 +320,10 @@ namespace CalamityMod /// Drops the correct number of boss bags for Armageddon. ///
/// The NPC to drop boss bags for. - /// The number of boss bags dropped. + /// The number of boss bags dropped. No bags are dropped if the boss has been downed already. public static int DropArmageddonBags(NPC theBoss) { - if (!CalamityWorld.armageddon) + if (!CalamityWorld.armageddon || CalamityGlobalNPC.GetDownedBossVariable(theBoss.type)) return 0; for (int i = 0; i < ArmageddonExtraBags; ++i) From 63e02ec355eada0a0de831536498d9197824274e Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 13 Apr 2021 18:13:41 -0500 Subject: [PATCH 31/43] 1 - Certain projectiles can no longer hit town NPCs. --- Projectiles/DraedonsArsenal/PulseRifleShot.cs | 2 +- Projectiles/Enemy/ToxicMinnowCloud.cs | 18 ++---------------- Projectiles/Magic/BeamingBolt2.cs | 2 +- Projectiles/Magic/BlueBubble.cs | 2 +- Projectiles/Magic/BrimstoneHomer.cs | 2 +- Projectiles/Magic/GhastlyExplosionShard.cs | 2 +- Projectiles/Magic/GleamingBolt2.cs | 2 +- Projectiles/Magic/GraniteEnergy.cs | 2 +- .../Magic/MadAlchemistsCocktailShrapnel.cs | 2 +- Projectiles/Magic/ManaBoltSmall.cs | 2 +- Projectiles/Magic/VividLaser2.cs | 16 +++------------- Projectiles/Melee/Blood.cs | 2 +- Projectiles/Melee/Blood2.cs | 2 +- Projectiles/Melee/BonebreakerProjectile.cs | 9 +-------- Projectiles/Melee/Brimlash2.cs | 2 +- Projectiles/Melee/EssenceFlame2.cs | 2 +- Projectiles/Melee/Exocomet.cs | 2 +- Projectiles/Melee/HolyColliderHolyFire.cs | 2 +- Projectiles/Melee/Leech.cs | 2 +- Projectiles/Melee/NightStabber.cs | 2 +- Projectiles/Melee/PlagueSeeker.cs | 2 +- Projectiles/Melee/PwnagehammerEcho.cs | 12 ++---------- Projectiles/Melee/RainBolt.cs | 2 +- Projectiles/Melee/ScourgeoftheCosmosMini.cs | 2 +- Projectiles/Melee/TinyCrystal.cs | 2 +- Projectiles/Melee/TinyFlare.cs | 2 +- Projectiles/Ranged/AquashardSplit.cs | 2 +- Projectiles/Ranged/AstrealFlame.cs | 2 +- Projectiles/Ranged/ClamorRifleProjSplit.cs | 2 +- Projectiles/Ranged/FungiOrb2.cs | 2 +- Projectiles/Ranged/SandyWaifuShark.cs | 2 +- Projectiles/Ranged/SicknessRound2.cs | 2 +- Projectiles/Ranged/TerraArrowSplit.cs | 2 +- Projectiles/Ranged/TerraBulletSplit.cs | 2 +- Projectiles/Ranged/VeriumBulletProj.cs | 9 +-------- Projectiles/Rogue/CelestialReaperAfterimage.cs | 2 +- Projectiles/Rogue/DesecratedBubble.cs | 16 +++------------- Projectiles/Rogue/EclipsesStealth.cs | 9 +-------- Projectiles/Rogue/LostSoulFriendly.cs | 2 +- Projectiles/Rogue/LuminousShard.cs | 2 +- Projectiles/Rogue/PhantasmalSoul.cs | 2 +- Projectiles/Rogue/Prismalline3.cs | 2 +- Projectiles/Rogue/RadiantStar2.cs | 2 +- Projectiles/Rogue/TheSyringeS1.cs | 2 +- Projectiles/Rogue/TurbulanceWindSlash.cs | 2 +- Projectiles/Rogue/Valaricicle.cs | 2 +- Projectiles/Rogue/Valaricicle2.cs | 2 +- Projectiles/Typeless/AtaxiaOrb.cs | 2 +- Projectiles/Typeless/ChaosFlare.cs | 2 +- Projectiles/Typeless/ChaosFlare2.cs | 2 +- Projectiles/Typeless/CursorProjSplit.cs | 14 ++------------ 51 files changed, 58 insertions(+), 131 deletions(-) diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index a6cf71eb1a..d1412009e6 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PulseBurst(4f, 5f); } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 280; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 280 && target.CanBeChasedBy(projectile); public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index f4feb53ef0..82efe42b9e 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -79,28 +79,14 @@ namespace CalamityMod.Projectiles.Enemy } } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft < 40) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft > 40; public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(BuffID.Poisoned, 600); } - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft < 40) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft > 40; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 227f53dfb4..c5fd72da18 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index 0bbd4c9cc6..8e62069c6d 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 120; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index 1a45c24fff..22f7fd7817 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index 44fc7c6fc9..bc39226c3b 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 50; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 50 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index c52b87bfe1..3c2e79cc99 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index 892578be7d..07156b0a76 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 90; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 60; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 60 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index 2623c7d651..258fa2ba58 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index b5ae75f9aa..4ab8bc09a8 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 40; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 40 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index efe1637bcb..4147656221 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -70,19 +70,9 @@ namespace CalamityMod.Projectiles.Magic target.ExoDebuffs(); } - // Cannot deal damage for the first several frames of existence. - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft >= 110) - { - return false; - } - return null; - } + // Cannot deal damage for the first several frames of existence. + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 110; - public override bool CanHitPvp(Player target) - { - return projectile.timeLeft < 110; - } + public override bool CanHitPvp(Player target) => projectile.timeLeft < 110; } } diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 8c2514c89b..4da978c197 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index d4cbfb19ee..f55ebc98ae 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 150; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 120; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 120 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 704f138600..6020ec3daa 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -110,14 +110,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 240); } - public override bool? CanHitNPC(NPC target) - { - if (projectile.ai[0] == 1f) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.ai[0] != 1f; public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index 93ea5af1fd..c8c52d1ccb 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 120; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index fc3403403c..4ac31bb0fe 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 3; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 8c94e17a19..beda999085 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 360; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 240; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 240 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index afcc0b639e..60b5fd08f2 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 90; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index 28c6540f85..b9de3fbfaa 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/NightStabber.cs b/Projectiles/Melee/NightStabber.cs index cd8a418258..c7c57a7b87 100644 --- a/Projectiles/Melee/NightStabber.cs +++ b/Projectiles/Melee/NightStabber.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/PlagueSeeker.cs b/Projectiles/Melee/PlagueSeeker.cs index 0f8ddbac50..5091e4cb7c 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index 244d4fd9b8..ff2fab74e3 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -89,17 +89,9 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool? CanHitNPC(NPC target) - { - if (projectile.ai[0] <= 42f) - return false; - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.ai[0] > 42f; - public override bool CanHitPvp(Player target) - { - return projectile.ai[0] > 42f; - } + public override bool CanHitPvp(Player target) => projectile.ai[0] > 42f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index af92adcf1e..a1817ae411 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index 3e322794da..10173ef279 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 3; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index 3fce8b2801..c4ce4ad91a 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 90; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 684f8e4ccd..55762268fa 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index 40c8692781..9b0f5db1f6 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index 1ad7677ee2..0bbca59048 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index 14b6ffc0da..1c6bd95dae 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index ec3d69c4d2..241dea6b6b 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index 9d57932272..33c2e01724 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 240; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 2b77b4363b..6d90d0a8e4 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.WoodenArrowFriendly; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index a44a9e22a7..281e5dc197 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 123160eef0..449eee3399 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.Bullet; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 64d9a5ded7..6324b18c2a 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -116,14 +116,7 @@ namespace CalamityMod.Projectiles.Ranged return true; } - public override bool? CanHitNPC(NPC target) - { - if (projectile.ai[0] > 0f) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f; public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.cs b/Projectiles/Rogue/CelestialReaperAfterimage.cs index 1d4a0f8317..47ce05b8f9 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index b403f91cff..67965c5e3a 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -82,19 +82,9 @@ namespace CalamityMod.Projectiles.Rogue } } - // Cannot deal damage for the first several frames of existence. - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft >= 100) - { - return false; - } - return null; - } + // Cannot deal damage for the first several frames of existence. + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 100; - public override bool CanHitPvp(Player target) - { - return projectile.timeLeft < 100; - } + public override bool CanHitPvp(Player target) => projectile.timeLeft < 100; } } \ No newline at end of file diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 65cdb57cb0..8f3e81bde2 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -90,14 +90,7 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override bool? CanHitNPC(NPC target) - { - if (projectile.ai[0] == 1f) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.ai[0] != 1f; public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; } diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 9aad503dc5..480d759d1c 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.alpha = 150; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/LuminousShard.cs b/Projectiles/Rogue/LuminousShard.cs index 6d5fe0c9c2..13ae3aa831 100644 --- a/Projectiles/Rogue/LuminousShard.cs +++ b/Projectiles/Rogue/LuminousShard.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index 6ec8979684..ebdd9fb1fd 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = Lifetime; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < Lifetime - NoHomingFrames; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < Lifetime - NoHomingFrames && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 2484329355..f7837120e8 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index 6b071842a8..6f4ee3b57b 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/TheSyringeS1.cs b/Projectiles/Rogue/TheSyringeS1.cs index 03495b70b2..a3eb0bb390 100644 --- a/Projectiles/Rogue/TheSyringeS1.cs +++ b/Projectiles/Rogue/TheSyringeS1.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void PostAI() { diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 46223a9b51..60ae74c45b 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index 5c40e27c53..4cf1eef705 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.coldDamage = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs index 0cc49a54be..3627bbe3da 100644 --- a/Projectiles/Rogue/Valaricicle2.cs +++ b/Projectiles/Rogue/Valaricicle2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.coldDamage = true; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Typeless/AtaxiaOrb.cs b/Projectiles/Typeless/AtaxiaOrb.cs index fb480c6b54..a6544f5859 100644 --- a/Projectiles/Typeless/AtaxiaOrb.cs +++ b/Projectiles/Typeless/AtaxiaOrb.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.timeLeft = 200; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 170; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 170 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Typeless/ChaosFlare.cs b/Projectiles/Typeless/ChaosFlare.cs index b3b6a248cf..04869804f8 100644 --- a/Projectiles/Typeless/ChaosFlare.cs +++ b/Projectiles/Typeless/ChaosFlare.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.extraUpdates = 1; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Typeless/ChaosFlare2.cs b/Projectiles/Typeless/ChaosFlare2.cs index efdc08d0b8..3f26337b07 100644 --- a/Projectiles/Typeless/ChaosFlare2.cs +++ b/Projectiles/Typeless/ChaosFlare2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.extraUpdates = 2; } - public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); public override void AI() { diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index c06e659950..12e4a3fe56 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -201,19 +201,9 @@ namespace CalamityMod.Projectiles.Typeless target.AddBuff(ModContent.BuffType(), 120); } - public override bool? CanHitNPC(NPC target) - { - if (projectile.alpha >= 128) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.alpha < 128; - public override bool CanHitPvp(Player target) - { - return projectile.alpha < 128; - } + public override bool CanHitPvp(Player target) => projectile.alpha < 128; public override void Kill(int timeLeft) { From a33b98f9a4d3bfd57b506b1a6a2a49df7390c5d7 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Fri, 16 Apr 2021 16:35:07 -0500 Subject: [PATCH 32/43] 1 - Reduced Mechanical Cart speed by 30%. 2 - Reduced Portal Gun fall speed while a boss is alive from 3.5x to 2x. 3 - Made the hardmode progression config option actually do what it's supposed to do. 4 - Teleporters are disabled during boss fights. 5 - Celestial Jewel and Astral Arcanum teleports no longer work if a boss is alive. 6 - Added Malice Mode activation item with placeholder sprite. 7 - Adjusted Alicorn mount offsets a bit. --- Buffs/Pets/SCalPetBuff.cs | 2 +- CalPlayer/CalamityPlayer.cs | 13 +- CalPlayer/CalamityPlayerMiscEffects.cs | 12 +- CalamityMod.cs | 8 +- ILEditing/ILChanges.cs | 42 ++++--- Items/Accessories/AstralArcanum.cs | 2 +- Items/Accessories/CelestialJewel.cs | 2 +- Items/CalamityGlobalItemLoot.cs | 113 ++++++++++-------- Items/DifficultyItems/Malice.cs | 77 ++++++++++++ Items/DifficultyItems/Malice.png | Bin 0 -> 497 bytes Items/Mounts/AlicornMount.cs | 11 +- Items/Placeables/AstralFossil.cs | 8 +- Items/Placeables/AstralSilt.cs | 8 +- Items/TreasureBags/StarterBag.cs | 7 +- Localization/CalamityLocalization.cs | 9 +- NPCs/CalamityGlobalNPC.cs | 39 +++--- NPCs/CalamityGlobalNPCLoot.cs | 28 +++-- .../PlaguebringerGoliath.cs | 21 ---- NPCs/TownNPCs/FAP.cs | 4 +- Projectiles/CalamityGlobalProjectile.cs | 34 +++--- Tiles/CalamityGlobalTile.cs | 2 +- Utilities/NPCUtils.cs | 2 +- 22 files changed, 267 insertions(+), 177 deletions(-) create mode 100644 Items/DifficultyItems/Malice.cs create mode 100644 Items/DifficultyItems/Malice.png diff --git a/Buffs/Pets/SCalPetBuff.cs b/Buffs/Pets/SCalPetBuff.cs index bef829c02f..97c5974f70 100644 --- a/Buffs/Pets/SCalPetBuff.cs +++ b/Buffs/Pets/SCalPetBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Pets public override void SetDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Description.SetDefault("Watching over you with supreme calamitous energy... How adorable"); + Description.SetDefault("Watching over you with supreme calamitous energy...how adorable"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d71a4ba69f..b3d2901dc5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -296,10 +296,11 @@ namespace CalamityMod.CalPlayer public AndromedaPlayerState andromedaState; public int andromedaCripple; public const float UnicornSpeedNerfPower = 0.8f; - #endregion + public const float MechanicalCartSpeedNerfPower = 0.7f; + #endregion - #region Pet - public bool thirdSage = false; + #region Pet + public bool thirdSage = false; public bool thirdSageH = true; // Third sage healing public bool perfmini = false; public bool akato = false; @@ -2963,13 +2964,13 @@ namespace CalamityMod.CalPlayer if (prismaticSet && !prismaticCooldown && prismaticLasers <= 0) prismaticLasers = CalamityUtils.SecondsToFrames(35f); } - if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) + if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum && !areThereAnyDamnBosses) { AstralArcanumUI.Toggle(); } if (CalamityMod.AstralTeleportHotKey.JustPressed) { - if (celestialJewel) + if (celestialJewel && !areThereAnyDamnBosses) { if (Main.netMode == NetmodeID.SinglePlayer) { @@ -8822,7 +8823,7 @@ namespace CalamityMod.CalPlayer #region Nurse Modifications public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) { - if (CalamityWorld.death && areThereAnyDamnBosses) + if ((CalamityWorld.death || CalamityWorld.malice) && areThereAnyDamnBosses) { chatText = "Now is not the time!"; return false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c7245767a4..cc4c7d2b2d 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -962,10 +962,14 @@ namespace CalamityMod.CalPlayer { if (player.IsUnderwater() && modPlayer.ironBoots) player.maxFallSpeed = 9f; - if (modPlayer.aeroSet && !player.wet) - player.maxFallSpeed = 15f; - if (modPlayer.gSabatonFall > 0 && !player.wet) - player.maxFallSpeed = 20f; + + if (!player.wet) + { + if (modPlayer.aeroSet) + player.maxFallSpeed = 15f; + if (modPlayer.gSabatonFall > 0 || (player.PortalPhysicsEnabled && CalamityPlayer.areThereAnyDamnBosses)) + player.maxFallSpeed = 20f; + } } // Omega Blue Armor bonus diff --git a/CalamityMod.cs b/CalamityMod.cs index 6f28e75e10..9f74bf5964 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -141,8 +141,10 @@ namespace CalamityMod carpetOriginal = Main.flyingCarpetTexture; Mount.mounts[Mount.Unicorn].dashSpeed *= CalamityPlayer.UnicornSpeedNerfPower; Mount.mounts[Mount.Unicorn].runSpeed *= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].dashSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].runSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; - NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); + NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); RageHotKey = RegisterHotKey("Rage Mode", "V"); AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B"); AegisHotKey = RegisterHotKey("Elysian Guard", "N"); @@ -316,8 +318,10 @@ namespace CalamityMod } Mount.mounts[Mount.Unicorn].dashSpeed /= CalamityPlayer.UnicornSpeedNerfPower; Mount.mounts[Mount.Unicorn].runSpeed /= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].dashSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].runSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; - heartOriginal2 = null; + heartOriginal2 = null; heartOriginal = null; rainOriginal = null; manaOriginal = null; diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index b994912092..291605d234 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -57,7 +57,7 @@ namespace CalamityMod.ILEditing RemoveAerialBaneDamageBoost(); AdjustDamageVariance(); RemoveExpertHardmodeScaling(); - IncreaseaChlorophyteSpreadChance(); + IncreaseChlorophyteSpreadChance(); ReduceTileBoostedRunSpeeds(); ReduceWingHoverVelocities(); RemoveRNGFromBlackBelt(); @@ -67,6 +67,7 @@ namespace CalamityMod.ILEditing LabDoorFixes(); AlterTownNPCSpawnRate(); DisableDemonAltarGeneration(); + DisableTeleportersDuringBossFights(); FixSplittingWormBannerDrops(); } @@ -139,7 +140,7 @@ namespace CalamityMod.ILEditing }; } - private static void IncreaseaChlorophyteSpreadChance() + private static void IncreaseChlorophyteSpreadChance() { // Change the Chlorophyte spawn rate. IL.Terraria.WorldGen.hardUpdateWorld += (il) => @@ -176,11 +177,11 @@ namespace CalamityMod.ILEditing cursor.GotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f)); // The max run speed multiplier for Frozen Slime Blocks. cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 1.1f); // Reduce by 0.15. + cursor.Emit(OpCodes.Ldc_R4, 1f); // Reduce boost to 0. cursor.GotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f)); // The max run speed multiplier for Ice Blocks. cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 1.1f); // Reduce by 0.15. + cursor.Emit(OpCodes.Ldc_R4, 1f); // Reduce boost to 0. }; } @@ -353,14 +354,9 @@ namespace CalamityMod.ILEditing }; } - private static void DisableDemonAltarGeneration() - { - IL.Terraria.WorldGen.SmashAltar += (il) => - { - var cursor = new ILCursor(il); - cursor.Emit(OpCodes.Ret); - }; - } + private static void DisableDemonAltarGeneration() => On.Terraria.WorldGen.SmashAltar += PreventSmashAltarCode; + + private static void DisableTeleportersDuringBossFights() => On.Terraria.Wiring.Teleport += DisableTeleporters; private static void FixSplittingWormBannerDrops() { @@ -442,10 +438,26 @@ namespace CalamityMod.ILEditing // If it's anything else, let vanilla and/or TML handle it. return orig(i, j, forced); } - #endregion - #region Helper Functions - private static int FindTopOfDoor(int i, int j, Tile rootTile) + private static void PreventSmashAltarCode(On.Terraria.WorldGen.orig_SmashAltar orig, int i, int j) + { + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + return; + + orig(i, j); + } + + private static void DisableTeleporters(On.Terraria.Wiring.orig_Teleport orig) + { + if (CalamityPlayer.areThereAnyDamnBosses) + return; + + orig(); + } + #endregion + + #region Helper Functions + private static int FindTopOfDoor(int i, int j, Tile rootTile) { Tile t = Main.tile[i, j]; int topY = j; diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index 63bf2776fd..3fac295c54 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories { if (line2.mod == "Terraria" && line2.Name == "Tooltip6") { - line2.text = "Press " + hotkey + " to toggle teleportation UI"; + line2.text = "Press " + hotkey + " to toggle teleportation UI while no bosses are alive"; } } } diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index e30dc6d600..4e593c59b4 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories { if (line2.mod == "Terraria" && line2.Name == "Tooltip2") { - line2.text = "Press " + hotkey + " to teleport to a random location"; + line2.text = "Press " + hotkey + " to teleport to a random location while no bosses are alive"; } } } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index b8051353f5..333fb21183 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items case ItemID.TwinsBossBag: case ItemID.SkeletronPrimeBossBag: // Only drop hallowed bars after all mechs are down. - if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); break; @@ -205,74 +205,83 @@ namespace CalamityMod.Items switch (itemID) { case ItemID.WoodenCrate: - int[] preMechBlockedDrops_WoodenCrate = new int[] + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - ItemID.MythrilOre, - ItemID.OrichalcumOre, - ItemID.AdamantiteOre, - ItemID.TitaniumOre, - ItemID.MythrilBar, - ItemID.OrichalcumBar, - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; - int[] postOneMechBlockedDrops_WoodenCrate = new int[] - { - ItemID.AdamantiteOre, - ItemID.TitaniumOre, - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; + int[] preMechBlockedDrops_WoodenCrate = new int[] + { + ItemID.MythrilOre, + ItemID.OrichalcumOre, + ItemID.AdamantiteOre, + ItemID.TitaniumOre, + ItemID.MythrilBar, + ItemID.OrichalcumBar, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + int[] postOneMechBlockedDrops_WoodenCrate = new int[] + { + ItemID.AdamantiteOre, + ItemID.TitaniumOre, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; - if (!NPC.downedMechBossAny) - DropHelper.BlockDrops(preMechBlockedDrops_WoodenCrate); - else if (!twoMechsDowned) - DropHelper.BlockDrops(postOneMechBlockedDrops_WoodenCrate); + if (!NPC.downedMechBossAny) + DropHelper.BlockDrops(preMechBlockedDrops_WoodenCrate); + else if (!twoMechsDowned) + DropHelper.BlockDrops(postOneMechBlockedDrops_WoodenCrate); + } DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 3, 5); break; case ItemID.IronCrate: - int[] preMechBlockedDrops_IronCrate = new int[] + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - ItemID.MythrilBar, - ItemID.OrichalcumBar, - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; - int[] postOneMechBlockedDrops_IronCrate = new int[] - { - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; + int[] preMechBlockedDrops_IronCrate = new int[] + { + ItemID.MythrilBar, + ItemID.OrichalcumBar, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + int[] postOneMechBlockedDrops_IronCrate = new int[] + { + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; - if (!NPC.downedMechBossAny) - DropHelper.BlockDrops(preMechBlockedDrops_IronCrate); - else if (!twoMechsDowned) - DropHelper.BlockDrops(postOneMechBlockedDrops_IronCrate); + if (!NPC.downedMechBossAny) + DropHelper.BlockDrops(preMechBlockedDrops_IronCrate); + else if (!twoMechsDowned) + DropHelper.BlockDrops(postOneMechBlockedDrops_IronCrate); + } DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 8); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 8); break; case ItemID.GoldenCrate: - int[] preMechBlockedDrops_GoldenCrate = new int[] + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - ItemID.MythrilBar, - ItemID.OrichalcumBar, - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; - int[] postOneMechBlockedDrops_GoldenCrate = new int[] - { - ItemID.AdamantiteBar, - ItemID.TitaniumBar, - }; + int[] preMechBlockedDrops_GoldenCrate = new int[] + { + ItemID.MythrilBar, + ItemID.OrichalcumBar, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + int[] postOneMechBlockedDrops_GoldenCrate = new int[] + { + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; - if (!NPC.downedMechBossAny) - DropHelper.BlockDrops(preMechBlockedDrops_GoldenCrate); - else if (!twoMechsDowned) - DropHelper.BlockDrops(postOneMechBlockedDrops_GoldenCrate); + if (!NPC.downedMechBossAny) + DropHelper.BlockDrops(preMechBlockedDrops_GoldenCrate); + else if (!twoMechsDowned) + DropHelper.BlockDrops(postOneMechBlockedDrops_GoldenCrate); + } break; case ItemID.CorruptFishingCrate: diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs new file mode 100644 index 0000000000..9d7d905971 --- /dev/null +++ b/Items/DifficultyItems/Malice.cs @@ -0,0 +1,77 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DifficultyItems +{ + public class Malice : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malice"); + Tooltip.SetDefault("Enrages every boss and allows them to drop special items.\n" + + "Nurse no longer heals while a boss is alive.\n" + + "Effect can be toggled on and off."); + } + + public override void SetDefaults() + { + item.rare = ItemRarityID.Purple; + item.width = 28; + item.height = 28; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item119; + item.consumable = false; + } + + public override bool CanUseItem(Player player) => CalamityWorld.revenge; + + public override bool UseItem(Player player) + { + // This world syncing code should only be run by one entity- the server, to prevent a race condition + // with the packets. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.ChangingTheRules"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return true; + } + if (!CalamityWorld.malice) + { + CalamityWorld.malice = true; + string key = "Mods.CalamityMod.MaliceText"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + else + { + CalamityWorld.malice = false; + string key = "Mods.CalamityMod.MaliceText2"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + CalamityWorld.DoGSecondStageCountdown = 0; + CalamityNetcode.SyncWorld(); + + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DifficultyItems/Malice.png b/Items/DifficultyItems/Malice.png new file mode 100644 index 0000000000000000000000000000000000000000..493a9b001ca2fca997f4041e011df8e577faa106 GIT binary patch literal 497 zcmeAS@N?(olHy`uVBq!ia0vp^MnJ5?!3-n?Y^5`R6k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?O(KtpJ}8S0K&LC$?PCFDI^tuw zi~ZuGP!@-@SuaYN!zM0 zS@YejtlRIL1YE`bRd;!mUFq@WcyxIwFVE5sORj$RPUd|m!BptE;c5=c%ww}xX0cu@ ze0XwE@F~e7vB}q!jr%`vCNDd2`f)~*>NSh`oA+$yV4d~w`t1v)j!Oy+9E&~VA6;!M zDE6<8~h7mA7^%`5f9J^i!rOLX7F4m5R%xa<bP0l+XkK`yS3u literal 0 HcmV?d00001 diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 01a43700e7..df04e74dc0 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -28,18 +28,15 @@ namespace CalamityMod.Items.Mounts mountData.blockExtraJumps = false; mountData.totalFrames = 15; mountData.constantJump = false; + int baseYOffset = 24; int[] array = new int[mountData.totalFrames]; for (int l = 0; l < array.Length; l++) { - array[l] = 30; + array[l] = baseYOffset; } - array[1] = 28; - array[3] = 28; - array[5] = 28; - array[7] = 28; - array[12] = 28; + array[1] = array[3] = array[5] = array[7] = array[12] = baseYOffset - 2; mountData.playerYOffsets = array; - mountData.xOffset = 0; + mountData.xOffset = -4; mountData.bodyFrame = 3; mountData.yOffset = 7; //-8 mountData.playerHeadOffset = 36; //30 diff --git a/Items/Placeables/AstralFossil.cs b/Items/Placeables/AstralFossil.cs index 314647ff93..a16bb08606 100644 --- a/Items/Placeables/AstralFossil.cs +++ b/Items/Placeables/AstralFossil.cs @@ -140,22 +140,22 @@ namespace CalamityMod.Items.Placeables } else if (val < 85.03f) { - resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 87.03f) { - resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.78f) { - resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 89.53f) { - resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (CalamityWorld.downedStarGod) diff --git a/Items/Placeables/AstralSilt.cs b/Items/Placeables/AstralSilt.cs index 50893dbe30..b50a00e6ea 100644 --- a/Items/Placeables/AstralSilt.cs +++ b/Items/Placeables/AstralSilt.cs @@ -118,22 +118,22 @@ namespace CalamityMod.Items.Placeables } else if (val < 83.03f) { - resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 85.03f) { - resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 86.78f) { - resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.53f) { - resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (CalamityWorld.downedStarGod) diff --git a/Items/TreasureBags/StarterBag.cs b/Items/TreasureBags/StarterBag.cs index afeb433019..1b9cb7fdc8 100644 --- a/Items/TreasureBags/StarterBag.cs +++ b/Items/TreasureBags/StarterBag.cs @@ -51,8 +51,11 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ItemID.Torch, 25); DropHelper.DropItem(player, ItemID.Chest, 3); - // Difficulty items (doesn't drop in Normal) - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); + // Malice item + DropHelper.DropItem(player, ModContent.ItemType()); + + // Difficulty items (doesn't drop in Normal) + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); // Speedrun King Slime diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index b4cbef35e7..698cd3151c 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -120,10 +120,13 @@ namespace CalamityMod.Localization new [] { "RevengeText", "Revengeance is active." }, new [] { "RevengeText2", "Revengeance is not active." }, - new [] { "DeathText", "Death is active, enjoy the fun." }, - new [] { "DeathText2", "Death is not active, not fun enough for you?" }, + new [] { "DeathText", "Death is active; enjoy the fun." }, + new [] { "DeathText2", "Death is not active; not fun enough for you?" }, - new [] { "ArmageddonText", "Bosses will now kill you instantly." }, + new [] { "MaliceText", "Malice is active; witness the horror!" }, + new [] { "MaliceText2", "Malice is not active." }, + + new [] { "ArmageddonText", "Bosses will now kill you instantly." }, new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." }, new [] { "DefiledText", "Your soul is mine..." }, diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ac29ce0773..a81da6eb1e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1445,22 +1445,25 @@ namespace CalamityMod.NPCs } // Reduce mech boss HP and damage depending on the new ore progression changes - if (!NPC.downedMechBossAny) + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + if (!NPC.downedMechBossAny) { - npc.lifeMax = (int)(npc.lifeMax * 0.8); - npc.damage = (int)(npc.damage * 0.8); - npc.defDamage = npc.damage; + if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8); + npc.damage = (int)(npc.damage * 0.8); + npc.defDamage = npc.damage; + } } - } - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - { - if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - npc.lifeMax = (int)(npc.lifeMax * 0.9); - npc.damage = (int)(npc.damage * 0.9); - npc.defDamage = npc.damage; + if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + { + npc.lifeMax = (int)(npc.lifeMax * 0.9); + npc.damage = (int)(npc.damage * 0.9); + npc.defDamage = npc.damage; + } } } @@ -3923,9 +3926,7 @@ namespace CalamityMod.NPCs npc2.ai[0] = -1000 * Main.rand.Next(3); if (Main.netMode == NetmodeID.Server && slime < Main.maxNPCs) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slime, 0f, 0f, 0f, 0, 0, 0); - } } } } @@ -3940,9 +3941,7 @@ namespace CalamityMod.NPCs case NPCID.EnchantedSword: case NPCID.CrimsonAxe: if (npc.life <= npc.lifeMax * 0.5) - { npc.justHit = false; - } break; @@ -3953,25 +3952,19 @@ namespace CalamityMod.NPCs case NPCID.BlackRecluse: case NPCID.BlackRecluseWall: if (npc.life <= npc.lifeMax * 0.25) - { npc.justHit = false; - } break; case NPCID.Paladin: if (npc.life <= npc.lifeMax * 0.15) - { npc.justHit = false; - } break; case NPCID.Clown: if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead) - { npc.ai[2] += 29f; - } break; } @@ -3979,9 +3972,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCType() || npc.type == NPCType()) { if (npc.life <= npc.lifeMax * 0.25) - { npc.justHit = false; - } } } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 598ef4a7c1..13fd69a399 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -206,23 +206,27 @@ namespace CalamityMod.NPCs if (!Main.hardMode) { // Increase altar count to allow natural mech boss spawning. - WorldGen.altarCount++; + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + WorldGen.altarCount++; string key2 = "Mods.CalamityMod.UglyBossText"; Color messageColor2 = Color.Aquamarine; CalamityUtils.DisplayLocalizedText(key2, messageColor2); - string key3 = "Mods.CalamityMod.HardmodeOreTier1Text"; - Color messageColor3 = new Color(50, 255, 130); - WorldGenerationMethods.SpawnOre(TileID.Cobalt, 12E-05, .4f, .6f); - WorldGenerationMethods.SpawnOre(TileID.Palladium, 12E-05, .4f, .6f); - CalamityUtils.DisplayLocalizedText(key3, messageColor3); + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + string key3 = "Mods.CalamityMod.HardmodeOreTier1Text"; + Color messageColor3 = new Color(50, 255, 130); + WorldGenerationMethods.SpawnOre(TileID.Cobalt, 12E-05, .4f, .6f); + WorldGenerationMethods.SpawnOre(TileID.Palladium, 12E-05, .4f, .6f); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); + } } } else if (lastTwinStanding) { // Only drop hallowed bars after all mechs are down - if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); @@ -237,13 +241,13 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss2 || !CalamityConfig.Instance.SellVanillaSummons); - if (!NPC.downedMechBoss2) + if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); } else if (npc.type == NPCID.TheDestroyer) { // Only drop hallowed bars after all mechs are down - if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); @@ -258,13 +262,13 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss1 || !CalamityConfig.Instance.SellVanillaSummons); - if (!NPC.downedMechBoss1) + if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); } else if (npc.type == NPCID.SkeletronPrime) { // Only drop hallowed bars after all mechs are down - if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); @@ -280,7 +284,7 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss3 || !CalamityConfig.Instance.SellVanillaSummons); - if (!NPC.downedMechBoss3) + if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); } else if (npc.type == NPCID.Plantera) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 7cd203eb0f..2f1bbe799b 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1017,27 +1017,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool CheckActive() => canDespawn; - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - Rectangle targetHitbox = target.Hitbox; - - float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); - - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; - - return minDist <= 100f; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 2; k++) diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 699e1db6e9..9b24365075 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -114,11 +114,11 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.dayTime) { - dialogue.Add("Like I always say, when you're drunk you can tolerate annoying people a lot more easily..."); + dialogue.Add("Like I always say, when you're drunk you can tolerate annoying people a lot easier..."); dialogue.Add("I'm literally balls drunk off my sass right now."); dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind. Probably both."); dialogue.Add("When I'm drunk I'm way happier...at least until the talking worms start to appear."); - dialogue.Add("I should reprogram the whole game while drunk and send it back to the testers."); + dialogue.Add("I should reprogram the whole game, while drunk, and send it back to the testers."); dialogue.Add("What a great day, might just drink so much that I get poisoned again."); } else diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2853ace474..1a98e8bd61 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -362,10 +362,13 @@ namespace CalamityMod.Projectiles if (defDamage == 0) { // Reduce mech boss projectile damage depending on the new ore progression changes - if (!NPC.downedMechBossAny) - projectile.damage = (int)(projectile.damage * 0.8); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - projectile.damage = (int)(projectile.damage * 0.9); + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + if (!NPC.downedMechBossAny) + projectile.damage = (int)(projectile.damage * 0.8); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + projectile.damage = (int)(projectile.damage * 0.9); + } defDamage = projectile.damage; } @@ -971,20 +974,23 @@ namespace CalamityMod.Projectiles } // Reduce mech boss projectile damage depending on the new ore progression changes - if (!NPC.downedMechBossAny) + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - if (MechBossProjectileIDs.Contains(projectile.type)) + if (!NPC.downedMechBossAny) { - if (CalamityUtils.AnyBossNPCS(true)) - projectile.damage = (int)(projectile.damage * 0.8); + if (MechBossProjectileIDs.Contains(projectile.type)) + { + if (CalamityUtils.AnyBossNPCS(true)) + projectile.damage = (int)(projectile.damage * 0.8); + } } - } - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - { - if (MechBossProjectileIDs.Contains(projectile.type)) + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (CalamityUtils.AnyBossNPCS(true)) - projectile.damage = (int)(projectile.damage * 0.9); + if (MechBossProjectileIDs.Contains(projectile.type)) + { + if (CalamityUtils.AnyBossNPCS(true)) + projectile.damage = (int)(projectile.damage * 0.9); + } } } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index eb9cffe787..c8971770ab 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -194,7 +194,7 @@ namespace CalamityMod.Tiles Gore.NewGore(new Vector2(i, j) * 16, Main.rand.NextVector2CircularEdge(3f, 3f), mod.GetGoreSlot("Gores/SulphSeaGen/SulphPotGore2")); } } - else if (type == TileID.DemonAltar) + else if (type == TileID.DemonAltar && CalamityConfig.Instance.EarlyHardmodeProgressionRework) { int quantity = 6; Vector2 pos = new Vector2(i, j) * 16; diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index a26a1f69c7..fd2e8bb769 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -108,7 +108,7 @@ namespace CalamityMod NPC npc = Main.npc[i]; if (npc.IsABoss()) { - // Added due to the new mech boss ore progression, return true if any mech is alive and checkForMechs is true, reduces mech boss projectile damage if true + // Added due to the new mech boss ore progression, return true if any mech is alive and checkForMechs is true, reduces mech boss projectile damage if true. if (checkForMechs) return npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer; return true; From f82dfe34ece1a98a481a05889d60d4c9754e6e77 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 13 Apr 2021 00:08:19 -0400 Subject: [PATCH 33/43] Reworked afterimage code and added a new form of afterimages for bullets. --- Projectiles/Boss/AstralFlame.cs | 2 +- Projectiles/Boss/AstralLaser.cs | 2 +- Projectiles/Boss/AstralShot2.cs | 2 +- Projectiles/Boss/BigFlare.cs | 2 +- Projectiles/Boss/BigFlare2.cs | 2 +- Projectiles/Boss/BrimstoneBarrage.cs | 2 +- Projectiles/Boss/BrimstoneHellblast.cs | 2 +- Projectiles/Boss/BrimstoneHellfireball.cs | 2 +- Projectiles/Boss/DarkEnergyBall.cs | 2 +- Projectiles/Boss/DarkEnergyBall2.cs | 2 +- Projectiles/Boss/DarkOrb.cs | 2 +- Projectiles/Boss/DoGFire.cs | 2 +- Projectiles/Boss/Flare.cs | 2 +- Projectiles/Boss/FrostMist.cs | 2 +- Projectiles/Boss/GreatSandBlast.cs | 2 +- Projectiles/Boss/HiveBombGoliath.cs | 2 +- Projectiles/Boss/JewelProjectile.cs | 2 +- Projectiles/Boss/OldDukeGore.cs | 2 +- Projectiles/Boss/OldDukeSummonDrop.cs | 2 +- Projectiles/Boss/OldDukeVortex.cs | 2 +- Projectiles/Boss/ProfanedSpear.cs | 2 +- Projectiles/Boss/RedLightningFeather.cs | 2 +- Projectiles/Boss/SandBlast.cs | 2 +- Projectiles/Boss/ScavengerLaser.cs | 2 +- Projectiles/Boss/SignusScythe.cs | 2 +- Projectiles/Boss/SirenSong.cs | 2 +- Projectiles/Boss/SporeGasPlantera.cs | 2 +- Projectiles/Boss/WaterSpear.cs | 2 +- Projectiles/Boss/YharonFireball2.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 85 ---------- .../DraedonsArsenal/PoleWarperSummon.cs | 2 +- .../DraedonsArsenal/SnakeEyesSummon.cs | 2 +- .../DraedonsArsenal/StarSwallowerAcid.cs | 2 +- .../DraedonsArsenal/TrackingDiskProjectile.cs | 2 +- Projectiles/Enemy/BelchingCoralSpike.cs | 2 +- Projectiles/Enemy/CrabBoulder.cs | 2 +- Projectiles/Enemy/FlakAcid.cs | 2 +- Projectiles/Enemy/GammaAcid.cs | 2 +- Projectiles/Enemy/MantisRing.cs | 2 +- Projectiles/Environment/AcidDrop.cs | 2 +- Projectiles/Magic/AquamarineBolt.cs | 2 +- Projectiles/Magic/Asteroid.cs | 2 +- Projectiles/Magic/AsteroidMolten.cs | 2 +- Projectiles/Magic/AstralCrystal.cs | 2 +- Projectiles/Magic/AstralStarMagic.cs | 2 +- Projectiles/Magic/AstralachneaFang.cs | 2 +- Projectiles/Magic/BeastScythe.cs | 2 +- Projectiles/Magic/BrimstoneFireball.cs | 2 +- .../Magic/BrimstoneHellfireballFriendly.cs | 2 +- Projectiles/Magic/ClamorNoctusStar.cs | 2 +- Projectiles/Magic/DivineRetributionSpear.cs | 2 +- Projectiles/Magic/EelDrop.cs | 2 +- Projectiles/Magic/EidolicWailSoundwave.cs | 2 +- Projectiles/Magic/EventHorizonStar.cs | 2 +- Projectiles/Magic/FlareBoltProjectile.cs | 2 +- Projectiles/Magic/ForbiddenAxeBlade.cs | 2 +- .../Magic/FrigidflashBoltProjectile.cs | 2 +- Projectiles/Magic/FrostBoltProjectile.cs | 2 +- Projectiles/Magic/GammaLaser.cs | 2 +- Projectiles/Magic/GhastlyBlast.cs | 2 +- Projectiles/Magic/HadopelagicEcho2.cs | 2 +- Projectiles/Magic/HadopelagicEchoSoundwave.cs | 2 +- Projectiles/Magic/HellwingPillar.cs | 2 +- Projectiles/Magic/IceCluster.cs | 2 +- Projectiles/Magic/IonBlast.cs | 2 +- Projectiles/Magic/LuxorsGiftMagic.cs | 2 +- Projectiles/Magic/MiasmaGas.cs | 2 +- Projectiles/Magic/NuclearFuryProjectile.cs | 2 +- Projectiles/Magic/PhantasmalFuryProj.cs | 2 +- Projectiles/Magic/RougeSlashLarge.cs | 2 +- Projectiles/Magic/RougeSlashMedium.cs | 2 +- Projectiles/Magic/RougeSlashSmall.cs | 2 +- Projectiles/Magic/SanguineFlareProj.cs | 2 +- .../SeethingDischargeBrimstoneBarrage.cs | 2 +- .../SeethingDischargeBrimstoneHellblast.cs | 2 +- Projectiles/Magic/ShiftingSandsProj.cs | 2 +- Projectiles/Magic/SirensSongNote.cs | 2 +- Projectiles/Magic/SlitheringEelProjectile.cs | 2 +- Projectiles/Magic/Snowflake.cs | 2 +- Projectiles/Magic/Starblast.cs | 2 +- Projectiles/Magic/StickyFeather.cs | 2 +- Projectiles/Magic/TearsofHeavenProjectile.cs | 2 +- Projectiles/Magic/TradewindsProjectile.cs | 2 +- Projectiles/Magic/UndinesRetributionSpear.cs | 2 +- Projectiles/Magic/Vehemence.cs | 2 +- Projectiles/Magic/VenusianBolt.cs | 2 +- Projectiles/Magic/VenusianFlame.cs | 2 +- Projectiles/Magic/VitriolicViperFang.cs | 2 +- Projectiles/Magic/Vortex.cs | 2 +- Projectiles/Magic/WyvernFeatherGreen.cs | 2 +- Projectiles/Magic/WyvernFeatherPink.cs | 2 +- Projectiles/Magic/WyvernFeatherPurple.cs | 2 +- Projectiles/Melee/AstralScytheProjectile.cs | 2 +- .../Melee/BalefulHarvesterProjectile.cs | 2 +- Projectiles/Melee/BiomeOrb.cs | 2 +- Projectiles/Melee/BlazingPhantomBlade.cs | 2 +- Projectiles/Melee/BloodyBlade.cs | 2 +- Projectiles/Melee/Brimlash2.cs | 2 +- Projectiles/Melee/BrimlashProj.cs | 2 +- Projectiles/Melee/BurningMeteor.cs | 2 +- Projectiles/Melee/CometQuasherMeteor.cs | 2 +- Projectiles/Melee/CrescentMoonProj.cs | 2 +- Projectiles/Melee/Cyclone.cs | 2 +- Projectiles/Melee/Dark.cs | 2 +- Projectiles/Melee/DarkBeam.cs | 2 +- Projectiles/Melee/DemonBlast.cs | 2 +- Projectiles/Melee/DevilsSunriseCyclone.cs | 2 +- Projectiles/Melee/DivineHatchetBoomerang.cs | 2 +- Projectiles/Melee/DracoBeam.cs | 2 +- Projectiles/Melee/DracoBeam2.cs | 2 +- Projectiles/Melee/ElementalExcaliburBeam.cs | 2 +- Projectiles/Melee/EmpyreanKnife.cs | 2 +- Projectiles/Melee/EssenceBeam.cs | 2 +- Projectiles/Melee/EssenceFireball.cs | 2 +- Projectiles/Melee/EssenceScythe.cs | 2 +- Projectiles/Melee/ExoGladComet.cs | 2 +- Projectiles/Melee/ExoGladSpears.cs | 2 +- Projectiles/Melee/ExoGladiusBeam.cs | 2 +- Projectiles/Melee/Exobeam.cs | 2 +- Projectiles/Melee/Exocomet.cs | 2 +- Projectiles/Melee/FallenPaladinsHammerProj.cs | 2 +- .../Melee/ForbiddenOathbladeProjectile.cs | 2 +- Projectiles/Melee/GaelSkull.cs | 2 +- Projectiles/Melee/GaelSkull2.cs | 2 +- Projectiles/Melee/GalacticaComet.cs | 2 +- Projectiles/Melee/Galaxia.cs | 2 +- Projectiles/Melee/Galaxia2.cs | 2 +- Projectiles/Melee/GalaxySmasherHammer.cs | 2 +- Projectiles/Melee/GalaxyStar.cs | 2 +- Projectiles/Melee/GalileosMoon.cs | 2 +- Projectiles/Melee/GalileosPlanet.cs | 2 +- Projectiles/Melee/GelWave.cs | 2 +- Projectiles/Melee/GhastlySoulLarge.cs | 2 +- Projectiles/Melee/GhastlySoulMedium.cs | 2 +- Projectiles/Melee/GhastlySoulSmall.cs | 2 +- Projectiles/Melee/GreenWater.cs | 2 +- Projectiles/Melee/HellionSpike.cs | 2 +- Projectiles/Melee/HyperBlade.cs | 2 +- Projectiles/Melee/Iceberg.cs | 2 +- Projectiles/Melee/IllustriousKnife.cs | 2 +- Projectiles/Melee/InsidiousHarpoon.cs | 2 +- Projectiles/Melee/JudgementBlah.cs | 2 +- Projectiles/Melee/LifeScythe.cs | 2 +- Projectiles/Melee/Light.cs | 2 +- Projectiles/Melee/LightBeam.cs | 2 +- Projectiles/Melee/LuxorsGiftMelee.cs | 2 +- .../Melee/MeldGreatswordBigProjectile.cs | 2 +- .../Melee/MeldGreatswordMediumProjectile.cs | 2 +- .../Melee/MeldGreatswordSmallProjectile.cs | 2 +- Projectiles/Melee/MirrorBlast.cs | 2 +- Projectiles/Melee/MourningSkull.cs | 2 +- Projectiles/Melee/Oathblade.cs | 2 +- Projectiles/Melee/OceanBeam.cs | 2 +- Projectiles/Melee/OmegaBiomeOrb.cs | 2 +- Projectiles/Melee/PlagueBeeDust.cs | 2 +- Projectiles/Melee/PlagueDust.cs | 2 +- Projectiles/Melee/PrismaticWave.cs | 2 +- Projectiles/Melee/PwnagehammerProj.cs | 2 +- Projectiles/Melee/Razorwind.cs | 2 +- Projectiles/Melee/SHIV.cs | 2 +- Projectiles/Melee/SandBlade.cs | 2 +- Projectiles/Melee/ScourgeoftheCosmosProj.cs | 2 +- Projectiles/Melee/SoulScythe.cs | 2 +- Projectiles/Melee/StarnightBeam.cs | 2 +- Projectiles/Melee/StellarContemptHammer.cs | 2 +- Projectiles/Melee/StormBeam.cs | 2 +- Projectiles/Melee/StormRulerProj.cs | 2 +- Projectiles/Melee/SunlightBlade.cs | 2 +- .../Melee/TenebreusTidesWaterProjectile.cs | 2 +- Projectiles/Melee/TerraBall.cs | 2 +- Projectiles/Melee/TerrorBeam.cs | 2 +- Projectiles/Melee/TriactisHammerProj.cs | 2 +- Projectiles/Melee/TrueBiomeOrb.cs | 2 +- .../Melee/TrueCausticEdgeProjectile.cs | 2 +- Projectiles/Melee/VoidEssence.cs | 2 +- Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs | 2 +- Projectiles/Melee/Yoyos/AortaYoyo.cs | 2 +- Projectiles/Melee/Yoyos/AzathothYoyo.cs | 2 +- Projectiles/Melee/Yoyos/ChaotrixYoyo.cs | 2 +- Projectiles/Melee/Yoyos/LaceratorYoyo.cs | 2 +- Projectiles/Melee/Yoyos/MicrowaveYoyo.cs | 2 +- Projectiles/Melee/Yoyos/ObliteratorYoyo.cs | 2 +- Projectiles/Melee/Yoyos/OblivionYoyo.cs | 2 +- Projectiles/Melee/Yoyos/OracleYoyo.cs | 2 +- Projectiles/Melee/Yoyos/SolarFlareYoyo.cs | 2 +- .../Melee/Yoyos/SulphurousGrabberYoyo.cs | 2 +- Projectiles/Melee/Yoyos/VerdantYoyo.cs | 2 +- Projectiles/Ranged/AstralCannonProjectile.cs | 2 +- Projectiles/Ranged/AstralRound.cs | 2 +- Projectiles/Ranged/AstrealArrow.cs | 2 +- Projectiles/Ranged/BallistaGreatArrow.cs | 2 +- Projectiles/Ranged/BloodfireArrowProj.cs | 2 +- Projectiles/Ranged/BloodflareSoul.cs | 2 +- Projectiles/Ranged/Bolt.cs | 2 +- Projectiles/Ranged/CardClub.cs | 2 +- Projectiles/Ranged/CardClubSplit.cs | 2 +- Projectiles/Ranged/CardDiamond.cs | 2 +- Projectiles/Ranged/CardHeart.cs | 2 +- Projectiles/Ranged/CardSpade.cs | 2 +- Projectiles/Ranged/ClaretCannonProj.cs | 2 +- Projectiles/Ranged/ContagionArrow.cs | 2 +- Projectiles/Ranged/DragonBurst.cs | 2 +- Projectiles/Ranged/ElysianArrowProj.cs | 2 +- Projectiles/Ranged/FeatherLarge.cs | 2 +- Projectiles/Ranged/FlakKrakenProj.cs | 2 +- .../Ranged/HighExplosivePeanutShell.cs | 2 +- Projectiles/Ranged/LeafArrow.cs | 2 +- Projectiles/Ranged/LuxorsGiftRanged.cs | 2 +- Projectiles/Ranged/MagnaStrike.cs | 2 +- Projectiles/Ranged/MagnomalyRocket.cs | 2 +- Projectiles/Ranged/Nanomachine.cs | 2 +- Projectiles/Ranged/NorfleetComet.cs | 2 +- Projectiles/Ranged/Nuke.cs | 2 +- Projectiles/Ranged/OnyxSharkBomb.cs | 2 +- Projectiles/Ranged/OpalStrike.cs | 2 +- Projectiles/Ranged/PlagueArrow.cs | 2 +- Projectiles/Ranged/PlanarRipperBolt.cs | 2 +- Projectiles/Ranged/PlasmaBlast.cs | 2 +- Projectiles/Ranged/RainbowBlast.cs | 2 +- Projectiles/Ranged/SandstormBullet.cs | 2 +- Projectiles/Ranged/SeasSearingBubble.cs | 2 +- Projectiles/Ranged/ShockblastRound.cs | 2 +- Projectiles/Ranged/Shroom.cs | 2 +- Projectiles/Ranged/SicknessRound.cs | 2 +- Projectiles/Ranged/SicknessRound2.cs | 2 +- Projectiles/Ranged/SporeBomb.cs | 2 +- Projectiles/Ranged/SputterComet.cs | 2 +- Projectiles/Ranged/SputterCometBig.cs | 2 +- Projectiles/Ranged/SpykerProj.cs | 2 +- Projectiles/Ranged/ThePackMissile.cs | 2 +- Projectiles/Ranged/ToxicannonDrop.cs | 2 +- Projectiles/Ranged/ToxicannonShot.cs | 2 +- Projectiles/Ranged/Voidragon.cs | 2 +- Projectiles/Rogue/AccretionDisk2.cs | 2 +- Projectiles/Rogue/AccretionDiskProj.cs | 2 +- Projectiles/Rogue/AcidBarrelDrop.cs | 2 +- Projectiles/Rogue/AntumbraShardProjectile.cs | 2 +- Projectiles/Rogue/AuroradicalSplitter.cs | 2 +- Projectiles/Rogue/AuroradicalStar.cs | 2 +- Projectiles/Rogue/BlastBarrelProjectile.cs | 2 +- Projectiles/Rogue/BlazingStarProj.cs | 2 +- Projectiles/Rogue/BloodsoakedCrashax.cs | 2 +- .../Rogue/BouncingEyeballProjectile.cs | 2 +- .../BouncingEyeballProjectileStealthStrike.cs | 2 +- Projectiles/Rogue/ButcherKnife.cs | 2 +- Projectiles/Rogue/CarvingFork.cs | 2 +- Projectiles/Rogue/Celestus2.cs | 2 +- Projectiles/Rogue/CelestusBoomerang.cs | 2 +- Projectiles/Rogue/CinquedeaProj.cs | 2 +- Projectiles/Rogue/CorpusAvertorClone.cs | 2 +- Projectiles/Rogue/CorpusAvertorProj.cs | 2 +- Projectiles/Rogue/CorpusAvertorStealth.cs | 2 +- Projectiles/Rogue/CosmicScythe.cs | 2 +- Projectiles/Rogue/CrystalPiercerProjectile.cs | 2 +- Projectiles/Rogue/DeificThunderboltProj.cs | 2 +- Projectiles/Rogue/DestructionBolt.cs | 2 +- Projectiles/Rogue/DukesDecapitatorProj.cs | 2 +- Projectiles/Rogue/DuneHopperProjectile.cs | 2 +- Projectiles/Rogue/EclipsesFallMain.cs | 2 +- Projectiles/Rogue/EclipsesStealth.cs | 2 +- Projectiles/Rogue/EnchantedAxeProj.cs | 2 +- Projectiles/Rogue/EquanimityProj.cs | 2 +- Projectiles/Rogue/EradicatorProjectile.cs | 2 +- Projectiles/Rogue/ExecutionersBladeProj.cs | 2 +- .../Rogue/ExecutionersBladeStealthProj.cs | 2 +- Projectiles/Rogue/FantasyTalismanProj.cs | 2 +- Projectiles/Rogue/FantasyTalismanStealth.cs | 2 +- Projectiles/Rogue/Fork.cs | 2 +- Projectiles/Rogue/GhoulishGougerBoomerang.cs | 2 +- Projectiles/Rogue/GlaiveProj.cs | 2 +- Projectiles/Rogue/GodsParanoiaDart.cs | 2 +- Projectiles/Rogue/GodsParanoiaProj.cs | 2 +- Projectiles/Rogue/GreenDonkeyKongReference.cs | 2 +- .../Rogue/HeavenfallenStardiskBoomerang.cs | 2 +- Projectiles/Rogue/HypothermiaChunk.cs | 2 +- Projectiles/Rogue/InfernalFireballEruption.cs | 2 +- Projectiles/Rogue/InfernalKrisProjectile.cs | 4 +- Projectiles/Rogue/InfernalSpearProjectile.cs | 2 +- Projectiles/Rogue/JawsProjectile.cs | 2 +- Projectiles/Rogue/KelvinCatalystBoomerang.cs | 2 +- Projectiles/Rogue/Knife.cs | 2 +- Projectiles/Rogue/LeonidCometBig.cs | 2 +- Projectiles/Rogue/LeviathanTooth.cs | 2 +- Projectiles/Rogue/LostSoulFriendly.cs | 2 +- Projectiles/Rogue/LuminousStrikerProj.cs | 2 +- Projectiles/Rogue/LunarKunaiProj.cs | 2 +- Projectiles/Rogue/LuxorsGiftRogue.cs | 2 +- Projectiles/Rogue/MalachiteBolt.cs | 2 +- Projectiles/Rogue/MalachiteProj.cs | 2 +- Projectiles/Rogue/MalachiteStealth.cs | 2 +- Projectiles/Rogue/MoltenAmputatorProj.cs | 2 +- Projectiles/Rogue/MonkeyDart.cs | 2 +- Projectiles/Rogue/NanoblackMain.cs | 2 +- Projectiles/Rogue/NanoblackSplit.cs | 2 +- Projectiles/Rogue/NightsGazeProjectile.cs | 2 +- Projectiles/Rogue/NightsGazeStar.cs | 2 +- Projectiles/Rogue/PenumbraBomb.cs | 2 +- Projectiles/Rogue/PenumbraSoul.cs | 2 +- Projectiles/Rogue/PhantasmalRuinProj.cs | 2 +- Projectiles/Rogue/PhantasmalSoul.cs | 2 +- Projectiles/Rogue/PhantomLanceProj.cs | 2 +- Projectiles/Rogue/ProfanedPartisanProj.cs | 2 +- Projectiles/Rogue/Quasar2.cs | 2 +- Projectiles/Rogue/QuasarKnife.cs | 2 +- Projectiles/Rogue/RadiantStar2.cs | 2 +- Projectiles/Rogue/RadiantStarKnife.cs | 2 +- Projectiles/Rogue/ReaperProjectile.cs | 2 +- Projectiles/Rogue/RegulusRiotProj.cs | 2 +- Projectiles/Rogue/SandslasherProj.cs | 2 +- Projectiles/Rogue/ScarletDevilProjectile.cs | 2 +- Projectiles/Rogue/ScourgeoftheDesertProj.cs | 2 +- .../Rogue/ScourgeoftheSeasProjectile.cs | 2 +- Projectiles/Rogue/ShatteredSunKnife.cs | 2 +- .../Rogue/ShatteredSunScorchedBlade.cs | 2 +- Projectiles/Rogue/ShinobiBladeProjectile.cs | 2 +- Projectiles/Rogue/SpearofDestinyProjectile.cs | 2 +- Projectiles/Rogue/SpearofPaleolithProj.cs | 2 +- Projectiles/Rogue/SphereBladed.cs | 2 +- Projectiles/Rogue/SphereBlue.cs | 2 +- Projectiles/Rogue/SphereSpiked.cs | 2 +- Projectiles/Rogue/SphereYellow.cs | 2 +- Projectiles/Rogue/StellarKnifeProj.cs | 2 +- .../Rogue/StormfrontRazorProjectile.cs | 2 +- Projectiles/Rogue/SupernovaBomb.cs | 2 +- Projectiles/Rogue/SylvanSlash.cs | 2 +- Projectiles/Rogue/TalonLargeProj.cs | 2 +- Projectiles/Rogue/TerraDiskProjectile.cs | 2 +- Projectiles/Rogue/TerraDiskProjectile2.cs | 2 +- Projectiles/Rogue/TheSyringeProj.cs | 2 +- Projectiles/Rogue/TimeBoltKnife.cs | 2 +- Projectiles/Rogue/TitaniumClone.cs | 2 +- .../Rogue/TitaniumShurikenProjectile.cs | 2 +- Projectiles/Rogue/TotalityFire.cs | 2 +- Projectiles/Rogue/TurbulanceProjectile.cs | 2 +- Projectiles/Rogue/TurbulanceWindSlash.cs | 2 +- Projectiles/Rogue/ValedictionBoomerang.cs | 2 +- Projectiles/Rogue/VeneratedKnife.cs | 4 +- Projectiles/Summon/AstrageldonLaser.cs | 2 +- Projectiles/Summon/AstralProbeRound.cs | 2 +- Projectiles/Summon/AureusBomber.cs | 2 +- Projectiles/Summon/BrimstoneFireballMinion.cs | 2 +- Projectiles/Summon/ChaosFlame.cs | 2 +- Projectiles/Summon/ColdDivinityPointyThing.cs | 2 +- .../Summon/CosmicViperConcussionMissile.cs | 2 +- Projectiles/Summon/CosmicViperHomingRocket.cs | 2 +- .../Summon/CosmicViperSplittingRocket.cs | 2 +- Projectiles/Summon/EndoCooperBody.cs | 2 +- Projectiles/Summon/EndoCooperLimbs.cs | 2 +- Projectiles/Summon/EndoIceShard.cs | 2 +- Projectiles/Summon/HallowedStarSummon.cs | 2 +- Projectiles/Summon/Hiveling.cs | 2 +- Projectiles/Summon/IceSentryFrostBolt.cs | 2 +- Projectiles/Summon/LuxorsGiftSummon.cs | 2 +- Projectiles/Summon/MagicAxe.cs | 2 +- Projectiles/Summon/MagicBird.cs | 2 +- Projectiles/Summon/MagicHammer.cs | 2 +- Projectiles/Summon/MagicUmbrella.cs | 2 +- Projectiles/Summon/MidnightSunLaser.cs | 2 +- Projectiles/Summon/MidnightSunUFO.cs | 2 +- Projectiles/Summon/MiniGuardianAttack.cs | 2 +- Projectiles/Summon/MiniGuardianDefense.cs | 2 +- Projectiles/Summon/PhantomicDagger.cs | 2 +- Projectiles/Summon/PlantSeed.cs | 2 +- Projectiles/Summon/PlantSeedGreen.cs | 2 +- Projectiles/Summon/PrincessMissile.cs | 2 +- .../Summon/ProfanedSoulCrystalProjectiles.cs | 8 +- Projectiles/Summon/RustShrapnel.cs | 2 +- Projectiles/Summon/TundraFlameBlossomsOrb.cs | 2 +- Projectiles/Typeless/AstralStar.cs | 2 +- Projectiles/Typeless/CursorProj.cs | 2 +- Projectiles/Typeless/CursorProjSplit.cs | 2 +- Projectiles/Typeless/GodKiller.cs | 2 +- Projectiles/Typeless/KelvinCatalystStar.cs | 2 +- .../Typeless/RelicOfDeliveranceSpear.cs | 2 +- Projectiles/Typeless/SkyFlareFriendly.cs | 2 +- Utilities/DrawingUtils.cs | 155 ++++++++++++++++++ Utilities/ProjectileUtils.cs | 3 - 377 files changed, 534 insertions(+), 467 deletions(-) diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index d1ab81c006..941f57c819 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index cfb5c07228..95348812a8 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 2317658c5b..6e8339c448 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BigFlare.cs b/Projectiles/Boss/BigFlare.cs index b95a4deff2..40269dcb88 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 3f6dd37fd3..daea1676fb 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index fd641b51ca..9d1aee2c61 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { lightColor.R = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 796f1e9ebd..054aaf5a77 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { lightColor.R = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 5ced54df1d..0e8d13bc77 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 0a7709dca2..8679461a3c 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); Rectangle frame = new Rectangle(0, projectile.frame * Main.projectileTexture[projectile.type].Height, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]); Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 3bc591c1cf..a0bb70bc01 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); Rectangle frame = new Rectangle(0, projectile.frame * Main.projectileTexture[projectile.type].Height, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]); Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 409f04f5d7..0c1c405672 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -556,7 +556,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 18343e5bd4..5117680e71 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 4a8b5d6abd..26c5708967 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index cc7d85f7b7..767640d779 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index ef3482c5ef..317579eca7 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 801994e971..8664d3061f 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index ef72f0b9ce..9a0f62ee49 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index fde7c930d7..7e91730c8c 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs index b61623666f..2af9d88ab3 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index 0501898f23..d41695bd6e 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index cdda128e97..50788fd531 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 4b30405893..a11a61b777 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, Main.projectileTexture[projectile.type], false); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, Main.projectileTexture[projectile.type], false); return false; } diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 6be48c9506..d32a2ed06e 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index c86cf362b9..4382b285d8 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 06364a720e..80a6341084 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 214f2b29d9..4744daf6e1 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 2f536669b1..34218d8b05 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss default: break; } - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index f7b0b3370d..12289acc5c 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index 6d652aa703..2c6f183f49 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1a98e8bd61..9de7462c78 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1612,91 +1612,6 @@ namespace CalamityMod.Projectiles } return true; } - - public static void DrawCenteredAndAfterimage(Projectile projectile, Color lightColor, int trailingMode, int typeOneDistanceMultiplier = 1, Texture2D texture = null, bool drawCentered = true) - { - if (texture is null) - texture = Main.projectileTexture[projectile.type]; - - int frameHeight = texture.Height / Main.projFrames[projectile.type]; - int frameY = frameHeight * projectile.frame; - float scale = projectile.scale; - float rotation = projectile.rotation; - - Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - Vector2 origin = rectangle.Size() / 2f; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - bool failedToDrawAfterimages = false; - - if (CalamityConfig.Instance.Afterimages) - { - Vector2 centerOffset = drawCentered ? projectile.Size / 2f : Vector2.Zero; - switch (trailingMode) - { - // Standard afterimages. No customizable features other than total afterimage count. - // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. - case 0: - for (int i = 0; i < projectile.oldPos.Length; i++) - { - Vector2 drawPos = projectile.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); - } - break; - - // Paladin's Hammer style afterimages. Can be optionally spaced out further by using the typeOneDistanceMultiplier variable. - // Type 1 afterimages linearly scale down from 66% to 0% opacity. They otherwise do not differ from type 0. - case 1: - Color drawColor = projectile.GetAlpha(lightColor); - int afterimageCount = ProjectileID.Sets.TrailCacheLength[projectile.type]; - int k = 0; - while (k < afterimageCount) - { - Vector2 drawPos = projectile.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. - if (k > 0) - { - float colorMult = (float)(afterimageCount - k); - drawColor *= colorMult / ((float)afterimageCount * 1.5f); - } - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); - k += typeOneDistanceMultiplier; - } - break; - - // Standard afterimages with rotation. No customizable features other than total afterimage count. - // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. - case 2: - for (int i = 0; i < projectile.oldPos.Length; i++) - { - float afterimageRot = projectile.oldRot[i]; - SpriteEffects sfxForThisAfterimage = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - Vector2 drawPos = projectile.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); - } - break; - - default: - failedToDrawAfterimages = true; - break; - } - } - - // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. - if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[projectile.type] <= 0 || failedToDrawAfterimages) - { - Vector2 startPos = drawCentered ? projectile.Center : projectile.position; - Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, projectile.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); - } - } #endregion #region Kill diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 61f235d734..cba32c5bc6 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, 1, 2); + CalamityUtils.DrawAfterimagesCentered(projectile, 1, lightColor, 2); return false; } } diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index 5be2791c08..fe04b4d994 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -256,7 +256,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, Color.White, 0, ProjectileID.Sets.TrailCacheLength[projectile.type]); + CalamityUtils.DrawAfterimagesCentered(projectile, 0, Color.White, ProjectileID.Sets.TrailCacheLength[projectile.type]); Texture2D eyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/SnakeEye"); Vector2 offsetVector = Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness); spriteBatch.Draw(eyeTexture, diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs index 8b27884e2b..3cafa57c5c 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127) * projectile.Opacity, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127) * projectile.Opacity, 2); return false; } } diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index 36394ba750..c74b537ccb 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], ProjectileID.Sets.TrailCacheLength[projectile.type]); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, ProjectileID.Sets.TrailCacheLength[projectile.type]); return false; } } diff --git a/Projectiles/Enemy/BelchingCoralSpike.cs b/Projectiles/Enemy/BelchingCoralSpike.cs index 45b275bbfa..d3d827ddca 100644 --- a/Projectiles/Enemy/BelchingCoralSpike.cs +++ b/Projectiles/Enemy/BelchingCoralSpike.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/CrabBoulder.cs b/Projectiles/Enemy/CrabBoulder.cs index 5d18ac21a0..0a3d6d1b45 100644 --- a/Projectiles/Enemy/CrabBoulder.cs +++ b/Projectiles/Enemy/CrabBoulder.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index 5abc682b56..c21ac0fd3f 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index 880eb45f8c..187ecac66e 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index 407d6830a0..7e328061a3 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index f9f48291f3..23c0d34b99 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Environment public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index e683df01cd..99fb0719c4 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 9b9b6d8fae..19ae131992 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index d57eabad06..794b527a62 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Magic default: break; } - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 9dc596dce5..2f6502238c 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index 7b42610878..1ea18c1fd5 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index be56475489..d8e3d983e0 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index 60581f397b..1fc04aa42d 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 108b2259c1..61eab1f49a 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 9e3e7ceb02..d40e30fc45 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index aa14130c26..4b81df408c 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index 58e84f49c5..635a963990 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/EelDrop.cs b/Projectiles/Magic/EelDrop.cs index c249f14812..30b25a49b0 100644 --- a/Projectiles/Magic/EelDrop.cs +++ b/Projectiles/Magic/EelDrop.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index 5e84778bee..8cf2ea2e50 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index 115e28862e..da3d52b7a1 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index f8063b51ee..4523f665ed 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index 91af3e6eb7..aa3ff8c279 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index e9e5fc4756..782b92609b 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 8dc84cbcdf..093b3619cd 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index b8fd95d0ba..10bf0d52d9 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index 454c363598..061fc8191e 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/HadopelagicEcho2.cs b/Projectiles/Magic/HadopelagicEcho2.cs index ef183b2d14..7a1cf33ad1 100644 --- a/Projectiles/Magic/HadopelagicEcho2.cs +++ b/Projectiles/Magic/HadopelagicEcho2.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HadopelagicEchoSoundwave.cs b/Projectiles/Magic/HadopelagicEchoSoundwave.cs index 0d631b551e..3f00099ef9 100644 --- a/Projectiles/Magic/HadopelagicEchoSoundwave.cs +++ b/Projectiles/Magic/HadopelagicEchoSoundwave.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HellwingPillar.cs b/Projectiles/Magic/HellwingPillar.cs index 0ebaa25551..8aa2d6c872 100644 --- a/Projectiles/Magic/HellwingPillar.cs +++ b/Projectiles/Magic/HellwingPillar.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index e96baa8eed..3cc3ad55a7 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 8215cd5cb6..32412ec0de 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 7b8b3cd489..4ae57912f7 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index 29fb35f4ee..6a0e222b88 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 37f70670f4..df22d82964 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 0ff73a38b2..93bf1dd04b 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index 7cc997146e..3908dbef0d 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashMedium.cs b/Projectiles/Magic/RougeSlashMedium.cs index 6e2dd4aceb..6e3c4ac021 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/RougeSlashSmall.cs b/Projectiles/Magic/RougeSlashSmall.cs index 8e1c209fad..5d61c1bb18 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 164055026a..d480d546cd 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 02d49de02e..6366ab6f4c 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index 98d3092088..99f5ca7523 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index 2b842424c7..92e65748bb 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SirensSongNote.cs b/Projectiles/Magic/SirensSongNote.cs index e76f16e47f..b671eb022c 100644 --- a/Projectiles/Magic/SirensSongNote.cs +++ b/Projectiles/Magic/SirensSongNote.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SlitheringEelProjectile.cs b/Projectiles/Magic/SlitheringEelProjectile.cs index b489a2cf15..283b516c4e 100644 --- a/Projectiles/Magic/SlitheringEelProjectile.cs +++ b/Projectiles/Magic/SlitheringEelProjectile.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 1); return false; } diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index a7ce271023..c6f7c5e7ac 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index 1aebb67f06..74d50123f3 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 7f8eedd116..957bce5890 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index 7bc0f3592d..e568836df2 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index c26db1b84d..26ab9a638d 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index 5701975589..fa231485eb 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 0f9f39ab4b..2b8439f6b7 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 3d0c7dcacb..8b35d7903b 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index e7b70c8a49..28aa1944b6 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index 198aada41d..1bb635035f 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index d0ff3f9e48..bc31bf8bf6 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 5751d5b4a6..fca16747e0 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index 7d03591928..d533c14268 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index 4aad1f99f5..55f3788c84 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/AstralScytheProjectile.cs b/Projectiles/Melee/AstralScytheProjectile.cs index 1ff1d54bb8..cef90409d8 100644 --- a/Projectiles/Melee/AstralScytheProjectile.cs +++ b/Projectiles/Melee/AstralScytheProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index ce4a78deaa..63b2aab92f 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BiomeOrb.cs b/Projectiles/Melee/BiomeOrb.cs index 85434d20df..ad4d990282 100644 --- a/Projectiles/Melee/BiomeOrb.cs +++ b/Projectiles/Melee/BiomeOrb.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 81183c88a5..4cf5a2ce78 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index 0ad3006f0e..223bebbf57 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index c8c52d1ccb..5b3b4c17a1 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 115) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index 549e560076..401d4e76c0 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 2a355713cb..c9ac2cc469 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 175) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index eeac7965b9..cafe691996 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.Calamity().lineColor == 2) tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/CometQuasherMeteor3"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); return false; } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 8d8823bbec..39a122929b 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 8b935d38e5..8bdec6829a 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Dark.cs b/Projectiles/Melee/Dark.cs index 3312cb24a1..2474350bf5 100644 --- a/Projectiles/Melee/Dark.cs +++ b/Projectiles/Melee/Dark.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 57c2fa6946..12e84cb99e 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index f338660fc8..4a553ce29a 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index d479e4abb6..399b6f4361 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs index 57d5875f37..ff43a0d0d5 100644 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ b/Projectiles/Melee/DivineHatchetBoomerang.cs @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index d047335a66..96bb15a463 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index c0b38fb269..ff88917a08 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 235) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 1f20fa538f..2d7dd4f8ad 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -334,7 +334,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 1195) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 14cc693be9..e9903bb639 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index ecc1241a95..04366ca82e 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/EssenceFireball.cs b/Projectiles/Melee/EssenceFireball.cs index 36c4e64058..1a36195859 100644 --- a/Projectiles/Melee/EssenceFireball.cs +++ b/Projectiles/Melee/EssenceFireball.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 115) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 0b513d6ae7..d62ad6e5c3 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/ExoGladComet.cs b/Projectiles/Melee/ExoGladComet.cs index 7623b19596..2f78cd5268 100644 --- a/Projectiles/Melee/ExoGladComet.cs +++ b/Projectiles/Melee/ExoGladComet.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/ExoGladSpears.cs b/Projectiles/Melee/ExoGladSpears.cs index c392e743ff..eaa489c673 100644 --- a/Projectiles/Melee/ExoGladSpears.cs +++ b/Projectiles/Melee/ExoGladSpears.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/ExoGladiusBeam.cs b/Projectiles/Melee/ExoGladiusBeam.cs index abfcda1387..8482233676 100644 --- a/Projectiles/Melee/ExoGladiusBeam.cs +++ b/Projectiles/Melee/ExoGladiusBeam.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 382ada426d..114907d012 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index beda999085..e306fd8ab9 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index aef64d06ec..7b10333b4f 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index a2651d5e87..0ead7493e3 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index 7479a2121a..8e5ffc540a 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index 8c914d33fd..4fbe0627ec 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 85fe73e3c8..19801e407d 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/Galaxia.cs b/Projectiles/Melee/Galaxia.cs index 4fc069d1a4..b2596c7e6c 100644 --- a/Projectiles/Melee/Galaxia.cs +++ b/Projectiles/Melee/Galaxia.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Galaxia2.cs b/Projectiles/Melee/Galaxia2.cs index 7cbeeed844..af30e79825 100644 --- a/Projectiles/Melee/Galaxia2.cs +++ b/Projectiles/Melee/Galaxia2.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index 96b93f1f3c..cd539f4edb 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalaxyStar.cs b/Projectiles/Melee/GalaxyStar.cs index a149589660..5efedec6c9 100644 --- a/Projectiles/Melee/GalaxyStar.cs +++ b/Projectiles/Melee/GalaxyStar.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/GalileosMoon.cs b/Projectiles/Melee/GalileosMoon.cs index 5446d83c83..51c34ef53c 100644 --- a/Projectiles/Melee/GalileosMoon.cs +++ b/Projectiles/Melee/GalileosMoon.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index 3853e7760b..7b658d5500 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 996d4c22a3..46a69dc997 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 195) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 163a7bac13..b35f36eeff 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 0bc7202dd7..aefe6f8984 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 09cd1b6cf6..462b6848e9 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 800cffb86e..875c9525d8 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 145) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index dba9fe779f..ece55b9b9e 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index a77e157d17..c4b8df0d77 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Iceberg.cs b/Projectiles/Melee/Iceberg.cs index b873f494bf..facf53e2fa 100644 --- a/Projectiles/Melee/Iceberg.cs +++ b/Projectiles/Melee/Iceberg.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 68a7cfee06..d5d2bfe1bf 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index f395b7deba..42cc303867 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/JudgementBlah.cs b/Projectiles/Melee/JudgementBlah.cs index 66d9c390b0..dfa50bcd89 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 115) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index 31cf9fbfa8..946a1feb42 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/Light.cs b/Projectiles/Melee/Light.cs index df8fc6a20b..324ee2484f 100644 --- a/Projectiles/Melee/Light.cs +++ b/Projectiles/Melee/Light.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index bad6dee446..eedf5d49ab 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index b5777d5a32..0385f93871 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs index 1529447900..ded6ad31d2 100644 --- a/Projectiles/Melee/MeldGreatswordBigProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs index 5935b9a6e3..9f09ffface 100644 --- a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs index 6dc60f13e7..2d345ff58f 100644 --- a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index ae3fb1ef53..fa16337150 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index 62a5890c41..f969c3ae27 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index ebbde7105f..4959223b36 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index 14eda93e97..ebc7132934 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/OmegaBiomeOrb.cs b/Projectiles/Melee/OmegaBiomeOrb.cs index b04dc85ebc..f31198aa08 100644 --- a/Projectiles/Melee/OmegaBiomeOrb.cs +++ b/Projectiles/Melee/OmegaBiomeOrb.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 235) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 0f7e416f03..47f6fc4133 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index 5d1f2aa715..b67a157084 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index eec9f82e40..c39ee1ab4a 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 355) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index 7e75b2b4ec..c9e603ffae 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index f7f912a065..3251df881d 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index 40091aee13..b5cc8bc429 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/SandBlade.cs b/Projectiles/Melee/SandBlade.cs index f4c092f2f8..1df68774f2 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index c691f9968c..0023f2d0fe 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index cce741c122..c0f10bdb10 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index eb4b348fd8..63e0f7aaf9 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 12b75c38c5..1f1e44af13 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index e889ab6c1b..7e82dfe196 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index 10a9935b4e..021a64ac08 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index b280fdbca4..67a735520c 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 7970a0aa6a..badc2a25c5 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.timeLeft == 300) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TerraBall.cs b/Projectiles/Melee/TerraBall.cs index f5525bf045..3d33d4ebf5 100644 --- a/Projectiles/Melee/TerraBall.cs +++ b/Projectiles/Melee/TerraBall.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 80e81f7d65..6fec0b0ea3 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index 81438bb1ab..9667dce296 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/TrueBiomeOrb.cs b/Projectiles/Melee/TrueBiomeOrb.cs index f6ba37865d..ed8d38750d 100644 --- a/Projectiles/Melee/TrueBiomeOrb.cs +++ b/Projectiles/Melee/TrueBiomeOrb.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index 6df6fc0f28..ae85e36f66 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index 419900e99b..f50278f8c4 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 95) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index f4f9034860..0dfaea5c07 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AortaYoyo.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs index 9dcdd303e6..e5bfcda50f 100644 --- a/Projectiles/Melee/Yoyos/AortaYoyo.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 2dc5d93389..913f86b2b7 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs index 3e1cce6485..4ce0697de8 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index 18af7320a0..a758375420 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 26495a4869..c8440e1a43 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 5197b62cbd..54f1f2c5d9 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index c2e269a9e9..a0ef4e0d6d 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index 80a046368e..accefa75a7 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 550ed61424..eaea97cb2c 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs index d8e736203b..5cfd7e4e36 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (bubbleStronk) { tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); } return false; } diff --git a/Projectiles/Melee/Yoyos/VerdantYoyo.cs b/Projectiles/Melee/Yoyos/VerdantYoyo.cs index ce7e308fc2..e610d28d43 100644 --- a/Projectiles/Melee/Yoyos/VerdantYoyo.cs +++ b/Projectiles/Melee/Yoyos/VerdantYoyo.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/AstralCannonProjectile.cs b/Projectiles/Ranged/AstralCannonProjectile.cs index 1029adf127..a088f395b2 100644 --- a/Projectiles/Ranged/AstralCannonProjectile.cs +++ b/Projectiles/Ranged/AstralCannonProjectile.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 310dd83141..fc12a26277 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index 32b5deb0f5..5b8f6ad345 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index 7e816dd765..35687ea5fb 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 675e8d329f..7e2552fa41 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index f92cb1023e..ea6c1e587a 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index 39101a00fc..8631a4343a 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 16d290ec60..329ce76e73 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index b32aa6aa96..02b0c1a33d 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index ccc514c942..9ca318bdf7 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index 652f803dba..118432c0d9 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index e8277639b8..f35433e32a 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 8f29776de0..034304696c 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index bdb059f307..fc4dc14986 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonBurst.cs index 477ca0e269..a93f6cd13c 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonBurst.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 96bf30968f..fc69453386 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index 434cadd9c1..3bbc1eb80e 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs index b9d7503c49..c6c6448c5e 100644 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ b/Projectiles/Ranged/FlakKrakenProj.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs index 699d0bff09..9f538d6f38 100644 --- a/Projectiles/Ranged/HighExplosivePeanutShell.cs +++ b/Projectiles/Ranged/HighExplosivePeanutShell.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 329aded31a..fcae4dab98 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Ranged/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index 54def4f8b1..accf968003 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/MagnaStrike.cs b/Projectiles/Ranged/MagnaStrike.cs index b78e8904e7..6b27032315 100644 --- a/Projectiles/Ranged/MagnaStrike.cs +++ b/Projectiles/Ranged/MagnaStrike.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 93c862fbbb..7dca67ba5d 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index d64c90f11b..bdda8883bd 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/Nanomachine"); if (projectile.localAI[1] == 2) texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/Nanomachine2"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index c0f3bdb55e..f3161f88a2 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.timeLeft >= 600) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 3117583faf..0396839776 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index ce1f3997f7..f96a4328ab 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index 9ee6f6dac3..b2147a49ec 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 7f53a23154..66f7df7444 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index c83e47946f..92075b8126 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index bc6f5d6735..9a869cb061 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 159a069a2d..630c2fb00b 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index 3cab982af3..9856dfdea1 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index 56554d93b7..37ab014921 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index 6f50bd44ec..e04e62ca1b 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/Shroom.cs b/Projectiles/Ranged/Shroom.cs index 0ac1beb795..af7968804e 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 3b05566b15..2a2f7d6def 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 6d90d0a8e4..39f51dc9ac 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index 9a903726e8..e31407c09b 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 5e04f0dc13..9e173eb246 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 019dc6374a..9f1fd535d1 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index bae846c1a1..296f5d20cc 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index b25734ad75..7a44f17a03 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index dcc306d486..d86a12b2a0 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Ranged/ToxicannonShot.cs b/Projectiles/Ranged/ToxicannonShot.cs index 12e0e16df1..d5d03ff76a 100644 --- a/Projectiles/Ranged/ToxicannonShot.cs +++ b/Projectiles/Ranged/ToxicannonShot.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index e12926a541..8c52e85306 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs index ff42dcebd1..70279c331e 100644 --- a/Projectiles/Rogue/AccretionDisk2.cs +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/AccretionDiskProj.cs b/Projectiles/Rogue/AccretionDiskProj.cs index 57e5b60da6..7c74a1f1c2 100644 --- a/Projectiles/Rogue/AccretionDiskProj.cs +++ b/Projectiles/Rogue/AccretionDiskProj.cs @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Rogue/AcidBarrelDrop.cs index aba26bb898..0c0dc8024e 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Rogue/AcidBarrelDrop.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index d986052c75..b31566cd85 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index 486183ad9c..89ef71f1f2 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 12bc1fb418..fcfa8b70c2 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index c4a70d1fa6..ef4a4b64ca 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) => false; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 55e911b64f..a78454d720 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } // Make the star bounce on tiles. diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 6f3d8f0d34..693e584020 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) //afterimages { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index 25f589cdd5..da8c602865 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index 44ec1498bc..a51307a88c 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 82c6285f99..dcfff20946 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index 2ebf7c5f54..843675e168 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 825b8d27e4..8130ff4581 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CelestusBoomerang.cs b/Projectiles/Rogue/CelestusBoomerang.cs index 29c88a41e5..5630f19e93 100644 --- a/Projectiles/Rogue/CelestusBoomerang.cs +++ b/Projectiles/Rogue/CelestusBoomerang.cs @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index a8f5bb9e5c..d2bbf85c04 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index b11f9d7c61..02e04dc6ba 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 0b5a79e345..708aebe228 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index ac5ede5444..ca101b2025 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 92200be451..feb9d89443 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 30193494be..300be26580 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/DeificThunderboltProj.cs b/Projectiles/Rogue/DeificThunderboltProj.cs index dceeaeb6ef..3459ec91e8 100644 --- a/Projectiles/Rogue/DeificThunderboltProj.cs +++ b/Projectiles/Rogue/DeificThunderboltProj.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 5fa414983f..f467af26f8 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/DukesDecapitatorProj.cs b/Projectiles/Rogue/DukesDecapitatorProj.cs index 8f4b23c6eb..ea1d12b1f4 100644 --- a/Projectiles/Rogue/DukesDecapitatorProj.cs +++ b/Projectiles/Rogue/DukesDecapitatorProj.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/DuneHopperProjectile.cs b/Projectiles/Rogue/DuneHopperProjectile.cs index e94b9eacf2..4a91a280ac 100644 --- a/Projectiles/Rogue/DuneHopperProjectile.cs +++ b/Projectiles/Rogue/DuneHopperProjectile.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], projectile.Calamity().stealthStrike ? 4 : 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, projectile.Calamity().stealthStrike ? 4 : 2); return false; } } diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 122922b198..d97e6978e3 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 8f3e81bde2..50c08293a2 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/EnchantedAxeProj.cs b/Projectiles/Rogue/EnchantedAxeProj.cs index 132d003aa3..d4dceb78db 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Rogue { Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 64ccd4809a..2d8b2cefc3 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3); return false; } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 1c31a875ca..2fd9744884 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index 32c2d268b1..eb6bda0aef 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs index c2d7ed136c..133ede7040 100644 --- a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index d97a13a99f..a46ae0af24 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 2822d57053..375a2e1322 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 25920ab98b..fde3849f1d 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/GhoulishGougerBoomerang.cs b/Projectiles/Rogue/GhoulishGougerBoomerang.cs index fa00e8c386..c348bbf5cd 100644 --- a/Projectiles/Rogue/GhoulishGougerBoomerang.cs +++ b/Projectiles/Rogue/GhoulishGougerBoomerang.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index c6e6478e14..ecfbbd80dd 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GodsParanoiaDart.cs b/Projectiles/Rogue/GodsParanoiaDart.cs index c183d603df..16274da52a 100644 --- a/Projectiles/Rogue/GodsParanoiaDart.cs +++ b/Projectiles/Rogue/GodsParanoiaDart.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index b450910b1d..5aa8c1db79 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs index cec49f3447..506554a2ee 100644 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ b/Projectiles/Rogue/GreenDonkeyKongReference.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index 6eec536b3b..0823f3d4b6 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 05d18001a9..c7f38364e6 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/InfernalFireballEruption.cs b/Projectiles/Rogue/InfernalFireballEruption.cs index d35f8eff92..66f929e739 100644 --- a/Projectiles/Rogue/InfernalFireballEruption.cs +++ b/Projectiles/Rogue/InfernalFireballEruption.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 38309eaec4..1df55c9f15 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue { // If this is a stealth strike, make the blade glow orange Color glowColour = new Color(255, 215, 100, 100); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, glowColour, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], glowColour, 1); float minScale = 1.9f; float maxScale = 2.5f; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); } return false; } diff --git a/Projectiles/Rogue/InfernalSpearProjectile.cs b/Projectiles/Rogue/InfernalSpearProjectile.cs index 37fbcdac0b..002290f245 100644 --- a/Projectiles/Rogue/InfernalSpearProjectile.cs +++ b/Projectiles/Rogue/InfernalSpearProjectile.cs @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index cdde2df040..9b795b46c3 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index 036b0c249b..d02285fe61 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -192,7 +192,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index ae8b5fe06b..98e777439d 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs index a2109daa19..85c4725484 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1); return false; } diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index c0045d9d56..e0ce3791cd 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); if (projectile.Calamity().stealthStrike) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); } return false; } diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 480d759d1c..bb4b79c2b7 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LuminousStrikerProj.cs b/Projectiles/Rogue/LuminousStrikerProj.cs index 9321e1ebf9..0a396d1d7c 100644 --- a/Projectiles/Rogue/LuminousStrikerProj.cs +++ b/Projectiles/Rogue/LuminousStrikerProj.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 60fd36b6ce..2907f37f46 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index 045a593822..643f209599 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index aef7d8e6c2..67e00d910e 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index 936dfd22c1..9055fd8faa 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs index 84a804f37b..0bbcd4fe01 100644 --- a/Projectiles/Rogue/MalachiteStealth.cs +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index 038b475c9f..9774d0e32a 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index b603cf425a..b5f3ad2bc2 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[0] == 1) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } return true; diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs index 809c847a42..633aa0f140 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs index d3ab36ae0d..cb09ac1599 100644 --- a/Projectiles/Rogue/NanoblackSplit.cs +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index d5536f1f7b..e6ca210860 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index da8436154c..f21d7243fd 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, Color.White, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.White, 1); return false; } diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index 3623f4d7ca..d4736abf63 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index fe20a345c1..4a681c5c02 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PhantasmalRuinProj.cs b/Projectiles/Rogue/PhantasmalRuinProj.cs index edafe36ff9..d78a61c7cc 100644 --- a/Projectiles/Rogue/PhantasmalRuinProj.cs +++ b/Projectiles/Rogue/PhantasmalRuinProj.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3); return false; } diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index ebdd9fb1fd..ca4365eeeb 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > Lifetime - NoDrawFrames) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PhantomLanceProj.cs b/Projectiles/Rogue/PhantomLanceProj.cs index 3b5e9cdd46..8a1b9afaea 100644 --- a/Projectiles/Rogue/PhantomLanceProj.cs +++ b/Projectiles/Rogue/PhantomLanceProj.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index 5c91d6ed66..060010e6c6 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/Quasar2.cs b/Projectiles/Rogue/Quasar2.cs index 937d730296..3c961eadd8 100644 --- a/Projectiles/Rogue/Quasar2.cs +++ b/Projectiles/Rogue/Quasar2.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/QuasarKnife.cs b/Projectiles/Rogue/QuasarKnife.cs index f561f73cb6..e70fd7aac8 100644 --- a/Projectiles/Rogue/QuasarKnife.cs +++ b/Projectiles/Rogue/QuasarKnife.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index 6f4ee3b57b..b796f966e3 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index dee98ba9a6..f6b3245958 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index d50ed20b04..e89dc7167d 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 6b9660f93a..316d034937 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/SandslasherProj.cs b/Projectiles/Rogue/SandslasherProj.cs index e8fb161ba1..c56740ffb1 100644 --- a/Projectiles/Rogue/SandslasherProj.cs +++ b/Projectiles/Rogue/SandslasherProj.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 1800f6ae3b..90bb135e6a 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(100, 100, 100), ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(100, 100, 100), 1); return true; } } diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index d1689b3ff4..8ea261ac7d 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index d0139b4f00..11999af4dd 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredSunKnife.cs index 755ec8b1a2..a3e59a3372 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredSunKnife.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index 40f9c9bcf0..42372cc373 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 24cff2fcb4..9ca9add6b2 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index e059580d91..7d12acb713 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 994a8a917c..834978cbc2 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index 4845cc80a0..6660a15e0d 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index 0b1f585b48..0852bd4354 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index a26186c3b5..ad669775fe 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index b6995efcd1..f89f43608a 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 5f9598ffcd..33953839c6 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.cs b/Projectiles/Rogue/StormfrontRazorProjectile.cs index dffc61ae03..e35c8ed7af 100644 --- a/Projectiles/Rogue/StormfrontRazorProjectile.cs +++ b/Projectiles/Rogue/StormfrontRazorProjectile.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 2cbf699315..d303ea6680 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SylvanSlash.cs b/Projectiles/Rogue/SylvanSlash.cs index 8c5abd3973..141448cb15 100644 --- a/Projectiles/Rogue/SylvanSlash.cs +++ b/Projectiles/Rogue/SylvanSlash.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 195) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index 33802c7687..0c3e3943ea 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TerraDiskProjectile.cs b/Projectiles/Rogue/TerraDiskProjectile.cs index 96fc9e5ce4..555472dc94 100644 --- a/Projectiles/Rogue/TerraDiskProjectile.cs +++ b/Projectiles/Rogue/TerraDiskProjectile.cs @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/TerraDiskProjectile2.cs index a8939f92a4..d6299d53d4 100644 --- a/Projectiles/Rogue/TerraDiskProjectile2.cs +++ b/Projectiles/Rogue/TerraDiskProjectile2.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index 7e072065fb..fdfd01b1d8 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index 2b858b757d..43f85f80ae 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -224,7 +224,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/TitaniumClone.cs b/Projectiles/Rogue/TitaniumClone.cs index afd57caf0b..6692827311 100644 --- a/Projectiles/Rogue/TitaniumClone.cs +++ b/Projectiles/Rogue/TitaniumClone.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 338ad4ca77..e62b061cec 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Rogue Texture2D tex = Main.projectileTexture[projectile.type]; if (projectile.Calamity().stealthStrike) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); } else { diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index 627421cb0f..5b3d1bf60a 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index ddc43dccd2..0283aeefe4 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 60ae74c45b..c04ae62df1 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index b52109fefe..5f842d7510 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/VeneratedKnife.cs b/Projectiles/Rogue/VeneratedKnife.cs index 2e944dc3ed..c6bac499a8 100644 --- a/Projectiles/Rogue/VeneratedKnife.cs +++ b/Projectiles/Rogue/VeneratedKnife.cs @@ -73,12 +73,12 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 0f) { Texture2D knife1 = Main.projectileTexture[projectile.type]; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3, knife1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, knife1); } else if (projectile.ai[0] == 1f) { Texture2D knife2 = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/VeneratedKnife2"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3, knife2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, knife2); } return false; } diff --git a/Projectiles/Summon/AstrageldonLaser.cs b/Projectiles/Summon/AstrageldonLaser.cs index 26cd5201d7..44bdf30d64 100644 --- a/Projectiles/Summon/AstrageldonLaser.cs +++ b/Projectiles/Summon/AstrageldonLaser.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index e246811fec..054eec0313 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 1347dfcbc3..3be260cc68 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -269,7 +269,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 8e68c72adb..319d87c8fa 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/ChaosFlame.cs b/Projectiles/Summon/ChaosFlame.cs index f7a54c6364..29a9379eb4 100644 --- a/Projectiles/Summon/ChaosFlame.cs +++ b/Projectiles/Summon/ChaosFlame.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon if (projectile.timeLeft == 300) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/ColdDivinityPointyThing.cs b/Projectiles/Summon/ColdDivinityPointyThing.cs index 552ad4b40c..74ecd0efd6 100644 --- a/Projectiles/Summon/ColdDivinityPointyThing.cs +++ b/Projectiles/Summon/ColdDivinityPointyThing.cs @@ -315,7 +315,7 @@ namespace CalamityMod.Projectiles.Summon { if (!circling || (!circlingPlayer && recharging == 0)) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], !circlingPlayer ? 1 : 3); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, !circlingPlayer ? 1 : 3); } return true; } diff --git a/Projectiles/Summon/CosmicViperConcussionMissile.cs b/Projectiles/Summon/CosmicViperConcussionMissile.cs index c34a69b30f..80fad55789 100644 --- a/Projectiles/Summon/CosmicViperConcussionMissile.cs +++ b/Projectiles/Summon/CosmicViperConcussionMissile.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index 3f3490836b..761a7989c3 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index f14ab583da..72c6ebf811 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -208,7 +208,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 9294fffd71..14a7a88eba 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -340,7 +340,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index 3457d54020..d288f47dca 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.ai[0] == 2f) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index 965991c921..87327db404 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index 05788a4298..2de2d3cab3 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/Hiveling.cs b/Projectiles/Summon/Hiveling.cs index f8b7788367..e869594621 100644 --- a/Projectiles/Summon/Hiveling.cs +++ b/Projectiles/Summon/Hiveling.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index 37eb5687b9..ba44de76e8 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index c61534ae89..861f707d5a 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs index 9384f70adc..fe68c143f5 100644 --- a/Projectiles/Summon/MagicAxe.cs +++ b/Projectiles/Summon/MagicAxe.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs index dd1a6c8d03..5f1eb4a8e0 100644 --- a/Projectiles/Summon/MagicBird.cs +++ b/Projectiles/Summon/MagicBird.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs index aacbc9712b..756aba4ea6 100644 --- a/Projectiles/Summon/MagicHammer.cs +++ b/Projectiles/Summon/MagicHammer.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs index 7594dbf8f5..4546dec019 100644 --- a/Projectiles/Summon/MagicUmbrella.cs +++ b/Projectiles/Summon/MagicUmbrella.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/MidnightSunLaser.cs b/Projectiles/Summon/MidnightSunLaser.cs index 3027455004..94be9d4488 100644 --- a/Projectiles/Summon/MidnightSunLaser.cs +++ b/Projectiles/Summon/MidnightSunLaser.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index b4b30c730c..e80e6b43e0 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index e7a040218b..4a33a82d44 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -211,7 +211,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().endoCooper) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } else diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 58ae8fc8a9..a5854c42a5 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().endoCooper) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } else diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index 8681e74e34..2e356354f3 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon { if (CalamityConfig.Instance.Afterimages) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); } return true; } diff --git a/Projectiles/Summon/PlantSeed.cs b/Projectiles/Summon/PlantSeed.cs index 09ba64cec6..590e7b5078 100644 --- a/Projectiles/Summon/PlantSeed.cs +++ b/Projectiles/Summon/PlantSeed.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Summon/PlantSeedGreen.cs b/Projectiles/Summon/PlantSeedGreen.cs index 78a91fef24..8fd1542a5a 100644 --- a/Projectiles/Summon/PlantSeedGreen.cs +++ b/Projectiles/Summon/PlantSeedGreen.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Summon/PrincessMissile.cs b/Projectiles/Summon/PrincessMissile.cs index c78129b9ca..35f75c92bd 100644 --- a/Projectiles/Summon/PrincessMissile.cs +++ b/Projectiles/Summon/PrincessMissile.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 7feaab6fe9..38e65e8656 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Summon int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y6 = num214 * projectile.frame; Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3, texture2D13); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, texture2D13); return false; } @@ -469,7 +469,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -708,7 +708,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -1300,7 +1300,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/RustShrapnel.cs b/Projectiles/Summon/RustShrapnel.cs index f61d72747e..6af2946d43 100644 --- a/Projectiles/Summon/RustShrapnel.cs +++ b/Projectiles/Summon/RustShrapnel.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/TundraFlameBlossomsOrb.cs b/Projectiles/Summon/TundraFlameBlossomsOrb.cs index 02db424590..d171d9dbc0 100644 --- a/Projectiles/Summon/TundraFlameBlossomsOrb.cs +++ b/Projectiles/Summon/TundraFlameBlossomsOrb.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 110765cd50..33d750b2a0 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index aef6539f04..c4a576318b 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index 12e4a3fe56..9f8a8a602e 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index 24dc7ba3ac..8946685375 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index a364b5756e..ba98f48f8f 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 0db00af1bd..1631c8d6c2 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } // Force the spear to have "priority" when drawing so that it draws over the player. diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 185f408433..88de19c668 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index eec2416998..f095b873b8 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -5,11 +5,166 @@ using System.Reflection; using System.Text; using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ID; namespace CalamityMod { public static partial class CalamityUtils { + #region Projectile Afterimages + /// + /// Draws a projectile as a series of afterimages. The first of these afterimages is centered on the center of the projectile's hitbox.
+ /// This function is guaranteed to draw the projectile itself, even if it has no afterimages and/or the Afterimages config option is turned off. + ///
+ /// The projectile to be drawn. + /// The type of afterimage drawing code to use. Vanilla Terraria has three options: 0, 1, and 2. + /// The light color to use for the afterimages. + /// If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages. + /// The texture to draw. Set to null to draw the projectile's own loaded texture. + /// If false, the afterimages will be centered on the projectile's position instead of its own center. + public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true) + { + if (texture is null) + texture = Main.projectileTexture[proj.type]; + + int frameHeight = texture.Height / Main.projFrames[proj.type]; + int frameY = frameHeight * proj.frame; + float scale = proj.scale; + float rotation = proj.rotation; + + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Vector2 origin = rectangle.Size() / 2f; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (proj.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + // If no afterimages are drawn due to an invalid mode being specified, ensure the projectile itself is drawn anyway. + bool failedToDrawAfterimages = false; + + if (CalamityConfig.Instance.Afterimages) + { + Vector2 centerOffset = drawCentered ? proj.Size / 2f : Vector2.Zero; + switch (mode) + { + // Standard afterimages. No customizable features other than total afterimage count. + // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 0: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); + } + break; + + // Paladin's Hammer style afterimages. Can be optionally spaced out further by using the typeOneDistanceMultiplier variable. + // Type 1 afterimages linearly scale down from 66% to 0% opacity. They otherwise do not differ from type 0. + case 1: + // Safety check: the loop must increment + int increment = Math.Max(1, typeOneIncrement); + Color drawColor = proj.GetAlpha(lightColor); + int afterimageCount = ProjectileID.Sets.TrailCacheLength[proj.type]; + int k = 0; + while (k < afterimageCount) + { + Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. + if (k > 0) + { + float colorMult = (float)(afterimageCount - k); + drawColor *= colorMult / ((float)afterimageCount * 1.5f); + } + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); + k += increment; + } + break; + + // Standard afterimages with rotation. No customizable features other than total afterimage count. + // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 2: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + float afterimageRot = proj.oldRot[i]; + SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); + } + break; + + default: + failedToDrawAfterimages = true; + break; + } + } + + // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. + if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) + { + Vector2 startPos = drawCentered ? proj.Center : proj.position; + Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY), rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); + } + } + + // Used for bullets. This lets you draw afterimages while keeping the hitbox at the front of the projectile. + // This supports type 0 and type 2 afterimages. Vanilla bullets never have type 2 afterimages. + public static void DrawAfterimagesFromEdge(Projectile proj, int mode, Color lightColor, Texture2D texture = null) + { + if (texture is null) + texture = Main.projectileTexture[proj.type]; + + int frameHeight = texture.Height / Main.projFrames[proj.type]; + int frameY = frameHeight * proj.frame; + float scale = proj.scale; + float rotation = proj.rotation; + + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + + SpriteEffects spriteEffects = SpriteEffects.None; + if (proj.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Vector2 drawOrigin = new Vector2(texture.Width * 0.5f, proj.height * 0.5f); + + switch (mode) + { + default: // If you specify an afterimage mode other than 0 or 2, you get nothing. + return; + + // Standard afterimages. No customizable features other than total afterimage count. + // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 0: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, drawOrigin, scale, spriteEffects, 0f); + } + return; + + // Standard afterimages with rotation. No customizable features other than total afterimage count. + // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 2: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + float afterimageRot = proj.oldRot[i]; + SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, drawOrigin, scale, sfxForThisAfterimage, 0f); + } + return; + } + } + #endregion + public static void DrawItemGlowmaskSingleFrame(this Item item, SpriteBatch spriteBatch, float rotation, Texture2D glowmaskTexture) { Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f - 2f); diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 70fb715a21..b1fb0e3b10 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -1,6 +1,4 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -15,7 +13,6 @@ namespace CalamityMod { public static partial class CalamityUtils { - public static int CountProjectiles(int Type) => Main.projectile.Count(proj => proj.type == Type && proj.active); public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer); From 361f31f7f59fb22fe7bff79d4a93cd8b590830fa Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 13 Apr 2021 00:08:39 -0400 Subject: [PATCH 34/43] 1 - Fixed hitbox alignment for all bullets. 2 - Improved Terra Bullet dust. --- Projectiles/Ranged/AccelerationBulletProj.cs | 5 +- Projectiles/Ranged/AcidBulletProj.cs | 8 +- Projectiles/Ranged/BloodfireBulletProj.cs | 2 +- Projectiles/Ranged/EnhancedNanoRoundProj.cs | 8 +- Projectiles/Ranged/FlashBulletProj.cs | 8 +- Projectiles/Ranged/FrostsparkBulletProj.cs | 6 +- Projectiles/Ranged/HolyFireBulletProj.cs | 7 +- Projectiles/Ranged/HyperiusBulletProj.cs | 6 +- Projectiles/Ranged/HyperiusSplit.cs | 7 +- Projectiles/Ranged/IcyBulletProj.cs | 9 +- Projectiles/Ranged/SuperballBulletProj.cs | 5 +- Projectiles/Ranged/TerraBulletMain.cs | 47 ++++------ Projectiles/Ranged/VeriumBulletProj.cs | 99 ++++++++++---------- 13 files changed, 104 insertions(+), 113 deletions(-) diff --git a/Projectiles/Ranged/AccelerationBulletProj.cs b/Projectiles/Ranged/AccelerationBulletProj.cs index f9b5f0f118..538bc171bf 100644 --- a/Projectiles/Ranged/AccelerationBulletProj.cs +++ b/Projectiles/Ranged/AccelerationBulletProj.cs @@ -10,13 +10,14 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Acceleration Bullet"); + DisplayName.SetDefault("Acceleration Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { + // Intentionally large bullet hitbox because this thing speeds up significantly projectile.width = 8; projectile.height = 8; projectile.aiStyle = 1; @@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, null, false); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/AcidBulletProj.cs b/Projectiles/Ranged/AcidBulletProj.cs index ed00aa6163..6263961108 100644 --- a/Projectiles/Ranged/AcidBulletProj.cs +++ b/Projectiles/Ranged/AcidBulletProj.cs @@ -11,15 +11,15 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Acid Bullet"); + DisplayName.SetDefault("Acid Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index 96aa569f8a..48f524a454 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index 2e3f3e5e69..1a00399717 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Nano Round"); + DisplayName.SetDefault("Enhanced Nano Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/FlashBulletProj.cs b/Projectiles/Ranged/FlashBulletProj.cs index de9c60d85f..be5639c264 100644 --- a/Projectiles/Ranged/FlashBulletProj.cs +++ b/Projectiles/Ranged/FlashBulletProj.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Flash Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/FrostsparkBulletProj.cs b/Projectiles/Ranged/FrostsparkBulletProj.cs index 72f0dfa94d..5270fed82a 100644 --- a/Projectiles/Ranged/FrostsparkBulletProj.cs +++ b/Projectiles/Ranged/FrostsparkBulletProj.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index 2a36f61514..fa1f1d1cfe 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -22,8 +22,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + // Intentionally large bullet hitbox + projectile.width = 8; + projectile.height = 8; projectile.friendly = true; projectile.ranged = true; projectile.extraUpdates = 4; @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 2f0713c0b3..383ebb69ba 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 31670b1b7b..7705520b29 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { + // Intentionally large bullet hitbox to make Hyperius swarm more forgiving with hits projectile.width = 8; projectile.height = 8; projectile.aiStyle = 1; @@ -51,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft == 360) - return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + if (projectile.timeLeft == 360) + return false; + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs index 3cad98ad52..b8eb0fe003 100644 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ b/Projectiles/Ranged/IcyBulletProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class IcyBulletProj : ModProjectile { + public override void SetStaticDefaults() => DisplayName.SetDefault("Icy Bullet"); + public override void SetDefaults() { projectile.width = 4; @@ -22,12 +24,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; - projectile.coldDamage = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icy Bullet"); + projectile.coldDamage = true; } public override void AI() diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs index d46834f706..d435908395 100644 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ b/Projectiles/Ranged/SuperballBulletProj.cs @@ -10,13 +10,14 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Superball Bullet"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { + // Intentionally large bullet hitbox because this thing speeds up significantly projectile.width = 8; projectile.height = 8; projectile.aiStyle = 1; @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index db3ce4ef4a..a91129acef 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -11,60 +11,51 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Terra Bullet"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; projectile.timeLeft = 600; projectile.alpha = 255; projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(projectile.Center, 0f, 0.4f, 0f); + + // localAI is used as an invisibility counter. The bullet fades into existence after 15 startup frames. projectile.localAI[0] += 1f; if (projectile.localAI[0] >= 6f) { + // After 15 frames, the alpha will be exactly 0 if (projectile.alpha > 0) - { projectile.alpha -= 17; - } - for (int num136 = 0; num136 < 2; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.8f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + + // Dust type 74, scale 0.8, no gravity, no light, no velocity + Vector2 pos = projectile.Center - projectile.velocity * 0.1f; + Dust d = Dust.NewDustDirect(pos, 0, 0, 74, Scale: 0.8f); + d.position = pos; + d.velocity = Vector2.Zero; + d.noGravity = true; + d.noLight = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; } public override void Kill(int timeLeft) @@ -73,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int b = 0; b < 2; b++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 6324b18c2a..f4e80796b6 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -1,54 +1,53 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class VeriumBulletProj : ModProjectile - { + public class VeriumBulletProj : ModProjectile + { private float speed = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verium Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = 2; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 2; + projectile.timeLeft = 600; + projectile.extraUpdates = 1; + aiType = ProjectileID.Bullet; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } - public override bool PreAI() - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; - if (Main.rand.NextBool(2)) - { - int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[purple].alpha = projectile.alpha; - Main.dust[purple].velocity *= 0f; - Main.dust[purple].noGravity = true; - } + public override bool PreAI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[purple].alpha = projectile.alpha; + Main.dust[purple].velocity *= 0f; + Main.dust[purple].noGravity = true; + } if (projectile.ai[0] > 0f) projectile.ai[0]--; @@ -114,24 +113,24 @@ namespace CalamityMod.Projectiles.Ranged return false; } return true; - } + } public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f; - public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; + public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { projectile.ai[0] = 10f; - projectile.damage /= 2; + projectile.damage /= 2; if (target.life > 0) projectile.ai[1] = target.whoAmI; - } + } - public override void OnHitPvp(Player target, int damage, bool crit) - { + public override void OnHitPvp(Player target, int damage, bool crit) + { projectile.ai[0] = 10f; - projectile.damage /= 2; - } - } + projectile.damage /= 2; + } + } } From 9a42985fa0ec4e84a4dc912ac0b43584b9c73da3 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 13 Apr 2021 01:21:49 -0400 Subject: [PATCH 35/43] Progress on God Slayer Slugs --- Items/Ammo/GodSlayerSlug.cs | 6 +- Items/Ammo/VanquisherArrow.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 2 +- ...layerSlugAlt.png => GodSlayerSlugBlue.png} | Bin Projectiles/Ranged/GodSlayerSlugMain.cs | 60 ------- Projectiles/Ranged/GodSlayerSlugProj.cs | 169 ++++++++++++++++++ ...erSlugMain.png => GodSlayerSlugPurple.png} | Bin 7 files changed, 173 insertions(+), 66 deletions(-) rename Projectiles/Ranged/{GodSlayerSlugAlt.png => GodSlayerSlugBlue.png} (100%) delete mode 100644 Projectiles/Ranged/GodSlayerSlugMain.cs create mode 100644 Projectiles/Ranged/GodSlayerSlugProj.cs rename Projectiles/Ranged/{GodSlayerSlugMain.png => GodSlayerSlugPurple.png} (100%) diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index 6015176f08..5cd1e9405f 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -26,21 +26,19 @@ namespace CalamityMod.Items.Ammo item.value = Item.buyPrice(silver: 4); item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; item.ammo = ItemID.MusketBall; } public override void AddRecipes() { - /* - ModRecipe recipe = new ModRecipe(mod); + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.EmptyBullet, 999); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this, 999); recipe.AddRecipe(); - */ } } } diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 58d4089bae..448e0a2f8a 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Ammo ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 333); + recipe.SetResult(this, 999); recipe.AddRecipe(); } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 9de7462c78..3635277359 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1698,6 +1698,7 @@ namespace CalamityMod.Projectiles } #endregion + // TODO -- this entire region needs to go to Projectile Utilities #region AI Shortcuts public static Projectile SpawnOrb(Projectile projectile, int damage, int projType, float distanceRequired, float speedMult, bool gsPhantom = false) { @@ -1867,7 +1868,6 @@ namespace CalamityMod.Projectiles } } } - public static void ExpandHitboxBy(Projectile projectile, int width, int height) { projectile.position = projectile.Center; diff --git a/Projectiles/Ranged/GodSlayerSlugAlt.png b/Projectiles/Ranged/GodSlayerSlugBlue.png similarity index 100% rename from Projectiles/Ranged/GodSlayerSlugAlt.png rename to Projectiles/Ranged/GodSlayerSlugBlue.png diff --git a/Projectiles/Ranged/GodSlayerSlugMain.cs b/Projectiles/Ranged/GodSlayerSlugMain.cs deleted file mode 100644 index 48e073c3c1..0000000000 --- a/Projectiles/Ranged/GodSlayerSlugMain.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class GodSlayerSlugMain : ModProjectile - { - private const int Lifetime = 600; - private const int NoDrawFrames = 2; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Slug"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = 242; - projectile.alpha = 255; - projectile.extraUpdates = 5; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.timeLeft = Lifetime; - } - - public override void AI() - { - if (projectile.timeLeft < Lifetime - NoDrawFrames) - projectile.alpha = 100; - } - - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 140); - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if(projectile.timeLeft < Lifetime - NoDrawFrames) - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 0, drawCentered: false); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(SoundID.Dig, projectile.Center, 1); - return true; - } - } -} diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs new file mode 100644 index 0000000000..a418419889 --- /dev/null +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -0,0 +1,169 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class GodSlayerSlugProj : ModProjectile + { + private const int Lifetime = 600; + private const int NoDrawFrames = 2; + private const int BlueNoCollideFrames = 9; + private const int TurnBlueFrameDelay = 7; + + private bool BlueMode => projectile.ai[0] != 0f; + public override string Texture => "CalamityMod/Projectiles/Ranged/GodSlayerSlugPurple"; + private static Texture2D TextureBlue; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Slug"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + TextureBlue = mod.GetTexture("Projectiles/Ranged/GodSlayerSlugBlue"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.alpha = 255; + projectile.extraUpdates = 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.timeLeft = Lifetime; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(projectile.tileCollide); + public override void ReceiveExtraAI(BinaryReader reader) => projectile.tileCollide = reader.ReadBoolean(); + + public override void AI() + { + // On frame 1, store the original velocity. This is needed for the warp. + if (projectile.timeLeft == Lifetime) + projectile.localAI[0] = projectile.velocity.Length(); + + // Rapidly fade into visibility. + if (projectile.alpha > 0) + projectile.alpha -= 17; + + // Add light appropriate to the bullet's current state. + if (BlueMode) + Lighting.AddLight(projectile.Center, 0.06f, 0.24f, 0.29f); + else + Lighting.AddLight(projectile.Center, 0.3f, 0.2f, 0.32f); + + // If the bullet has struck at least one target, increment the counter for turning blue. + if (projectile.numHits > 0 && CalamityUtils.FinalExtraUpdate(projectile) && !BlueMode) + ++projectile.ai[1]; + + // If the bullet has struck at least one target but hasn't hit anything for ten frames, turn blue and warp. + if (projectile.ai[1] >= TurnBlueFrameDelay) + TurnBlue(true); + + // When blue, ignore walls for the first several updates. + if (BlueMode && projectile.ai[1] > 0f) + { + --projectile.ai[1]; + if (projectile.ai[1] == 0f) + projectile.tileCollide = true; + } + } + + private void TurnBlue(bool setPosition = false) + { + // Switch to blue mode officially + projectile.ai[0] = 1f; + + // Provide several frames of passing through walls to prevent frustration + projectile.ai[1] = BlueNoCollideFrames; + projectile.tileCollide = false; + + // Reduce damage, but remove piercing + projectile.damage = (int)(0.3f * projectile.damage); + projectile.penetrate = 1; + projectile.usesLocalNPCImmunity = false; + + // Reset projectile lifetime so it can fly again for its full possible range + projectile.timeLeft = Lifetime - NoDrawFrames * projectile.MaxUpdates; + + if (!setPosition || Main.myPlayer != projectile.owner) + return; + + // The warp must be performed client side because it requires knowledge of the player's mouse position. + projectile.netUpdate = true; + projectile.tileCollide = false; + Vector2 mouseVec = CalamityUtils.SafeDirectionTo(Main.LocalPlayer, Main.MouseWorld, -Vector2.UnitY); + float warpDist = Main.rand.NextFloat(70f, 96f); + float warpAngle = Main.rand.NextFloat(-MathHelper.Pi / 3f, MathHelper.Pi / 3f); + Vector2 warpOffset = -warpDist * mouseVec.RotatedBy(warpAngle); + projectile.position = Main.LocalPlayer.MountedCenter + warpOffset; + + // Set all old positions to the bullet's warp position so that there aren't weird afterimages + for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[projectile.type]; ++i) + projectile.oldPos[i] = projectile.position; + + // The projectile flies at the mouse vector at its original muzzle velocity. + projectile.velocity = mouseVec * projectile.localAI[0]; + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 140); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft >= Lifetime - NoDrawFrames * projectile.MaxUpdates) + return false; + // Use the blue bullet texture if the bullet has turned blue. + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor, BlueMode ? TextureBlue : null); + return false; + } + + // God Slayer Slugs explode on death, even if they never visually turned blue. + public override void Kill(int timeLeft) + { + // Turn blue to set stats correctly, if not already done. + if (!BlueMode) + TurnBlue(false); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + projectile.Damage(); + + // The bullet's explosion is a fancy triangle pattern. + int dustID = 180; + for (int i = 0; i < 9; ++i) + { + float speed = Main.rand.NextFloat(3f, 11.2f); + Vector2 dustVel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); + Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); + d.position = projectile.Center; + d.velocity = dustVel; + d.noGravity = true; + d.scale *= Main.rand.NextFloat(1.1f, 1.4f); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 2f / 3f); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 4f / 3f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // If the projectile has hit something but hasn't turned blue, turn it blue and warp it behind the player. + if (projectile.numHits > 0 && !BlueMode) + { + TurnBlue(true); + return false; + } + + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(SoundID.Dig, projectile.Center, 1); + return true; + } + } +} diff --git a/Projectiles/Ranged/GodSlayerSlugMain.png b/Projectiles/Ranged/GodSlayerSlugPurple.png similarity index 100% rename from Projectiles/Ranged/GodSlayerSlugMain.png rename to Projectiles/Ranged/GodSlayerSlugPurple.png From 3cc87ace9802e364b631274a8baa1c0dc8327543 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 13 Apr 2021 01:30:52 -0400 Subject: [PATCH 36/43] tooltip and todos --- Items/Ammo/GodSlayerSlug.cs | 5 ++++- Projectiles/Ranged/GodSlayerSlugProj.cs | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index 5cd1e9405f..a7a3b9bb59 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -11,7 +11,10 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Slug"); - Tooltip.SetDefault("These bullets aren't finished."); + Tooltip.SetDefault("Pierces through unlimited targets\n" + + "After striking at least one enemy,\n" + + "if the bullet hits a wall or runs out of targets,\n" + + "it will warp backwards through space and explode on impact"); } public override void SetDefaults() diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index a418419889..20b547058d 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -112,7 +112,10 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[projectile.type]; ++i) projectile.oldPos[i] = projectile.position; - // The projectile flies at the mouse vector at its original muzzle velocity. + // TODO -- when the bullet warps it should produce a tiny puff of dust + // this may require vector math so that the puff of dust is at the back of the bullet + + // TODO -- the bullet should aim itself towards the mouse with about 26px square deviation projectile.velocity = mouseVec * projectile.localAI[0]; } @@ -136,7 +139,8 @@ namespace CalamityMod.Projectiles.Ranged CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); projectile.Damage(); - // The bullet's explosion is a fancy triangle pattern. + // Create a fancy triangle of dust. + // TODO: This is too loose, it needs to be a tight triangular pattern. int dustID = 180; for (int i = 0; i < 9; ++i) { From 49b36fb579d13d8773e47fc53b5d05c2a5b8d3f5 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 21 Apr 2021 18:57:16 -0500 Subject: [PATCH 37/43] 1 - Boss Zen buff changed to Boss Effects. 2 - Adjusted Hallowed Rune, Spirit Glyph and Phantomic Artifact buffs to be less insane. 3 - Reduced Camper regen. 4 - Boss Effects is now applied by the boss to each player within 6400 units of it. 5 - Angel Treads improve wing flight time by 10% instead of 20%. 6 - Adjusted several tooltips to state that they don't work during boss fights or have reduced effect during boss fights. 7 - Reworked Arbalest, Skullmasher and Pearl God. Skullmasher is not done yet though. 8 - Fixed Golden Eagle spread. 9 - Normality Relocator states that it gives portal gun fall speed for 30 frames after a teleport. 10 - Gael's Greatsword drops from Malice Mode SCal. 11 - Perforator Hive doesn't deal contact damage for 3 seconds after spawning. --- Buffs/StatBuffs/BossZen.cs | 16 ++++- Buffs/StatBuffs/HallowedRuneAtkBuff.cs | 13 ++-- Buffs/StatBuffs/HallowedRuneDefBuff.cs | 7 +- Buffs/StatBuffs/PhantomicArmourBuff.cs | 6 +- Buffs/StatBuffs/PhantomicEmpowermentBuff.cs | 4 +- Buffs/StatBuffs/PhantomicRestorationBuff.cs | 2 +- Buffs/StatBuffs/ProfanedCrystalBuff.cs | 2 +- Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs | 10 +-- Buffs/StatBuffs/SpiritGeneratorDefBuff.cs | 7 +- CalPlayer/CalamityPlayer.cs | 60 ++++++---------- CalPlayer/CalamityPlayerLifeRegen.cs | 15 ++-- CalPlayer/CalamityPlayerMiscEffects.cs | 24 +------ CalPlayer/CalamityPlayerOnHit.cs | 20 +++--- CalamityConfig.cs | 2 +- Items/Accessories/AngelTreads.cs | 2 +- Items/Accessories/AstralArcanum.cs | 2 +- Items/Accessories/GoldBurdenBreaker.cs | 3 +- Items/Accessories/PhantomicArtifact.cs | 5 +- Items/Accessories/TheCamper.cs | 7 +- Items/NormalityRelocator.cs | 1 + Items/Potions/TeslaPotion.cs | 2 +- Items/Tools/ClimateChange/Cosmolight.cs | 3 +- Items/Weapons/Ranged/Aeries.cs | 2 +- Items/Weapons/Ranged/Arbalest.cs | 51 ++++++++++---- Items/Weapons/Ranged/GoldenEagle.cs | 16 +++-- Items/Weapons/Ranged/PearlGod.cs | 65 +++++++++++++++--- Items/Weapons/Ranged/Skullmasher.cs | 17 ++--- Items/Weapons/Typeless/Aestheticus.cs | 1 + NPCs/CalamityGlobalNPC.cs | 14 ++++ NPCs/Crags/Scryllar.cs | 2 - NPCs/Crags/ScryllarRage.cs | 2 - NPCs/Perforator/PerforatorHive.cs | 8 +++ NPCs/SupremeCalamitas/SupremeCalamitas.cs | 7 +- Projectiles/Ranged/AMRShot.cs | 48 ++++++++++--- Projectiles/Ranged/Shockblast.cs | 42 +++--------- Projectiles/Ranged/ShockblastRound.cs | 76 +++++++++------------ 36 files changed, 316 insertions(+), 248 deletions(-) diff --git a/Buffs/StatBuffs/BossZen.cs b/Buffs/StatBuffs/BossZen.cs index 17f3500cc4..9a089e80c3 100644 --- a/Buffs/StatBuffs/BossZen.cs +++ b/Buffs/StatBuffs/BossZen.cs @@ -7,8 +7,8 @@ namespace CalamityMod.Buffs.StatBuffs { public override void SetDefaults() { - DisplayName.SetDefault("Boss Zen"); - Description.SetDefault("The active boss is reducing spawn rates...a lot"); + DisplayName.SetDefault("Boss Effects"); + Description.SetDefault("This tooltip is edited in the function below"); Main.debuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; @@ -19,5 +19,15 @@ namespace CalamityMod.Buffs.StatBuffs { player.Calamity().bossZen = true; } - } + + public override void ModifyBuffTip(ref string tip, ref int rare) + { + tip = "The nearby boss is:\n" + + "Greatly reducing enemy spawn rates\n" + + "Disabling teleportation effects\n" + + "Increasing Nurse healing cost by 400%\n" + + "Disabling Death Mode weather and biome effects\n" + + "Disabling Target and Super Dummy hitboxes"; + } + } } diff --git a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs index 7299addb51..cda8a37727 100644 --- a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Hallowed Power"); - Description.SetDefault("Minion damage boosted by 15%"); + Description.SetDefault("Minion damage boosted by 10%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -16,9 +16,10 @@ namespace CalamityMod.Buffs.StatBuffs longerExpertDebuff = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().hallowedPower = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hallowedPower = true; + player.minionDamage += 0.1f; + } + } } diff --git a/Buffs/StatBuffs/HallowedRuneDefBuff.cs b/Buffs/StatBuffs/HallowedRuneDefBuff.cs index 3e581e9d36..4856abe2bf 100644 --- a/Buffs/StatBuffs/HallowedRuneDefBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneDefBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Hallowed Defense"); - Description.SetDefault("Defense boosted by 7 and damage reduction boosted by 7%"); + Description.SetDefault("Defense boosted by 8 and damage reduction boosted by 4%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -18,7 +18,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().hallowedDefense = true; - } + player.statDefense += 8; + player.endurance += 0.04f; + } } } diff --git a/Buffs/StatBuffs/PhantomicArmourBuff.cs b/Buffs/StatBuffs/PhantomicArmourBuff.cs index bdb6527e42..fae17dd3a1 100644 --- a/Buffs/StatBuffs/PhantomicArmourBuff.cs +++ b/Buffs/StatBuffs/PhantomicArmourBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Phantomic Shield"); - Description.SetDefault("Defense boosted by 8 and damage reduction boosted by 8%\n" + + Description.SetDefault("Defense boosted by 10 and damage reduction boosted by 5%\n" + "An ephemeral bulwark protects you"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; @@ -20,8 +20,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.endurance += 0.08f; - player.statDefense += 8; + player.endurance += 0.05f; + player.statDefense += 10; } } } diff --git a/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs index 0e56a4db6c..52ba453934 100644 --- a/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs +++ b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Phantomic Empowerment"); - Description.SetDefault("Empowering minion damage by 15%"); + Description.SetDefault("Empowering minion damage by 10%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.minionDamage += 0.15f; + player.minionDamage += 0.1f; } } } diff --git a/Buffs/StatBuffs/PhantomicRestorationBuff.cs b/Buffs/StatBuffs/PhantomicRestorationBuff.cs index 85a82c8f23..ace3972774 100644 --- a/Buffs/StatBuffs/PhantomicRestorationBuff.cs +++ b/Buffs/StatBuffs/PhantomicRestorationBuff.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Buffs.StatBuffs { calPlayer.phantomicHeartRegen = 1000; } - player.lifeRegen += 3; + player.lifeRegen += 2; } } } diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index a8918d9379..72bfce7a05 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Buffs.StatBuffs tip = "You are an emissary of the profaned goddess now!\n" + (offense ? "The " + (Main.dayTime ? "light of the sun" : "heat of the lava") + " empowers your offensive capabilities" : "The " + (player.wet ? (player.honeyWet ? "honey cools" : "water douses") : "darkness of night cools") + " your flames, empowering your defensive capabilities") + - (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); + (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); } } else if (CalamityWorld.downedSCal) diff --git a/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs b/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs index 0a4ebc1aa8..50a4402d21 100644 --- a/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Buffs.StatBuffs longerExpertDebuff = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sPower = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.minionDamage += 0.1f; + } + } } diff --git a/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs b/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs index 3dcf4b7f7c..d4136d4bc4 100644 --- a/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Spirit Defense"); - Description.SetDefault("Defense boosted by 5 and damage reduction boosted by 5%"); + Description.SetDefault("Defense boosted by 6 and damage reduction boosted by 3%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -18,7 +18,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().sDefense = true; - } + player.statDefense += 6; + player.endurance += 0.03f; + } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index b3d2901dc5..35b1e23c48 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -447,8 +447,6 @@ namespace CalamityMod.CalPlayer public int gSabatonFall = 0; public int gSabatonCooldown = 0; public bool sGenerator = false; - public bool sDefense = false; - public bool sPower = false; public bool sRegen = false; public bool IBoots = false; public bool elysianFire = false; @@ -482,6 +480,7 @@ namespace CalamityMod.CalPlayer public bool celestialJewel = false; public bool astralArcanum = false; public bool harpyRing = false; + public bool angelTreads = false; public bool harpyWingBoost = false; //harpy wings + harpy ring public bool ironBoots = false; public bool depthCharm = false; @@ -826,9 +825,8 @@ namespace CalamityMod.CalPlayer public bool polarisBoostThree = false; public bool bloodfinBoost = false; public int bloodfinTimer = 30; - public bool hallowedDefense = false; - public bool hallowedPower = false; public bool hallowedRegen = false; + public bool hallowedPower = false; public bool kamiBoost = false; public bool avertorBonus = false; #endregion @@ -1559,6 +1557,7 @@ namespace CalamityMod.CalPlayer celestialJewel = false; astralArcanum = false; harpyRing = false; + angelTreads = false; harpyWingBoost = false; //harpy wings + harpy ring darkSunRing = false; calamityRing = false; @@ -1577,14 +1576,11 @@ namespace CalamityMod.CalPlayer raiderTalisman = false; gSabaton = false; sGenerator = false; - sDefense = false; sRegen = false; - sPower = false; hallowedRune = false; phantomicArtifact = false; - hallowedDefense = false; hallowedRegen = false; - hallowedPower = false; + hallowedPower = false; kamiBoost = false; IBoots = false; elysianFire = false; @@ -2137,12 +2133,9 @@ namespace CalamityMod.CalPlayer #endregion #region Buffs - sDefense = false; sRegen = false; - sPower = false; - hallowedDefense = false; hallowedRegen = false; - hallowedPower = false; + hallowedPower = false; onyxExcavator = false; angryDog = false; fab = false; @@ -5226,53 +5219,41 @@ namespace CalamityMod.CalPlayer if (heldItem.type > ItemID.None) { if (heldItem.summon && !heldItem.melee && !heldItem.ranged && !heldItem.magic && !heldItem.Calamity().rogue) - { damageMult += 0.1; - } } } + if (isTrueMelee) { // Add more true melee damage to the true melee projectile that scales with melee speed // This is done because melee speed does nothing to melee weapons that are purely projectiles damageMult += trueMeleeDamage + ((1f - player.meleeSpeed) * (100f / player.meleeSpeed) / 100f); } + if (screwdriver) { if (proj.penetrate > 1 || proj.penetrate == -1) damageMult += 0.1; } - if (sPower) - { - if (isSummon) - damageMult += 0.1; - } - if (hallowedPower) - { - if (isSummon) - damageMult += 0.15; - } + if (auricSet && godSlayerDamage && isTrueMelee) - { damageMult += 0.15; - } + if (enraged) - { damageMult += 1.25; - } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) - { damageMult += 0.1; - } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && isSummon) - { damageMult += 0.1; - } + if (proj.type == ModContent.ProjectileType()) { if (target.buffImmune[ModContent.BuffType()]) damageMult += 0.1; } + else if (proj.type == ProjectileID.InfernoFriendlyBlast) { damageMult += 0.33; @@ -5280,14 +5261,11 @@ namespace CalamityMod.CalPlayer if (brimflameFrenzy && brimflameSet) { if (proj.magic) - { damageMult += 0.3; - } } + if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) - { CalamityUtils.ApplyRippersToDamage(this, ref damageMult); - } if ((filthyGlove || electricianGlove) && proj.Calamity().stealthStrike && proj.Calamity().rogue) { @@ -5296,8 +5274,11 @@ namespace CalamityMod.CalPlayer else damageMult += 0.1; } + + // Adjust damage based on the damage multiplier damage = (int)(damage * damageMult); + // Old Die damage multiplier, rolls again and takes the higher roll if it's a rogue projectile or the player is wearing rogue armor if (oldDie) { float diceMult = Main.rand.NextFloat(0.9215f, 1.1205f); @@ -5932,9 +5913,9 @@ namespace CalamityMod.CalPlayer if (phantomicArtifact && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { Projectile pro = Main.projectile.AsEnumerable().Where(projectile => projectile.friendly && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType()).First(); - phantomicBulwarkCooldown = 1200; // 20 second cooldown + phantomicBulwarkCooldown = 1800; // 30 second cooldown pro.Kill(); - damage = (int)(damage * 0.8f); //20% damage reduction for a projectile. + projectileDamageReduction += 0.2; } if (auralisAuroraCounter >= 300) @@ -7252,9 +7233,6 @@ namespace CalamityMod.CalPlayer double newDamage = damage - (player.statDefense * defenseMultiplier); double newDamageLimit = NPC.downedMoonlord ? 20D : (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) ? 15D : Main.hardMode ? 10D : 5D; - /*double bossDamageLimitIncrease = CalamityWorld.death ? 40D : 20D; - if (areThereAnyDamnBosses && Main.masterMode) - newDamageLimit += bossDamageLimitIncrease;*/ if (newDamage < newDamageLimit) newDamage = newDamageLimit; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 99f0269791..14cc35103c 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -671,7 +671,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.phantomicHeartRegen <= 720 && modPlayer.phantomicHeartRegen >= 600) { - player.lifeRegen += 5; //Boosts the life regen from 3 to 8 for a short time. + player.lifeRegen += 2; if (Main.rand.NextBool(2)) { int regen = Dust.NewDust(player.position, player.width, player.height, 5, 0f, 0f, 200, new Color(99, 54, 84), 2f); @@ -722,10 +722,6 @@ namespace CalamityMod.CalPlayer player.lifeRegenTime += 8; player.lifeRegen += 16; } - if (modPlayer.camper) - { - player.lifeRegen += 2; - } if (modPlayer.handWarmer && modPlayer.eskimoSet) { player.lifeRegen += 2; @@ -893,11 +889,10 @@ namespace CalamityMod.CalPlayer // The Camper regen boost activates while moving so it can stack with Shiny Stone like effects if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife && !player.StandingStill()) { - float camperRegenMult = CalamityPlayer.areThereAnyDamnBosses ? 1.3f : 1.75f; - int camperCap = CalamityPlayer.areThereAnyDamnBosses ? 20 : 30; - player.lifeRegen = (int)((player.lifeRegen * 2) * camperRegenMult); - player.lifeRegenCount = player.lifeRegenCount > camperCap ? player.lifeRegenCount : camperCap; - player.lifeRegenCount++; + float camperRegenMult = CalamityPlayer.areThereAnyDamnBosses ? 1.25f : 2f; + int camperRegenCount = CalamityPlayer.areThereAnyDamnBosses ? 1 : 4; + player.lifeRegen = (int)(player.lifeRegen * camperRegenMult); + player.lifeRegenCount += camperRegenCount; if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) { int regen = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index cc4c7d2b2d..025824c78a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -75,13 +75,6 @@ namespace CalamityMod.CalPlayer // Bool for any existing events, true if any event is active CalamityPlayer.areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player); - // If any boss NPC is active, apply Zen to the player to reduce spawn rate - if (CalamityPlayer.areThereAnyDamnBosses && CalamityConfig.Instance.BossZen) - { - if (player.whoAmI == Main.myPlayer) - player.AddBuff(ModContent.BuffType(), 2, false); - } - // Revengeance effects RevengeanceModeMiscEffects(player, modPlayer, mod); @@ -967,7 +960,7 @@ namespace CalamityMod.CalPlayer { if (modPlayer.aeroSet) player.maxFallSpeed = 15f; - if (modPlayer.gSabatonFall > 0 || (player.PortalPhysicsEnabled && CalamityPlayer.areThereAnyDamnBosses)) + if (modPlayer.gSabatonFall > 0 || player.PortalPhysicsEnabled) player.maxFallSpeed = 20f; } } @@ -1348,20 +1341,6 @@ namespace CalamityMod.CalPlayer modPlayer.throwingDamage += modPlayer.raiderStack / 150f * damageMult; } - // Spirit Glyph defense buff - if (modPlayer.sDefense) - { - player.statDefense += 5; - player.endurance += 0.05f; - } - - // Hallowed Rune defense buff - if (modPlayer.hallowedDefense) - { - player.statDefense += 7; - player.endurance += 0.07f; - } - if (modPlayer.kamiBoost) player.allDamage += 0.15f; @@ -2705,6 +2684,7 @@ namespace CalamityMod.CalPlayer double flightTimeMult = 1D + (modPlayer.ZoneAstral ? 0.05 : 0D) + (modPlayer.harpyRing ? 0.2 : 0D) + + (modPlayer.angelTreads ? 0.1 : 0D) + (modPlayer.blueCandle ? 0.1 : 0D) + (modPlayer.soaring ? 0.1 : 0D) + (modPlayer.prismaticGreaves ? 0.1 : 0D) + diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index d8912cb3a9..325ada0eef 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -346,31 +346,29 @@ namespace CalamityMod.CalPlayer empowerBuff, shieldBuff }); - player.AddBuff(buffType, 420); //7 seconds + player.AddBuff(buffType, 60); if (buffType == restoreBuff) { - if (modPlayer.phantomicHeartRegen == 1000 && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && Main.rand.NextBool(20)) + if (modPlayer.phantomicHeartRegen == 1000 && player.ownedProjectileCounts[ProjectileType()] == 0 && Main.rand.NextBool(20)) { Vector2 target = proj.Center; target.Y += Main.rand.Next(-50, 50); target.X += Main.rand.Next(-50, 50); - Projectile.NewProjectile(target, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f); + Projectile.NewProjectile(target, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 0f); } } else if (buffType == empowerBuff) { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 5 && Main.rand.NextBool(10)) //at most 5 + if (player.ownedProjectileCounts[ProjectileType()] < 5 && Main.rand.NextBool(10)) //at most 5 { int damage = (int)(100 * player.MinionDamage()); - Projectile.NewProjectile(proj.position, proj.velocity, ModContent.ProjectileType(), damage, 1f, player.whoAmI, 0f); + Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, player.whoAmI, 0f); } } else { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && modPlayer.phantomicBulwarkCooldown == 0) - { - Projectile.NewProjectile(player.position, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f); - } + if (player.ownedProjectileCounts[ProjectileType()] == 0 && modPlayer.phantomicBulwarkCooldown == 0) + Projectile.NewProjectile(player.position, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 0f); } } else if (modPlayer.hallowedRune) @@ -381,7 +379,7 @@ namespace CalamityMod.CalPlayer BuffType(), BuffType() }); - player.AddBuff(buffType, 120); + player.AddBuff(buffType, 60); } else if (modPlayer.sGenerator) { @@ -391,7 +389,7 @@ namespace CalamityMod.CalPlayer BuffType(), BuffType() }); - player.AddBuff(buffType, 120); + player.AddBuff(buffType, 60); } } diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 90ab909faf..d0e6edd9e7 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -151,7 +151,7 @@ namespace CalamityMod [Label("Boss Zen")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] - [Tooltip("While a boss is alive, all players receive the Boss Zen buff which drastically reduces enemy spawn rates.")] + [Tooltip("While a boss is alive, all players near a boss receive the Boss Effects buff, which drastically reduces enemy spawn rates.")] public bool BossZen { get; set; } [Label("Never Weaken Reactive Boss DR")] diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index 4f5e645f66..c0c74887dc 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.harpyRing = true; + modPlayer.angelTreads = true; player.accRunSpeed = 7.5f; player.rocketBoots = 3; player.moveSpeed += 0.12f; diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index 3fac295c54..ffbd94d85c 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AstralArcanumUIHotkey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip6") + if (line2.mod == "Terraria" && line2.Name == "Tooltip7") { line2.text = "Press " + hotkey + " to toggle teleportation UI while no bosses are alive"; } diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index 1c1bd7f13d..cfc32f50c1 100644 --- a/Items/Accessories/GoldBurdenBreaker.cs +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("The good time\n" + "Go fast\n" + "WARNING: May have disastrous results\n" + - "Increases horizontal movement speed beyond comprehension"); + "Increases horizontal movement speed beyond comprehension\n" + + "Does not work while a boss is alive"); } public override void SetDefaults() diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index a9183af297..e3956c6c56 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Terraria; +using Terraria; using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Items.Materials; @@ -24,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.width = 48; item.height = 62; item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - item.rare = ItemRarityID.Red; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; item.accessory = true; } diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 226a515e47..046de7fdcc 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -59,7 +59,6 @@ namespace CalamityMod.Items.Accessories player.AddBuff(BuffID.HeartLamp, 60, true); player.AddBuff(BuffID.Campfire, 60, true); player.AddBuff(BuffID.WellFed, 60, true); - player.lifeRegen += 2; Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); if (Main.myPlayer == player.whoAmI) { @@ -93,16 +92,16 @@ namespace CalamityMod.Items.Accessories bool magic = player.ActiveItem().magic; if (summon) { - player.minionKB += 0.10f; + player.minionKB += 0.1f; player.AddBuff(BuffID.Bewitched, 60, true); } else if (rogue) { - modPlayer.throwingVelocity += 0.10f; + modPlayer.throwingVelocity += 0.1f; } else if (melee) { - player.meleeSpeed += 0.10f; + player.meleeSpeed += 0.1f; player.AddBuff(BuffID.Sharpened, 60, true); } else if (ranged) diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index 26d9a5ed83..19b5ef79f0 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items DisplayName.SetDefault("Normality Relocator"); Tooltip.SetDefault("I'll be there in the blink of an eye\n" + "This line is modified below\n" + + "Fall speed is doubled for 30 frames after teleporting\n" + "Teleportation is disabled while Chaos State is active\n" + "Works while in the inventory"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs index 5101c8129a..c2e905b806 100644 --- a/Items/Potions/TeslaPotion.cs +++ b/Items/Potions/TeslaPotion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions { DisplayName.SetDefault("Tesla Potion"); Tooltip.SetDefault("Summons an aura of electricity that electrifies and slows enemies\n" + - "Slowdown does not work on bosses\n" + + "Slowdown does not work on bosses and aura damage is reduced on bosses\n" + "Reduces the duration of the Electrified debuff"); } diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index d8f9b10a8f..851dcd6593 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmolight"); - Tooltip.SetDefault("Changes night to day and vice versa"); + Tooltip.SetDefault("Changes night to day and vice versa\n" + + "Does not work while a boss is alive"); } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/Aeries.cs b/Items/Weapons/Ranged/Aeries.cs index 1b7470d366..f90f550d02 100644 --- a/Items/Weapons/Ranged/Aeries.cs +++ b/Items/Weapons/Ranged/Aeries.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 24f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); item.useAmmo = AmmoID.Bullet; } diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index fe8f2c5377..9375c0381d 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -7,10 +7,15 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Arbalest : ModItem { + private int totalProjectiles = 1; + private float arrowScale = 0.5f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arbalest"); - Tooltip.SetDefault("Fires volleys of 3 high-speed arrows"); + Tooltip.SetDefault("Fires a volley of 10 high-speed arrows\n" + + "Arrows start off small and grow in size with continuous fire\n" + + "Arrow damage and knockback scale with arrow size"); } public override void SetDefaults() @@ -19,17 +24,18 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 58; item.height = 22; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 7; + item.reuseDelay = 30; + item.useAnimation = 28; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = ItemRarityID.Pink; - item.UseSound = SoundID.Item5; + item.UseSound = null; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 10f; + item.shootSpeed = 12f; item.useAmmo = AmmoID.Arrow; item.Calamity().challengeDrop = true; } @@ -39,15 +45,32 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 3; i++) - { - float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += i; - Main.projectile[proj].noDropItem = true; - } - return false; + Main.PlaySound(SoundID.Item5, (int)player.Center.X, (int)player.Center.Y); + + if (totalProjectiles > 4) + { + totalProjectiles = 1; + + if (arrowScale < 1.5f) + arrowScale += 0.05f; + } + + for (int i = 0; i < totalProjectiles; i++) + { + float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * arrowScale), knockBack * arrowScale, player.whoAmI); + Main.projectile[proj].scale = arrowScale; + Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].noDropItem = true; + } + + totalProjectiles++; + + if (arrowScale >= 1.5f) + arrowScale = 0.5f; + + return false; } } } diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index c8ffff2792..aeaeacb84e 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public class GoldenEagle : ModItem { + private const float Spread = 0.0425f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Golden Eagle"); @@ -37,14 +39,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int numProj = 4; - float rotation = MathHelper.ToRadians(5); - for (int i = 0; i < numProj + 1; i++) + Vector2 velocity = new Vector2(speedX, speedY); + + // Fire extra bullets to the left and right + for (int i = 0; i < 2; i++) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, velocity.RotatedBy(-Spread * (i + 1)), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, velocity.RotatedBy(+Spread * (i + 1)), type, damage, knockBack, player.whoAmI); } - return false; + + return true; } } } diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 6a2fc71f45..aa5909bb9e 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -8,10 +8,16 @@ namespace CalamityMod.Items.Weapons.Ranged { public class PearlGod : ModItem { + private const int defaultSpread = 1; + private int spread = defaultSpread; + private bool finalShot = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl God"); - Tooltip.SetDefault("Your life is mine..."); + Tooltip.SetDefault("Your life is mine...\n" + + "Fires shockblast rounds that emit massive explosions and steal enemy life as well as additional bullets\n" + + "Every seventh shot fires a massive shockblast"); } public override void SetDefaults() @@ -29,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.Calamity().customRarity = CalamityRarity.PureGreen; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 24f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); item.useAmmo = AmmoID.Bullet; item.Calamity().challengeDrop = true; @@ -42,13 +48,56 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 2; ++index) - { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.75), knockBack, player.whoAmI); - Main.projectile[proj].extraUpdates += index; + if (spread > 6) + { + spread = defaultSpread; + finalShot = true; } - int proj2 = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - Main.projectile[proj2].extraUpdates += 2; + + Vector2 velocity = new Vector2(speedX, speedY); + float rotation = MathHelper.ToRadians(spread); + if (!finalShot) + { + int totalLoops = 1; + switch (spread) + { + case 1: + case 2: + break; + case 3: + case 4: + totalLoops = 2; + break; + case 5: + case 6: + totalLoops = 3; + break; + } + + for (int i = 0; i < totalLoops; i++) + { + int proj = Projectile.NewProjectile(position, velocity.RotatedBy(-rotation * (i + 1)), type, (int)(damage * 0.5), knockBack * 0.5f, player.whoAmI); + Main.projectile[proj].extraUpdates += spread; + int proj2 = Projectile.NewProjectile(position, velocity.RotatedBy(+rotation * (i + 1)), type, (int)(damage * 0.5), knockBack * 0.5f, player.whoAmI); + Main.projectile[proj2].extraUpdates += spread; + } + + int proj3 = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, spread); + Main.projectile[proj3].extraUpdates += spread; + + spread++; + } + else + { + for (int i = 0; i < 3; i++) + { + int proj = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage * 2, knockBack * 2f, player.whoAmI, 0f, 10f); + Main.projectile[proj].extraUpdates += 9; + } + + finalShot = false; + } + return false; } } diff --git a/Items/Weapons/Ranged/Skullmasher.cs b/Items/Weapons/Ranged/Skullmasher.cs index 1dc36b30b6..824063967b 100644 --- a/Items/Weapons/Ranged/Skullmasher.cs +++ b/Items/Weapons/Ranged/Skullmasher.cs @@ -10,8 +10,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Skullmasher"); - Tooltip.SetDefault("Sniper shotgun, because why not?\n" + - "Converts musket balls into high velocity bullets that, on crit, fire a second swarm of bullets"); + Tooltip.SetDefault("Makes their brain hurt\n" + + "Fires high velocity bullets that split into additional bullets when close to an enemy\n" + + "If you crit the target a second swarm of bullets will fire"); } public override void SetDefaults() @@ -42,13 +43,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 5; ++index) - { - if (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.3), knockBack, player.whoAmI); + for (int index = 0; index < 4; ++index) + { + float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, type, 1f); } + return false; } } diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index 00c01f1b64..e612a5449d 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Typeless { DisplayName.SetDefault("Aestheticus"); Tooltip.SetDefault("Fires crystals that explode and slow enemies down\n" + + "Slowdown does not work on bosses\n" + "This weapon scales with all your damage stats at once"); } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a81da6eb1e..1d8999d759 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; @@ -88,6 +89,9 @@ namespace CalamityMod.NPCs public const float CatchUpDistance200Tiles = 3200f; public const float CatchUpDistance350Tiles = 5600f; + // Boss Zen distance + private const float BossZenDistance = 6400f; + // Max velocity used in contact damage scaling public float maxVelocity = 0f; @@ -1968,6 +1972,16 @@ namespace CalamityMod.NPCs if (KillTime > 0) { + // If any boss NPC is active, apply Zen to nearby players to reduce spawn rate + if (CalamityConfig.Instance.BossZen) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < BossZenDistance) + Main.player[Main.myPlayer].AddBuff(BuffType(), 2); + } + } + if (AITimer < KillTime) AITimer++; diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 1e809a08f7..88c833e11a 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -255,8 +255,6 @@ namespace CalamityMod.NPCs.Crags { DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); - float gaelsChance = Main.expertMode ? 0.03f : 0.02f; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedYharon, gaelsChance); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 5238c38d9c..688a356851 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -255,8 +255,6 @@ namespace CalamityMod.NPCs.Crags { DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); - float gaelsChance = Main.expertMode ? 0.03f : 0.02f; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedYharon, gaelsChance); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index b90ba70037..09b7aa2bc0 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -85,6 +85,14 @@ namespace CalamityMod.NPCs.Perforator if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) npc.TargetClosest(); + // Don't deal damage for 3 seconds after spawning + npc.damage = npc.defDamage; + if (npc.ai[1] < 180f) + { + npc.ai[1] += 1f; + npc.damage = 0; + } + Player player = Main.player[npc.target]; bool malice = CalamityWorld.malice; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 1a82cfbbbd..b7f85a14e5 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2044,8 +2044,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.player[npc.target].Calamity().sCalKillCount < 5) Main.player[npc.target].Calamity().sCalKillCount++; - // Materials - int essenceMin = Main.expertMode ? 30 : 20; + // Legendary drop for SCal + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + // Materials + int essenceMin = Main.expertMode ? 30 : 20; int essenceMax = Main.expertMode ? 40 : 30; DropHelper.DropItem(npc, ModContent.ItemType(), true, essenceMin, essenceMax); diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index 20d54744a4..da15bb2097 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -25,13 +25,45 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } - public override bool OnTileCollide(Vector2 oldVelocity) + public override void AI() + { + float num107 = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); + if (projectile.alpha > 0) + projectile.alpha -= (byte)(num107 * 0.9); + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.ai[1] == 1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (Vector2.Distance(projectile.Center, npc.Center) < 300f && npc.CanBeChasedBy(projectile)) + { + projectile.ai[1] = 2f; + Vector2 velocity = Vector2.Normalize(npc.Center - projectile.Center) * 12f; + int proj = Projectile.NewProjectile(projectile.Center, velocity, (int)projectile.ai[0], projectile.damage / 2, projectile.knockBack * 0.5f, Main.myPlayer); + Main.projectile[proj].extraUpdates += 5; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha < 140) + return new Color(255, 255, 255, 100); + + return Color.Transparent; + } + + public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); @@ -41,16 +73,17 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(target.Center, crit); + target.AddBuff(ModContent.BuffType(), 600); + if (target.defense > 50) - { target.defense -= 50; - } } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(target.Center, crit); + target.AddBuff(ModContent.BuffType(), 600); } @@ -58,12 +91,11 @@ namespace CalamityMod.Projectiles.Ranged { if (crit) { - for (int x = 0; x < 8; x++) + int extraProjectileAmt = projectile.ai[1] >= 1f ? 2 : 8; + for (int x = 0; x < extraProjectileAmt; x++) { if (projectile.owner == Main.myPlayer) - { CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 4, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); - } } } } diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index aa483fc007..1ac0485097 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -29,29 +29,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.025f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } + Lighting.AddLight(projectile.Center, 0f, 0f, 0.25f); float num461 = 25f; if (projectile.ai[0] > 180f) { @@ -65,22 +43,24 @@ namespace CalamityMod.Projectiles.Ranged num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float sizeMultiplier = (projectile.ai[1] * 0.5f) + 1f; + float num463 = Main.rand.Next(-10, 11) * sizeMultiplier; + float num464 = Main.rand.Next(-10, 11) * sizeMultiplier; + float num465 = Main.rand.Next(3, 9) * sizeMultiplier; + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, 1f); + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185); Dust dust = Main.dust[num467]; + dust.scale = sizeMultiplier; dust.noGravity = true; dust.position.X = projectile.Center.X; dust.position.Y = projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.position.X += Main.rand.Next(-10, 11); + dust.position.Y += Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index 6f50bd44ec..27ced6774c 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -33,7 +33,11 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, projectile.ai[1]); + Main.projectile[proj].scale = (projectile.ai[1] * 0.5f) + 1f; + } return true; } @@ -43,62 +47,50 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - projectile.damage = (int)(projectile.damage * 0.995); - projectile.knockBack = projectile.knockBack * 0.995f; - } - } - public override bool PreAI() { //Rotation projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; - for (int num136 = 0; num136 < 2; num136++) - { - Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.5f, 0.7f); - float x2 = projectile.Center.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num136 = 0; num136 < 2; num136++) + { + Vector2 dspeed = -projectile.velocity * Main.rand.NextFloat(0.5f, 0.7f); + float x2 = projectile.Center.X - projectile.velocity.X / 10f * num136; + float y2 = projectile.Center.Y - projectile.velocity.Y / 10f * num136; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 185, 0f, 0f, 0, default, 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity = dspeed; + Main.dust[num137].noGravity = true; + } + } + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); - } + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, projectile.ai[1]); + Main.projectile[proj].scale = (projectile.ai[1] * 0.5f) + 1f; + } + if (Main.player[projectile.owner].moonLeech) - { return; - } - float healAmt = (float)damage * 0.05f; + + float healAmt = damage * 0.05f; if ((int)healAmt == 0) - { return; - } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { return; - } + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } } From c756f9166ea43406024d082748a6877edaf6ed30 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 24 Apr 2021 01:03:31 -0500 Subject: [PATCH 38/43] 1 - Camper causes you to deal 90% less damage if you're moving, I did this because the current method allows you to stack projectiles while not moving, spawn a boss and then nuke it while tanking with Camper. 2 - Reduced Alicorn mount speed by 20%. 3 - Crabulon, Astrum Aureus and Ravager no longer jump away from you sometimes. 4 - Made Aquatic Scourge a more progressive battle and made the body segment projectiles consistent. 5 - Changed how Astrum Aureus spawns his homing flames. 6 - Changed how Dragonfolly spawns its feathers. 7 - Adjusted various bullets that were spawning dust immediately to not spawn dust until a few frames have passed. 8 - Doubled Bee, Wasp, Tiny Eater, Giant Bee and Bat projectile velocities. 9 - Increased the damage DoG's head does in both phases. --- CalPlayer/CalamityPlayer.cs | 20 -- Items/Accessories/TheCamper.cs | 2 +- Items/Mounts/AlicornMount.cs | 10 +- Items/Mounts/Crysthamyr.cs | 2 +- Items/Weapons/Magic/Cryophobia.cs | 3 +- Items/Weapons/Ranged/Arbalest.cs | 10 +- Items/Weapons/Ranged/AstralBlaster.cs | 2 +- Items/Weapons/Ranged/Skullmasher.cs | 3 +- Items/Weapons/Ranged/SlagMagnum.cs | 2 +- NPCs/CalamityAI.cs | 267 ++++++++++++------- NPCs/CalamityGlobalNPC.cs | 26 +- NPCs/Crabulon/CrabulonIdle.cs | 23 +- NPCs/DesertScourge/DesertScourgeHead.cs | 4 +- NPCs/Ravager/RavagerBody.cs | 3 + NPCs/TownNPCs/FAP.png | Bin 3168 -> 3393 bytes NPCs/Yharon/Yharon.cs | 8 +- Projectiles/Boss/AstralFlame.cs | 27 +- Projectiles/CalamityGlobalProjectile.cs | 74 +++-- Projectiles/Ranged/AMRShot.cs | 29 +- Projectiles/Ranged/AccelerationBulletProj.cs | 30 ++- Projectiles/Ranged/AcidBulletProj.cs | 21 +- Projectiles/Ranged/AstralRound.cs | 31 ++- Projectiles/Ranged/BloodClotFriendly.cs | 24 +- Projectiles/Ranged/BloodfireBulletProj.cs | 22 +- Projectiles/Ranged/DragonBurst.cs | 6 +- Projectiles/Ranged/EnhancedNanoRoundProj.cs | 22 +- Projectiles/Ranged/FlashBulletProj.cs | 21 +- Projectiles/Ranged/FrostsparkBulletProj.cs | 25 +- Projectiles/Ranged/HolyFireBulletProj.cs | 35 +-- Projectiles/Ranged/IcyBulletProj.cs | 32 ++- Projectiles/Ranged/IlluminatedBullet.cs | 14 +- Projectiles/Ranged/ProBolt.cs | 45 ++-- Projectiles/Ranged/RealmRavagerBullet.cs | 14 +- Projectiles/Ranged/SicknessRound.cs | 36 ++- Projectiles/Ranged/SicknessRound2.cs | 9 +- Projectiles/Ranged/SlagRound.cs | 36 ++- Projectiles/Ranged/SuperballBulletProj.cs | 33 +-- Projectiles/Ranged/TerraBulletMain.cs | 2 +- Projectiles/Ranged/TerraBulletSplit.cs | 20 +- Projectiles/Ranged/VeriumBulletProj.cs | 19 +- Utilities/NPCStats.cs | 4 +- 41 files changed, 604 insertions(+), 412 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 35b1e23c48..ed9861a107 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -6808,26 +6808,6 @@ namespace CalamityMod.CalPlayer } #endregion - #region Can Hit - public override bool? CanHitNPC(Item item, NPC target) - { - if (camper && !player.StandingStill()) - { - return false; - } - return null; - } - - public override bool? CanHitNPCWithProj(Projectile proj, NPC target) - { - if (camper && !player.StandingStill()) - { - return false; - } - return null; - } - #endregion - #region Fishing public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) { diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 046de7fdcc..e7f04bfd4e 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Camper"); Tooltip.SetDefault("In rest may we find victory.\n" + - "You deal no damage unless stationary\n" + + "You deal 90% less damage unless stationary\n" + "Standing still grants buff(s) dependent on what weapon you're holding\n" + "Standing still provides a damaging aura around you\n" + "While moving, you regenerate health as if standing still\n" + diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index df04e74dc0..6e05f9eed6 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Mounts mountData.spawnDustNoGravity = true; mountData.buff = ModContent.BuffType(); mountData.heightBoost = 35; - mountData.fallDamage = 0f; //0.5 - mountData.runSpeed = 7f; //12 - mountData.dashSpeed = 21f; //8 + mountData.fallDamage = 0f; + mountData.runSpeed = 5.6f; + mountData.dashSpeed = 16.8f; mountData.flightTimeMax = 500; mountData.fatigueMax = 0; mountData.jumpHeight = 12; - mountData.acceleration = 0.45f; - mountData.jumpSpeed = 8f; //10 + mountData.acceleration = 0.4f; + mountData.jumpSpeed = 8.01f; mountData.swimSpeed = 4f; mountData.blockExtraJumps = false; mountData.totalFrames = 15; diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index 9a930dde93..f7f6bf2363 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Mounts mountData.flightTimeMax = 750; mountData.fatigueMax = 0; mountData.jumpHeight = 12; - mountData.acceleration = 0.6f; + mountData.acceleration = 0.35f; mountData.jumpSpeed = 9f; mountData.swimSpeed = 6f; mountData.blockExtraJumps = true; diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index ba779299c6..77dd797621 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Cryophobia"); - Tooltip.SetDefault("Chill"); + Tooltip.SetDefault("Chill\n" + + "Fires an ice ball that splits multiple times before exploding into shards"); } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index 9375c0381d..e4b0cbd790 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged DisplayName.SetDefault("Arbalest"); Tooltip.SetDefault("Fires a volley of 10 high-speed arrows\n" + "Arrows start off small and grow in size with continuous fire\n" + - "Arrow damage and knockback scale with arrow size"); + "Arrow damage, spread and knockback scale with arrow size"); } public override void SetDefaults() @@ -55,13 +55,15 @@ namespace CalamityMod.Items.Weapons.Ranged arrowScale += 0.05f; } + float spreadScale = arrowScale * arrowScale; + int spread = (int)(30f * spreadScale); for (int i = 0; i < totalProjectiles; i++) { - float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-spread, spread + 1) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-spread, spread + 1) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * arrowScale), knockBack * arrowScale, player.whoAmI); Main.projectile[proj].scale = arrowScale; - Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].extraUpdates += 1; Main.projectile[proj].noDropItem = true; } diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 9f21a06897..3487062645 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 14f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); item.useAmmo = AmmoID.Bullet; } diff --git a/Items/Weapons/Ranged/Skullmasher.cs b/Items/Weapons/Ranged/Skullmasher.cs index 824063967b..68b1cac1b9 100644 --- a/Items/Weapons/Ranged/Skullmasher.cs +++ b/Items/Weapons/Ranged/Skullmasher.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Skullmasher"); Tooltip.SetDefault("Makes their brain hurt\n" + - "Fires high velocity bullets that split into additional bullets when close to an enemy\n" + - "If you crit the target a second swarm of bullets will fire"); + "Fires a spread of 4 high velocity bullets that split into additional bullets upon hitting an enemy"); } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 8bb41f70c1..0b20d445bd 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 22f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); item.useAmmo = AmmoID.Bullet; } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index f325137615..cad7682ffe 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -64,6 +64,11 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Phases + bool phase2 = lifeRatio < 0.8f; + bool phase3 = lifeRatio < 0.6f; + bool phase4 = lifeRatio < 0.4f; + // Increase aggression if player is taking a long time to kill the boss if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; @@ -208,7 +213,7 @@ namespace CalamityMod.NPCs } // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral) + if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral && phase3) { npc.localAI[0] += 1f; if (player.gravDir == -1f && expertMode) @@ -235,22 +240,25 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); } - int num320 = expertMode ? 14 : 7; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - for (int num321 = 0; num321 < num320; num321++) + if (phase4) { - Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401) * 0.01f; + int num320 = expertMode ? 14 : 7; + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + for (int num321 = 0; num321 < num320; num321++) + { + Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= Main.rand.Next(50, 401) * 0.01f; - if (expertMode) - vector15 *= 1f + (death ? 0.25f : 0.25f * (1f - lifeRatio)); + if (expertMode) + vector15 *= 1f + (death ? 0.25f : 0.25f * (1f - lifeRatio)); - if (BossRushEvent.BossRushActive) - vector15 *= 1.25f; + if (BossRushEvent.BossRushActive) + vector15 *= 1.25f; - Projectile.NewProjectile(npc.Center, vector15, type, damage, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); + Projectile.NewProjectile(npc.Center, vector15, type, damage, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); + } } } } @@ -261,15 +269,17 @@ namespace CalamityMod.NPCs // Fire sand blasts or teeth depending on body type else { - if (calamityGlobalNPC.newAI[0] == 1f) + if (calamityGlobalNPC.newAI[0] == 1f && phase2) { + npc.localAI[0] += 1f; + float shootProjectile = 300; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if (npc.type == ModContent.NPCType()) { - int num = expertMode ? 4 : 3; - npc.localAI[0] += Main.rand.Next(num); - if (npc.localAI[0] >= Main.rand.Next(700, 10001)) + if (npc.localAI[0] % divisor == 0f) { - npc.localAI[0] = 0f; npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { @@ -280,23 +290,21 @@ namespace CalamityMod.NPCs float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - float num941 = BossRushEvent.BossRushActive ? 10f : death ? 6f : 5f; + float num941 = BossRushEvent.BossRushActive ? 15f : death ? 9f : 8f; num944 = num941 / num944; num942 *= num944; num943 *= num944; vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer); npc.netUpdate = true; } } } else if (npc.type == ModContent.NPCType()) { - npc.localAI[0] += Main.rand.Next(4); - if (npc.localAI[0] >= Main.rand.Next(700, 10001)) + if (npc.localAI[0] % divisor == 0f) { - npc.localAI[0] = 0f; npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { @@ -306,7 +314,7 @@ namespace CalamityMod.NPCs float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - float num941 = BossRushEvent.BossRushActive ? 16f : death ? 10f : 8f; + float num941 = BossRushEvent.BossRushActive ? 24f : death ? 15f : 12f; num944 = num941 / num944; num942 *= num944; num943 *= num944; @@ -2465,35 +2473,47 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += npc.ai[0] == 2f ? 4f : shootTimer; - if (npc.localAI[0] >= 180f) - { - npc.localAI[0] = 0f; - Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); - // Fire astral flames while teleporting - if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0) - { - float velocity = BossRushEvent.BossRushActive ? 14f : death ? 8f : 7f; - int totalProjectiles = 6; - float radians = MathHelper.TwoPi / totalProjectiles; + float astralFlameGateValue = phase3 ? 30f : 60f; + if (npc.localAI[0] >= astralFlameGateValue) + { + // Fire astral flames while teleporting + if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0) + { + npc.localAI[0] = 0f; + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); + + float velocity = BossRushEvent.BossRushActive ? 14f : death ? 8f : 7f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) damage *= 2; + float spreadLimit = phase3 ? 100f : 50f; + float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; + Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f); + Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f); + Projectile.NewProjectile(npc.Center, Vector2.Normalize(destination - npc.Center) * velocity, type, damage, 0f, Main.myPlayer); + } + } - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - + if (npc.localAI[0] >= 180f) + { // Fire astral lasers while walking - else if (npc.ai[0] == 2f && phase2) + if (npc.ai[0] == 2f) { - float num179 = BossRushEvent.BossRushActive ? 24f : death ? 20f : 18.5f; + npc.localAI[0] = 0f; + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); + + float num179 = BossRushEvent.BossRushActive ? 24f : death ? 20f : 18.5f; int maxProjectiles = death ? 6 : 4; int spread = death ? 60 : 45; + + if (!phase2) + { + maxProjectiles /= 2; + spread /= 2; + } + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num180 = player.position.X + player.width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; @@ -2503,12 +2523,14 @@ namespace CalamityMod.NPCs num183 = num179 / num183; num180 *= num183; num182 *= num183; + value9.X += num180; + value9.Y += num182; + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) damage *= 2; - value9.X += num180; - value9.Y += num182; + for (int i = 0; i < maxProjectiles; i++) { num180 = player.position.X + player.width * 0.5f - value9.X; @@ -2519,15 +2541,17 @@ namespace CalamityMod.NPCs num182 += Main.rand.Next(-spread, spread + 1); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer); } } } } } + else + npc.localAI[0] = 0f; - // Start up - if (npc.ai[0] == 0f) + // Start up + if (npc.ai[0] == 0f) { // If hit or after two seconds start Idle phase npc.ai[1] += 1f; @@ -2553,7 +2577,7 @@ namespace CalamityMod.NPCs // Stay vulnerable for a maximum of 1.5 or 2.5 seconds npc.ai[1] += 1f; - if (npc.ai[1] >= ((phase3 || calamityGlobalNPC.enraged > 0) ? 90f : 150f)) + if (npc.ai[1] >= 120f || calamityGlobalNPC.enraged > 0) { // Increase defense npc.defense = npc.defDefense; @@ -2666,16 +2690,21 @@ namespace CalamityMod.NPCs // Half second delay before jumping npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - npc.ai[1] = -20f; - else if (npc.ai[1] == -1f) - { - // Set jump velocity, reset and set AI to next phase (Stomp) - float velocityX = BossRushEvent.BossRushActive ? 12f : 9f; + if (npc.ai[1] >= 30f) + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + // Set jump velocity, reset and set AI to next phase (Stomp) + float velocityX = BossRushEvent.BossRushActive ? 12f : 9f; velocityX += 6f * enrageScale; if (expertMode) velocityX += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.velocity.X = velocityX * npc.direction; float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); @@ -2690,23 +2719,23 @@ namespace CalamityMod.NPCs } if (expertMode) - { - if (player.position.Y < npc.Bottom.Y) - npc.velocity.Y = -14.5f; - else - npc.velocity.Y = 1f; + { + if (player.position.Y < npc.Bottom.Y) + npc.velocity.Y = -14.5f; + else + npc.velocity.Y = 1f; - npc.noTileCollide = true; - } - else - npc.velocity.Y = -14.5f; + npc.noTileCollide = true; + } + else + npc.velocity.Y = -14.5f; if (calamityGlobalNPC.newAI[0] > 1f) npc.velocity.Y *= calamityGlobalNPC.newAI[0]; npc.ai[0] = 4f; - npc.ai[1] = 0f; - } + npc.ai[1] = 0f; + } } CustomGravity(); @@ -2724,13 +2753,18 @@ namespace CalamityMod.NPCs npc.TargetClosest(); npc.ai[2] += 1f; float maxStompAmt = death ? 2f : 3f; - if (npc.ai[2] >= maxStompAmt) - { - npc.ai[0] = phase3 ? 5f : 1f; - npc.ai[2] = 0f; - } - else - npc.ai[0] = 3f; + if (npc.ai[2] >= maxStompAmt) + { + npc.ai[0] = phase2 ? 5f : 1f; + npc.ai[2] = 0f; + } + else + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + + npc.ai[0] = 3f; + } calamityGlobalNPC.newAI[0] = 0f; @@ -2844,8 +2878,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - npc.localAI[1] += 5f; + if (phase3) + npc.localAI[1] += 1f; if (npc.localAI[1] >= (240f - (death ? 60f * (1f - lifeRatio) : 0f))) { @@ -2934,7 +2968,7 @@ namespace CalamityMod.NPCs if (npc.alpha <= 0) { // Spawn slimes - bool spawnFlag = revenge; + bool spawnFlag = phase3; if (NPC.CountNPCS(ModContent.NPCType()) > 1) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) @@ -4306,6 +4340,24 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); + // Count feathers and prevent spawning more if the limit is reached. + bool spawnFeathers = true; + int featherLimit = 20; + int featherAmt = 0; + for (int j = 0; j < Main.maxProjectiles; j++) + { + Projectile projectile = Main.projectile[j]; + + if (projectile.type == type && projectile.active && projectile.hostile) + featherAmt++; + + if (featherAmt >= featherLimit) + { + spawnFeathers = false; + break; + } + } + if (num1307 == 0 && canHit && npc.localAI[3] == 0f) { npc.TargetClosest(); @@ -4331,17 +4383,33 @@ namespace CalamityMod.NPCs if (npc.localAI[3] > 0f) npc.localAI[3] -= 1f; - if (phase2) + if (phase2 && spawnFeathers) { Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); - int totalProjectiles = phase3 ? 4 : 3; + int totalProjectiles = 40; float radians = MathHelper.TwoPi / totalProjectiles; - int distance = 560; + int distance = 800; + bool spawnRight = player.velocity.X > 0f; for (int i = 0; i < totalProjectiles; i++) { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer, 0f, phase3 ? 1f : 0f); + if (spawnRight) + { + if (i >= (int)Math.Floor(totalProjectiles * 0.125) && i <= (int)Math.Ceiling(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + else + { + if (i >= (int)Math.Floor(totalProjectiles * 0.625) && i <= (int)Math.Ceiling(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } } } } @@ -4357,15 +4425,34 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 0f) npc.localAI[2] -= 1f; - Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); - int totalProjectiles = phase2 ? 5 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = phase2 ? 720 : 880; - for (int i = 0; i < totalProjectiles; i++) + if (spawnFeathers) { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); + int totalProjectiles = phase2 ? 40 : 48; + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = phase2 ? 1200 : 1320; + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (spawnRight) + { + if (i >= totalProjectiles / 2) + break; + + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + else + { + if (i >= totalProjectiles / 2) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1d8999d759..2cb9357af4 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3422,18 +3422,11 @@ namespace CalamityMod.NPCs #region AI public override void AI(NPC npc) { - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) - { - switch (npc.type) - { - case NPCID.DungeonGuardian: - CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc); - break; - - default: - break; - } - } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + { + if (npc.type == NPCID.DungeonGuardian) + CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc); + } } #endregion @@ -3642,6 +3635,10 @@ namespace CalamityMod.NPCs #region Modify Hit public override void ModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit) { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.camper && !player.StandingStill()) + damage = (int)(damage * 0.1); + if (npc.type == NPCType()) { if (item.type == ItemType()) @@ -3663,12 +3660,13 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.MakeTownNPCsTakeMoreDamage(npc, projectile, mod, ref damage); + if (modPlayer.camper && !player.StandingStill()) + damage = (int)(damage * 0.1); + if (!projectile.npcProj && !projectile.trap) { if (projectile.ranged && modPlayer.plagueReaper && pFlames > 0) - { damage = (int)(damage * 1.1); - } } // Nerfed because these are really overpowered diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 078b02ea12..b9f0972412 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -264,7 +263,7 @@ namespace CalamityMod.NPCs.Crabulon num823 = 12f; if (npc.Calamity().enraged > 0) num823 = 16f; - num823 += 2f * enrageScale; + num823 += 4f * enrageScale; bool flag51 = false; if (Math.Abs(npc.Center.X - player.Center.X) < 50f) @@ -274,9 +273,7 @@ namespace CalamityMod.NPCs.Crabulon { npc.velocity.X *= 0.9f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - { npc.velocity.X = 0f; - } } else { @@ -372,8 +369,6 @@ namespace CalamityMod.NPCs.Crabulon case 0: break; case 1: - npc.ai[1] += 1f; - break; case 2: npc.ai[1] += 3f; break; @@ -385,16 +380,13 @@ namespace CalamityMod.NPCs.Crabulon } } if (phase2) - { npc.ai[1] += !revenge ? 4f : 1f; - } if (phase3) - { npc.ai[1] += !revenge ? 4f : 1f; - } } - if (npc.ai[1] >= 300f) + float jumpGateValue = 300f / (enrageScale + 1f); + if (npc.ai[1] >= jumpGateValue) { npc.ai[1] = -20f; } @@ -447,6 +439,9 @@ namespace CalamityMod.NPCs.Crabulon else npc.velocity.Y = velocityY; + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.velocity.X = velocityX * npc.direction; npc.ai[0] = 4f; @@ -503,9 +498,13 @@ namespace CalamityMod.NPCs.Crabulon } else { - npc.ai[0] = 3f; + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + + npc.ai[0] = 3f; if (revenge) npc.ai[3] += 1f; + npc.netUpdate = true; } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 83f8312f44..382749edac 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -139,8 +139,8 @@ namespace CalamityMod.NPCs.DesertScourge if (lungeUpward) { - speed *= 2f; - turnSpeed *= 2f; + speed *= 1.5f; + turnSpeed *= 1.5f; } if (npc.Calamity().enraged > 0) diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 2de8c36f7a..83799c2db4 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -385,6 +385,9 @@ namespace CalamityMod.NPCs.Ravager calamityGlobalNPC.newAI[2] = player.direction; } + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.velocity.X = velocityX * npc.direction; npc.velocity.Y = velocityY; diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/FAP.png index de58fdb8c208c24fca8e5b93cf7e69a73366c0af..79b860fc41da3855fcc305d8b1cb80ed4bbe6873 100644 GIT binary patch literal 3393 zcma)<2~<+~9>)<-(NIK9ZZ0T+hGhz7mW73YC~m2Fk_;!7tSqO=r| z&Wyn{`Z5D6bINHV1)G-1v@y!Iac{Im)TV6lUF^-g=FEHNJkGi2&pjOezyJMxKfmwq zcMBsUf-KDK&0#Q@1t*vl4Xti4n6VOtfWDawbtFKGQA%_W1J?Yr<5TDcxg#Jv00vW) zEO;j{hVE&RVKITw%41ismhF=qe7o01>fs!8@weG}e1q1nH4MXZM6Vvn%bP9ysR&o2 zkG(#3q2U0(8sbdiIN7G2_c4)CpjgHtj_xBHM!-i2T^t;*K;LRy8m}Q6IGV1!G zVH*sF-os%9#H4-ptj=g-e=wSjX-*6!-zC1Eo14+UZfYLXeU`D{0e$IBo$)lF*_|+> z{q_0jt&QX)?1G8sduD}LqVE0s$A?bm4C<=fPdH!7Epf6uaA50?@XRj@{l607#oKCJHg{l)rBP_$u#v}64o%|GM) z?CXYdTij~N`}D%Dt~QubYT827buc?FWr)ODYFt^MS%Jd=ntp{dB0b%V^6Xs=BActFw#S}>RUuW!p;c$sk9;P_qilCLl)6p_f8UWn16Ptw|8oVh2}te!C=%q z>cktz4Wp~^=V)>uR6pH${cuZXMGMuA**G})rY7*$x9)xgfmFMk)88oyC-odtcGM%5 z(FNVqnUJSPch@-MwUo-Z1;hSLxV+`U>`G}HP->YCwwlaV-(igEtxQEnFs`U1Du|wV zPa8_@L2U&el1y|+1PZ+udC?Z^bsr|Ioj>Q1{cDarf3e{^Y#5Ozi=cEesaM|u!8T~m zpelMMx;I!vZ|Od8fCm?25Ih@nz&foktmd%kvMhZQR&{jDM(GyYam5A2Mo+D-?%e%Ni7Ht&ne2&4rmz#p0eo~TwTZS3 zDF;nz?>EvEB}SLdOOZZ@8|(HwAZxELk;T3A3KZKc_aw+TRI+yYUGFbwn5ROQ@%nb@ z%)l$9wY z$2BGo9W14@w;(b=i_-9lsU0s%$>XA=%)1gb-=PDjtVd>_s%F9w@ATga2mm|-{W6ZS zvm5Jy%<1G&(&tY~Bb69gr>MIV$UG4Cb|WoUVF(Om#&~gBFEd*Aj#$ODdsGVdPr7#6 zM2s2NJQEBPJWUi#7x}5|by^1~Y>K!bhq{z$1{aM%*k9m-!Z_Q2uOwxikGhzdA83x& z_?AMd@)yu&iHx(hQaVj#Sm_R1bAc+WgsnO5^=YT14g4+0bL!ocqqtm2U92%N+bGH{ zH7~&re;P?FEPG&y8xIl`bNLA?=L6@oK!N*fme)+}P}U}cr+j86!>vU_`Fy0d+o|Kx z^No0VX6mVBBJP;Eju*>T-sxS4kb}Nop6jh_wsJ=w*n~vpIC0z~3y(?TO+9BZREaDD{y==cRvCzodel4_jv$6a`#LAL9 z{>zLb3vq~cTlCS~$UY4hbe{?m7aaA&r?gdvoXRt(d&N$5`BQym#j=wBBw8thR3QGl zx|U*|in83*!9ovhg?I(V%)MLYpkYwpa`G3)HLeQk`(I5pZNqUR7Jq_$Tp8%0)LYG? zeY+1rdr&wy$iolt!E2F{%RrKdE53?iFRDGFRUFg$vqZ77h$K{g_U&>fHH9iW8?O!) zcyJh$a-f)+@S%E?5D)E4y32&{2sG&Q2_SCgy5FowyIN#TQk~_e1DNlU>Im zUSnY77IUYYNwbS{FDh0ZYRd4+VpFV;@}G>W^&)^MJ3abOMjG&hN8wrvL+(TIh9Bve z1CTV<=<+KlgI@vH?XlNe-q2X8!tghhk&ikKCV$DT$(gqU$}Y$beo?CTesCPws|s|` z9ksrpmF7_&=q3i?xkj_VW8WrsHOizR5PQ~8x*FF@>EFk||KZts3b`!<^!8cOcmjFt zARs?Ftk8H>(#6h*DD$LCj`C_`PGFx96l9@;kxa}Q+l@V1?vpn;hhOQ3QiVMhZCK`WKGgdO{e~UEq`UB^Zlhyw?oCFWWI6 zT<-gj!;9M`SZRiiEMDATrUm+t2-hdC&Nzi|c@uMDNqv))+O|0&uAMgI`dT2q`bAg> z-CdA=bBj0KSzcQDv1Y@b&iqMglXjleNMDFllY8%0&lPSW?nR1TdKW+u%k^g@KMaq0 zpB<=e2KmraRX$MF+O|SPWMC}X!MROAjovlw6i=nZwM=Cf7ZQM!_?mKGZ8>S(UXB60 zx66T8XC{|x1Ao{S1y-Hz508wNs3Ijkuik|b1S$`oGCF4C!DYPv*-bt^I>er?7IKiY z!dS{@&j>`_TmSf|wZ9zl>g|HP*}8l3xV(w687HEixZxm1dAmfe+GBf!?*kq`Xk(U2 zojx30kMmg2e+zXYdOQFk;s0w5=$jl-PsA`G1FfXxwij1Q$$K!%Fv(OGC-|bzEvBiy zp1$jT9wu078_=#OQ0<%l!`IR=?LPl)2*kF!M#Y}>{o}&EC8|*MYR71NOE#54W~TI1 z+mm9eO0NiWPu@1GJ+d|OCoISar&z(+HezSyu@OoA@S={_N6XtM$S1#E>Im|w6}u#p zaUMk~Al=_JJSmg{PgU(x106BDmRJ0){LHqsz<3jWz%X@q-?twVB{d{X)?H^hg5m2b zT$J}Hi_sIyp)PDmiAxTmMC+a^u-dGLSo8vU#KJ*OrY8?Y1Z{4h%(rk?Infg~Ap|x967@^icv>({zVIvlAK6!Y%>EU} za_(;k971kTa#v{+k73;lgA;Z}WI|ofgdMuyIh9+@wns!?Us0qY&Coi#t}$)@Qi+C< zrsOGsb%l8WD(&ND7!E&4Zw6WFi{ELiRn0VoG!d3<#sAnmuY=^3=QgA zsL`r`kVIn@%6DYR%po!6b zBr%V3;sPXiMZI5Qm;p8=#lpo(Qapg$4iN)e=%lW0z}rPZASXh}9VQh0WrzveRc~l< zs-Mo>>@v=}nU59loo_R38%>?e!2V-t-DTS2ixML)^|@^3G0czfOJn3V?dVK_8{o#S zcY^lIDmu&$i@^|M%B!3b3f&V$9{JJ3gi$i4@HOi%6JmYKN4$K+t#6 zux1feNbTisK4Qd+XPEb1<@@d1l%hXV0|{_`rqu65S?f}OgDxF2&(FN0L4DNY-Pd^i b_}xQcvvVbEWPC96Is)SaMzES0e96B6>PO4# literal 3168 zcmaJ@c|4SR7k_3oF$}T|VlXNx+XyW*W1SgG3|cg4GWIAHa+_$3HCZNECT|KMR}_US zX|iOgWGA$cP?KD=m@M%=+}`)zw?E$J^O?_ip3n2l`JMAU-|so+f}?|txTvBi0080? zvLy|)n*jh3hJt~2;~6I~pn;sG*_Z>j+m!|21KfvXPXd7Q6tShF2=JNUXy;-DS{<}A z=jKxldhQCAC zJo0^&vSFj%X6XkuXYUcr@Bz6(4Di7rZ4ihWr^(F#Bd*$n~G|wdp3Ud z;WqV8EqU)pB4&aYzE{)#6sDvI&vbTlFo{Mp%MlOVb*^8>hfCDbmw)@fC&!iLzOjyXP zP?Cep^9*uot3r9OKWN{VvoAjJo*>bJ&2Ej|ez6#i#E;7;{=QK_?W?J1#rV$$tM?U% zPmpw!MqVmCU+~~6lB93sRllwdriL>=-6sM`UK_fV0dMZ?JXO7R?I84m}S483TZ`K;P0}Izc9J&0PHRT!_JpTKY zF;;(yY66?FTm3D(_x2$TOQOy-z1Q7?y-v6ym3M}5X;Qt`RNwrWdpUOEO^7#OhC!u~ zg_dFU<$NQa&Nw!S%@EL%A%n!4wAgvQsFg}vh%BA6Smz;wm*D>B97&1F*`g~qsL0UA znMul|(*~9=D_@x5q#8A3D%EPo%Rmm|&()_uD>adITQ`5HXB!M+39Sls+b(nTw*nKkZICLDFCtaOG;7O|6RSm}=i!WPE9<_PkRrIJ zaHRYTMy5#oHuG=HT^&X8W6X4fpH`^1oQrl~Xe>UEBIE#pey=gf>5TodJcr^g(Nrn8 z?WPbk$R&#G4M|8!D2?sEx#2VQBryF6ZNO1bG_zKoX~69uWz{jjz&2~`(+U<(#aa%v zmOCV@&q4UUC>7_bj*XUYa10cnxc2OiYV9iDI8+f$Vwff|!E&gh42!Ef$(kX*V2mXE2jO;a_LXS&>o>-maPGYVGX+R+XBT*C4yyXR0}9l z)RF+DjO`Jy4hT5{R`ORTzLJe*&kWvr~vBX~yO|Bhh9tcaUtc z#{o`DbZX}WNRJ`&L%+%|OZ%t%^p+|=iu4G}TKkvL!xod1a3sG4F877xKOp_DAvbLa z+JSuU53E?+1t*3Ptazpm2;#uyYJMp6>SlJLPt8*13T;ex|15p5)>`QmrWkr4mp001qLXacXml zjc-!ONhf$d+Hhv)qe3s_I=WsqyJ5dZ6T-jsOR?@ymPQkVpMlaf>3;#1$k2@h;_QzS z<*Dgm44}Pq!$Gq!^iQyXRj_-6k4Xp%0n5mWcqJw9!v+XPY9EXthu6zYDz`}`_w<+O za}6~04t-ouSx+93cB9a~`{$bwlftSv3E96R*|2llq}+o_?uZvo`&Do};q{52UJM-n z|4DJ#`caJNJ}{>Z;McT5xVNoYW`UpS)_?SZ?1q=BT70O_T*1?uei58wY_-rv5b zSF85ZH!ClvB(ArTpu>&H1*6Q#w=AeT)m5Vmg#6ciPQz)afQ8?~5aFPEtH|+hGl`nXDE++1u)_Z%jalu3~IbE?f~$%hE`nEQxlDorF>y+C7G^6K#?N)re# z?>BEY!=4^H7Ke2_>MHswc^PW z$_8&D&k^UH_eBSSaaW6qe zX989+gxxmc_P`#T2R}!Y-x`v>eP2z#;FP{!zAg-6j+!^uADKeqe3e~n%f(3nG0HR~@h%yFQa~FnI zg-UDAf~`Z7Ip6<~eTAVR70=LjQjbfFi5bam`7l*DcUJONEsio+(f=6k>%=+i3Qiaw zLnsFeb|+6jGR)Vfjj^C2an!=A%#vu%T%XAIL5XfZ7w&~TUrC@lQkh6l-Wi8lJ_+gZ zJvNOkCf3{(t*Ez5Ws&N1bD@6ndc0Lsi-|Wk&Dl3UD_`4nvRi#mk=Hw>GNIKA*7n}? zSLhcO7gd%ux0Vi7hU8)(J2?SeUP~9jvG0 ziBYSR?{kc{AHJs(N1~?tsOjt*nJ9=|)dSt2Gji3g_HM0pAO%xCo5C$D zhVPwXO7=2*xMKM-HKE8IM4Dj*!JF$jIeIC$!2ht@m`LSS{!K-o7484EQu7za-*8<~ z9=0gPp0)tTu9ulYC_5nMm`@^Zj@=vNJiVYI(i)?&%04fjww&%pP1qF3wD{`s@(W*0 zI}TleXvKUrwbJK4L-P2WME^%hpkwr~hM@WQa`^^AD>8OZ6%*-Y>OO>hSPkmQ)9%sI z!c+8G5ux`3Htu4=zr`ngzFC4=Y-l$ja=M|>?|=+Sd+a=^M4RyfM8YxLk@~g(Oy7#? zv~Uev&gAj>TN1!1sAacA?S^}Nb)KL&UBv>{1PNTS;+#rd_xOG`ZG{x)qF9f=s2sO| zTj)-KgSw^^8xhcgl6%&KbP?74lqi<(0-D=p2#_Lrx%NS;bJV^9EN+qjmuH% jgl)9E@-x)((!4HH>w$~t^4ay^<_=J-94v2}GdTYSN*IeC diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 500633816c..792a8c7b08 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -989,7 +989,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * 8f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; @@ -1358,7 +1358,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * 8f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; @@ -2214,7 +2214,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; @@ -2244,7 +2244,7 @@ namespace CalamityMod.NPCs.Yharon } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 30f - flareDustBulletHellSpawn) * 8f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 20f - flareDustBulletHellSpawn) * 8f; int type = ModContent.ProjectileType(); int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); Main.projectile[proj].extraUpdates += 1; diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 941f57c819..30972fcd13 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -40,27 +40,29 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } + if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); } else { projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + + int num103 = Player.FindClosest(projectile.Center, 1, 1); Vector2 vector11 = Main.player[num103].Center - projectile.Center; if (vector11.Length() < 60f) { projectile.Kill(); return; } + projectile.ai[0] += 1f; if (projectile.ai[0] > 15f) { @@ -68,22 +70,27 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } + if (projectile.ai[0] >= 120f) { - projectile.ai[1] += 1f; if (projectile.ai[1] < 120f) { - float scaleFactor2 = projectile.velocity.Length(); + if (projectile.ai[1] < 15f) + projectile.velocity *= 1.02f; + + float scaleFactor2 = projectile.velocity.Length(); vector11.Normalize(); vector11 *= scaleFactor2; projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } - else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + else if (projectile.velocity.Length() < 18f) projectile.velocity *= 1.01f; - } - } + + projectile.ai[1] += 1f; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 3635277359..d16fe27fd7 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -962,42 +962,62 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (defDamage == 0 && projectile.hostile) + if (defDamage == 0) { - // Reduce Nail damage from Nailheads because they're stupid - if (projectile.type == ProjectileID.Nail && Main.expertMode) - projectile.damage /= 2; - - if ((CalamityLists.hardModeNerfList.Contains(projectile.type) && Main.hardMode && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon) || projectile.type == ProjectileID.JavelinHostile) + if (projectile.hostile) { - projectile.damage = (int)(projectile.damage * 0.65); + // Reduce Nail damage from Nailheads because they're stupid + if (projectile.type == ProjectileID.Nail && Main.expertMode) + projectile.damage /= 2; + + if ((CalamityLists.hardModeNerfList.Contains(projectile.type) && Main.hardMode && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon) || projectile.type == ProjectileID.JavelinHostile) + { + projectile.damage = (int)(projectile.damage * 0.65); + } + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + if (!NPC.downedMechBossAny) + { + if (MechBossProjectileIDs.Contains(projectile.type)) + { + if (CalamityUtils.AnyBossNPCS(true)) + projectile.damage = (int)(projectile.damage * 0.8); + } + } + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + { + if (MechBossProjectileIDs.Contains(projectile.type)) + { + if (CalamityUtils.AnyBossNPCS(true)) + projectile.damage = (int)(projectile.damage * 0.9); + } + } + } } - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + else { - if (!NPC.downedMechBossAny) - { - if (MechBossProjectileIDs.Contains(projectile.type)) - { - if (CalamityUtils.AnyBossNPCS(true)) - projectile.damage = (int)(projectile.damage * 0.8); - } - } - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - { - if (MechBossProjectileIDs.Contains(projectile.type)) - { - if (CalamityUtils.AnyBossNPCS(true)) - projectile.damage = (int)(projectile.damage * 0.9); - } - } + if (modPlayer.camper && !player.StandingStill()) + projectile.damage = (int)(projectile.damage * 0.1); } defDamage = projectile.damage; } - if (NPC.downedMoonlord) + // Setting this in SetDefaults didn't work + switch (projectile.type) + { + case ProjectileID.Bee: + case ProjectileID.Wasp: + case ProjectileID.TinyEater: + case ProjectileID.GiantBee: + case ProjectileID.Bat: + projectile.extraUpdates = 1; + break; + } + + if (NPC.downedMoonlord) { if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) { diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index da15bb2097..9bcf17c4ed 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -38,21 +38,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 0; projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - - if (projectile.ai[1] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (Vector2.Distance(projectile.Center, npc.Center) < 300f && npc.CanBeChasedBy(projectile)) - { - projectile.ai[1] = 2f; - Vector2 velocity = Vector2.Normalize(npc.Center - projectile.Center) * 12f; - int proj = Projectile.NewProjectile(projectile.Center, velocity, (int)projectile.ai[0], projectile.damage / 2, projectile.knockBack * 0.5f, Main.myPlayer); - Main.projectile[proj].extraUpdates += 5; - } - } - } } public override Color? GetAlpha(Color lightColor) @@ -89,13 +74,19 @@ namespace CalamityMod.Projectiles.Ranged private void OnHitEffects(Vector2 targetPos, bool crit) { - if (crit) + bool skullmasher = projectile.ai[1] == 1f; + if (crit || skullmasher) { - int extraProjectileAmt = projectile.ai[1] >= 1f ? 2 : 8; + int extraProjectileAmt = skullmasher ? 2 : 8; for (int x = 0; x < extraProjectileAmt; x++) { - if (projectile.owner == Main.myPlayer) - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 4, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); + if (projectile.owner == Main.myPlayer) + { + bool fromRight = skullmasher ? x > 0 : x > 3; + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, fromRight, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); + if (skullmasher) + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, fromRight, 500f, 500f, 0f, 500f, 10f, (int)projectile.ai[0], (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); + } } } } diff --git a/Projectiles/Ranged/AccelerationBulletProj.cs b/Projectiles/Ranged/AccelerationBulletProj.cs index 538bc171bf..6a37f8f4fd 100644 --- a/Projectiles/Ranged/AccelerationBulletProj.cs +++ b/Projectiles/Ranged/AccelerationBulletProj.cs @@ -17,9 +17,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - // Intentionally large bullet hitbox because this thing speeds up significantly - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -32,13 +31,24 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.velocity *= 1.01f; - if (Main.rand.NextBool(3)) - { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + if (projectile.velocity.Length() >= 12f) + { + projectile.velocity *= 0.5f; + projectile.extraUpdates++; + projectile.netUpdate = true; + } + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/AcidBulletProj.cs b/Projectiles/Ranged/AcidBulletProj.cs index 6263961108..221ab4bd3e 100644 --- a/Projectiles/Ranged/AcidBulletProj.cs +++ b/Projectiles/Ranged/AcidBulletProj.cs @@ -31,14 +31,19 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - if (Main.rand.NextBool(2)) - { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index fc12a26277..9602483a75 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,15 +19,15 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; projectile.timeLeft = 600; projectile.light = 0.25f; - projectile.extraUpdates = 1; + projectile.extraUpdates = 2; aiType = ProjectileID.Bullet; } @@ -49,21 +48,27 @@ namespace CalamityMod.Projectiles.Ranged { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); projectile.spriteDirection = projectile.direction; - if (Main.rand.NextBool(2)) - { - int randomDust = Utils.SelectRandom(Main.rand, new int[] + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(2)) { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { ModContent.DustType(), ModContent.DustType() - }); - int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[astral].alpha = projectile.alpha; - Main.dust[astral].velocity *= 0f; - Main.dust[astral].noGravity = true; - } + }); + int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[astral].alpha = projectile.alpha; + Main.dust[astral].velocity *= 0f; + Main.dust[astral].noGravity = true; + } + } if (speed == 0f) speed = projectile.velocity.Length(); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, speed, 12f); return false; } diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 473325d506..78b262e084 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +11,14 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Clot"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; @@ -36,5 +39,18 @@ namespace CalamityMod.Projectiles.Ranged } } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + } } diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index 48f524a454..8e231ca279 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -36,15 +36,19 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.15f); // Dust - int dustID = 90; - float scale = Main.rand.NextFloat(0.6f, 0.9f); - Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); - Vector2 posOffset = projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; - d.position += posOffset - 2f * Vector2.UnitY; - d.noGravity = true; - d.velocity *= 0.6f; - d.velocity += projectile.velocity * 0.15f; - d.scale = scale; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + int dustID = 90; + float scale = Main.rand.NextFloat(0.6f, 0.9f); + Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, dustID); + Vector2 posOffset = projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; + d.position += posOffset - 2f * Vector2.UnitY; + d.noGravity = true; + d.velocity *= 0.6f; + d.velocity += projectile.velocity * 0.15f; + d.scale = scale; + } } // These bullets glow in the dark. diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonBurst.cs index a93f6cd13c..224b1967c9 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonBurst.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.extraUpdates = 10; projectile.penetrate = 1; @@ -32,10 +32,10 @@ namespace CalamityMod.Projectiles.Ranged //Rotation projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) +MathHelper.ToRadians(90) * projectile.direction; + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { - float num93 = projectile.velocity.X / 3f; float num94 = projectile.velocity.Y / 3f; int num95 = 4; diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index 1a00399717..1241d3ced3 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -1,4 +1,3 @@ - using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -32,14 +31,19 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - if (Main.rand.NextBool(3)) - { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/FlashBulletProj.cs b/Projectiles/Ranged/FlashBulletProj.cs index be5639c264..d0bd78479a 100644 --- a/Projectiles/Ranged/FlashBulletProj.cs +++ b/Projectiles/Ranged/FlashBulletProj.cs @@ -30,14 +30,19 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.1f / 255f); - if (Main.rand.NextBool(3)) - { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.1f); + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/FrostsparkBulletProj.cs b/Projectiles/Ranged/FrostsparkBulletProj.cs index 5270fed82a..553da055da 100644 --- a/Projectiles/Ranged/FrostsparkBulletProj.cs +++ b/Projectiles/Ranged/FrostsparkBulletProj.cs @@ -32,16 +32,21 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, 0.15f, 0.05f, 0.3f); - if (Main.rand.NextBool()) - { - int dustType = 15; - float spacing = Main.rand.NextFloat(-0.2f, 0.8f); - int dust = Dust.NewDust(projectile.Center - spacing * projectile.velocity, 1, 1, dustType);; - Main.dust[dust].position = projectile.Center; - Main.dust[dust].velocity *= 0.4f; - Main.dust[dust].velocity += projectile.velocity * 0.7f; - Main.dust[dust].noGravity = true; - } + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool()) + { + int dustType = 15; + float spacing = Main.rand.NextFloat(-0.2f, 0.8f); + int dust = Dust.NewDust(projectile.Center - spacing * projectile.velocity, 1, 1, dustType); ; + Main.dust[dust].position = projectile.Center; + Main.dust[dust].velocity *= 0.4f; + Main.dust[dust].velocity += projectile.velocity * 0.7f; + Main.dust[dust].noGravity = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index fa1f1d1cfe..a05a0067df 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -22,9 +22,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - // Intentionally large bullet hitbox - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.extraUpdates = 4; @@ -36,19 +35,23 @@ namespace CalamityMod.Projectiles.Ranged projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); projectile.spriteDirection = projectile.direction; - // Flaking dust - if (Main.rand.NextBool()) - { - float scale = Main.rand.NextFloat(0.6f, 1.6f); - int dustID = Dust.NewDust(projectile.Center, 1, 1, 244); - Main.dust[dustID].position = projectile.Center; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = scale; - float angleDeviation = 0.17f; - float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - Vector2 sprayVelocity = projectile.velocity.RotatedBy(angle) * 0.6f; - Main.dust[dustID].velocity = sprayVelocity; - } + // Flaking dust + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool()) + { + float scale = Main.rand.NextFloat(0.6f, 1.6f); + int dustID = Dust.NewDust(projectile.Center, 1, 1, 244); + Main.dust[dustID].position = projectile.Center; + Main.dust[dustID].noGravity = true; + Main.dust[dustID].scale = scale; + float angleDeviation = 0.17f; + float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); + Vector2 sprayVelocity = projectile.velocity.RotatedBy(angle) * 0.6f; + Main.dust[dustID].velocity = sprayVelocity; + } + } } public override Color? GetAlpha(Color lightColor) => Alpha; diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs index b8eb0fe003..26ec484952 100644 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ b/Projectiles/Ranged/IcyBulletProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,9 +9,14 @@ namespace CalamityMod.Projectiles.Ranged { public class IcyBulletProj : ModProjectile { - public override void SetStaticDefaults() => DisplayName.SetDefault("Icy Bullet"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icy Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() + public override void SetDefaults() { projectile.width = 4; projectile.height = 4; @@ -29,11 +35,15 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Main.rand.NextBool(3)) - { - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default, 1f); - Main.dust[index2].noGravity = true; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(3)) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default, 1f); + Main.dust[index2].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -42,7 +52,13 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 120); } - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override Color? GetAlpha(Color lightColor) { return new Color(200, 200, 200, projectile.alpha); } diff --git a/Projectiles/Ranged/IlluminatedBullet.cs b/Projectiles/Ranged/IlluminatedBullet.cs index b3af24bd70..23a0885f17 100644 --- a/Projectiles/Ranged/IlluminatedBullet.cs +++ b/Projectiles/Ranged/IlluminatedBullet.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class IlluminatedBullet : ModProjectile @@ -10,7 +12,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Illuminated Bullet"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -47,7 +51,13 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); } diff --git a/Projectiles/Ranged/ProBolt.cs b/Projectiles/Ranged/ProBolt.cs index 66d9929bad..4ab36211b3 100644 --- a/Projectiles/Ranged/ProBolt.cs +++ b/Projectiles/Ranged/ProBolt.cs @@ -1,6 +1,9 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class ProBolt : ModProjectile @@ -8,12 +11,14 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 3; @@ -27,21 +32,29 @@ namespace CalamityMod.Projectiles.Ranged projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) *projectile.direction; Lighting.AddLight(projectile.Center, new Vector3(158, 240, 240) * (1.5f / 255)); - for (int num134 = 0; num134 < 6; num134++) - { - Vector2 dspeed = -projectile.velocity * 0.8f; - float x = projectile.Center.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.Center.Y - projectile.velocity.Y / 10f * (float)num134; - int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 1.25f); - Main.dust[num135].alpha = projectile.alpha; - Main.dust[num135].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity = dspeed; - Main.dust[num135].noGravity = true; - } + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + Vector2 dspeed = -projectile.velocity * 0.8f; + float x = projectile.Center.X - projectile.velocity.X / 10f; + float y = projectile.Center.Y - projectile.velocity.Y / 10f; + int num135 = Dust.NewDust(new Vector2(x, y), 1, 1, 160, 0f, 0f, 0, default, 1.25f); + Main.dust[num135].alpha = projectile.alpha; + Main.dust[num135].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity = dspeed; + Main.dust[num135].noGravity = true; + } } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; if (projectile.penetrate <= 0) diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index ba81aca67d..8222e92154 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class RealmRavagerBullet : ModProjectile @@ -9,7 +11,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Explosive Bullet"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -26,7 +30,13 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 90; } - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.position); projectile.position = projectile.Center; diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 2a2f7d6def..6c7ecf6175 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -38,24 +38,20 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreAI() { - for (int num136 = 0; num136 < 3; num136++) - { - Vector2 dspeed = -projectile.velocity * 0.5f; - float x2 = projectile.Center.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 1f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + Vector2 dspeed = -projectile.velocity * 0.5f; + float x2 = projectile.Center.X - projectile.velocity.X / 10f; + float y2 = projectile.Center.Y - projectile.velocity.Y / 10f; + int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 1f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity = dspeed; + Main.dust[num137].noGravity = true; + } + //Rotation projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = (projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + MathHelper.ToRadians(90) * projectile.direction; diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 39f51dc9ac..dd5bf6b1e4 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -49,11 +49,6 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num137].position.Y = y2; Main.dust[num137].velocity = dspeed; Main.dust[num137].noGravity = true; - - float num138 = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - projectile.localAI[0] = num138; //Rotation projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 072d071800..7b8a42feb1 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -1,9 +1,11 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class SlagRound : ModProjectile @@ -11,35 +13,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; + projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; } public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 2f) - { - for (int num468 = 0; num468 < 2; num468++) - { - Vector2 dspeed = -projectile.velocity * 0.7f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1.3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; - } - } + if (projectile.localAI[0] > 4f) + { + Vector2 dspeed = -projectile.velocity * 0.7f; + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 32, 0f, 0f, 100, default, 1f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity = dspeed; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs index d435908395..34da52f062 100644 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ b/Projectiles/Ranged/SuperballBulletProj.cs @@ -17,9 +17,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - // Intentionally large bullet hitbox because this thing speeds up significantly - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -31,13 +30,17 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Main.rand.NextBool(3)) - { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -49,16 +52,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) - { projectile.velocity.X = -oldVelocity.X; - } if (projectile.velocity.Y != oldVelocity.Y) - { projectile.velocity.Y = -oldVelocity.Y; - } - projectile.velocity *= 1.5f; + + if (projectile.extraUpdates < 5) + projectile.extraUpdates++; + Main.PlaySound(SoundID.Item10, projectile.position); } return false; diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index a91129acef..ee8a6eb7ee 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged // localAI is used as an invisibility counter. The bullet fades into existence after 15 startup frames. projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) + if (projectile.localAI[0] > 4f) { // After 15 frames, the alpha will be exactly 0 if (projectile.alpha > 0) diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 449eee3399..a18dda526c 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -34,18 +34,12 @@ namespace CalamityMod.Projectiles.Ranged public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } - public override void AI() + public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (projectile.alpha > 0) diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index f4e80796b6..b1dad5bc8f 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -41,12 +41,17 @@ namespace CalamityMod.Projectiles.Ranged { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); projectile.spriteDirection = projectile.direction; - if (Main.rand.NextBool(2)) + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) { - int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[purple].alpha = projectile.alpha; - Main.dust[purple].velocity *= 0f; - Main.dust[purple].noGravity = true; + if (Main.rand.NextBool(2)) + { + int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[purple].alpha = projectile.alpha; + Main.dust[purple].velocity *= 0f; + Main.dust[purple].noGravity = true; + } } if (projectile.ai[0] > 0f) diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 3c8bf93a9c..919e83a47d 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -508,10 +508,10 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 180, 270, 300, 315, 405 } }, { ModContent.NPCType(), new int[] { 180, 270, 300, 315, 405 } }, - { ModContent.NPCType(), new int[] { 250, 500, 550, 580, 660 } }, + { ModContent.NPCType(), new int[] { 300, 600, 650, 680, 760 } }, { ModContent.NPCType(), new int[] { 180, 306, 340, 357, 510 } }, { ModContent.NPCType(), new int[] { 150, 255, 289, 306, 408 } }, - { ModContent.NPCType(), new int[] { 300, 600, 650, 680, 780 } }, + { ModContent.NPCType(), new int[] { 350, 700, 750, 780, 880 } }, { ModContent.NPCType(), new int[] { 220, 374, 425, 442, 561 } }, { ModContent.NPCType(), new int[] { 180, 306, 340, 357, 459 } }, { ModContent.NPCType(), new int[] { 180, 360, 396, 420, 510 } }, From 74280788c2eadf36de816e00513f4492de33adf3 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 24 Apr 2021 05:21:04 -0500 Subject: [PATCH 39/43] 1 - Fixed some possible worm issues with every worm NPC in Calamity. --- NPCs/Abyss/EidolonWyrmBody.cs | 4 ++-- NPCs/Abyss/EidolonWyrmBodyAlt.cs | 4 ++-- NPCs/Abyss/EidolonWyrmBodyAltHuge.cs | 4 ++-- NPCs/Abyss/EidolonWyrmBodyHuge.cs | 4 ++-- NPCs/Abyss/EidolonWyrmHead.cs | 4 ++-- NPCs/Abyss/EidolonWyrmHeadHuge.cs | 4 ++-- NPCs/Abyss/EidolonWyrmTail.cs | 4 ++-- NPCs/Abyss/EidolonWyrmTailHuge.cs | 4 ++-- NPCs/Abyss/GulperEelBody.cs | 4 ++-- NPCs/Abyss/GulperEelBodyAlt.cs | 4 ++-- NPCs/Abyss/GulperEelHead.cs | 4 ++-- NPCs/Abyss/GulperEelTail.cs | 4 ++-- NPCs/Abyss/OarfishBody.cs | 4 ++-- NPCs/Abyss/OarfishHead.cs | 4 ++-- NPCs/Abyss/OarfishTail.cs | 5 ++--- NPCs/AquaticScourge/AquaticSeekerBody.cs | 4 ++-- NPCs/AquaticScourge/AquaticSeekerHead.cs | 4 ++-- NPCs/AquaticScourge/AquaticSeekerTail.cs | 4 ++-- NPCs/CalamityAI.cs | 8 ++++---- NPCs/DesertScourge/DesertScourgeHead.cs | 4 ++-- NPCs/DesertScourge/DesertScourgeHeadSmall.cs | 9 ++++----- NPCs/DesertScourge/DriedSeekerHead.cs | 8 ++++---- NPCs/DevourerofGods/DevourerofGodsBody.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsBody2.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsBodyS.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsHead.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsHead2.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsTail.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsTail2.cs | 4 ++-- NPCs/DevourerofGods/DevourerofGodsTailS.cs | 4 ++-- NPCs/Perforator/PerforatorHeadLarge.cs | 2 +- NPCs/Perforator/PerforatorHeadSmall.cs | 2 +- NPCs/StormWeaver/StormWeaverBody.cs | 4 ++-- NPCs/StormWeaver/StormWeaverBodyNaked.cs | 4 ++-- NPCs/StormWeaver/StormWeaverHead.cs | 4 ++-- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 4 ++-- NPCs/StormWeaver/StormWeaverTail.cs | 4 ++-- NPCs/StormWeaver/StormWeaverTailNaked.cs | 4 ++-- NPCs/SunkenSea/SeaSerpent1.cs | 4 ++-- NPCs/SunkenSea/SeaSerpent2.cs | 4 ++-- NPCs/SunkenSea/SeaSerpent3.cs | 4 ++-- NPCs/SunkenSea/SeaSerpent4.cs | 4 ++-- NPCs/SunkenSea/SeaSerpent5.cs | 4 ++-- NPCs/SupremeCalamitas/SCalWormBody.cs | 4 ++-- NPCs/SupremeCalamitas/SCalWormBodyWeak.cs | 4 ++-- NPCs/SupremeCalamitas/SCalWormHead.cs | 4 ++-- NPCs/SupremeCalamitas/SCalWormTail.cs | 4 ++-- NPCs/TownNPCs/FAP.png | Bin 3393 -> 3409 bytes 49 files changed, 100 insertions(+), 102 deletions(-) diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index ce21d46ffc..b79adab08c 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 3b4ca6500b..6bb26dbd13 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs index 3f09a4d4ca..a27547108e 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/EidolonWyrmBodyHuge.cs b/NPCs/Abyss/EidolonWyrmBodyHuge.cs index ea1e2be1ac..7a19413ba3 100644 --- a/NPCs/Abyss/EidolonWyrmBodyHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyHuge.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 0b28eaab57..98d05788cd 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -98,9 +98,9 @@ namespace CalamityMod.NPCs.Abyss Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); } } - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 7b32dbfbb2..9494fe375a 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -107,9 +107,9 @@ namespace CalamityMod.NPCs.Abyss Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); } } - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 92957f8c49..5410543ebc 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -44,9 +44,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/EidolonWyrmTailHuge.cs b/NPCs/Abyss/EidolonWyrmTailHuge.cs index 88f1e10c25..7ea423cc0b 100644 --- a/NPCs/Abyss/EidolonWyrmTailHuge.cs +++ b/NPCs/Abyss/EidolonWyrmTailHuge.cs @@ -44,9 +44,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 6a589801fd..a4384fb3ac 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 15d77bb456..5bbe2a2c98 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 9dd4ebc64f..ec93fa97fe 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -76,9 +76,9 @@ namespace CalamityMod.NPCs.Abyss detectsPlayer = true; } npc.chaseable = detectsPlayer; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index c344e5b3a3..5adc3cf9db 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 7b225d713f..0bf8a2a69b 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -43,9 +43,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 9dc342b0ea..e40e114ae2 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -70,9 +70,9 @@ namespace CalamityMod.NPCs.Abyss detectsPlayer = true; } npc.chaseable = detectsPlayer; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index 0e670a7e1b..a8f622686c 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -43,11 +43,10 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } - npc.velocity.Length(); bool flag = false; if (npc.ai[1] <= 0f) { diff --git a/NPCs/AquaticScourge/AquaticSeekerBody.cs b/NPCs/AquaticScourge/AquaticSeekerBody.cs index b637e9eb1f..e8fdb10a87 100644 --- a/NPCs/AquaticScourge/AquaticSeekerBody.cs +++ b/NPCs/AquaticScourge/AquaticSeekerBody.cs @@ -44,9 +44,9 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/AquaticScourge/AquaticSeekerHead.cs b/NPCs/AquaticScourge/AquaticSeekerHead.cs index 1c3781b5f2..49f2ccd77d 100644 --- a/NPCs/AquaticScourge/AquaticSeekerHead.cs +++ b/NPCs/AquaticScourge/AquaticSeekerHead.cs @@ -46,9 +46,9 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/AquaticScourge/AquaticSeekerTail.cs b/NPCs/AquaticScourge/AquaticSeekerTail.cs index 79ef4e517e..c401a9f185 100644 --- a/NPCs/AquaticScourge/AquaticSeekerTail.cs +++ b/NPCs/AquaticScourge/AquaticSeekerTail.cs @@ -44,9 +44,9 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index cad7682ffe..b3f791fc98 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -78,8 +78,8 @@ namespace CalamityMod.NPCs npc.chaseable = calamityGlobalNPC.newAI[0] == 1f; // Set worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -3230,8 +3230,8 @@ namespace CalamityMod.NPCs } // Set worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 382749edac..1ac2fb6846 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -179,8 +179,8 @@ namespace CalamityMod.NPCs.DesertScourge { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[3] = npc.whoAmI; + Main.npc[lol].realLife = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index e7858d0196..1993f4300e 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -57,7 +57,6 @@ namespace CalamityMod.NPCs.DesertScourge npc.TargetClosest(); } Player player = Main.player[npc.target]; - npc.velocity.Length(); npc.alpha -= 42; if (npc.alpha < 0) { @@ -77,10 +76,10 @@ namespace CalamityMod.NPCs.DesertScourge { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[3] = npc.whoAmI; + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 05d43e9e86..8cd3b49879 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -53,10 +53,10 @@ namespace CalamityMod.NPCs.DesertScourge { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[3] = npc.whoAmI; + Main.npc[lol].realLife = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 4f4a8e9e56..6caa7ed2bb 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -85,8 +85,8 @@ namespace CalamityMod.NPCs.DevourerofGods else npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index 5cb19e6d37..14193dafde 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -74,9 +74,9 @@ namespace CalamityMod.NPCs.DevourerofGods npc.dontTakeDamage = false; } - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index 1a210c14a6..9715e43bc1 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -98,9 +98,9 @@ namespace CalamityMod.NPCs.DevourerofGods { invinceTime = 240; } - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } // Target diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index eaa49220fb..8b74aa0b85 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -129,8 +129,8 @@ namespace CalamityMod.NPCs.DevourerofGods Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index cfb8cda0e7..c72116110f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -82,9 +82,9 @@ namespace CalamityMod.NPCs.DevourerofGods Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.alpha != 0) diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 366fd50305..cd67c41d99 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -176,8 +176,8 @@ namespace CalamityMod.NPCs.DevourerofGods Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Worm shit again - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 2fa3f688d2..ebb258d5d5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -57,9 +57,9 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } // Target diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index 5b354d976d..9a38cd2818 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -71,9 +71,9 @@ namespace CalamityMod.NPCs.DevourerofGods npc.dontTakeDamage = false; } - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 49587254e0..612fed5d1a 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -97,8 +97,8 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.npc[(int)npc.ai[2]].dontTakeDamage) invinceTime = 240; - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 5089cb2f3b..1ade00064a 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.Perforator Main.npc[lol].localAI[3] = 1f; } Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[3] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index cf4be22ac9..b967ee24a1 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -138,7 +138,7 @@ namespace CalamityMod.NPCs.Perforator lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[3] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; NetMessage.SendData(MsgType, -1, -1, null, lol, 0f, 0f, 0f, 0); diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index d6ccf72dfc..521fae21aa 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -76,9 +76,9 @@ namespace CalamityMod.NPCs.StormWeaver npc.defense = 0; Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index bdab186bb3..df78cb0899 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -100,9 +100,9 @@ namespace CalamityMod.NPCs.StormWeaver Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 0aa90d6cea..ba48297f3d 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -101,9 +101,9 @@ namespace CalamityMod.NPCs.StormWeaver CalamityUtils.StartRain(); } Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } // Get a target diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 2cd6c028c3..648829d636 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -140,9 +140,9 @@ namespace CalamityMod.NPCs.StormWeaver Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } // Get a target diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 62c186a6c9..cf6a4fb945 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -70,9 +70,9 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index d19d16c24b..846258c6af 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -97,9 +97,9 @@ namespace CalamityMod.NPCs.StormWeaver Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index 8edb7c8c7d..ef2507ebab 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -43,9 +43,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs index f239eae8b6..607401472e 100644 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -46,9 +46,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs index 4f890e5dd3..a410cf620d 100644 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -43,9 +43,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs index 7fd77f36e1..587e4edd2a 100644 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -43,9 +43,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs index fca9623c43..9d905f6127 100644 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -43,9 +43,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { Lighting.AddLight(npc.Center, (255 - npc.alpha) * 0f / 255f, (255 - npc.alpha) * 0.30f / 255f, (255 - npc.alpha) * 0.30f / 255f); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; if (npc.ai[1] <= 0f) diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index 5361dee67f..ba98444bc2 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -72,9 +72,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index 45907fa8d9..cc1b3890d4 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -65,9 +65,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index b181196c6b..7377add402 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -87,9 +87,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Player player = Main.player[npc.target]; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index af2cfbb6e3..5f1df23a1d 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -69,9 +69,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/FAP.png index 79b860fc41da3855fcc305d8b1cb80ed4bbe6873..c29b4bed7f24105032d0d78139ee5962d09037de 100644 GIT binary patch literal 3409 zcmb7{cT`hb7REzI5)u#uDF(10-I54F2#|mhloA1@2udhY1SB8`f=COIj!!yKy5=ED zM`A%C5D+9FL8UpANK-({^M&?sZq%7I^K|~0yH?i8y?14uefIwL@7qbhTbhcB$clhK zAW<`%i8ZjQfItGF!hFED$*fB-VBra}HpPM-GUaE18-7oW1qKAFP6KZe1b};8yt(Z$ zr{ftW>cKHrHv%Nc8VaUQKCTzRsSMo)bC{Dn1T{q>ttY%pl+InY>-zebdc~#Yv3P}= zyeaVOi`(3*fkoo7wWZD1pDs|%wGm<9^|k<TG@hye+lZp>7IssuNee3zmh5GV&GG}guB+sT%hOIF31>EY`H=W z47OH!WZ&}@Fl4Wz&IrPxFqmPa(enySu+8+vq zr%7zC-D(>W8m!Q`dFULIl~8a9PVSxN@cOvvLxYccjE@(B*H*~STgDeh@p<~N+~oPL zx9HobJZW}3WHzL5plLJFf)eXHl%4&~u0d{e$xin+V;mW=>!SyiWtLPgRAY4DfK!x( zWs0$Jo6^aWX4dSN%zYCZ!~m*BovMRu6I_U#h}GhEN&h{KKCk^66>;rN+z`ZZm3;_y zgm51TC;z3^=pbDc*z@h^Di%SO2t4NabSGN22jdt|g2mctYVjLtb0|F`B6cb7MT=}G z(L6;Cjme1VS_H=ztL(N>6FlfUy~1X%QAi>pk9VmQ#|X$KK=>_)@nBXP&b=sa-+Xr2 z_0Tcby~Scfi3rBw^fH}mG`VVNYK%=4-o zb6;40=~Z2hkruyE`nc6y1L&jSH*NfdyrMQWGIfjhKXXuuRA<>VdgOaVMMh02QJAH4 zA}OB*`JmJmn;KLmnKG^D$10A&9BI_>C8Zs|8(^&cDR{N&B|F^@bM{j_Z2yO)hv3{6 zA=pQa(pjG;HP;3o`!;yk-!P63)|=_+s!ESmye;5RuBy?hn2|S;+>&)-w}@(CUKv&V zw7ie27DIUye5CZT#{!R0J?2lNHktV5brL&(&k6~>rxR$uTgwZF>y-hd6DFItNS(@7) zRlZh{KUTZ9xavFyqR!FqmT$RyqYpWa zylZVB6`>{Ub{LG)=$q}of$;BGy!z~k;vcrn-H)R(OS6zr!ch}%dQe`pJ}9&?XzPTT zkHUxOxlN;2qTU~+JR#)|JjeYEbz_(5pQ19zQt44EQ5huWm2_ z7}8hJ9VHo8sLHGmELC)3$Yh#GVsmpQXIf=+C{`g)IN>?xY!6JsJ4hhN;V;C-_sX*5 zrz!NfhI;$GEy=G{J_udhCrq$^lK@J(E8?^;jh`}FRQz*&UL zmO|Lca_8D}*ROPkc@g73PcNxJi@H#B-c#%V-Wnu(;88c)adp;$g6fZZz%BLtu?x;G zI?*R($p?28BfE9Gjo{(>M|JHMUWY>aZfHjAwC#G;(uvLtr)t>Nj&Sz~X2|Hcdo!x@ zr{GBnT*W6L1asF>BmQ>M5>e}(dgd=L^tMz^!G-wiPqK*vl`;9jJpWbKu(_p~4^A{w zwk~c@!y*9>h)JCj(KNF1=RXF5_3-zJ%KU?M?@>^O~db!MZ|Nkr5^S zt(`~4Kbyg>IxnE}iTBKcLmw(`R;Mc_2D)fMYRrQgxLxF7zhYts_Uzzpzo(-mLs2DO8Qees*_Qo~?F2yaFx-;Y#Ady9 zXB*vs|6NOav66t2->tWV?AEz?=0Ca?xJ|7pw zW0D4p@q?wgwJ%15yB3R<d?kdUr< zHv#uhQ;T!?WN76{$FRl9_ifLgFo##tI0xWtJ`>%0C*wZxsD87hv5)O`JRODpWT2N~e1{g=?FcwZu23mp zH7NIJCx!Dgt}eDx5Gk<0n1Dq1H~yN)MZ3DT<=$TukE*OR-|v;wDus|G@m?g|Xo>uZ z>Qu#&ph-Bu-jtjR?%BLtv7Z4DGgy&|3W^=MMN-&+{-%BQFOCyYc=9@>{rsr1T?&0$ zM_;m=&MR~)^wcv-c;Un={@nG|$R{!>#=OcBjyZ&zp#dI6%D&kqlK)?ORg55@WPrRO zKZW@V^I5H?nI5>ehf{%7NwJo==(d>N)G6r?m?SwC0X%dRyHyQXgpWl^5)ljLdSt_a z=dKddiY&k+XE5||JD_|;esIq^`>+mJP7b*09pmZKU>8oSIZVCg*2>+b`n`TnKtyeZ8d#&!ujEwLHJLCqE$tAPn+k)0Cdpv68>Hy*j59C}8FnLeWE#U-2-5wVmz~l3S6A@Q+chNj|V7;^Q?B!y~f1Ex+G@fp^Q|bVsX?W;p zv*J2}_Y*a#zP6TmA0-jv>)1Yw!cZ@mZM<=vkJi9H8?~X4e>oxb+zwZ7;ct-iOsLrP5Jt?RKjy4J!u>xGzV~0GPq4f z2ifTn4D4IeeOajhpg%xtU;W57WhREY2S_vZ!e9bW2%sPxeO^_8R&bw|Gv4~pjne_O zS}y-NR20S}GYbxJKzaa}!zxzr(>MFO(LB^BlddtnCz4~MQqpm$D0cj%&t2?9gg-7J z@DyMM@xBOW+~l23w1byT4Ke}^h3+6l1CKMq9sdS7?nK#>6>gh4QX=xglJZ&sgX^kV zBrKMN@VVfKy5=*I)o+*tUZ$PgI6{8-!0^eB79$XnU6LloR}U4cG5Z2eV(z ztoN1&!T`Vi-#PrQ2#;PQpokLdRvGNkogv{V6ie3f6htPW=5F;JlIcwEh1YnFCuMJ^IRX8gYYz${Y;= Q{-S`)j#-*K#Ja@%6GHb_*Z=?k literal 3393 zcma)<2~<+~9>)<-(NIK9ZZ0T+hGhz7mW73YC~m2Fk_;!7tSqO=r| z&Wyn{`Z5D6bINHV1)G-1v@y!Iac{Im)TV6lUF^-g=FEHNJkGi2&pjOezyJMxKfmwq zcMBsUf-KDK&0#Q@1t*vl4Xti4n6VOtfWDawbtFKGQA%_W1J?Yr<5TDcxg#Jv00vW) zEO;j{hVE&RVKITw%41ismhF=qe7o01>fs!8@weG}e1q1nH4MXZM6Vvn%bP9ysR&o2 zkG(#3q2U0(8sbdiIN7G2_c4)CpjgHtj_xBHM!-i2T^t;*K;LRy8m}Q6IGV1!G zVH*sF-os%9#H4-ptj=g-e=wSjX-*6!-zC1Eo14+UZfYLXeU`D{0e$IBo$)lF*_|+> z{q_0jt&QX)?1G8sduD}LqVE0s$A?bm4C<=fPdH!7Epf6uaA50?@XRj@{l607#oKCJHg{l)rBP_$u#v}64o%|GM) z?CXYdTij~N`}D%Dt~QubYT827buc?FWr)ODYFt^MS%Jd=ntp{dB0b%V^6Xs=BActFw#S}>RUuW!p;c$sk9;P_qilCLl)6p_f8UWn16Ptw|8oVh2}te!C=%q z>cktz4Wp~^=V)>uR6pH${cuZXMGMuA**G})rY7*$x9)xgfmFMk)88oyC-odtcGM%5 z(FNVqnUJSPch@-MwUo-Z1;hSLxV+`U>`G}HP->YCwwlaV-(igEtxQEnFs`U1Du|wV zPa8_@L2U&el1y|+1PZ+udC?Z^bsr|Ioj>Q1{cDarf3e{^Y#5Ozi=cEesaM|u!8T~m zpelMMx;I!vZ|Od8fCm?25Ih@nz&foktmd%kvMhZQR&{jDM(GyYam5A2Mo+D-?%e%Ni7Ht&ne2&4rmz#p0eo~TwTZS3 zDF;nz?>EvEB}SLdOOZZ@8|(HwAZxELk;T3A3KZKc_aw+TRI+yYUGFbwn5ROQ@%nb@ z%)l$9wY z$2BGo9W14@w;(b=i_-9lsU0s%$>XA=%)1gb-=PDjtVd>_s%F9w@ATga2mm|-{W6ZS zvm5Jy%<1G&(&tY~Bb69gr>MIV$UG4Cb|WoUVF(Om#&~gBFEd*Aj#$ODdsGVdPr7#6 zM2s2NJQEBPJWUi#7x}5|by^1~Y>K!bhq{z$1{aM%*k9m-!Z_Q2uOwxikGhzdA83x& z_?AMd@)yu&iHx(hQaVj#Sm_R1bAc+WgsnO5^=YT14g4+0bL!ocqqtm2U92%N+bGH{ zH7~&re;P?FEPG&y8xIl`bNLA?=L6@oK!N*fme)+}P}U}cr+j86!>vU_`Fy0d+o|Kx z^No0VX6mVBBJP;Eju*>T-sxS4kb}Nop6jh_wsJ=w*n~vpIC0z~3y(?TO+9BZREaDD{y==cRvCzodel4_jv$6a`#LAL9 z{>zLb3vq~cTlCS~$UY4hbe{?m7aaA&r?gdvoXRt(d&N$5`BQym#j=wBBw8thR3QGl zx|U*|in83*!9ovhg?I(V%)MLYpkYwpa`G3)HLeQk`(I5pZNqUR7Jq_$Tp8%0)LYG? zeY+1rdr&wy$iolt!E2F{%RrKdE53?iFRDGFRUFg$vqZ77h$K{g_U&>fHH9iW8?O!) zcyJh$a-f)+@S%E?5D)E4y32&{2sG&Q2_SCgy5FowyIN#TQk~_e1DNlU>Im zUSnY77IUYYNwbS{FDh0ZYRd4+VpFV;@}G>W^&)^MJ3abOMjG&hN8wrvL+(TIh9Bve z1CTV<=<+KlgI@vH?XlNe-q2X8!tghhk&ikKCV$DT$(gqU$}Y$beo?CTesCPws|s|` z9ksrpmF7_&=q3i?xkj_VW8WrsHOizR5PQ~8x*FF@>EFk||KZts3b`!<^!8cOcmjFt zARs?Ftk8H>(#6h*DD$LCj`C_`PGFx96l9@;kxa}Q+l@V1?vpn;hhOQ3QiVMhZCK`WKGgdO{e~UEq`UB^Zlhyw?oCFWWI6 zT<-gj!;9M`SZRiiEMDATrUm+t2-hdC&Nzi|c@uMDNqv))+O|0&uAMgI`dT2q`bAg> z-CdA=bBj0KSzcQDv1Y@b&iqMglXjleNMDFllY8%0&lPSW?nR1TdKW+u%k^g@KMaq0 zpB<=e2KmraRX$MF+O|SPWMC}X!MROAjovlw6i=nZwM=Cf7ZQM!_?mKGZ8>S(UXB60 zx66T8XC{|x1Ao{S1y-Hz508wNs3Ijkuik|b1S$`oGCF4C!DYPv*-bt^I>er?7IKiY z!dS{@&j>`_TmSf|wZ9zl>g|HP*}8l3xV(w687HEixZxm1dAmfe+GBf!?*kq`Xk(U2 zojx30kMmg2e+zXYdOQFk;s0w5=$jl-PsA`G1FfXxwij1Q$$K!%Fv(OGC-|bzEvBiy zp1$jT9wu078_=#OQ0<%l!`IR=?LPl)2*kF!M#Y}>{o}&EC8|*MYR71NOE#54W~TI1 z+mm9eO0NiWPu@1GJ+d|OCoISar&z(+HezSyu@OoA@S={_N6XtM$S1#E>Im|w6}u#p zaUMk~Al=_JJSmg{PgU(x106BDmRJ0){LHqsz<3jWz%X@q-?twVB{d{X)?H^hg5m2b zT$J}Hi_sIyp)PDmiAxTmMC+a^u-dGLSo8vU#KJ*OrY8?Y1Z{4h%(rk?Infg~Ap|x967@^icv>({zVIvlAK6!Y%>EU} za_(;k971kTa#v{+k73;lgA;Z}WI|ofgdMuyIh9+@wns!?Us0qY&Coi#t}$)@Qi+C< zrsOGsb%l8WD(&ND7!E&4Zw6WFi{ELiRn0VoG!d3<#sAnmuY=^3=QgA zsL`r`kVIn@%6DYR%po!6b zBr%V3;sPXiMZI5Qm;p8=#lpo(Qapg$4iN)e=%lW0z}rPZASXh}9VQh0WrzveRc~l< zs-Mo>>@v=}nU59loo_R38%>?e!2V-t-DTS2ixML)^|@^3G0czfOJn3V?dVK_8{o#S zcY^lIDmu&$i@^|M%B!3b3f&V$9{JJ3gi$i4@HOi%6JmYKN4$K+t#6 zux1feNbTisK4Qd+XPEb1<@@d1l%hXV0|{_`rqu65S?f}OgDxF2&(FN0L4DNY-Pd^i b_}xQcvvVbEWPC96Is)SaMzES0e96B6>PO4# From 8685cfc58457c0325035c906ee6b18c52bcaf8fb Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 25 Apr 2021 05:25:58 -0500 Subject: [PATCH 40/43] 1 - Buffed Fulguration Halberd, Gladiator's Locket, Anarchy Blade, Basher, Corrupted Crusher Blade, Crimson Crusher Blade, Depth Crusher, Vulcanite Lance, Feralthorn Claymore, Hellkite, Majestic Guard, Marnite Spear, Mycelial Claws, Old Lord Oathsword, Omniblade and Profaned Sword. 2 - Nerfed Pumpler exploding pumpkin damage. 3 - Nerfed most vanilla prehardmode desert enemies pre-Desert Scourge. 4 - Added some block drop code so that two instances of the same item cannot be dropped. 5 - Unloaded some lists that were previously forgotten about and added more items to said lists. --- CalPlayer/CalamityPlayer.cs | 19 +- CalamityLists.cs | 25 +- Items/Accessories/GladiatorsLocket.cs | 17 +- Items/Weapons/Melee/AnarchyBlade.cs | 8 +- Items/Weapons/Melee/Basher.cs | 4 +- Items/Weapons/Melee/CorruptedCrusherBlade.cs | 6 +- Items/Weapons/Melee/CrimsonCrusherBlade.cs | 4 +- Items/Weapons/Melee/DepthBlade.cs | 6 +- Items/Weapons/Melee/ExsanguinationLance.cs | 2 +- Items/Weapons/Melee/FeralthornClaymore.cs | 24 +- Items/Weapons/Melee/FulgurationHalberd.cs | 4 +- Items/Weapons/Melee/Hellkite.cs | 6 +- Items/Weapons/Melee/MajesticGuard.cs | 4 +- Items/Weapons/Melee/MarniteSpear.cs | 2 +- Items/Weapons/Melee/MycelialClaws.cs | 2 +- Items/Weapons/Melee/OldLordOathsword.cs | 2 +- Items/Weapons/Melee/Omniblade.cs | 6 +- Items/Weapons/Melee/PhoenixBlade.cs | 13 +- Items/Weapons/Melee/ProfanedSword.cs | 12 +- Items/Weapons/Ranged/Pumpler.cs | 12 +- NPCs/CalamityAI.cs | 28 +- NPCs/CalamityGlobalAI.cs | 6 +- NPCs/CalamityGlobalNPC.cs | 138 ++-- NPCs/CalamityGlobalNPCLoot.cs | 637 ++++++++++--------- NPCs/CalamityGlobalTownNPC.cs | 5 - Projectiles/Melee/BrimstoneBoom.cs | 49 +- Projectiles/Typeless/GladiatorSword.cs | 30 +- Projectiles/Typeless/GladiatorSword2.cs | 32 +- 28 files changed, 573 insertions(+), 530 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index ed9861a107..bc62d018f0 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -44,6 +44,7 @@ using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Environment; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -4762,7 +4763,10 @@ namespace CalamityMod.CalPlayer break; } - CalamityPlayerOnHit.ItemLifesteal(player, mod, target, item, damage); + if (item.type == ModContent.ItemType()) + target.damage = (int)(target.defDamage * 0.9); + + CalamityPlayerOnHit.ItemLifesteal(player, mod, target, item, damage); CalamityPlayerOnHit.ItemOnHit(player, mod, item, damage, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); CalamityPlayerOnHit.NPCDebuffs(player, mod, target, item.melee, item.ranged, item.magic, item.summon, item.Calamity().rogue, false); @@ -4891,21 +4895,19 @@ namespace CalamityMod.CalPlayer break; } - if (ProjectileID.Sets.StardustDragon[proj.type]) - { + if (proj.type == ModContent.ProjectileType()) + target.damage = (int)(target.defDamage * 0.9); + + if (ProjectileID.Sets.StardustDragon[proj.type]) target.immune[proj.owner] = 10; - } if (!proj.npcProj && !proj.trap && proj.friendly) { if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) - { target.AddBuff(ModContent.BuffType(), 360); - } + if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ModContent.ItemType()) - { target.AddBuff(BuffID.Midas, 300, false); - } CalamityPlayerOnHit.ProjLifesteal(player, mod, target, proj, damage, crit); CalamityPlayerOnHit.ProjOnHit(player, mod, proj, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); @@ -4914,6 +4916,7 @@ namespace CalamityMod.CalPlayer // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (target.type == NPCID.TargetDummy || target.type == ModContent.NPCType()) return; + if (rageModeActive && shatteredCommunity) ShatteredCommunity.AccumulateRageDamage(player, this, damage); } diff --git a/CalamityLists.cs b/CalamityLists.cs index 186920e3d4..322e5b95f8 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1062,7 +1062,13 @@ namespace CalamityMod useTurnList = new List() { - ItemID.IronBroadsword, + ItemID.WoodenSword, + ItemID.RichMahoganySword, + ItemID.BorealWoodSword, + ItemID.EbonwoodSword, + ItemID.ShadewoodSword, + ItemID.CopperBroadsword, + ItemID.IronBroadsword, ItemID.LeadBroadsword, ItemID.SilverBroadsword, ItemID.TungstenBroadsword, @@ -1336,6 +1342,13 @@ namespace CalamityMod weaponAutoreuseList = new List() { + ItemID.WoodenSword, + ItemID.RichMahoganySword, + ItemID.BorealWoodSword, + ItemID.EbonwoodSword, + ItemID.ShadewoodSword, + ItemID.CopperShortsword, + ItemID.CopperBroadsword, ItemID.IronShortsword, ItemID.IronBroadsword, ItemID.LeadShortsword, @@ -1348,15 +1361,18 @@ namespace CalamityMod ItemID.PlatinumBroadsword, ItemID.GoldShortsword, ItemID.GoldBroadsword, + ItemID.CactusSword, ItemID.ZombieArm, ItemID.CandyCaneSword, ItemID.BoneSword, ItemID.LightsBane, ItemID.BloodButcherer, ItemID.DyeTradersScimitar, + ItemID.FieryGreatsword, ItemID.NightsEdge, ItemID.TrueNightsEdge, ItemID.TrueExcalibur, + ItemID.BreakerBlade, ItemID.PhoenixBlaster, ItemID.VenusMagnum, ItemID.MagicDagger, @@ -2525,13 +2541,20 @@ namespace CalamityMod iceWeaponList = null; natureWeaponList = null; alcoholList = null; + useTurnList = null; + twentyUseTimeBuffList = null; + fiftySizeBuffList = null; + quadrupleDamageBuffList = null; + tripleDamageBuffList = null; doubleDamageBuffList = null; sixtySixDamageBuffList = null; fiftyDamageBuffList = null; thirtyThreeDamageBuffList = null; twentyFiveDamageBuffList = null; + twentyDamageBuffList = null; tenDamageBuffList = null; weaponAutoreuseList = null; + spearAutoreuseList = null; tenDamageNerfList = null; quarterDamageNerfList = null; pumpkinMoonBuffList = null; diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 49eb6d2352..b49d0cf936 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; -using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -28,11 +28,9 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.Calamity(); //there might be an upgrade sometime later? - if (modPlayer.gladiatorSword) - { + if (player.Calamity().gladiatorSword) return false; - } + return true; } @@ -43,15 +41,14 @@ namespace CalamityMod.Items.Accessories if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { player.AddBuff(ModContent.BuffType(), 3600, true); - } - int damage = Main.hardMode ? 50 : 20; + + int damage = 30; int swordDmg = (int)(damage * player.AverageDamage()); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), swordDmg, 6f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), swordDmg, 6f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 256967d502..a147cafbf9 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -54,9 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.Brimstone); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.Brimstone); } // Gains 10% of missing health as base damage. @@ -68,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.NextBool(5)) @@ -85,7 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 965efd3d2e..39c8dcff84 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 40; item.height = 42; - item.damage = 24; + item.damage = 30; item.scale = 1.5f; item.melee = true; item.useAnimation = item.useTime = 26; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Items/Weapons/Melee/CorruptedCrusherBlade.cs b/Items/Weapons/Melee/CorruptedCrusherBlade.cs index 1f89d2cd63..922dc6ff30 100644 --- a/Items/Weapons/Melee/CorruptedCrusherBlade.cs +++ b/Items/Weapons/Melee/CorruptedCrusherBlade.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 39; + item.damage = 42; item.melee = true; item.width = 66; item.height = 80; @@ -42,11 +42,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.CursedInferno, 300); if (target.defense > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) - { target.defense = target.defDefense - 5; - } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) diff --git a/Items/Weapons/Melee/CrimsonCrusherBlade.cs b/Items/Weapons/Melee/CrimsonCrusherBlade.cs index cbf679abb4..a3a64d33ad 100644 --- a/Items/Weapons/Melee/CrimsonCrusherBlade.cs +++ b/Items/Weapons/Melee/CrimsonCrusherBlade.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 38; + item.damage = 40; item.melee = true; item.width = 70; item.height = 80; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Ichor, 300); if (target.damage > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) { target.damage = target.defDamage - 5; diff --git a/Items/Weapons/Melee/DepthBlade.cs b/Items/Weapons/Melee/DepthBlade.cs index 1854bf95b0..27120887cb 100644 --- a/Items/Weapons/Melee/DepthBlade.cs +++ b/Items/Weapons/Melee/DepthBlade.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 56; item.height = 50; - item.damage = 22; + item.damage = 36; item.melee = true; item.useAnimation = 22; item.useTime = 22; @@ -60,12 +60,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Items/Weapons/Melee/ExsanguinationLance.cs b/Items/Weapons/Melee/ExsanguinationLance.cs index 3225d5313e..6b5617c632 100644 --- a/Items/Weapons/Melee/ExsanguinationLance.cs +++ b/Items/Weapons/Melee/ExsanguinationLance.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 44; - item.damage = 77; + item.damage = 130; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 2b03764e87..c118675f4c 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 68; - item.damage = 63; + item.damage = 80; item.melee = true; item.useAnimation = 13; item.useStyle = ItemUseStyleID.SwingThrow; @@ -44,35 +44,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 300); + for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } + Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } + Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 300); + for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } + Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } + Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index 8d99c77c7e..47cb18a20d 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Fulguration Halberd"); - Tooltip.SetDefault("Inflicts burning blood on enemy hits\n" + + Tooltip.SetDefault("Inflicts burning blood on enemy hits and decreases enemy contact damage by 10% on hit\n" + "Right click to use as a spear"); } @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 60; item.height = 64; item.scale = 1.5f; - item.damage = 53; + item.damage = 120; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index d090776ee8..c6c5a4150a 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 84; - item.damage = 100; + item.damage = 150; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; @@ -45,9 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 589d1b1763..3417822cbd 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Majestic Guard"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 10 when striking them\n" + + Tooltip.SetDefault("Has a 20% chance to lower enemy defense by 10 when striking them\n" + "If enemy defense is 0 or below your attacks will heal you"); } @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 98; item.height = 98; item.scale = 1.5f; - item.damage = 60; + item.damage = 120; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/MarniteSpear.cs b/Items/Weapons/Melee/MarniteSpear.cs index 58a18bd3f8..0084cb1ec6 100644 --- a/Items/Weapons/Melee/MarniteSpear.cs +++ b/Items/Weapons/Melee/MarniteSpear.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 50; - item.damage = 20; + item.damage = 26; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Melee/MycelialClaws.cs b/Items/Weapons/Melee/MycelialClaws.cs index dbf5d5b439..21848f6af2 100644 --- a/Items/Weapons/Melee/MycelialClaws.cs +++ b/Items/Weapons/Melee/MycelialClaws.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 22; - item.damage = 14; + item.damage = 21; item.melee = true; item.useAnimation = 6; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/OldLordOathsword.cs b/Items/Weapons/Melee/OldLordOathsword.cs index c8bc4126a1..ef1b69e6ad 100644 --- a/Items/Weapons/Melee/OldLordOathsword.cs +++ b/Items/Weapons/Melee/OldLordOathsword.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 34; + item.damage = 60; item.width = 70; item.height = 70; item.melee = true; diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 322ccf973c..77835d62e0 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 64; - item.damage = 63; + item.damage = 95; item.melee = true; item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; @@ -43,17 +43,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { if (Main.rand.NextBool(5)) - { target.AddBuff(ModContent.BuffType(), 360); - } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { if (Main.rand.NextBool(5)) - { target.AddBuff(ModContent.BuffType(), 360); - } } public override void AddRecipes() diff --git a/Items/Weapons/Melee/PhoenixBlade.cs b/Items/Weapons/Melee/PhoenixBlade.cs index d37f874e6d..f7cac4b223 100644 --- a/Items/Weapons/Melee/PhoenixBlade.cs +++ b/Items/Weapons/Melee/PhoenixBlade.cs @@ -37,17 +37,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { if (target.life <= 0) - { OnHitEffects(player, target.Center, knockback); - } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { if (target.statLife <= 0) - { OnHitEffects(player, target.Center, item.knockBack); - } } private void OnHitEffects(Player player, Vector2 targetPos, float kBack) @@ -55,8 +51,9 @@ namespace CalamityMod.Items.Weapons.Melee int boom = Projectile.NewProjectile(targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), kBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceMelee = true; - float randomSpeedX = (float)Main.rand.Next(5); - float randomSpeedY = (float)Main.rand.Next(3, 7); + + float randomSpeedX = Main.rand.Next(5); + float randomSpeedY = Main.rand.Next(3, 7); Projectile.NewProjectile(targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), kBack, player.whoAmI); Projectile.NewProjectile(targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), kBack, player.whoAmI); } @@ -64,9 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/ProfanedSword.cs b/Items/Weapons/Melee/ProfanedSword.cs index aaf7488b7b..49b457db38 100644 --- a/Items/Weapons/Melee/ProfanedSword.cs +++ b/Items/Weapons/Melee/ProfanedSword.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 75; + item.damage = 100; item.melee = true; item.width = item.height = 52; item.scale = 1.5f; @@ -66,22 +66,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + target.AddBuff(ModContent.BuffType(), 300); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + target.AddBuff(ModContent.BuffType(), 300); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.Brimstone); - } } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index c4546cf652..3d2e2ad53c 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -68,15 +68,15 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.JackOLantern, (int)((double)damage * 1.65), knockBack * 4f, player.whoAmI, 0f, 0f); + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.JackOLantern, (int)(damage * 1.4), knockBack * 4f, player.whoAmI); } else { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index b3f791fc98..c4b049a4e9 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -65,9 +65,8 @@ namespace CalamityMod.NPCs float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.6f; - bool phase4 = lifeRatio < 0.4f; + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; // Increase aggression if player is taking a long time to kill the boss if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) @@ -213,7 +212,7 @@ namespace CalamityMod.NPCs } // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral && phase3) + if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral && phase2) { npc.localAI[0] += 1f; if (player.gravDir == -1f && expertMode) @@ -240,7 +239,7 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); } - if (phase4) + if (phase3) { int num320 = expertMode ? 14 : 7; type = ModContent.ProjectileType(); @@ -269,7 +268,7 @@ namespace CalamityMod.NPCs // Fire sand blasts or teeth depending on body type else { - if (calamityGlobalNPC.newAI[0] == 1f && phase2) + if (calamityGlobalNPC.newAI[0] == 1f) { npc.localAI[0] += 1f; float shootProjectile = 300; @@ -3093,11 +3092,9 @@ namespace CalamityMod.NPCs // Phases based on life percentage bool halfHealth = lifeRatio < 0.5f; bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; - bool phase2 = (lifeRatio < 0.9f && expertMode) || (doubleWormPhase && expertMode); bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; - bool phase3 = (lifeRatio < 0.7f && expertMode) || (doubleWormPhase && expertMode); - bool phase4 = lifeRatio < 0.5f && doubleWormPhase && expertMode; - bool phase5 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; // Set timed DR if (!doubleWormPhase) @@ -3451,7 +3448,7 @@ namespace CalamityMod.NPCs if (flyAtTarget) { - float speedMultiplier = doubleWormPhase ? (phase5 ? 1.25f : phase4 ? 1.2f : 1.15f) : 1f; + float speedMultiplier = doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; speed *= speedMultiplier; } @@ -3651,14 +3648,9 @@ namespace CalamityMod.NPCs // Shoot lasers if (npc.type == ModContent.NPCType() && Main.netMode != NetmodeID.MultiplayerClient) { - int shootTime = 1; - if (phase2 || targetFloatingUp) - shootTime += 1; - if (phase3 || targetFloatingUp) - shootTime += 1; - + int shootTime = ((doubleWormPhase && expertMode) || targetFloatingUp) ? 2 : 1; npc.localAI[0] += 1f; - float shootProjectile = 600 / shootTime; + float shootProjectile = 400 / shootTime; float timer = npc.ai[0] + 15f; float divisor = timer + shootProjectile; if (!flyAtTarget) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 4f00ab3390..8cb7d60f1a 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -4625,12 +4625,8 @@ namespace CalamityMod.NPCs if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { // Laser speed - float projectileSpeed = 4f; + float projectileSpeed = 4.5f; projectileSpeed += enrageScale; - if (phase2) - projectileSpeed += 0.25f; - if (phase3) - projectileSpeed += 0.25f; if (BossRushEvent.BossRushActive) projectileSpeed *= 1.25f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2cb9357af4..5dad63eeae 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -95,6 +95,9 @@ namespace CalamityMod.NPCs // Max velocity used in contact damage scaling public float maxVelocity = 0f; + // Variable used to nerf desert prehardmode enemies pre-Desert Scourge + private const double DesertEnemyStatMultiplier = 0.75; + // Town NPC shop alert animation variables public int shopAlertAnimTimer = 0; public int shopAlertAnimFrame = 0; @@ -986,9 +989,7 @@ namespace CalamityMod.NPCs public override void SetDefaults(NPC npc) { for (int m = 0; m < maxAIMod; m++) - { newAI[m] = 0f; - } // Apply DR to vanilla NPCs. // This also applies DR to other mods' NPCs who have set up their NPCs to have DR. @@ -1011,21 +1012,15 @@ namespace CalamityMod.NPCs DebuffImmunities(npc); if (BossRushEvent.BossRushActive) - { BossRushStatChanges(npc, mod); - } BossValueChanges(npc); if (DraedonMayhem) - { DraedonMechaMayhemStatChanges(npc); - } if (CalamityWorld.revenge) - { RevDeathStatChanges(npc, mod); - } OtherStatChanges(npc); } @@ -1063,7 +1058,7 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffType()] = false; } - // Sets certain vanilla NPCs and all town NPCs to be immune to all debuffs. + // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.SkeletronHead || (EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC || npc.type == NPCID.SpikeBall || npc.type == NPCID.BlazingWheel) { for (int k = 0; k < npc.buffImmune.Length; k++) @@ -1365,16 +1360,13 @@ namespace CalamityMod.NPCs case NPCID.LittleCrimera: case NPCID.Corruptor: case NPCID.DevourerHead: - case NPCID.WalkingAntlion: case NPCID.Crawdad: - case NPCID.Crawdad2: // chomp - case NPCID.DungeonGuardian: + case NPCID.Crawdad2: case NPCID.ManEater: case NPCID.AngryTrapper: case NPCID.Snatcher: case NPCID.SpikeBall: - case NPCID.TombCrawlerHead: // lol - case NPCID.DesertBeast: // don't ask me why basilisks are called this + case NPCID.DesertBeast: case NPCID.BoneLee: case NPCID.Paladin: case NPCID.BigMimicCorruption: @@ -1383,7 +1375,7 @@ namespace CalamityMod.NPCs case NPCID.DiggerHead: case NPCID.SeekerHead: case NPCID.DuneSplicerHead: - case NPCID.SolarCrawltipedeHead: // everybody hates this enemy lol, but they're not that bad + case NPCID.SolarCrawltipedeHead: case NPCID.Mimic: case NPCID.SandShark: case NPCID.SandsharkCorrupt: @@ -1398,7 +1390,7 @@ namespace CalamityMod.NPCs case NPCID.PresentMimic: case NPCID.Yeti: case NPCID.NebulaBeast: - case NPCID.SolarCorite: // pain + case NPCID.SolarCorite: case NPCID.StardustWormHead: case NPCID.EaterofWorldsHead: case NPCID.SkeletronHead: @@ -1428,26 +1420,95 @@ namespace CalamityMod.NPCs case NPCID.PumpkingBlade: case NPCID.SantaNK1: case NPCID.DukeFishron: + canBreakPlayerDefense = true; + break; + + // Reduce prehardmode desert enemy stats pre-Desert Scourge + case NPCID.WalkingAntlion: + if (!CalamityWorld.downedDesertScourge) + { + npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + npc.defense /= 2; + npc.defDefense = npc.defense; + } + canBreakPlayerDefense = true; + break; + + case NPCID.Antlion: + case NPCID.FlyingAntlion: + if (!CalamityWorld.downedDesertScourge) + { + npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + npc.defense /= 2; + npc.defDefense = npc.defense; + } + break; + + // Reduce Dungeon Guardian HP + case NPCID.DungeonGuardian: + npc.lifeMax = (int)(npc.lifeMax * 0.1); + canBreakPlayerDefense = true; + break; + + // Reduce Tomb Crawler stats + case NPCID.TombCrawlerHead: + npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.downedDesertScourge ? 0.6 : 0.45)); + if (!CalamityWorld.downedDesertScourge) + { + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + // Tomb Crawler Head has 0 defense so there is no need to reduce it + } + canBreakPlayerDefense = true; + break; + + case NPCID.TombCrawlerBody: + case NPCID.TombCrawlerTail: + npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.downedDesertScourge ? 0.6 : 0.45)); + if (!CalamityWorld.downedDesertScourge) + { + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + npc.defense /= 2; + npc.defDefense = npc.defense; + } + break; + + // Fix Sharkron hitboxes case NPCID.Sharkron: case NPCID.Sharkron2: + npc.width = npc.height = 36; canBreakPlayerDefense = true; break; + // Make Core hitbox bigger + case NPCID.MartianSaucerCore: + npc.width *= 2; + npc.height *= 2; + break; + + // Increase Cultist HP + case NPCID.CultistBoss: + npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.revenge ? 2 : 1.2)); + npc.npcSlots = 20f; + break; + + // Nerf Green Jellyfish because they spawn in prehardmode + case NPCID.GreenJellyfish: + npc.damage = 40; + npc.defDamage = npc.damage; + npc.defense = 4; + npc.defDefense = npc.defense; + break; + default: break; } - // Fix Sharkron hitboxes - if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) - npc.width = npc.height = 36; - - // Make Core hitbox bigger - if (npc.type == NPCID.MartianSaucerCore) - { - npc.width *= 2; - npc.height *= 2; - } - // Reduce mech boss HP and damage depending on the new ore progression changes if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { @@ -1471,29 +1532,6 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.CultistBoss) - { - npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.revenge ? 2 : 1.2)); - npc.npcSlots = 20f; - } - else if (npc.type == NPCID.DungeonGuardian) - { - npc.lifeMax = (int)(npc.lifeMax * 0.1); - } - - if (npc.type >= NPCID.TombCrawlerHead && npc.type <= NPCID.TombCrawlerTail && !Main.hardMode) - { - npc.lifeMax = (int)(npc.lifeMax * 0.6); - } - - if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) - { - npc.damage = 40; - npc.defDamage = npc.damage; - npc.defense = 4; - npc.defDefense = npc.defense; - } - if (Main.hardMode && HardmodeNPCNerfList.Contains(npc.type)) { npc.damage = (int)(npc.damage * 0.75); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 13fd69a399..f55d3f3b41 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -85,132 +85,132 @@ namespace CalamityMod.NPCs ArmageddonLoot(npc); if (npc.type == NPCID.KingSlime) - { - // Drop a huge spray of Gel items - int minGel = Main.expertMode ? 90 : 60; - int maxGel = Main.expertMode ? 120 : 80; - DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); + { + // Drop a huge spray of Gel items + int minGel = Main.expertMode ? 90 : 60; + int maxGel = Main.expertMode ? 120 : 80; + DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); // Legendary drop for King Slime DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedSlimeKing); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedSlimeKing, 2, 0, 0); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, NPC.downedSlimeKing); - } - else if (npc.type == NPCID.EyeofCthulhu) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 2, 4); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedSlimeKing); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedSlimeKing, 2, 0, 0); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, NPC.downedSlimeKing); + } + else if (npc.type == NPCID.EyeofCthulhu) + { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 2, 4); // Legendary drops for Eye of Cthulhu DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss1); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss1, 2, 0, 0); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss1); - } - else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) - { + DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss1, 2, 0, 0); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss1); + } + else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) + { DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss2, 2, 0, 0); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedBoss2); - } - else if (npc.type == NPCID.QueenBee) - { - // Drop weapons Calamity style instead of mutually exclusive. - if (!Main.expertMode) - { - int[] queenBeeWeapons = new int[] - { - ItemID.BeeKeeper, - ItemID.BeesKnees, - ItemID.BeeGun, - }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, queenBeeWeapons); - DropHelper.BlockDrops(queenBeeWeapons); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss2, 2, 0, 0); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedBoss2); + } + else if (npc.type == NPCID.QueenBee) + { + // Drop weapons Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] queenBeeWeapons = new int[] + { + ItemID.BeeKeeper, + ItemID.BeesKnees, + ItemID.BeeGun, + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, queenBeeWeapons); + DropHelper.BlockDrops(queenBeeWeapons); + } - DropHelper.DropItemCondition(npc, ItemID.Stinger, !Main.expertMode, 5, 10); // Extra stingers - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 30, 50); + DropHelper.DropItemCondition(npc, ItemID.Stinger, !Main.expertMode, 5, 10); // Extra stingers + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 30, 50); // Legendary drop for Queen Bee DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedQueenBee); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedQueenBee, 2, 0, 0); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedQueenBee); - } - else if (npc.type == NPCID.SkeletronHead) - { + DropHelper.DropResidentEvilAmmo(npc, NPC.downedQueenBee, 2, 0, 0); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedQueenBee); + } + else if (npc.type == NPCID.SkeletronHead) + { DropHelper.DropItemSpray(npc, ItemID.Bone, 70, 100, 5); // Legendary drop for Skeletron DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss3); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss3, 3, 1, 0); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss3); - } - else if (npc.type == NPCID.WallofFlesh) - { - if (!Main.expertMode) - { - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. - int[] wofWeapons = new int[] - { - ItemID.BreakerBlade, - ItemID.ClockworkAssaultRifle, - ModContent.ItemType(), - ItemID.LaserRifle, - ModContent.ItemType(), - ModContent.ItemType(), - }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, wofWeapons); - DropHelper.BlockDrops(wofWeapons); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss3, 3, 1, 0); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss3); + } + else if (npc.type == NPCID.WallofFlesh) + { + if (!Main.expertMode) + { + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + int[] wofWeapons = new int[] + { + ItemID.BreakerBlade, + ItemID.ClockworkAssaultRifle, + ModContent.ItemType(), + ItemID.LaserRifle, + ModContent.ItemType(), + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, wofWeapons); + DropHelper.BlockDrops(wofWeapons); - // Drop emblems Calamity style instead of mutually exclusive -- this includes the Rogue Emblem. - int[] emblems = new int[] - { - ItemID.WarriorEmblem, - ItemID.RangerEmblem, - ItemID.SorcererEmblem, - ItemID.SummonerEmblem, - ModContent.ItemType(), - }; - DropHelper.DropEntireSet(npc, 0.25f, emblems); - DropHelper.BlockDrops(emblems); - } + // Drop emblems Calamity style instead of mutually exclusive -- this includes the Rogue Emblem. + int[] emblems = new int[] + { + ItemID.WarriorEmblem, + ItemID.RangerEmblem, + ItemID.SorcererEmblem, + ItemID.SummonerEmblem, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, 0.25f, emblems); + DropHelper.BlockDrops(emblems); + } - // Drop Demon Trophy directly if it hasn't been used yet and Expert Mode is not active. - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode && !CalamityWorld.demonMode); + // Drop Demon Trophy directly if it hasn't been used yet and Expert Mode is not active. + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode && !CalamityWorld.demonMode); - // Drop Hermit's Box directly for EACH player, regardles of Expert or not. 100% chance on first kill, 10% chance afterwards. - float hermitBoxChance = Main.hardMode ? 1f : 0.1f; - DropHelper.DropItemChance(npc, ModContent.ItemType(), true, hermitBoxChance); + // Drop Hermit's Box directly for EACH player, regardles of Expert or not. 100% chance on first kill, 10% chance afterwards. + float hermitBoxChance = Main.hardMode ? 1f : 0.1f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), true, hermitBoxChance); - DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); + DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); // Legendary drop for Wall of Flesh DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); - DropHelper.DropResidentEvilAmmo(npc, Main.hardMode, 3, 1, 0); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, ModContent.NPCType() }, Main.hardMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); + DropHelper.DropResidentEvilAmmo(npc, Main.hardMode, 3, 1, 0); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, ModContent.NPCType() }, Main.hardMode); - // First kill text (this is not a loot function) - if (!Main.hardMode) - { + // First kill text (this is not a loot function) + if (!Main.hardMode) + { // Increase altar count to allow natural mech boss spawning. if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) WorldGen.altarCount++; - string key2 = "Mods.CalamityMod.UglyBossText"; - Color messageColor2 = Color.Aquamarine; + string key2 = "Mods.CalamityMod.UglyBossText"; + Color messageColor2 = Color.Aquamarine; CalamityUtils.DisplayLocalizedText(key2, messageColor2); if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) @@ -222,320 +222,323 @@ namespace CalamityMod.NPCs CalamityUtils.DisplayLocalizedText(key3, messageColor3); } } - } - else if (lastTwinStanding) - { + } + else if (lastTwinStanding) + { // Only drop hallowed bars after all mechs are down if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); // Legendary drop for Twins DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss2); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss2, 4, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss2 || !CalamityConfig.Instance.SellVanillaSummons); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss2, 4, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss2 || !CalamityConfig.Instance.SellVanillaSummons); if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); - } - else if (npc.type == NPCID.TheDestroyer) - { + } + else if (npc.type == NPCID.TheDestroyer) + { // Only drop hallowed bars after all mechs are down if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); // Legendary drop for Destroyer DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss1); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss1, 4, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss1 || !CalamityConfig.Instance.SellVanillaSummons); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss1, 4, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss1 || !CalamityConfig.Instance.SellVanillaSummons); if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); } - else if (npc.type == NPCID.SkeletronPrime) - { + else if (npc.type == NPCID.SkeletronPrime) + { // Only drop hallowed bars after all mechs are down if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); // Legendary drop for Skeletron Prime DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss3); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss3, 4, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss3 || !CalamityConfig.Instance.SellVanillaSummons); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss3, 4, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss3 || !CalamityConfig.Instance.SellVanillaSummons); if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) SpawnMechBossHardmodeOres(); } - else if (npc.type == NPCID.Plantera) - { - // Drop weapons Calamity style instead of mutually exclusive. - if (!Main.expertMode) - { - int[] planteraWeapons = new int[] - { - ItemID.FlowerPow, - ItemID.Seedler, - ItemID.GrenadeLauncher, - ItemID.VenusMagnum, - ItemID.LeafBlower, - ItemID.NettleBurst, - ItemID.WaspGun, - ItemID.PygmyStaff - }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, planteraWeapons); - DropHelper.BlockDrops(planteraWeapons); - } + else if (npc.type == NPCID.Plantera) + { + // Drop weapons Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] planteraWeapons = new int[] + { + ItemID.FlowerPow, + ItemID.Seedler, + ItemID.GrenadeLauncher, + ItemID.VenusMagnum, + ItemID.LeafBlower, + ItemID.NettleBurst, + ItemID.WaspGun, + ItemID.PygmyStaff + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, planteraWeapons); + DropHelper.BlockDrops(planteraWeapons); + } - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); - DropHelper.DropItemCondition(npc, ItemID.JungleKey, !Main.expertMode, 5, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); + DropHelper.DropItemCondition(npc, ItemID.JungleKey, !Main.expertMode, 5, 1, 1); // Legendary drop for Plantera DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedPlantBoss); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); - // Spawn Perennial Ore if Plantera has never been killed - if (!NPC.downedPlantBoss) - { - string key2 = "Mods.CalamityMod.PlantOreText"; - Color messageColor2 = Color.GreenYellow; - string key3 = "Mods.CalamityMod.SandSharkText3"; - Color messageColor3 = Color.Goldenrod; + // Spawn Perennial Ore if Plantera has never been killed + if (!NPC.downedPlantBoss) + { + string key2 = "Mods.CalamityMod.PlantOreText"; + Color messageColor2 = Color.GreenYellow; + string key3 = "Mods.CalamityMod.SandSharkText3"; + Color messageColor3 = Color.Goldenrod; - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .5f, .7f); + WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .5f, .7f); - CalamityUtils.DisplayLocalizedText(key2, messageColor2); - CalamityUtils.DisplayLocalizedText(key3, messageColor3); - } - } + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); + } + } - // These event enemies set shop variables and since those depend on downed bools they must be done in PreNPCLoot. - else if (npc.type == NPCID.Pumpking) - { - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Clothier }, NPC.downedHalloweenKing); - } - else if (npc.type == NPCID.Everscream) - { - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedChristmasTree || !NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); - } - else if (npc.type == NPCID.SantaNK1) - { - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); - } - else if (npc.type == NPCID.IceQueen) - { - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Clothier }, NPC.downedChristmasIceQueen); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); - } + // These event enemies set shop variables and since those depend on downed bools they must be done in PreNPCLoot. + else if (npc.type == NPCID.Pumpking) + { + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Clothier }, NPC.downedHalloweenKing); + } + else if (npc.type == NPCID.Everscream) + { + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedChristmasTree || !NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); + } + else if (npc.type == NPCID.SantaNK1) + { + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || NPC.downedChristmasSantank || !NPC.downedChristmasIceQueen); + } + else if (npc.type == NPCID.IceQueen) + { + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Clothier }, NPC.downedChristmasIceQueen); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); + } - else if (npc.type == NPCID.Golem) - { - // Drop loot Calamity style instead of mutually exclusive. - if (!Main.expertMode) - { - int[] golemItems = new int[] - { - ItemID.GolemFist, - ItemID.PossessedHatchet, - ItemID.Stynger, - ItemID.HeatRay, - ItemID.StaffofEarth, - ItemID.EyeoftheGolem, - ItemID.SunStone, - }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, golemItems); - DropHelper.BlockDrops(golemItems); - } + else if (npc.type == NPCID.Golem) + { + // Drop loot Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] golemItems = new int[] + { + ItemID.GolemFist, + ItemID.PossessedHatchet, + ItemID.Stynger, + ItemID.HeatRay, + ItemID.StaffofEarth, + ItemID.EyeoftheGolem, + ItemID.SunStone, + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, golemItems); + DropHelper.BlockDrops(golemItems); + } - // If Golem has never been killed, provide a Picksaw to all players. This only applies in Normal Mode. - // The Golem Treasure Bag is guaranteed to provide a Picksaw if one is not yet in the inventory. - DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !Main.expertMode && !NPC.downedGolemBoss); + // If Golem has never been killed, provide a Picksaw to all players. This only applies in Normal Mode. + // The Golem Treasure Bag is guaranteed to provide a Picksaw if one is not yet in the inventory. + DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !Main.expertMode && !NPC.downedGolemBoss); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 10); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 10); // Legendary drop for Golem DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedGolemBoss); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedGolemBoss, 4, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedGolemBoss, 4, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); - // If Golem has never been killed, send a message about the Plague. - if (!NPC.downedGolemBoss) - { - string key = "Mods.CalamityMod.BabyBossText"; - Color messageColor = Color.Lime; + // If Golem has never been killed, send a message about the Plague. + if (!NPC.downedGolemBoss) + { + string key = "Mods.CalamityMod.BabyBossText"; + Color messageColor = Color.Lime; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - } - else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) - { - // Drop weapons Calamity style instead of mutually exclusive. - if (!Main.expertMode) - { - int[] betsyWeapons = new int[] - { - ItemID.DD2SquireBetsySword, // Flying Dragon + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + } + else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) + { + // Drop weapons Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] betsyWeapons = new int[] + { + ItemID.DD2SquireBetsySword, // Flying Dragon ItemID.MonkStaffT3, // Sky Dragon's Fury ItemID.DD2BetsyBow, // Aerial Bane ItemID.ApprenticeStaffT3, // Betsy's Wrath }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, betsyWeapons); - DropHelper.BlockDrops(betsyWeapons); - } + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, betsyWeapons); + DropHelper.BlockDrops(betsyWeapons); + } - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBetsy, 4, 2, 1); + DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBetsy, 4, 2, 1); - // Mark Betsy as dead (Vanilla does not keep track of her) - CalamityWorld.downedBetsy = true; - CalamityNetcode.SyncWorld(); - } - else if (npc.type == NPCID.DukeFishron) - { - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. - if (!Main.expertMode) - { - int[] dukeWeapons = new int[] - { - ItemID.Flairon, - ItemID.Tsunami, - ItemID.BubbleGun, - ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, - ModContent.ItemType(), - }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, dukeWeapons); - DropHelper.BlockDrops(dukeWeapons); - } + // Mark Betsy as dead (Vanilla does not keep track of her) + CalamityWorld.downedBetsy = true; + CalamityNetcode.SyncWorld(); + } + else if (npc.type == NPCID.DukeFishron) + { + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + if (!Main.expertMode) + { + int[] dukeWeapons = new int[] + { + ItemID.Flairon, + ItemID.Tsunami, + ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, dukeWeapons); + DropHelper.BlockDrops(dukeWeapons); + } // Legendary drop for Duke Fishron DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedFishron); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedFishron || !CalamityConfig.Instance.SellVanillaSummons); - } - else if (npc.type == NPCID.CultistBoss) - { + DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedFishron || !CalamityConfig.Instance.SellVanillaSummons); + } + else if (npc.type == NPCID.CultistBoss) + { // Legendary drops for Cultist DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedAncientCultist); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, Main.bloodMoon); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedAncientCultist, 4, 2, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, Main.bloodMoon); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedAncientCultist, 4, 2, 1); - // Deus text (this is not a loot function) - if (!NPC.downedAncientCultist) - { - string key = "Mods.CalamityMod.DeusText"; - Color messageColor = Color.Gold; + // Deus text (this is not a loot function) + if (!NPC.downedAncientCultist) + { + string key = "Mods.CalamityMod.DeusText"; + Color messageColor = Color.Gold; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } - } - else if (npc.type == NPCID.MoonLordCore) - { - // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. - if (!Main.expertMode) - { - int[] moonLordWeapons = new int[] - { - ItemID.Meowmere, - ItemID.StarWrath, - ItemID.Terrarian, - ItemID.FireworksLauncher, // Celebration + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + } + else if (npc.type == NPCID.MoonLordCore) + { + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + if (!Main.expertMode) + { + int[] moonLordWeapons = new int[] + { + ItemID.Meowmere, + ItemID.StarWrath, + ItemID.Terrarian, + ItemID.FireworksLauncher, // Celebration // ItemID.CelebrationMK2, ItemID.SDMG, - ItemID.LastPrism, - ItemID.LunarFlareBook, - ItemID.MoonlordTurretStaff, // Lunar Portal Staff + ItemID.LastPrism, + ItemID.LunarFlareBook, + ItemID.MoonlordTurretStaff, // Lunar Portal Staff ItemID.RainbowCrystalStaff, - ModContent.ItemType(), - }; - DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, moonLordWeapons); - DropHelper.BlockDrops(moonLordWeapons); - } + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, moonLordWeapons); + DropHelper.BlockDrops(moonLordWeapons); + } - // Gravity Globe is available to Normal players as well - DropHelper.DropItemCondition(npc, ItemID.GravityGlobe, !Main.expertMode); + // Gravity Globe is available to Normal players as well + DropHelper.DropItemCondition(npc, ItemID.GravityGlobe, !Main.expertMode); - // One Celestial Onion is given to each player individually - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.expertMode); + // One Celestial Onion is given to each player individually + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.expertMode); // Legendary drops for Moon Lord DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMoonlord); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedMoonlord); - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, NPC.downedMoonlord || !CalamityConfig.Instance.SellVanillaSummons); + DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedMoonlord); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, NPC.downedMoonlord || !CalamityConfig.Instance.SellVanillaSummons); - string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; + string key = "Mods.CalamityMod.MoonBossText"; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.MoonBossText2"; + Color messageColor2 = Color.Violet; + string key3 = "Mods.CalamityMod.MoonBossText3"; + Color messageColor3 = Color.Crimson; + string key4 = "Mods.CalamityMod.ProfanedBossText2"; + Color messageColor4 = Color.Cyan; + string key5 = "Mods.CalamityMod.FutureOreText"; + Color messageColor5 = Color.LightGray; - // Spawn Exodium planetoids and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet - if (!NPC.downedMoonlord) - { - // Generate luminite planetoids. - // This operation is done on a separate thread to lighten the load on servers so that they - // can focus on more critical operations asychronously and ideally avoid a time-out crash. - // Very few operations in Terraria utilize the pool, so it is highly unlikely that no threads will remain in it. - ThreadPool.QueueUserWorkItem(_ => WorldGenerationMethods.GenerateLuminitePlanetoids()); + // Spawn Exodium planetoids and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet + if (!NPC.downedMoonlord) + { + // Generate luminite planetoids. + // This operation is done on a separate thread to lighten the load on servers so that they + // can focus on more critical operations asychronously and ideally avoid a time-out crash. + // Very few operations in Terraria utilize the pool, so it is highly unlikely that no threads will remain in it. + ThreadPool.QueueUserWorkItem(_ => WorldGenerationMethods.GenerateLuminitePlanetoids()); - CalamityUtils.DisplayLocalizedText(key, messageColor); - CalamityUtils.DisplayLocalizedText(key2, messageColor2); - CalamityUtils.DisplayLocalizedText(key3, messageColor3); - CalamityUtils.DisplayLocalizedText(key4, messageColor4); - CalamityUtils.DisplayLocalizedText(key5, messageColor5); - } - } + CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); + CalamityUtils.DisplayLocalizedText(key4, messageColor4); + CalamityUtils.DisplayLocalizedText(key5, messageColor5); + } + } else if (npc.type == NPCID.RedDevil) { DropHelper.DropItemChance(npc, ItemID.FireFeather, 0.1f); + DropHelper.BlockDrops(ItemID.FireFeather); } else if (npc.type == NPCID.Vampire || npc.type == NPCID.VampireBat) { DropHelper.DropItemChance(npc, ItemID.MoonStone, 0.15f); + DropHelper.BlockDrops(ItemID.MoonStone); } else if (npc.type == NPCID.Werewolf) { DropHelper.DropItemChance(npc, ItemID.MoonCharm, 0.05f); + DropHelper.BlockDrops(ItemID.MoonCharm); } else if (npc.type == NPCID.Mimic) { @@ -549,10 +552,52 @@ namespace CalamityMod.NPCs DropHelper.WeightStack(ItemID.Compass, w), DropHelper.WeightStack(ItemID.PhilosophersStone, w) ); + + int[] mimicDrops = new int[] + { + ItemID.StarCloak, + ItemID.CrossNecklace, + ItemID.TitanGlove, + ItemID.DualHook, + ItemID.MagicDagger, + ItemID.Compass, + ItemID.PhilosophersStone + }; + DropHelper.BlockDrops(mimicDrops); } else if (npc.type == NPCID.Moth) { DropHelper.DropItem(npc, ItemID.ButterflyDust); + DropHelper.BlockDrops(ItemID.ButterflyDust); + } + else if (npc.type >= NPCID.RustyArmoredBonesAxe && npc.type <= NPCID.HellArmoredBonesSword) + { + DropHelper.DropItemChance(npc, ItemID.WispinaBottle, 0.005f); + DropHelper.BlockDrops(ItemID.WispinaBottle); + } + else if (npc.type == NPCID.Paladin) + { + DropHelper.DropItemChance(npc, ItemID.PaladinsHammer, 0.15f); + DropHelper.DropItemChance(npc, ItemID.PaladinsShield, 0.2f); + + int[] paladinDrops = new int[] + { + ItemID.PaladinsHammer, + ItemID.PaladinsShield + }; + DropHelper.BlockDrops(paladinDrops); + } + else if (npc.type == NPCID.BoneLee) + { + DropHelper.DropItemChance(npc, ItemID.BlackBelt, 0.25f); + DropHelper.DropItemChance(npc, ItemID.Tabi, 0.25f); + + int[] boneLeeDrops = new int[] + { + ItemID.BlackBelt, + ItemID.Tabi + }; + DropHelper.BlockDrops(boneLeeDrops); } return true; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 12927d26fb..5819268ccb 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -752,11 +752,6 @@ namespace CalamityMod.NPCs break; case NPCID.Wizard: - if (Main.rand.NextBool(10) && permadong != -1) - { - chat = "I'd let " + Main.npc[permadong].GivenName + " coldheart MY icicle."; - } - if (Main.rand.NextBool(10) && Main.hardMode) { chat = "Space just got way too close for comfort."; diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index e715f6bb33..456aafe56b 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -22,35 +22,13 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.tileCollide = false; projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; + projectile.penetrate = -1; + projectile.timeLeft = 5; } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); float num461 = 25f; if (projectile.ai[0] > 180f) { @@ -64,12 +42,12 @@ namespace CalamityMod.Projectiles.Melee num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float num463 = Main.rand.Next(-10, 11); + float num464 = Main.rand.Next(-10, 11); + float num465 = Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; @@ -78,13 +56,18 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; } } - } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + } } diff --git a/Projectiles/Typeless/GladiatorSword.cs b/Projectiles/Typeless/GladiatorSword.cs index a52c2159c6..1b661ba401 100644 --- a/Projectiles/Typeless/GladiatorSword.cs +++ b/Projectiles/Typeless/GladiatorSword.cs @@ -1,5 +1,4 @@ using CalamityMod.CalPlayer; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,7 +8,7 @@ namespace CalamityMod.Projectiles.Typeless { public class GladiatorSword : ModProjectile { - private double rotation = 0; + private double rotation = 0D; public override void SetStaticDefaults() { @@ -32,11 +31,10 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.friendly = true; - projectile.hostile = false; bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); @@ -50,32 +48,32 @@ namespace CalamityMod.Projectiles.Typeless player.AverageDamage()); projectile.damage = damage2; } + if (!modPlayer.gladiatorSword) { projectile.active = false; return; } + if (flag64) { if (player.dead) - { modPlayer.glSword = false; - } if (modPlayer.glSword) - { projectile.timeLeft = 2; - } } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); + + Lighting.AddLight(projectile.Center, 0.15f, 0.15f, 0f); + Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; + projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - double rotateAmt = CalamityWorld.downedDoG ? 0.1 : NPC.downedMoonlord ? 0.08 : NPC.downedPlantBoss ? 0.05 : Main.hardMode ? 0.04 : 0.03; - rotation += rotateAmt; - if (rotation >= 360) - { - rotation = 0; - } + + rotation += 0.1; + if (rotation >= 360D) + rotation = 0D; + projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } } diff --git a/Projectiles/Typeless/GladiatorSword2.cs b/Projectiles/Typeless/GladiatorSword2.cs index b96c9c4461..d4dc29f631 100644 --- a/Projectiles/Typeless/GladiatorSword2.cs +++ b/Projectiles/Typeless/GladiatorSword2.cs @@ -1,5 +1,4 @@ using CalamityMod.CalPlayer; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,7 +8,7 @@ namespace CalamityMod.Projectiles.Typeless { public class GladiatorSword2 : ModProjectile { - private double rotation = 0; + private double rotation = 0D; public override void SetStaticDefaults() { @@ -33,11 +32,10 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.friendly = true; - projectile.hostile = false; bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); @@ -51,33 +49,33 @@ namespace CalamityMod.Projectiles.Typeless player.AverageDamage()); projectile.damage = damage2; } + if (!modPlayer.gladiatorSword) { projectile.active = false; return; } + if (flag64) { if (player.dead) - { modPlayer.glSword = false; - } if (modPlayer.glSword) - { projectile.timeLeft = 2; - } } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); + + Lighting.AddLight(projectile.Center, 0.15f, 0.15f, 0f); + Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; + projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - double rotateAmt = CalamityWorld.downedDoG ? 0.09 : NPC.downedMoonlord ? 0.07 : NPC.downedPlantBoss ? 0.04 : Main.hardMode ? 0.03 : 0.02; - //values are slightly different from the other sword to make this sword marginally slower so the intersection point isn't always at the same spot - rotation -= rotateAmt; - if (rotation <= 0) - { - rotation = 360; - } + + // Values are slightly different from the other sword to make this sword marginally slower so the intersection point isn't always at the same spot + rotation -= 0.09; + if (rotation <= 0D) + rotation = 360D; + projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } } From 4144a1de54bc33ad0527cb17b3756a5dfafb4e70 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 25 Apr 2021 07:18:31 -0500 Subject: [PATCH 41/43] 1 - Nerfed many On Hit extra projectiles and projectiles that spawn from other projectiles. 2 - Gave Friendly Infernados, Briny Baron typhoons and Monsoon/Alluvion typhoons ID static immunity instead of local immunity. --- CalPlayer/CalamityPlayerOnHit.cs | 57 ++++++++----------- Items/Armor/ForbiddenCirclet.cs | 2 +- .../BrimstoneCragCatches/Shadowfish.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 46 +++++++-------- Projectiles/Magic/InfernadoFriendly.cs | 4 +- Projectiles/Melee/BrinySpout.cs | 8 +-- Projectiles/Ranged/WaterSpout.cs | 6 +- Projectiles/Rogue/DragonShit.cs | 46 ++++++++------- Projectiles/Rogue/JewelSpike.cs | 6 +- Projectiles/Rogue/MoonSigil.cs | 2 +- Projectiles/Typeless/Nanotech.cs | 17 +++--- Projectiles/Typeless/UnstableSpark.cs | 2 +- 12 files changed, 95 insertions(+), 103 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 325ada0eef..9b11c74b4f 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -11,15 +11,12 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; -using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using System.Linq; -using CalamityMod.Items.Weapons.Summon; namespace CalamityMod.CalPlayer { @@ -126,30 +123,32 @@ namespace CalamityMod.CalPlayer //flask of party affects all types of weapons, !proj.melee is to prevent double flask effects if (!proj.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner, 0f, 0f); + Projectile.NewProjectile(position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); if (modPlayer.alchFlask && player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) { - Projectile projectile = CalamityGlobalProjectile.SpawnOrb(proj, (int)(proj.damage * 0.25), ProjectileType(), 400f, 12f); + Projectile projectile = CalamityGlobalProjectile.SpawnOrb(proj, (int)(30 * player.AverageDamage()), ProjectileType(), 400f, 12f); if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile.whoAmI].Calamity().forceTypeless = true; } + if (modPlayer.theBee && player.statLife >= player.statLifeMax2) - { Main.PlaySound(SoundID.Item110, proj.Center); - } + if (modPlayer.reaverDefense) player.lifeRegenTime += 1; + if (npcCheck) { - if (modPlayer.unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 10) + if (modPlayer.unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 5) { for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(proj.damage * 0.15), 0f, player.whoAmI); + Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * player.AverageDamage()), 0f, player.whoAmI); } } + if (modPlayer.astralStarRain && crit && modPlayer.astralStarRainCooldown <= 0) { modPlayer.astralStarRainCooldown = 60; @@ -359,9 +358,9 @@ namespace CalamityMod.CalPlayer } else if (buffType == empowerBuff) { - if (player.ownedProjectileCounts[ProjectileType()] < 5 && Main.rand.NextBool(10)) //at most 5 + if (player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(10)) { - int damage = (int)(100 * player.MinionDamage()); + int damage = (int)(75 * player.MinionDamage()); Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, player.whoAmI, 0f); } } @@ -417,23 +416,22 @@ namespace CalamityMod.CalPlayer { if (modPlayer.nucleogenesis) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.25), proj.knockBack * 0.25f, proj.owner); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.MinionDamage()), 4f, proj.owner); modPlayer.jellyDmg = 100f; } else if (modPlayer.starbusterCore) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.35), 3.5f, proj.owner); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(40 * player.MinionDamage()), 3.5f, proj.owner); modPlayer.jellyDmg = 60f; } else if (modPlayer.nuclearRod) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.25), 0f, proj.owner); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(20 * player.MinionDamage()), 0f, proj.owner); modPlayer.jellyDmg = 60f; } else if (modPlayer.jellyChargedBattery) { - int projDamage = (int)(proj.damage * 0.3); - CalamityGlobalProjectile.SpawnOrb(proj, projDamage, ProjectileType(), 800f, 15f); + CalamityGlobalProjectile.SpawnOrb(proj, (int)(15 * player.MinionDamage()), ProjectileType(), 800f, 15f); modPlayer.jellyDmg = 60f; } } @@ -445,7 +443,7 @@ namespace CalamityMod.CalPlayer modPlayer.hallowedRuneCooldown = 180; Vector2 spawnPosition = position - new Vector2(0f, 920f).RotatedByRandom(0.3f); float speed = Main.rand.NextFloat(17f, 23f); - Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), proj.damage / 3, 3f, proj.owner); + Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), (int)(30 * player.MinionDamage()), 3f, proj.owner); } } } @@ -455,7 +453,7 @@ namespace CalamityMod.CalPlayer #region Rogue private static void RogueOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) { - if (modProj.stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 2) + if (modProj.stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 1) { int projTileX = (int)(proj.Center.X / 16f); int projTileY = (int)(proj.Center.Y / 16f); @@ -485,7 +483,7 @@ namespace CalamityMod.CalPlayer break; } } - int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), 840, 15f, Main.myPlayer, 16f, 16f); + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(400 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().forceRogue = true; @@ -540,8 +538,7 @@ namespace CalamityMod.CalPlayer float speedX = (position.X - source.X) / 30f; float speedY = (position.Y - source.Y) * 8; Vector2 velocity = new Vector2(speedX, speedY); - int dmg = (int)(15 + (proj.damage * 0.05f)); - int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), dmg, 3f, proj.owner); + int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(15 * player.RogueDamage()), 3f, proj.owner); if (feather.WithinBounds(Main.maxProjectiles)) Main.projectile[feather].Calamity().forceRogue = true; modPlayer.featherCrownCooldown = 15; @@ -554,8 +551,7 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 10f; - int dmg = (int)(150 + (proj.damage * 0.05f)); - int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, dmg, 3, proj.owner); + int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, (int)(60 * player.RogueDamage()), 3, proj.owner); if (flare.WithinBounds(Main.maxProjectiles)) Main.projectile[flare].Calamity().forceRogue = true; modPlayer.moonCrownCooldown = 15; @@ -568,8 +564,7 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 40f; - int dmg = (int)(1000 + (proj.damage * 0.05f)); - int flare = Projectile.NewProjectile(source, velocity, ProjectileType(),dmg, 3f, proj.owner); + int flare = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(120 * player.RogueDamage()), 3f, proj.owner); if (flare.WithinBounds(Main.maxProjectiles)) Main.projectile[flare].Calamity().rogue = true; modPlayer.nanoFlareCooldown = 15; @@ -584,16 +579,14 @@ namespace CalamityMod.CalPlayer float yVector = Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - int dmg = (int)(75 + (proj.damage * 0.05f)); - Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), dmg, proj.knockBack, proj.owner, 0f, 0f); + Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), (int)(40 * player.RogueDamage()), proj.knockBack, proj.owner); modPlayer.forbiddenCooldown = 15; } } if (modPlayer.titanHeartSet && modProj.stealthStrike && modPlayer.titanCooldown <= 0 && modProj.stealthStrikeHitCount < 5) { - int dmg = (int)(100 + (proj.damage * 0.01f)); - int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), dmg, proj.knockBack, proj.owner, 1f, 0f); + int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(50 * player.RogueDamage()), proj.knockBack, proj.owner, 1f, 0f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceRogue = true; Main.PlaySound(SoundID.Item14, proj.Center); @@ -631,7 +624,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { float speed = Main.rand.NextFloat(5f, 11f); - Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(proj.damage * 0.3), proj.knockBack, player.whoAmI); + Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(35 * player.RogueDamage()), proj.knockBack, player.whoAmI); } } } @@ -681,6 +674,7 @@ namespace CalamityMod.CalPlayer modPlayer.shadowPotCooldown = 30; } } + if (npcCheck) { if (modPlayer.umbraphileSet && (Main.rand.NextBool(4) || (modProj.stealthStrike && modProj.stealthStrikeHitCount < 5)) && proj.type != ProjectileType()) @@ -697,7 +691,7 @@ namespace CalamityMod.CalPlayer for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(proj.damage * 0.1), 0f, player.whoAmI); + int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(20 * player.RogueDamage()), 0f, player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].Calamity().forceRogue = true; @@ -1332,7 +1326,6 @@ namespace CalamityMod.CalPlayer } #endregion - #region The Horseman's Blade public static void HorsemansBladeOnHit(Player player, int targetIdx, int damage, float knockback, int extraUpdateAmt = 0, int type = ProjectileID.FlamingJack) { diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index 38efa77607..96746a47d9 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.defense = 1; //21 + item.defense = 1; // This item has the same rarity and sell price as Forbidden Mask item.value = Item.buyPrice(gold: 25); item.rare = ItemRarityID.Pink; diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index c95f79f559..5d225b7aac 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shadowfish"); //Future potion ingredient + DisplayName.SetDefault("Shadowfish"); Tooltip.SetDefault("Darkness spreads"); } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index d16fe27fd7..b8f1682d9f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1195,7 +1195,7 @@ namespace CalamityMod.Projectiles { if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 30) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 15) { //Note: these don't count as true melee anymore but its useful code to keep around if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || @@ -1212,13 +1212,11 @@ namespace CalamityMod.Projectiles } vector24 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; Vector2 newCenter = player.RotatedRelativePoint(player.position + vector24, true) + projectile.velocity; - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, - (int)(projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(newCenter, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); } else { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.Mushroom, - (int)(projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); } } } @@ -1230,32 +1228,31 @@ namespace CalamityMod.Projectiles { if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 25) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.RogueDamage()), 0f, projectile.owner); } } } - // Moon Crown gets overridden by Nanotech else if (modPlayer.moonCrown && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { - if (Main.player[projectile.owner].miscCounter % 300 == 0 && projectile.FinalExtraUpdate()) + if (Main.player[projectile.owner].miscCounter % 120 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 15) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.2), 0, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(45 * player.RogueDamage()), 0f, projectile.owner); } } } + if (modPlayer.dragonScales && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { if (Main.player[projectile.owner].miscCounter % 50 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 15) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - // Spawn a dust that does 1/5th of the original damage Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), - (int)(projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); + (int)(80 * player.RogueDamage()), 0f, projectile.owner); } } } @@ -1276,7 +1273,8 @@ namespace CalamityMod.Projectiles } } } - //will always be friendly and rogue if it has this boost + + // Will always be friendly and rogue if it has this boost if (modPlayer.momentumCapacitor && momentumCapacitatorBoost) { if (projectile.velocity.Length() < 26f) @@ -1637,39 +1635,37 @@ namespace CalamityMod.Projectiles #region Kill public override void Kill(Projectile projectile, int timeLeft) { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) { if (rogue) { - if (modPlayer.etherealExtorter && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 10) + if (modPlayer.etherealExtorter && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) { for (int i = 0; i < 2; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int soul = Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), (int)(projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); + int soul = Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), (int)(25 * player.RogueDamage()), 0f, projectile.owner); Main.projectile[soul].tileCollide = false; } } + if (modPlayer.scuttlersJewel && CalamityLists.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) { - int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.35), projectile.knockBack, projectile.owner); + int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(15 * player.RogueDamage()), projectile.knockBack, projectile.owner); Main.projectile[spike].frame = 4; } } if (projectile.type == ProjectileID.UnholyWater) - { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); - } + if (projectile.type == ProjectileID.BloodWater) - { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); - } + if (projectile.type == ProjectileID.HolyWater) - { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); - } } } #endregion diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 440c8aa038..8118335fa3 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 500; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; projectile.magic = true; } diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index 16efbae42e..4db7e562e6 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 2; projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } + projectile.timeLeft = 90; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 8; + } public override void AI() { diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 2e56efabf7..40327e0c42 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -25,9 +25,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 837bcfe9d7..0bdd8d8301 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Rogue { public NPC target; public Vector2 rotationVector = Vector2.UnitY * -13f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -20,8 +21,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { projectile.width = 64; - projectile.height = 66; - projectile.scale = 1f; + projectile.height = 64; projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; @@ -30,7 +30,9 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 380 && target.CanBeChasedBy(projectile); + + public override void AI() { target = projectile.Center.ClosestNPCAt(1200f); if (projectile.localAI[0] == 0f) @@ -38,6 +40,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f); projectile.localAI[0] = 1f; } + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -45,22 +48,23 @@ namespace CalamityMod.Projectiles.Rogue projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) - { projectile.frame = 0; - } - if (projectile.timeLeft >= 380) - { - projectile.velocity *= 1.07f; - } - else if (target != null) - projectile.velocity = (projectile.velocity * 23f + projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; - else - { - projectile.timeLeft = Math.Min(projectile.timeLeft, 15); - projectile.alpha += 17; - projectile.velocity = rotationVector; - rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * projectile.ai[0])); - } + + if (projectile.timeLeft >= 380) + { + projectile.velocity *= 1.07f; + } + else if (target != null) + { + projectile.velocity = (projectile.velocity * 23f + projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; + } + else + { + projectile.timeLeft = Math.Min(projectile.timeLeft, 15); + projectile.alpha += 17; + projectile.velocity = rotationVector; + rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * projectile.ai[0])); + } } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); @@ -73,6 +77,7 @@ namespace CalamityMod.Projectiles.Rogue Main.spriteBatch.Draw(projectileTexture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.Center); @@ -84,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2)) { Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int d = 0; d < 8; d++) @@ -96,9 +101,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[idx].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); } } } diff --git a/Projectiles/Rogue/JewelSpike.cs b/Projectiles/Rogue/JewelSpike.cs index 166511b516..735ccea2e0 100644 --- a/Projectiles/Rogue/JewelSpike.cs +++ b/Projectiles/Rogue/JewelSpike.cs @@ -27,21 +27,21 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.velocity *= 0f; + if (Main.rand.NextBool(5) && projectile.frame < 3) { int crystalDust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); Main.dust[crystalDust].noGravity = true; } + projectile.frameCounter++; if (projectile.frameCounter > 4 && projectile.frame > 0) { projectile.frame--; projectile.frameCounter = 0; } - if (projectile.frame < 0) //just in case - { + if (projectile.frame < 0) projectile.frame = 0; - } } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index af64e67075..2c21e0511a 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 20; projectile.friendly = true; projectile.alpha = 0; - projectile.penetrate = 10; + projectile.penetrate = 2; projectile.ignoreWater = true; projectile.timeLeft = 250; projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 27f448d64b..6eaf3e2a09 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; @@ -22,20 +21,20 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = 1; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.ai[1] >= 30f && target.CanBeChasedBy(projectile); + + public override void AI() { Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); + projectile.rotation += projectile.velocity.X * 0.2f; if (projectile.velocity.X > 0f) - { projectile.rotation += 0.08f; - } else - { projectile.rotation -= 0.08f; - } + projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) + if (projectile.ai[1] > 60f) { projectile.alpha += 5; if (projectile.alpha >= 255) @@ -45,7 +44,9 @@ namespace CalamityMod.Projectiles.Typeless return; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + + if (projectile.ai[1] >= 30f) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Typeless/UnstableSpark.cs b/Projectiles/Typeless/UnstableSpark.cs index 702b4bcf6b..5b45274991 100644 --- a/Projectiles/Typeless/UnstableSpark.cs +++ b/Projectiles/Typeless/UnstableSpark.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.height = 12; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 120; + projectile.timeLeft = 90; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } From 2c6bccf20d16c9730c746061d9594e1ff3aadd40 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 25 Apr 2021 11:29:10 -0500 Subject: [PATCH 42/43] 1 - Fixed a bug with DoG. --- CalPlayer/CalamityPlayer.cs | 16 ++++++++-------- NPCs/Abyss/EidolonWyrmHeadHuge.cs | 1 - NPCs/DevourerofGods/DevourerofGodsHead.cs | 8 ++++---- NPCs/DevourerofGods/DevourerofGodsHeadS.cs | 8 ++++---- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index bc62d018f0..81920608f0 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2388,14 +2388,14 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityWorld.armageddon && !areThereAnyDamnBosses) - { - player.respawnTimer -= 5; - } - else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert - { - player.respawnTimer--; - } + + if (player.respawnTimer > 300) + { + if (CalamityWorld.armageddon && !areThereAnyDamnBosses) + player.respawnTimer -= 5; + else if (Main.expertMode) // 600 normal 900 expert + player.respawnTimer--; + } } #endregion diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 9494fe375a..dd58aa7918 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.Magic; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 8b74aa0b85..d92ad0520c 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Variables Vector2 vector = npc.Center; - bool flies = npc.ai[2] == 0f; + bool flies = npc.ai[3] == 0f; bool malice = CalamityWorld.malice; bool expertMode = Main.expertMode || malice; bool revenge = CalamityWorld.revenge || malice; @@ -412,7 +412,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.spriteDirection = 1; // Flight - if (npc.ai[2] == 0f) + if (npc.ai[3] == 0f) { if (Main.netMode != NetmodeID.Server) { @@ -598,7 +598,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > 900f) { - npc.ai[2] = 1f; + npc.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); npc.netUpdate = true; @@ -859,7 +859,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > 900f) { - npc.ai[2] = 0f; + npc.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); npc.netUpdate = true; diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index cd67c41d99..e1c058a92f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Variables Vector2 vector = npc.Center; - bool flies = npc.ai[2] == 0f; + bool flies = npc.ai[3] == 0f; bool malice = CalamityWorld.malice; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || malice; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || malice; @@ -577,7 +577,7 @@ namespace CalamityMod.NPCs.DevourerofGods int phaseLimit = death ? 600 : 900; // Flight - if (npc.ai[2] == 0f) + if (npc.ai[3] == 0f) { if (Main.netMode != NetmodeID.Server) { @@ -784,7 +784,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[2] = 1f; + npc.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); npc.netUpdate = true; @@ -1057,7 +1057,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[2] = 0f; + npc.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); npc.netUpdate = true; From af7d595f4c9609686a2818db8504479e2cf4cf69 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Mon, 26 Apr 2021 03:37:50 -0500 Subject: [PATCH 43/43] 1 - Hopefully fixed Third Sage healing on respawn. 2 - Made all accessory-spawned and set bonus projectiles unable to trigger themselves. 3 - Fixed some Malice Mode issues. --- CalPlayer/CalamityPlayer.cs | 81 ++++++++++++------------ CalPlayer/CalamityPlayerMiscEffects.cs | 12 +++- CalPlayer/CalamityPlayerOnHit.cs | 72 +++++++++++++-------- Items/Accessories/TheEvolution.cs | 4 +- Items/CalamityGlobalItem.cs | 56 ++++++++++------ Items/Weapons/Magic/HyphaeRod.cs | 2 +- Items/Weapons/Rogue/TheReaper.cs | 1 + NPCs/SlimeGod/SlimeGod.cs | 7 +- NPCs/SlimeGod/SlimeGodCore.cs | 8 +++ NPCs/SlimeGod/SlimeGodRun.cs | 7 +- NPCs/SlimeGod/SlimeGodRunSplit.cs | 7 +- NPCs/SlimeGod/SlimeGodSplit.cs | 7 +- Projectiles/CalamityGlobalProjectile.cs | 24 ++++--- Projectiles/Rogue/Corrocloud1.cs | 4 +- Projectiles/Rogue/Corrocloud2.cs | 4 +- Projectiles/Rogue/Corrocloud3.cs | 4 +- Projectiles/Rogue/DragonShit.cs | 18 +++++- Projectiles/Rogue/JewelSpike.cs | 8 +-- Projectiles/Rogue/LostSoulFriendly.cs | 21 +++++- Projectiles/Rogue/MoonSigil.cs | 19 ++++-- Projectiles/Rogue/PenumbraSoul.cs | 4 +- Projectiles/Summon/HallowedStarSummon.cs | 4 +- Projectiles/Summon/PhantomicDagger.cs | 4 +- Projectiles/Typeless/NanoFlare.cs | 2 +- Projectiles/Typeless/Nanotech.cs | 14 +++- Projectiles/Typeless/SabatonBoom.cs | 2 +- 26 files changed, 266 insertions(+), 130 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 81920608f0..ebc11382ec 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1390,14 +1390,7 @@ namespace CalamityMod.CalPlayer noLifeRegen = false; thirdSage = false; - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - thirdSageH = false; + thirdSageH = false; perfmini = false; akato = false; @@ -2863,9 +2856,13 @@ namespace CalamityMod.CalPlayer float randomSpeed = (float)Main.rand.Next(1, 7); float randomSpeed2 = (float)Main.rand.Next(1, 7); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, ai1); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, ai1); - } + int soul = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, ai1); + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].Calamity().forceTypeless = true; + int soul2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, ai1); + if (soul2.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul2].Calamity().forceTypeless = true; + } } } if (omegaBlueSet && omegaBlueCooldown <= 0) @@ -2951,8 +2948,10 @@ namespace CalamityMod.CalPlayer float kBack = ForbiddenCirclet.tornadoBaseKB + player.minionKB; if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, player.whoAmI, 0f, 0f); - } + int mark = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, player.whoAmI); + if (mark.WithinBounds(Main.maxProjectiles)) + Main.projectile[mark].Calamity().forceTypeless = true; + } } } if (prismaticSet && !prismaticCooldown && prismaticLasers <= 0) @@ -3019,7 +3018,9 @@ namespace CalamityMod.CalPlayer int projectileIndex = Projectile.NewProjectile(player.Center + initialVelocity * 3f, initialVelocity, ModContent.ProjectileType(), damage, 2f, player.whoAmI); Main.projectile[projectileIndex].tileCollide = false; Main.projectile[projectileIndex].localAI[1] = (Main.projectile[projectileIndex].velocity.Y < 0f).ToInt(); - } + if (projectileIndex.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectileIndex].Calamity().forceTypeless = true; + } // Remove all rage when the special attack is used, and apply the cooldown. rage = 0f; @@ -3147,7 +3148,7 @@ namespace CalamityMod.CalPlayer { int bubble = Projectile.NewProjectile(new Vector2(player.position.X, player.position.Y + (player.gravDir == -1f ? 20 : -20)), Vector2.Zero, ModContent.ProjectileType(), (int)(20f * player.RogueDamage()), 0f, player.whoAmI, 1f, 0f); if (bubble.WithinBounds(Main.maxProjectiles)) - Main.projectile[bubble].Calamity().forceRogue = true; + Main.projectile[bubble].Calamity().forceTypeless = true; sulphurBubbleCooldown = 20; } } @@ -3964,7 +3965,9 @@ namespace CalamityMod.CalPlayer int lumenyl = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType(), (int)(55 * player.RogueDamage()), 0, player.whoAmI); Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); - } + if (lumenyl.WithinBounds(Main.maxProjectiles)) + Main.projectile[lumenyl].Calamity().forceTypeless = true; + } // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust if (player.whoAmI == Main.myPlayer) @@ -3995,10 +3998,12 @@ namespace CalamityMod.CalPlayer } Main.PlaySound(SoundID.Item68, player.Center); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(2750 * player.RogueDamage()), 0, player.whoAmI); + int eclipse = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(2750 * player.RogueDamage()), 0, player.whoAmI); + if (eclipse.WithinBounds(Main.maxProjectiles)) + Main.projectile[eclipse].Calamity().forceTypeless = true; - // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust - if (player.whoAmI == Main.myPlayer) + // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust + if (player.whoAmI == Main.myPlayer) { NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } @@ -6871,7 +6876,7 @@ namespace CalamityMod.CalPlayer float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.065), knockBack * 0.5f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().forceRogue = true; //in case melee/rogue variants bug out + Main.projectile[p].Calamity().forceTypeless = true; //in case melee/rogue variants bug out if (item.type == ModContent.ItemType()) { Main.projectile[p].ai[1] = 1f; @@ -6889,8 +6894,10 @@ namespace CalamityMod.CalPlayer velocity = velocity.RotatedBy(angleStep * i); int knifeCol = Main.rand.Next(0, 2); - Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType(), knifeDamage, 0f, player.whoAmI, knifeCol, 0); - } + int knife = Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType(), knifeDamage, 0f, player.whoAmI, knifeCol, 0); + if (knife.WithinBounds(Main.maxProjectiles)) + Main.projectile[knife].Calamity().forceTypeless = true; + } } } } @@ -6905,8 +6912,10 @@ namespace CalamityMod.CalPlayer { Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; Vector2 directionToMouse = (startingPosition - Main.MouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - Projectile.NewProjectileDirect(startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3), 0f, player.whoAmI).penetrate = 2; - } + int drop = Projectile.NewProjectileDirect(startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3), 0f, player.whoAmI).penetrate = 2; + if (drop.WithinBounds(Main.maxProjectiles)) + Main.projectile[drop].Calamity().forceTypeless = true; + } } } } @@ -7585,20 +7594,6 @@ namespace CalamityMod.CalPlayer star.localNPCHitCooldown = 5; } } - - /*int num = 1; - if (Main.rand.NextBool(3)) - ++num; - if (Main.rand.NextBool(3)) - ++num; - if (player.strongBees && Main.rand.NextBool(3)) - ++num; - for (int index = 0; index < num; ++index) - { - int bee = Projectile.NewProjectile(player.position.X, player.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, player.beeType(), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[bee].usesLocalNPCImmunity = true; - Main.projectile[bee].localNPCHitCooldown = 5; - }*/ } if (theBee) { @@ -7624,7 +7619,9 @@ namespace CalamityMod.CalPlayer int bee = Projectile.NewProjectile(player.position.X, player.position.Y, Main.rand.Next(-35, 36) * 0.02f, Main.rand.Next(-35, 36) * 0.02f, Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType(), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[bee].usesLocalNPCImmunity = true; Main.projectile[bee].localNPCHitCooldown = 5; - } + if (bee.WithinBounds(Main.maxProjectiles)) + Main.projectile[bee].Calamity().forceTypeless = true; + } } } if (fCarapace) @@ -7694,8 +7691,10 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 5; i++) { Main.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); - Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); - } + int ink = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); + if (ink.WithinBounds(Main.maxProjectiles)) + Main.projectile[ink].Calamity().forceTypeless = true; + } } } if (blazingCore) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 025824c78a..7bc22ddcae 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1681,6 +1681,8 @@ namespace CalamityMod.CalPlayer lightningVel *= Main.rand.NextFloat(1f, 2f); int projectile = Projectile.NewProjectile(player.Center, lightningVel, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0, player.whoAmI, Main.rand.Next(2), 0f); Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; } for (int i = 0; i < 3; i++) @@ -1701,6 +1703,8 @@ namespace CalamityMod.CalPlayer cloudVelocity *= Main.rand.NextFloat(0f, 1f); int projectile = Projectile.NewProjectile(player.Center, cloudVelocity, ModContent.ProjectileType(), (int)(20 * player.RogueDamage()), 0, player.whoAmI, 0, 0); Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; } for (int i = 0; i < 3; i++) @@ -3070,8 +3074,10 @@ namespace CalamityMod.CalPlayer for (int I = 0; I < 3; I++) { float ai1 = I * 120; - Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, + int projectile = Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, ModContent.ProjectileType(), (int)(3750 * player.MinionDamage()), 1f, player.whoAmI, ai1, 0f); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; } } } @@ -3391,6 +3397,8 @@ namespace CalamityMod.CalPlayer Main.projectile[bee].usesLocalNPCImmunity = true; Main.projectile[bee].localNPCHitCooldown = 10; Main.projectile[bee].penetrate = 2; + if (bee.WithinBounds(Main.maxProjectiles)) + Main.projectile[bee].Calamity().forceTypeless = true; } } } @@ -3528,6 +3536,8 @@ namespace CalamityMod.CalPlayer velocity.Y += Main.rand.Next(-50, 51) * 0.02f; int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, 0f); Main.projectile[laser].localNPCHitCooldown = 5; + if (laser.WithinBounds(Main.maxProjectiles)) + Main.projectile[laser].Calamity().forceTypeless = true; } Main.PlaySound(SoundID.Item12, player.Center); } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 9b11c74b4f..d7a1c32f1e 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -55,12 +55,12 @@ namespace CalamityMod.CalPlayer for (int n = 0; n < 3; n++) CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), (int)(320 * player.AverageDamage()), 5f, player.whoAmI); } - if (modPlayer.unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 10) + if (modPlayer.unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 5) { for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI); + Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * player.AverageDamage()), 0f, player.whoAmI); } } if (modPlayer.astralStarRain && crit && modPlayer.astralStarRainCooldown <= 0) @@ -240,13 +240,13 @@ namespace CalamityMod.CalPlayer } } } - if (modPlayer.tarraRanged && Main.rand.Next(0, 100) >= 88 && player.ownedProjectileCounts[ProjectileType()] <= 20 && (proj.timeLeft <= 2 || proj.penetrate <= 1)) + if (modPlayer.tarraRanged && Main.rand.Next(0, 100) >= 88 && player.ownedProjectileCounts[ProjectileType()] < 5 && (proj.timeLeft <= 2 || proj.penetrate <= 1)) { int projAmt = Main.rand.Next(2, 4); for (int projCount = 0; projCount < projAmt; projCount++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(proj.Center, velocity, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.33, 65), 0f, proj.owner, 0f, 0f); + Projectile.NewProjectile(proj.Center, velocity, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.33, 65), 0f, proj.owner); } } if (npcCheck) @@ -361,7 +361,9 @@ namespace CalamityMod.CalPlayer if (player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(10)) { int damage = (int)(75 * player.MinionDamage()); - Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, player.whoAmI, 0f); + int dagger = Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, player.whoAmI, 0f); + if (dagger.WithinBounds(Main.maxProjectiles)) + Main.projectile[dagger].Calamity().forceTypeless = true; } } else @@ -416,17 +418,23 @@ namespace CalamityMod.CalPlayer { if (modPlayer.nucleogenesis) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.MinionDamage()), 4f, proj.owner); + int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.MinionDamage()), 4f, proj.owner); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; modPlayer.jellyDmg = 100f; } else if (modPlayer.starbusterCore) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(40 * player.MinionDamage()), 3.5f, proj.owner); + int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(40 * player.MinionDamage()), 3.5f, proj.owner); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; modPlayer.jellyDmg = 60f; } else if (modPlayer.nuclearRod) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(20 * player.MinionDamage()), 0f, proj.owner); + int projectile = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(20 * player.MinionDamage()), 0f, proj.owner); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; modPlayer.jellyDmg = 60f; } else if (modPlayer.jellyChargedBattery) @@ -443,7 +451,9 @@ namespace CalamityMod.CalPlayer modPlayer.hallowedRuneCooldown = 180; Vector2 spawnPosition = position - new Vector2(0f, 920f).RotatedByRandom(0.3f); float speed = Main.rand.NextFloat(17f, 23f); - Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), (int)(30 * player.MinionDamage()), 3f, proj.owner); + int projectile = Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), (int)(30 * player.MinionDamage()), 3f, proj.owner); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; } } } @@ -486,7 +496,7 @@ namespace CalamityMod.CalPlayer int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(400 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { - Main.projectile[projectileIndex].Calamity().forceRogue = true; + Main.projectile[projectileIndex].Calamity().forceTypeless = true; Main.projectile[projectileIndex].netUpdate = true; Main.projectile[projectileIndex].localNPCHitCooldown = 10; } @@ -540,7 +550,7 @@ namespace CalamityMod.CalPlayer Vector2 velocity = new Vector2(speedX, speedY); int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(15 * player.RogueDamage()), 3f, proj.owner); if (feather.WithinBounds(Main.maxProjectiles)) - Main.projectile[feather].Calamity().forceRogue = true; + Main.projectile[feather].Calamity().forceTypeless = true; modPlayer.featherCrownCooldown = 15; } } @@ -553,7 +563,7 @@ namespace CalamityMod.CalPlayer Vector2 velocity = (position - source) / 10f; int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, (int)(60 * player.RogueDamage()), 3, proj.owner); if (flare.WithinBounds(Main.maxProjectiles)) - Main.projectile[flare].Calamity().forceRogue = true; + Main.projectile[flare].Calamity().forceTypeless = true; modPlayer.moonCrownCooldown = 15; } } @@ -564,9 +574,7 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 40f; - int flare = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(120 * player.RogueDamage()), 3f, proj.owner); - if (flare.WithinBounds(Main.maxProjectiles)) - Main.projectile[flare].Calamity().rogue = true; + Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(120 * player.RogueDamage()), 3f, proj.owner); modPlayer.nanoFlareCooldown = 15; } } @@ -579,16 +587,16 @@ namespace CalamityMod.CalPlayer float yVector = Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), (int)(40 * player.RogueDamage()), proj.knockBack, proj.owner); + int eater = Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), (int)(40 * player.RogueDamage()), proj.knockBack, proj.owner); + if (eater.WithinBounds(Main.maxProjectiles)) + Main.projectile[eater].Calamity().forceTypeless = true; modPlayer.forbiddenCooldown = 15; } } if (modPlayer.titanHeartSet && modProj.stealthStrike && modPlayer.titanCooldown <= 0 && modProj.stealthStrikeHitCount < 5) { - int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(50 * player.RogueDamage()), proj.knockBack, proj.owner, 1f, 0f); - if (boom.WithinBounds(Main.maxProjectiles)) - Main.projectile[boom].Calamity().forceRogue = true; + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(50 * player.RogueDamage()), proj.knockBack, proj.owner, 1f, 0f); Main.PlaySound(SoundID.Item14, proj.Center); for (int dustexplode = 0; dustexplode < 360; dustexplode++) { @@ -601,7 +609,7 @@ namespace CalamityMod.CalPlayer modPlayer.titanCooldown = 15; } - if (modPlayer.corrosiveSpine && proj.type != ProjectileType() && proj.type != ProjectileType() && proj.type != ProjectileType() && modProj.stealthStrikeHitCount < 5) + if (modPlayer.corrosiveSpine && modProj.stealthStrikeHitCount < 5) { for (int i = 0; i < 3; i++) { @@ -624,7 +632,9 @@ namespace CalamityMod.CalPlayer if (type != -1) { float speed = Main.rand.NextFloat(5f, 11f); - Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(35 * player.RogueDamage()), proj.knockBack, player.whoAmI); + int cloud = Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(35 * player.RogueDamage()), proj.knockBack, player.whoAmI); + if (cloud.WithinBounds(Main.maxProjectiles)) + Main.projectile[cloud].Calamity().forceTypeless = true; } } } @@ -636,12 +646,16 @@ namespace CalamityMod.CalPlayer { int randrot = Main.rand.Next(-30, 391); Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); - Projectile.NewProjectile(proj.Center, SoulSpeed, ProjectileType(), (int)(proj.damage * 0.1), 3f, proj.owner, 0f, 0f); + int soul = Projectile.NewProjectile(proj.Center, SoulSpeed, ProjectileType(), (int)(proj.damage * 0.1), 3f, proj.owner, 0f, 0f); + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].Calamity().forceTypeless = true; modPlayer.shadowPotCooldown = 30; } if (CalamityLists.spikyBallProjList.Contains(proj.type)) { int scythe = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.05), 3f, proj.owner, 1f, 0f); + if (scythe.WithinBounds(Main.maxProjectiles)) + Main.projectile[scythe].Calamity().forceTypeless = true; Main.projectile[scythe].usesLocalNPCImmunity = true; Main.projectile[scythe].localNPCHitCooldown = 10; Main.projectile[scythe].penetrate = 2; @@ -653,6 +667,8 @@ namespace CalamityMod.CalPlayer shardVelocity.Normalize(); shardVelocity *= 5f; int shard = Projectile.NewProjectile(proj.Center, shardVelocity, ProjectileType(), (int)(proj.damage * 0.15), 0f, proj.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceTypeless = true; Main.projectile[shard].timeLeft = 150; modPlayer.shadowPotCooldown = 30; } @@ -662,7 +678,7 @@ namespace CalamityMod.CalPlayer Projectile ghost = CalamityGlobalProjectile.SpawnOrb(proj, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { - ghost.Calamity().forceRogue = true; + ghost.Calamity().forceTypeless = true; ghost.penetrate = 1; } modPlayer.shadowPotCooldown = 30; @@ -670,6 +686,8 @@ namespace CalamityMod.CalPlayer if (CalamityLists.flaskBombProjList.Contains(proj.type)) { int blackhole = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.05), 3f, proj.owner, 0f, 0f); + if (blackhole.WithinBounds(Main.maxProjectiles)) + Main.projectile[blackhole].Calamity().forceTypeless = true; Main.projectile[blackhole].Center = proj.Center; modPlayer.shadowPotCooldown = 30; } @@ -679,8 +697,10 @@ namespace CalamityMod.CalPlayer { if (modPlayer.umbraphileSet && (Main.rand.NextBool(4) || (modProj.stealthStrike && modProj.stealthStrikeHitCount < 5)) && proj.type != ProjectileType()) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI); - } + int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI); + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].Calamity().forceTypeless = true; + } if (modPlayer.raiderTalisman && modPlayer.raiderStack < 150 && crit && modPlayer.raiderCooldown <= 0) { modPlayer.raiderStack++; @@ -694,7 +714,7 @@ namespace CalamityMod.CalPlayer int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(20 * player.RogueDamage()), 0f, player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { - Main.projectile[spark].Calamity().forceRogue = true; + Main.projectile[spark].Calamity().forceTypeless = true; Main.projectile[spark].localNPCHitCooldown = -1; } } diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index 32af91ef79..6187185e58 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -21,7 +22,8 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.accessory = true; + item.rare = ItemRarityID.Purple; + item.accessory = true; item.Calamity().challengeDrop = true; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 389adcd6df..eede924ece 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -250,20 +250,36 @@ namespace CalamityMod.Items if (player.whoAmI == Main.myPlayer) { - if (item.melee) - Projectile.NewProjectile(position, velocity * 0.5f, ModContent.ProjectileType(), (int)(newDamage * 0.25), 0f, player.whoAmI); - - else if (rogue) - Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), (int)(newDamage * 0.2), 0f, player.whoAmI); - - else if (item.ranged) - Projectile.NewProjectile(position, velocity * 1.5f, ModContent.ProjectileType(), (int)(newDamage * 0.15), 0f, player.whoAmI); - - else if (item.magic) - Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), (int)(newDamage * 0.3), 0f, player.whoAmI); - - else if (item.summon && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI); + if (item.melee) + { + int projectile = Projectile.NewProjectile(position, velocity * 0.5f, ModContent.ProjectileType(), (int)(newDamage * 0.25), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (rogue) + { + int projectile = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), (int)(newDamage * 0.2), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (item.ranged) + { + int projectile = Projectile.NewProjectile(position, velocity * 1.5f, ModContent.ProjectileType(), (int)(newDamage * 0.15), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (item.magic) + { + int projectile = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), (int)(newDamage * 0.3), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (item.summon && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + int projectile = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } } } if (modPlayer.bloodflareMage && modPlayer.canFireBloodflareMageProjectile) @@ -303,8 +319,10 @@ namespace CalamityMod.Items num84 = item.shootSpeed / num84; hardar *= num84; hordor *= num84; - Projectile.NewProjectile(position, new Vector2(hardar, hordor), ProjectileID.Leaf, CalamityUtils.DamageSoftCap(damage * 0.2, 40), knockBack, player.whoAmI); - } + int projectile = Projectile.NewProjectile(position, new Vector2(hardar, hordor), ProjectileID.Leaf, CalamityUtils.DamageSoftCap(damage * 0.2, 40), knockBack, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } } } if (modPlayer.ataxiaBolt && modPlayer.canFireAtaxiaRangedProjectile) @@ -372,8 +390,10 @@ namespace CalamityMod.Items if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), newDamage, 2f, player.whoAmI); - } + int projectile = Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), newDamage, 2f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } } } if (modPlayer.prismaticRegalia) diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 8df153bb43..63e08a161b 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Magic if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMagic = true; - Main.projectile[proj].timeLeft = CalamityUtils.SecondsToFrames(8f); + Main.projectile[proj].timeLeft = CalamityUtils.SecondsToFrames(3f); } } return false; diff --git a/Items/Weapons/Rogue/TheReaper.cs b/Items/Weapons/Rogue/TheReaper.cs index 6f427a4e41..cf3101c3e0 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheReaper.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.rare = ItemRarityID.Purple; item.Calamity().challengeDrop = true; } diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 54ce5f0b0d..171f5f0012 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -141,12 +141,17 @@ namespace CalamityMod.NPCs.SlimeGod flag100 = true; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active || malice) + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { npc.localAI[1] = 0f; flag100 = false; hyperMode = true; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index eab46f5a02..7bcaca66dc 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -263,8 +263,13 @@ namespace CalamityMod.NPCs.SlimeGod // Reduce velocity to 0 to avoid spastic movement when inside big slime. if (Vector2.Distance(npc.Center, goToVector) < 24f) + { npc.velocity = Vector2.Zero; + if (npc.alpha < 255) + npc.alpha += 5; + } + bool slimeDead = false; if (goToVector == purpleSlimeVector) slimeDead = CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active; @@ -302,6 +307,9 @@ namespace CalamityMod.NPCs.SlimeGod return; } + if (npc.alpha > 55) + npc.alpha -= 5; + buffedSlime = 0; } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index b9d12b9f1e..0105ff5770 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -144,12 +144,17 @@ namespace CalamityMod.NPCs.SlimeGod flag100 = true; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active || malice) + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { npc.localAI[1] = 0f; hyperMode = true; flag100 = false; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (npc.localAI[1] != 1f) { diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 93d7ab0195..e46120ebf8 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -129,12 +129,17 @@ namespace CalamityMod.NPCs.SlimeGod flag100 = true; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active || malice) + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { npc.localAI[1] = 0f; hyperMode = true; flag100 = false; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (npc.localAI[1] != 1f) { diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 5dae4e75f3..c18cfeea54 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -129,12 +129,17 @@ namespace CalamityMod.NPCs.SlimeGod flag100 = true; } } - if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active || malice) + if (CalamityGlobalNPC.slimeGod < 0 || !Main.npc[CalamityGlobalNPC.slimeGod].active) { npc.localAI[1] = 0f; hyperMode = true; flag100 = false; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b8f1682d9f..ba8e67a2b7 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1224,7 +1224,7 @@ namespace CalamityMod.Projectiles if (rogue) { - if (modPlayer.nanotech && projectile.type != ProjectileType() && projectile.type != ProjectileType()) + if (modPlayer.nanotech) { if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) { @@ -1234,26 +1234,30 @@ namespace CalamityMod.Projectiles } } } - else if (modPlayer.moonCrown && projectile.type != ProjectileType() && projectile.type != ProjectileType()) + else if (modPlayer.moonCrown) { if (Main.player[projectile.owner].miscCounter % 120 == 0 && projectile.FinalExtraUpdate()) { if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(45 * player.RogueDamage()), 0f, projectile.owner); + int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(45 * player.RogueDamage()), 0f, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceTypeless = true; } } } - if (modPlayer.dragonScales && projectile.type != ProjectileType() && projectile.type != ProjectileType()) + if (modPlayer.dragonScales) { if (Main.player[projectile.owner].miscCounter % 50 == 0 && projectile.FinalExtraUpdate()) { if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), + int proj = Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), (int)(80 * player.RogueDamage()), 0f, projectile.owner); - } + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceTypeless = true; + } } } @@ -1648,14 +1652,18 @@ namespace CalamityMod.Projectiles Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int soul = Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), (int)(25 * player.RogueDamage()), 0f, projectile.owner); Main.projectile[soul].tileCollide = false; - } + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].Calamity().forceTypeless = true; + } } if (modPlayer.scuttlersJewel && CalamityLists.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) { int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(15 * player.RogueDamage()), projectile.knockBack, projectile.owner); Main.projectile[spike].frame = 4; - } + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].Calamity().forceTypeless = true; + } } if (projectile.type == ProjectileID.UnholyWater) diff --git a/Projectiles/Rogue/Corrocloud1.cs b/Projectiles/Rogue/Corrocloud1.cs index a126772cf8..ea6f8173c8 100644 --- a/Projectiles/Rogue/Corrocloud1.cs +++ b/Projectiles/Rogue/Corrocloud1.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } diff --git a/Projectiles/Rogue/Corrocloud2.cs b/Projectiles/Rogue/Corrocloud2.cs index 4125f75db8..82313b6398 100644 --- a/Projectiles/Rogue/Corrocloud2.cs +++ b/Projectiles/Rogue/Corrocloud2.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } diff --git a/Projectiles/Rogue/Corrocloud3.cs b/Projectiles/Rogue/Corrocloud3.cs index 2934a7b2c9..3e82f5b360 100644 --- a/Projectiles/Rogue/Corrocloud3.cs +++ b/Projectiles/Rogue/Corrocloud3.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 0bdd8d8301..cb29cc7417 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = false; projectile.penetrate = 1; projectile.timeLeft = 420; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 380 && target.CanBeChasedBy(projectile); @@ -67,7 +67,19 @@ namespace CalamityMod.Projectiles.Rogue } } - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + // Reduce damage of Nanotech projectiles if more than the cap are active + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + if (projectileCount > 5) + { + damage -= (int)(damage * ((projectileCount - 5) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Rogue/JewelSpike.cs b/Projectiles/Rogue/JewelSpike.cs index 735ccea2e0..dc87dd67ab 100644 --- a/Projectiles/Rogue/JewelSpike.cs +++ b/Projectiles/Rogue/JewelSpike.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 40; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } @@ -52,9 +52,7 @@ namespace CalamityMod.Projectiles.Rogue { float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - int shard = Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 4, 0f, projectile.owner); - if (shard.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard].Calamity().forceRogue = true; + Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 4, 0f, projectile.owner); } } } diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index bb4b79c2b7..817edd37fc 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.penetrate = 1; projectile.timeLeft = 240; - projectile.Calamity().rogue = true; + projectile.Calamity().rogue = true; projectile.extraUpdates = 1; projectile.alpha = 150; } @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.frame >= Main.projFrames[projectile.type]) projectile.frame = 0; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + Lighting.AddLight(projectile.Center, 0.25f, 0.25f, 0.25f); projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); @@ -49,7 +49,22 @@ namespace CalamityMod.Projectiles.Rogue CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } - public override void Kill(int timeLeft) + // Reduce damage of Nanotech projectiles if more than the cap are active + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (!projectile.Calamity().rogue) + { + int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + if (projectileCount > 5) + { + damage -= (int)(damage * ((projectileCount - 5) * 0.05)); + if (damage < 1) + damage = 1; + } + } + } + + public override void Kill(int timeLeft) { for (int j = 0; j <= 10; j++) { diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index 2c21e0511a..5752057c03 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -16,14 +16,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.alpha = 0; projectile.penetrate = 2; projectile.ignoreWater = true; projectile.timeLeft = 250; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { @@ -42,7 +41,19 @@ namespace CalamityMod.Projectiles.Rogue CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 8f, 20f); } - public override void Kill(int timeLeft) + // Reduce damage of Nanotech projectiles if more than the cap are active + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + if (projectileCount > 5) + { + damage -= (int)(damage * ((projectileCount - 5) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void Kill(int timeLeft) { float dustSp = 0.2f; int dustD = 0; diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index 4a681c5c02..3f57c5d8dd 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Rogue { projectile.height = 18; projectile.width = 18; - projectile.Calamity().rogue = true; projectile.timeLeft = 150; projectile.friendly = true; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.alpha = 80; + projectile.Calamity().rogue = true; + projectile.alpha = 80; projectile.penetrate = 2; projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index 2de2d3cab3..57e394ff2f 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Summon projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.alpha = 50; projectile.penetrate = 1; projectile.tileCollide = false; diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index 2e356354f3..a87a442638 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = 1; projectile.tileCollide = false; projectile.alpha = 200; - projectile.minion = true; - } + projectile.minion = true; + } public override bool? CanHitNPC(NPC target) { diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index 5e4fe5c78d..29ab33f4f1 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.extraUpdates = 10; + projectile.extraUpdates = 10; projectile.timeLeft = 60; } diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 6eaf3e2a09..0dd0479475 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -49,7 +49,19 @@ namespace CalamityMod.Projectiles.Typeless CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } - public override void Kill(int timeLeft) + // Reduce damage of projectiles if more than the cap are active + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + if (projectileCount > 5) + { + damage -= (int)(damage * ((projectileCount - 5) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void Kill(int timeLeft) { int num3; for (int num191 = 0; num191 < 2; num191 = num3 + 1) diff --git a/Projectiles/Typeless/SabatonBoom.cs b/Projectiles/Typeless/SabatonBoom.cs index 6ed4eda5a3..c82b125783 100644 --- a/Projectiles/Typeless/SabatonBoom.cs +++ b/Projectiles/Typeless/SabatonBoom.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.tileCollide = false; projectile.timeLeft = 40; - projectile.usesLocalNPCImmunity = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; }