From 8e3de257c9be424f69c60635b944f8930ca988c1 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 14 Jul 2025 13:51:10 -0500 Subject: [PATCH 1/6] wulfrum pole & rift reeler --- CalPlayer/CalamityPlayer.cs | 45 ++- Items/Fishing/FishingRods/RiftReeler.cs | 31 +- Items/Fishing/FishingRods/WulfrumRod.cs | 28 +- .../Mods.CalamityMod.Items.Fishing.hjson | 16 +- Projectiles/CalamityGlobalProjectile.cs | 304 ++++++++++++++++++ Projectiles/Typeless/RiftReelerBobber.cs | 5 + 6 files changed, 420 insertions(+), 9 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3abf5065bb..abd92b700e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -175,7 +175,20 @@ namespace CalamityMod.CalPlayer public int momentumCapacitorTime = 0; /// A multiplier on the player's movement speed applied while using Momentum Capacitor. public float momentumCapacitorBoost = 0f; - + public enum FishingMinigames + { + None, + WulfrumRod, + NavyFishingRod, + HeronRod, + SlurperPole, + VerstaltiteFishingRod, + FeralDoubleRod, + RiftReeler, + EarlyBloomRod, + TheDevourerOfCods + } + public FishingMinigames SelectedFishingMinigame = FishingMinigames.None; public bool countsAsAnyWet => (Player.armor[0].type == ItemID.FishBowl || Player.wetCount > 0 || Player.wet || Player.honeyWet || Player.lavaWet); #endregion @@ -382,6 +395,8 @@ namespace CalamityMod.CalPlayer public bool canFireGodSlayerRangedProjectile = false; public bool canFireBloodflareMageProjectile = false; public bool canFireBloodflareRangedProjectile = false; + + public int consecutiveCaughtFish = 0; #endregion #region Sound @@ -2561,6 +2576,8 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + SelectedFishingMinigame = FishingMinigames.None; + #region Minion Reset Effects wDroid = false; resButterfly = false; @@ -2822,6 +2839,8 @@ namespace CalamityMod.CalPlayer #endregion #region Buffs, Debuffs, Counters, and Nonsense + if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) + consecutiveCaughtFish = 0; heldGaelsLastFrame = false; gaelSwipes = 0; whitewaterHeal = 0; @@ -5567,5 +5586,29 @@ namespace CalamityMod.CalPlayer } } #endregion + + #region Controls + // These are used to entirely disable player directional inputs while being able to read them for other features + public bool ShouldHideControls = false; + public bool pressedRight = false; + public bool pressedLeft = false; + public bool pressedUp = false; + public bool pressedDown = false; + public override void SetControls() + { + pressedRight = Player.controlRight; + pressedLeft = Player.controlLeft; + pressedUp = Player.controlUp; + pressedDown = Player.controlDown; + if (ShouldHideControls) + { + Player.controlLeft = false; + Player.controlUp = false; + Player.controlDown = false; + Player.controlRight = false; + } + ShouldHideControls = false; + } + #endregion } } diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 4de6da68e1..6b3d224889 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -30,13 +31,35 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + Item.accessory = true; + } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.RiftReeler; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.RiftReeler; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i < Main.rand.Next(3, 6); i++) //3 to 5 bobbers + for (int i = 0; i < 4; i++) //3 to 5 bobbers { - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI, ai2: Main.rand.Next(2)); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(45f)), type, 10, 1f, player.whoAmI, ai2: Main.rand.Next(2)); } return false; } @@ -47,7 +70,7 @@ namespace CalamityMod.Items.Fishing.FishingRods if (bobber.ai[2] == 0f) lineColor = new Color(255, 165, 0, 100); else - lineColor = new Color(0, 206, 209, 100); + lineColor = new Color(200, 206, 209, 100); } public override void AddRecipes() diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index c004f3137f..237c0fbe50 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -23,12 +24,35 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) { lineOriginOffset = new Vector2(35f, -27f); - lineColor = new Color(200, 200, 200, 100); + lineColor = Color.Lerp(Color.GreenYellow, Color.DeepSkyBlue, Main.player[bobber.owner].Calamity().consecutiveCaughtFish / 5f); } public override void AddRecipes() diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 75375242bb..b0744ab1a7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -319,8 +319,13 @@ RiftReeler: { DisplayName: Rift Reeler Tooltip: ''' - Fires three to five lines at once + Fires four lines at once Can fish in lava + Provides a fishing minigame + Moving while fishing instead moves your bobbers + Rifts appear over time in liquids, containing an item + When bobbers touch a rift, they automatically reel in the item within + Equip this as an accessory to use this minigame for other rods 'The battlefield is a scene of constant chaos. The winner will be the one who controls that chaos, both the pole and the fish.' ''' @@ -355,7 +360,14 @@ VerstaltiteFishingRod: { WulfrumRod: { DisplayName: Wulfrum Fishing Pole - Tooltip: "'This barely works, but it's better than nothing...'" + Tooltip: + ''' + Provides a fishing minigame + Move in the indicated direction while fishing to catch items + The rod empowers the longer you go without a mistake, speeding it up + Equip this as an accessory to use this minigame for other rods + 'This barely works, but it's better than nothing...' + ''' } // Bait diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index c452f59d70..0ab6e5c4a0 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -379,6 +379,8 @@ namespace CalamityMod.Projectiles #region Pre AI public override bool PreAI(Projectile projectile) { + if (projectile.bobber && RunFishingMinigames(projectile)) + return false; #region Vanilla Summons AI Changes // @@ -3079,6 +3081,308 @@ namespace CalamityMod.Projectiles return true; } + + /// + /// Reel state of bobber + /// ai[0] in bobber AI + /// + private float isReelingIn = 0; + /// + /// How long you have to catch a fish when bitten + /// ai[1] in bobber AI + /// + private float CatchTime = 0; + /// + /// How long until a fish bites + /// LocalAI[1] in bobber AI + /// + private float TimerToCatch = 0; + /// + /// Item ID of hooked item for fishing minigames + /// + public int CaughtItemID = -1; + /// + /// What this does depends on the fishing minigame. Used to store data between updates + /// + public float PersistentFishingData = -1; + /// + /// What this does depends on the fishing minigame. Used to store data between updates + /// + public Vector2 PersistentFishingDataVector2 = Vector2.Zero; + public bool RunFishingMinigames(Projectile projectile) + { + #region Utilities + void SmallSplashAtOffset(Vector2 offset) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f) + offset, projectile.width + 12, 24, Dust.dustWater()); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + void Splash() + { + for (int i = 0; i < 100; i++) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f), projectile.width + 12, 24, Dust.dustWater()); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + + SoundEngine.PlaySound(SoundID.SplashWeak, projectile.Center); + } + Vector2 GetWaterLine() + { + Vector2 FoundWaterline = projectile.Center; + var tilePos = projectile.Center.ToTileCoordinates(); + if (Main.tile[tilePos.X,tilePos.Y].LiquidAmount > 0) + { + for (var i = 0; i < 1000; i++) + { + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y-i].LiquidAmount > 0) + continue; + FoundWaterline.Y = (tilePos.Y - i+1) * 16f; + FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y - i + 1].LiquidAmount / 255f) * 16f; + break; + } + } + else + { + for (var i = 0; i < 1000; i++) + { + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y + i].LiquidAmount == 0) + continue; + FoundWaterline.Y = (tilePos.Y + i) * 16f; + FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y + i].LiquidAmount / 255f) * 16f; + break; + } + } + return FoundWaterline; + } + #endregion + //Doze's notes on bobber AI + + //ai[0] - Bobber state. 0: thrown/idle/bitten, 1: reeling in, 2: snapped + //ai[1] - Amount of time to reel in the bobber once a bite happens. Is negative and counts up + //When reeled in, this becomes the value of localAI[1] (ID of item/NPC) + //At 0, the bobber is just floating waiting for a bite + //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. + //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC + //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. + var owner = Main.player[projectile.owner]; + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (owner.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.WulfrumRod) + { + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && item.owner == projectile.owner && item.whoAmI != projectile.whoAmI) + { + item.active = false; + } + } + + if (isReelingIn != projectile.ai[0]) + return false; + + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || projectile.lavaWet || projectile.honeyWet) + TimerToCatch++; + var speedup = Math.Min(owner.Calamity().consecutiveCaughtFish * 5, 25); + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 160 - owner.HeldItem.fishingPole; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + } + if (TimerToCatch >= 160-owner.HeldItem.fishingPole && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime*4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 4); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData*MathHelper.PiOver2)*10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45-speedup, 0.04f, Color.Blue, new(1,2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + if (CatchTime < 0 && CatchTime % totalTime == -15) + { + var playerDir = -1; + if (owner.Calamity().pressedUp) + { + playerDir = 3; + } + if (owner.Calamity().pressedLeft) + { + playerDir = 2; + } + if (owner.Calamity().pressedDown) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } else + { + + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + owner.Calamity().consecutiveCaughtFish++; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + return false; + } + else if (owner.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.RiftReeler) + { + if (PersistentFishingData == -1) + { + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + TimerToCatch = 300; + projectile.velocity.Y += 0.4f; + } else if (projectile.ai[0] == 0) + { + owner.Calamity().ShouldHideControls = true; + if (owner.Calamity().pressedUp) + projectile.velocity.Y -= 0.125f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.125f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.125f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.125f; + } + projectile.velocity *= 0.975f; + var AdjustedOwnerWaterline = Waterline; + if (AdjustedOwnerWaterline.Y < owner.Center.Y) + AdjustedOwnerWaterline.Y = owner.Center.Y; + + if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0) + { + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) + { + var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) + { + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) /2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; + } + } + } + } + if (PersistentFishingDataVector2 != Vector2.Zero) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Smoke); + if (Main.rand.NextBool(3)) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); + } + } + List<(Vector2,int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2,item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + + projectile.ai[0] = 1; + projectile.ai[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; + break; + } + + } + } + if (projectile.ai[0] == 0) + return true; + } + return false; + } #endregion #region AI diff --git a/Projectiles/Typeless/RiftReelerBobber.cs b/Projectiles/Typeless/RiftReelerBobber.cs index f5b3defd39..45bd54bfb3 100644 --- a/Projectiles/Typeless/RiftReelerBobber.cs +++ b/Projectiles/Typeless/RiftReelerBobber.cs @@ -13,6 +13,11 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 100; } public override bool PreDrawExtras() From 20dcccacb337dfa9dbfc4fcca31200027f74bf99 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 17 Jul 2025 13:37:25 -0500 Subject: [PATCH 2/6] feral double, DoC, navy, and heron rods --- CalPlayer/CalamityPlayerFishing.cs | 21 + CalPlayer/CalamityPlayerMiscEffects.cs | 36 - Items/Fishing/FishingRods/EarlyBloomRod.cs | 22 +- Items/Fishing/FishingRods/FeralDoubleRod.cs | 26 +- Items/Fishing/FishingRods/HeronRod.cs | 26 +- Items/Fishing/FishingRods/NavyFishingRod.cs | 26 +- Items/Fishing/FishingRods/SlurperPole.cs | 26 +- .../Fishing/FishingRods/TheDevourerofCods.cs | 22 +- .../FishingRods/VerstaltiteFishingRod.cs | 27 +- .../Mods.CalamityMod.Items.Fishing.hjson | 40 +- Projectiles/CalamityGlobalProjectile.cs | 773 ++++++++++++++---- Projectiles/Typeless/NavyBobber.cs | 21 +- 12 files changed, 831 insertions(+), 235 deletions(-) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index a87dd8a9fb..cc4d2168a0 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Fishing.SulphurCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; @@ -171,6 +172,20 @@ namespace CalamityMod.CalPlayer CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); } + if (attempt.playerFishingConditions.PoleItemType == ModContent.ItemType()) + { + if (Main.rand.NextBool(5)) + { + itemDrop = ModContent.ItemType(); + return; + } + if (Main.rand.NextBool(15)) + { + itemDrop = ModContent.ItemType(); + return; + } + } + // Ignore catches if it's junk if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan || itemDrop == ItemID.JojaCola) return; @@ -350,6 +365,10 @@ namespace CalamityMod.CalPlayer fishingLevel = fishingLevel * VerstaltiteFishingRod.FishingPowerBiomeMult; if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = fishingLevel * HeronRod.FishingPowerBiomeMult; + if (fishingRod.type == ModContent.ItemType()) + { + fishingLevel *= 1f + (Player.statLifeMax2 - Player.statLife) * 0.002f; + } // Prevent the player from fishing if they have the Bloodworm if (bait.type == ModContent.ItemType()) @@ -413,6 +432,8 @@ namespace CalamityMod.CalPlayer if (fishList.Contains(fish.type)) fish.stack += Main.rand.Next(1, 3 + 1); } + if (fish.type == ModContent.ItemType()) + fish.stack = Main.rand.Next(1, 6); } #endregion } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index bce295f5b1..863c6c0d4d 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3883,42 +3883,6 @@ namespace CalamityMod.CalPlayer } } - // Navy Fishing Rod's electric aura when in-use - if (Player.ActiveItem().type == ModContent.ItemType() && Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) - { - const int FramesPerHit = 120; - - // Constantly increment the timer every frame. - navyRodAuraTimer = (navyRodAuraTimer + 1) % FramesPerHit; - - // If the timer rolls over, it's time to deal damage. Only run this code for the client which is holding the fishing rod, - if (navyRodAuraTimer == 0 && Player.whoAmI == Main.myPlayer) - { - const int BaseDamage = 10; - int damage = (int)Player.GetBestClassDamage().ApplyTo(BaseDamage); - var source = Player.GetSource_ItemUse(Player.ActiveItem()); - float range = 200f; - - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) - continue; - - if (Vector2.Distance(Player.Center, npc.Center) <= range) - Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); - - // Occasionally spawn cute sparks so it looks like an electrical aura - if (Main.rand.NextBool(10)) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile spark = Projectile.NewProjectileDirect(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); - spark.localNPCHitCooldown = -2; - spark.timeLeft = 30; - } - } - } - } - // Inferno potion boost if (ataxiaBlaze && Player.inferno) { diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index ea7cbacd81..276056f757 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -25,11 +26,30 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + Item.accessory = true; } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } public override void HoldItem(Player player) { player.accFishingLine = true; + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index cf8ad0dc8e..c7f2dcce57 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralDoubleRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralDoubleRod; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 2e15e436bf..de061ab965 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.HeronRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.HeronRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 686b065a72..3aec86c486 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -24,6 +25,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavyFishingRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavyFishingRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index cac04d7307..5f853c3c89 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -27,6 +28,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SlurperPole; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SlurperPole; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 9ab034fd53..35febd82ae 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -31,13 +32,32 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); + Item.accessory = true; } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } public override void HoldItem(Player player) { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.TheDevourerOfCods; player.accFishingLine = true; } + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.TheDevourerOfCods; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 10; i++) diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 74ef5cc142..b7092c0ac5 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,30 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + player.accFishingLine = true; + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index b0744ab1a7..075b4cea5c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -282,6 +282,7 @@ EarlyBloomRod: { Tooltip: ''' Fires six lines at once. Line never snaps + Equip this as an accessory to disable fishing minigames 'The early bird catches the fish' ''' } @@ -291,7 +292,12 @@ FeralDoubleRod: { Tooltip: ''' Fires two lines at once - Just as you have tamed the jungle monster, you can now tame the fish in the sea + Gains fishing power the more life you have lost + Provides a fishing minigame + Press to drain life + Draining life speeds up catches + Bobbers can hook onto enemies, dealing damage when life is drained + Equip this as an accessory to use this minigame for other rods ''' } @@ -300,8 +306,12 @@ HeronRod: { Tooltip: ''' Increases fishing power by {0}x when in space - 'A silent head and beak lanced down and plucked it out by the head, - and the beak swallowed the little fish while its tail waved frantically.' + Provides a fishing minigame + Moving while fishing instead moves your bobbers + Rings appear over time above the water's surface + Touching a ring hooks an item onto the bobber + Bobbers will automatically reel in hooked items upon landing back in the water + Equip this as an accessory to use this minigame for other rods ''' } @@ -309,9 +319,11 @@ NavyFishingRod: { DisplayName: Navy Fishing Rod Tooltip: ''' - While held, slowly electrifies nearby enemies - 'The sea is a city. - Just below are highways, boulevards, streets and roundabouts bustling with submarine traffic.' + Fires bobbers that inflict Static Discharge on nearby enemies + Provides a fishing minigame + The bobber will float at your height underwater, allowing underwater fishing + Move in the indicated direction while fishing to catch items + Equip this as an accessory to use this minigame for other rods ''' } @@ -321,13 +333,11 @@ RiftReeler: { ''' Fires four lines at once Can fish in lava - Provides a fishing minigame - Moving while fishing instead moves your bobbers + Provides a fishing minigame + Moving while fishing instead moves your bobbers Rifts appear over time in liquids, containing an item - When bobbers touch a rift, they automatically reel in the item within + When bobbers touch a rift, they automatically reel in the item within Equip this as an accessory to use this minigame for other rods - 'The battlefield is a scene of constant chaos. - The winner will be the one who controls that chaos, both the pole and the fish.' ''' } @@ -336,6 +346,7 @@ SlurperPole: { Tooltip: ''' Can fish in lava + Equip this as an accessory to disable fishing minigames 'It is the burning lava of the soul that has a furnace within--a very volcano of grief and sorrow.' ''' } @@ -345,6 +356,11 @@ TheDevourerofCods: { Tooltip: ''' Fires ten lines at once. Line never snaps and can fish from lava + Provides a fishing minigame + Hooked items stay hooked forever + Common fish are automatically consumed while fishing + Consuming fish allows a bobber to hook a new item and feeds the user + Equip this as an accessory to use this minigame for other rods 'The devourer was once just an Eater of Shoals' ''' } @@ -354,6 +370,7 @@ VerstaltiteFishingRod: { Tooltip: ''' Increases fishing power by {0}x when in the tundra + Equip this as an accessory to disable fishing minigames The ancient alloy's prismatic qualities are perfect for attracting fish ''' } @@ -362,6 +379,7 @@ WulfrumRod: { DisplayName: Wulfrum Fishing Pole Tooltip: ''' + Can fish up Wulfrum Metal Scrap and Wulfrum Energy Cores Provides a fishing minigame Move in the indicated direction while fishing to catch items The rod empowers the longer you go without a mistake, speeding it up diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 0ab6e5c4a0..cbf05da6fe 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.Contracts; using System.IO; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; @@ -13,6 +14,8 @@ using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Fishing.AstralCatches; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -3111,6 +3114,9 @@ namespace CalamityMod.Projectiles public Vector2 PersistentFishingDataVector2 = Vector2.Zero; public bool RunFishingMinigames(Projectile projectile) { + var owner = Main.player[projectile.owner]; + var cplayer = owner.Calamity(); + #region Utilities void SmallSplashAtOffset(Vector2 offset) { @@ -3121,6 +3127,15 @@ namespace CalamityMod.Projectiles Main.dust[num].alpha = 100; Main.dust[num].noGravity = true; } + void SmallDustAtOffset(Vector2 offset, int dustID) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f) + offset, projectile.width + 12, 24, dustID); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } void Splash() { for (int i = 0; i < 100; i++) @@ -3135,6 +3150,51 @@ namespace CalamityMod.Projectiles SoundEngine.PlaySound(SoundID.SplashWeak, projectile.Center); } + void ReelTheBobberChecks() + { + if (projectile.localAI[1] == 1) + { + if (Main.netMode != 1) + { + NPC.SpawnOnPlayer(owner.whoAmI, 370); + } + projectile.ai[0] = 2f; + } + else if (projectile.localAI[1] < 1) + { + Point point = default(Point); + point = new Point((int)projectile.position.X, (int)projectile.position.Y); + int num = (int)(0f - projectile.localAI[1]); + if (num == 618) + { + point.Y += 64; + } + if (Main.netMode == 1) + { + NetMessage.SendData(130, -1, -1, null, point.X / 16, point.Y / 16, num); + } + else + { + if (num == 682) + { + NPC.unlockedSlimeRedSpawn = true; + } + NPC.NewNPC(new EntitySource_FishedOut(owner), point.X, point.Y, num); + projectile.ai[0] = 2f; + WorldGen.CheckAchievement_RealEstateAndTownSlimes(); + } + } + else if (Main.rand.Next(7) == 0 && !owner.accFishingLine) + { + projectile.ai[0] = 2f; + } + else + { + projectile.ai[1] = projectile.localAI[1]; + } + projectile.netUpdate = true; + } + Vector2 GetWaterLine() { Vector2 FoundWaterline = projectile.Center; @@ -3173,213 +3233,566 @@ namespace CalamityMod.Projectiles //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. - var owner = Main.player[projectile.owner]; - if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + + + switch (owner.Calamity().SelectedFishingMinigame) { - owner.Calamity().ShouldHideControls = true; - } - if (owner.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.WulfrumRod) - { - foreach (var item in Main.ActiveProjectiles) - { - if (item.bobber && item.owner == projectile.owner && item.whoAmI != projectile.whoAmI) + case CalamityPlayer.FishingMinigames.WulfrumRod: { - item.active = false; - } - } - - if (isReelingIn != projectile.ai[0]) - return false; - - if (CatchTime < 0) - CatchTime++; - if (projectile.wet || projectile.lavaWet || projectile.honeyWet) - TimerToCatch++; - var speedup = Math.Min(owner.Calamity().consecutiveCaughtFish * 5, 25); - var totalTime = 60 - speedup; - if (TimerToCatch + 90 >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) - { - if (PersistentFishingData == 0) - PersistentFishingData = Main.rand.NextBool() ? 1 : -1; - var timer = TimerToCatch - 160 - owner.HeldItem.fishingPole; - SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); - } - if (TimerToCatch >= 160-owner.HeldItem.fishingPole && CatchTime >= 0) - { - PersistentFishingData = 0; - projectile.FishingCheck(); - if (projectile.ai[1] < 0) - { - CatchTime = -totalTime*4; - CaughtItemID = (int)projectile.localAI[1]; - } - TimerToCatch = 0; - } - if (CatchTime < 0 && CatchTime % totalTime == 0) - { - Splash(); - PersistentFishingData = Main.rand.Next(0, 4); - var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData*MathHelper.PiOver2)*10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45-speedup, 0.04f, Color.Blue, new(1,2), shrinkSpeed: -0.2f); - GeneralParticleHandler.SpawnParticle(particle); - } - if (CatchTime < 0 && CatchTime % totalTime == -15) - { - var playerDir = -1; - if (owner.Calamity().pressedUp) - { - playerDir = 3; - } - if (owner.Calamity().pressedLeft) - { - playerDir = 2; - } - if (owner.Calamity().pressedDown) - { - playerDir = 1; - } - if (owner.Calamity().pressedRight) - { - playerDir = 0; - } - if (playerDir == PersistentFishingData) - { - - } else - { - - if (playerDir >= 0) + foreach (var item in Main.ActiveProjectiles) { - var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); - GeneralParticleHandler.SpawnParticle(particle); - } else + if (item.bobber && item.owner == projectile.owner && item.whoAmI != projectile.whoAmI) + { + item.active = false; + } + } + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) { - var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + owner.Calamity().ShouldHideControls = true; + } + if (isReelingIn != projectile.ai[0]) + return false; + + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || projectile.lavaWet || projectile.honeyWet) + TimerToCatch++; + var speedup = Math.Min(owner.Calamity().consecutiveCaughtFish * 5, 25); + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 160 - owner.HeldItem.fishingPole; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + } + if (TimerToCatch >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime * 4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 4); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); GeneralParticleHandler.SpawnParticle(particle); } - TimerToCatch = 0; - CatchTime = 0; - CaughtItemID = -1; - PersistentFishingData = 0; - owner.Calamity().consecutiveCaughtFish = 0; - } - } - if (CatchTime == -1) - { - isReelingIn = 1; - CatchTime = (float)CaughtItemID; - TimerToCatch = 0; - owner.Calamity().consecutiveCaughtFish++; - } - if (projectile.ai[0] == 0) - { - - - projectile.ai[1] = CatchTime; - projectile.localAI[1] = TimerToCatch; - if (CaughtItemID != -1 && isReelingIn == 0) - { - projectile.localAI[1] = 0; - projectile.ai[1] = 0; - } - projectile.ai[0] = isReelingIn; - } - return false; - } - else if (owner.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.RiftReeler) - { - if (PersistentFishingData == -1) - { - PersistentFishingData = 1; - TimerToCatch = 300; - } - var Waterline = GetWaterLine(); - if (Waterline.Y >= projectile.Center.Y) - { - TimerToCatch = 300; - projectile.velocity.Y += 0.4f; - } else if (projectile.ai[0] == 0) - { - owner.Calamity().ShouldHideControls = true; - if (owner.Calamity().pressedUp) - projectile.velocity.Y -= 0.125f; - if (owner.Calamity().pressedDown) - projectile.velocity.Y += 0.125f; - if (owner.Calamity().pressedLeft) - projectile.velocity.X -= 0.125f; - if (owner.Calamity().pressedRight) - projectile.velocity.X += 0.125f; - } - projectile.velocity *= 0.975f; - var AdjustedOwnerWaterline = Waterline; - if (AdjustedOwnerWaterline.Y < owner.Center.Y) - AdjustedOwnerWaterline.Y = owner.Center.Y; - - if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0) - { - TimerToCatch -= Main.rand.Next(1, 5); - if (TimerToCatch <= 0) - { - projectile.FishingCheck(); - if (projectile.ai[1] < 0) + if (CatchTime < 0 && CatchTime % totalTime == -15) { - - CaughtItemID = (int)projectile.localAI[1]; - projectile.ai[1] = 0; - projectile.localAI[1] = 0; - for (var i = 0; i < 1000; i++) + var playerDir = -1; + if (owner.Calamity().pressedUp) { - var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); - var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); - if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) + playerDir = 3; + } + if (owner.Calamity().pressedLeft) + { + playerDir = 2; + } + if (owner.Calamity().pressedDown) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } + else + { + + if (playerDir >= 0) { - if (projectile.localAI[2] >= 1) + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + projectile.localAI[1] = CaughtItemID; + ReelTheBobberChecks(); + owner.Calamity().consecutiveCaughtFish++; + if (projectile.ai[0] == 2) + return false; + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + return false; + } + + + case CalamityPlayer.FishingMinigames.RiftReeler: + { + if (PersistentFishingData == -1) + { + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + TimerToCatch = 300; + projectile.velocity.Y += 0.4f; + } + else if (projectile.ai[0] == 0) + { + owner.Calamity().ShouldHideControls = true; + if (owner.Calamity().pressedUp) + projectile.velocity.Y -= 0.125f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.125f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.125f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.125f; + } + projectile.velocity *= 0.975f; + var AdjustedOwnerWaterline = Waterline; + if (AdjustedOwnerWaterline.Y < owner.Center.Y) + AdjustedOwnerWaterline.Y = owner.Center.Y; + + if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0) + { + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) { - int customSonarText = (int)(projectile.localAI[2] - 1); - if (Main.popupText[customSonarText].sonar) + var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) { - Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) /2f; + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; } } - PersistentFishingDataVector2 = vectorToCheck; - TimerToCatch = 600; + } + } + if (PersistentFishingDataVector2 != Vector2.Zero) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Smoke); + if (Main.rand.NextBool(3)) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); + } + } + List<(Vector2, int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + ReelTheBobberChecks(); + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; break; } + + } + } + if (projectile.ai[0] == 0) + return true; + break; + } + + + case CalamityPlayer.FishingMinigames.FeralDoubleRod: + if (projectile.ai[0] == 0) + { + //var waterline = GetWaterLine(); + if (projectile.wet) + { + if (cplayer.mouseRight && projectile.ai[1] == 0) + { + projectile.localAI[1] += 2; + owner.lifeRegenCount -= 60; //0.5 health per tick + } + } + else + { + if (PersistentFishingData >= 0 && Main.npc[(int)PersistentFishingData].active && projectile.Distance(Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2) < 128) + { + projectile.Center = Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2; + projectile.velocity = Vector2.Zero; + if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) + { + owner.lifeRegenCount -= 600; //0.5 health per tick + var projID = Projectile.NewProjectile(projectile.GetSource_FromThis(), Main.npc[(int)PersistentFishingData].Center, Vector2.Zero, ModContent.ProjectileType(), (int)owner.GetBestClassDamage().ApplyTo(owner.HeldItem.fishingPole), 0f, owner.whoAmI, Main.npc[(int)PersistentFishingData].whoAmI); + if (Main.projectile.IndexInRange(projID)) + { + Main.projectile[projID].ArmorPenetration = 100; + } + } + projectile.timeLeft++; + return true; + } else if (PersistentFishingData >= 0) + { + PersistentFishingData = -1; + projectile.velocity.Y -= 3; + } + foreach (var item in Main.ActiveNPCs) + { + if (item.friendly || item.dontTakeDamage) + continue; + if (projectile.Colliding(projectile.Hitbox, item.Hitbox)) + { + PersistentFishingDataVector2 = projectile.Center - item.Center; + PersistentFishingData = item.whoAmI; + break; + } + } + + } + } + break; + + + case CalamityPlayer.FishingMinigames.NavyFishingRod: + { + if (isReelingIn != projectile.ai[0]) + return false; + var waterline = GetWaterLine(); + var AdjustedOwnerWaterline = waterline; + if (AdjustedOwnerWaterline.Y < owner.Center.Y) + AdjustedOwnerWaterline.Y = owner.Center.Y; + if (AdjustedOwnerWaterline.Y >= projectile.Center.Y) + { + projectile.velocity.Y += 0.4f; + } else + { + projectile.velocity.Y -= 0.1f; + } + projectile.velocity *= 0.975f; + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || projectile.lavaWet || projectile.honeyWet) + TimerToCatch++; + var speedup = 15; + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 300 && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 300; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + + SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0),DustID.BlueCrystalShard); + } + if (TimerToCatch >= 300 && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime * 4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 2); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + if (CatchTime < 0 && CatchTime % totalTime == -15) + { + var playerDir = -1; + if (owner.Calamity().pressedLeft) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } + else + { + + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + projectile.localAI[1] = CaughtItemID; + ReelTheBobberChecks(); + owner.Calamity().consecutiveCaughtFish++; + if (projectile.ai[0] == 2) + return false; + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + if (projectile.ai[0] == 0) + return true; + break; + } + + + case CalamityPlayer.FishingMinigames.TheDevourerOfCods: + var fishToEat = new List() + { + ItemID.Bass, + ItemID.AtlanticCod, + ItemID.Flounder, + ItemID.NeonTetra, + ItemID.RedSnapper, + ItemID.RockLobster, + ItemID.Salmon, + ItemID.Shrimp, + ItemID.Trout, + ItemID.Tuna, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; + if (projectile.ai[1] < -1) + { + if (fishToEat.Contains((int)projectile.localAI[1])) + { + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + SoundEngine.PlaySound(SoundID.Item2,projectile.Center); + if (!owner.HasBuff(BuffID.WellFed3)) + { + if (owner.HasBuff(BuffID.WellFed2)) + { + var bIndex = owner.FindBuffIndex(BuffID.WellFed2); + if (owner.buffTime[bIndex] < 60000) + { + owner.buffTime[bIndex] += 300; + } + } else + { + + owner.AddBuff(BuffID.WellFed2, 300); + } + } else + { + var bIndex = owner.FindBuffIndex(BuffID.WellFed3); + if (owner.buffTime[bIndex] < 60000) + { + owner.buffTime[bIndex] += 300; + } } } - } - if (PersistentFishingDataVector2 != Vector2.Zero) - { - Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Smoke); - if (Main.rand.NextBool(3)) + else { - Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); + projectile.ai[1] = -30; } } - List<(Vector2,int)> validRifts = new(); + + return false; - foreach (var item in Main.ActiveProjectiles) + + case CalamityPlayer.FishingMinigames.HeronRod: { - if (item.bobber && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) { - validRifts.Add((item.Calamity().PersistentFishingDataVector2,item.whoAmI)); + owner.Calamity().ShouldHideControls = true; } - } - foreach (var item in validRifts) - { - if (projectile.Distance(item.Item1) < 16) + if (PersistentFishingData == -1) { - + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + TimerToCatch = 300; + projectile.velocity.Y += 0.4f; + } + else if (projectile.ai[0] <= 0) + { + projectile.velocity.Y -= 0.1f; + } + if (projectile.ai[0] <= 1) + { + owner.Calamity().ShouldHideControls = true; + } + projectile.velocity *= 0.975f; + if (projectile.wet) + projectile.velocity *= 0.99f; + var AdjustedOwnerWaterline = Waterline; + if (AdjustedOwnerWaterline.Y < owner.Center.Y) + AdjustedOwnerWaterline.Y = owner.Center.Y; + + if (projectile.ai[0] == 0) + { + + if (owner.Calamity().pressedUp && projectile.velocity.Y < 0) + projectile.velocity.Y -= 0.3f; + if (owner.Calamity().pressedUp && Waterline.Y < projectile.Center.Y) + projectile.velocity.Y -= 0.3f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.25f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.25f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.25f; + if (Waterline.Y <= projectile.Center.Y-8) + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) + { + var vectorToCheck = Waterline + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 32)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount == 0) + { + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; + } + } + } + } + if (PersistentFishingDataVector2 != Vector2.Zero && owner.miscCounter % 15 == 0) + { + + var particle = new CustomSpark(PersistentFishingDataVector2, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 25, 0.02f, Color.Green, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + List<(Vector2, int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + + projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + ReelTheBobberChecks(); + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; + break; + } + + } + } + if (projectile.ai[0] == -1 && (Waterline.Y <= projectile.Center.Y || projectile.velocity.Length() < 0.5f)) projectile.ai[0] = 1; - projectile.ai[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; - Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; - Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; - break; - } - + if (projectile.ai[0] == 0) + return true; + break; } - } - if (projectile.ai[0] == 0) - return true; + + + case CalamityPlayer.FishingMinigames.EarlyBloomRod: + break; } return false; } diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index 7d45038fbc..cf8952aa1a 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,6 +16,23 @@ namespace CalamityMod.Projectiles.Typeless Projectile.bobber = true; } + public override void PostAI() + { + foreach (var item in Main.ActiveNPCs) + { + if (!item.friendly && item.Distance(Projectile.Center) < 160) + { + item.AddBuff(ModContent.BuffType(), 180); + if (Main.rand.NextBool(10)) + { + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); + Projectile spark = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), item.Center, velocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + spark.localNPCHitCooldown = -2; + spark.timeLeft = 30; + } + } + } + } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); From fc7a33cb71377f4c8d1a08ba3511bed2009c9f0c Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 21 Jul 2025 16:43:32 -0500 Subject: [PATCH 3/6] fixed heron rod --- Projectiles/CalamityGlobalProjectile.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index cbf05da6fe..e696418703 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3691,7 +3691,6 @@ namespace CalamityMod.Projectiles var Waterline = GetWaterLine(); if (Waterline.Y >= projectile.Center.Y) { - TimerToCatch = 300; projectile.velocity.Y += 0.4f; } else if (projectile.ai[0] <= 0) @@ -3705,9 +3704,6 @@ namespace CalamityMod.Projectiles projectile.velocity *= 0.975f; if (projectile.wet) projectile.velocity *= 0.99f; - var AdjustedOwnerWaterline = Waterline; - if (AdjustedOwnerWaterline.Y < owner.Center.Y) - AdjustedOwnerWaterline.Y = owner.Center.Y; if (projectile.ai[0] == 0) { From 915908e9bfff7cc063ab5078fef523e296181e4c Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 21 Jul 2025 17:36:39 -0500 Subject: [PATCH 4/6] proper lava fishing and bugfixes --- Projectiles/CalamityGlobalProjectile.cs | 38 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index e696418703..6c7a82e43e 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3184,9 +3184,11 @@ namespace CalamityMod.Projectiles WorldGen.CheckAchievement_RealEstateAndTownSlimes(); } } - else if (Main.rand.Next(7) == 0 && !owner.accFishingLine) + else if (Main.rand.NextBool(7) && !owner.accFishingLine) { projectile.ai[0] = 2f; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; } else { @@ -3255,7 +3257,7 @@ namespace CalamityMod.Projectiles if (CatchTime < 0) CatchTime++; - if (projectile.wet || projectile.lavaWet || projectile.honeyWet) + if (projectile.wet || (projectile.lavaWet && owner.accLavaFishing) || projectile.honeyWet) TimerToCatch++; var speedup = Math.Min(owner.Calamity().consecutiveCaughtFish * 5, 25); var totalTime = 60 - speedup; @@ -3381,11 +3383,8 @@ namespace CalamityMod.Projectiles projectile.velocity.X += 0.125f; } projectile.velocity *= 0.975f; - var AdjustedOwnerWaterline = Waterline; - if (AdjustedOwnerWaterline.Y < owner.Center.Y) - AdjustedOwnerWaterline.Y = owner.Center.Y; - if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0) + if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0 && !(projectile.lavaWet && !owner.accLavaFishing)) { TimerToCatch -= Main.rand.Next(1, 5); if (TimerToCatch <= 0) @@ -3425,6 +3424,13 @@ namespace CalamityMod.Projectiles { Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); } + var particle = new HeavySmokeParticle(PersistentFishingDataVector2, Vector2.One.RotatedByRandom(6.28) * Main.rand.NextFloat(1f, 4f), Color.Lerp(Color.DarkOrange,Color.DarkGray,Main.rand.NextFloat()), 15, 0.2f, 1);// (PersistentFishingDataVector2, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 25, 0.02f, Color.Green, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + if (projectile.lavaWet) + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); } List<(Vector2, int)> validRifts = new(); @@ -3441,6 +3447,8 @@ namespace CalamityMod.Projectiles { projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; ReelTheBobberChecks(); + if (projectile.ai[0] < 2) + projectile.ai[0] = 1; Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; break; @@ -3523,7 +3531,7 @@ namespace CalamityMod.Projectiles projectile.velocity *= 0.975f; if (CatchTime < 0) CatchTime++; - if (projectile.wet || projectile.lavaWet || projectile.honeyWet) + if (projectile.wet || (projectile.lavaWet && owner.accLavaFishing) || projectile.honeyWet) TimerToCatch++; var speedup = 15; var totalTime = 60 - speedup; @@ -3705,6 +3713,11 @@ namespace CalamityMod.Projectiles if (projectile.wet) projectile.velocity *= 0.99f; + if (projectile.lavaWet) + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } if (projectile.ai[0] == 0) { @@ -3723,7 +3736,7 @@ namespace CalamityMod.Projectiles if (TimerToCatch <= 0) { projectile.FishingCheck(); - if (projectile.ai[1] < 0) + if (projectile.ai[1] < 0 && !(projectile.lavaWet && !owner.accLavaFishing)) { CaughtItemID = (int)projectile.localAI[1]; @@ -3769,9 +3782,8 @@ namespace CalamityMod.Projectiles { if (projectile.Distance(item.Item1) < 16) { - projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; - ReelTheBobberChecks(); + projectile.ai[0] = -1; Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; break; @@ -3780,7 +3792,11 @@ namespace CalamityMod.Projectiles } } if (projectile.ai[0] == -1 && (Waterline.Y <= projectile.Center.Y || projectile.velocity.Length() < 0.5f)) - projectile.ai[0] = 1; + { + ReelTheBobberChecks(); + if (projectile.ai[0] < 2) + projectile.ai[0] = 1; + } if (projectile.ai[0] == 0) return true; break; From 365924bb4f14c9f5921aa7a421994a575841e32b Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 21 Aug 2025 09:45:09 -0500 Subject: [PATCH 5/6] final cleanups --- Items/Fishing/FishingRods/RiftReeler.cs | 2 +- .../Fishing/FishingRods/TheDevourerofCods.cs | 24 +++- .../FishingRods/VerstaltiteFishingRod.cs | 4 +- Projectiles/CalamityGlobalProjectile.cs | 109 ++++++++---------- 4 files changed, 76 insertions(+), 63 deletions(-) diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 6b3d224889..f8f84d98f1 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i < 4; i++) //3 to 5 bobbers + for (int i = 0; i < 4; i++) //4 bobbers { Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(45f)), type, 10, 1f, player.whoAmI, ai2: Main.rand.Next(2)); } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 35febd82ae..bbbc0ba65a 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -1,5 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Fishing.AstralCatches; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -13,6 +17,24 @@ namespace CalamityMod.Items.Fishing.FishingRods { public class TheDevourerofCods : ModItem, ILocalizedModType { + public static List FishToEat = new List() + { + ItemID.Bass, + ItemID.AtlanticCod, + ItemID.Flounder, + ItemID.NeonTetra, + ItemID.RedSnapper, + ItemID.RockLobster, + ItemID.Salmon, + ItemID.Shrimp, + ItemID.Trout, + ItemID.Tuna, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index b7092c0ac5..7781598667 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -47,12 +47,12 @@ namespace CalamityMod.Items.Fishing.FishingRods { player.accFishingLine = true; if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VerstaltiteFishingRod; } public override void UpdateEquip(Player player) { - player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VerstaltiteFishingRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 6c7a82e43e..42280745b3 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; using System.IO; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; @@ -14,8 +13,7 @@ using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; -using CalamityMod.Items.Fishing.AstralCatches; -using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -3084,6 +3082,10 @@ namespace CalamityMod.Projectiles return true; } + #endregion + + #region Fishing Minigames + // All these fields are exclusively used for fishing minigames, so I declared them in this region for organization /// /// Reel state of bobber @@ -3201,13 +3203,13 @@ namespace CalamityMod.Projectiles { Vector2 FoundWaterline = projectile.Center; var tilePos = projectile.Center.ToTileCoordinates(); - if (Main.tile[tilePos.X,tilePos.Y].LiquidAmount > 0) + if (Main.tile[tilePos.X, tilePos.Y].LiquidAmount > 0) { for (var i = 0; i < 1000; i++) { - if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y-i].LiquidAmount > 0) + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y - i].LiquidAmount > 0) continue; - FoundWaterline.Y = (tilePos.Y - i+1) * 16f; + FoundWaterline.Y = (tilePos.Y - i + 1) * 16f; FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y - i + 1].LiquidAmount / 255f) * 16f; break; } @@ -3235,7 +3237,7 @@ namespace CalamityMod.Projectiles //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. - + switch (owner.Calamity().SelectedFishingMinigame) { @@ -3353,7 +3355,7 @@ namespace CalamityMod.Projectiles } projectile.ai[0] = isReelingIn; } - return false; + return false; } @@ -3424,9 +3426,11 @@ namespace CalamityMod.Projectiles { Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); } - var particle = new HeavySmokeParticle(PersistentFishingDataVector2, Vector2.One.RotatedByRandom(6.28) * Main.rand.NextFloat(1f, 4f), Color.Lerp(Color.DarkOrange,Color.DarkGray,Main.rand.NextFloat()), 15, 0.2f, 1);// (PersistentFishingDataVector2, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 25, 0.02f, Color.Green, Vector2.One); - GeneralParticleHandler.SpawnParticle(particle); + var particle = new HeavySmokeParticle(PersistentFishingDataVector2, Vector2.One.RotatedByRandom(6.28) * Main.rand.NextFloat(1f, 4f), Color.Lerp(Color.DarkOrange, Color.DarkGray, Main.rand.NextFloat()), 15, 0.2f, 1); + GeneralParticleHandler.SpawnParticle(particle); } + + //When in lava, give the bobber a particle over it to show its location if (projectile.lavaWet) { var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); @@ -3465,16 +3469,15 @@ namespace CalamityMod.Projectiles case CalamityPlayer.FishingMinigames.FeralDoubleRod: if (projectile.ai[0] == 0) { - //var waterline = GetWaterLine(); - if (projectile.wet) + if (projectile.wet) //Fishing in water { if (cplayer.mouseRight && projectile.ai[1] == 0) { projectile.localAI[1] += 2; - owner.lifeRegenCount -= 60; //0.5 health per tick + owner.lifeRegenCount -= 60; // -0.5 health per tick } } - else + else //Attached to an enemy { if (PersistentFishingData >= 0 && Main.npc[(int)PersistentFishingData].active && projectile.Distance(Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2) < 128) { @@ -3482,37 +3485,38 @@ namespace CalamityMod.Projectiles projectile.velocity = Vector2.Zero; if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) { - owner.lifeRegenCount -= 600; //0.5 health per tick + owner.lifeRegenCount -= 600; // -5 health per 10 ticks var projID = Projectile.NewProjectile(projectile.GetSource_FromThis(), Main.npc[(int)PersistentFishingData].Center, Vector2.Zero, ModContent.ProjectileType(), (int)owner.GetBestClassDamage().ApplyTo(owner.HeldItem.fishingPole), 0f, owner.whoAmI, Main.npc[(int)PersistentFishingData].whoAmI); if (Main.projectile.IndexInRange(projID)) { - Main.projectile[projID].ArmorPenetration = 100; + Main.projectile[projID].ArmorPenetration = 100; //This should ignore almost all armor } } projectile.timeLeft++; return true; - } else if (PersistentFishingData >= 0) + } + else if (PersistentFishingData >= 0) { PersistentFishingData = -1; projectile.velocity.Y -= 3; } - foreach (var item in Main.ActiveNPCs) + foreach (var item in Main.ActiveNPCs) + { + if (item.friendly || item.dontTakeDamage) + continue; + if (projectile.Colliding(projectile.Hitbox, item.Hitbox)) { - if (item.friendly || item.dontTakeDamage) - continue; - if (projectile.Colliding(projectile.Hitbox, item.Hitbox)) - { - PersistentFishingDataVector2 = projectile.Center - item.Center; - PersistentFishingData = item.whoAmI; - break; - } + PersistentFishingDataVector2 = projectile.Center - item.Center; + PersistentFishingData = item.whoAmI; + break; } - + } + } } break; - - + + case CalamityPlayer.FishingMinigames.NavyFishingRod: { if (isReelingIn != projectile.ai[0]) @@ -3524,7 +3528,8 @@ namespace CalamityMod.Projectiles if (AdjustedOwnerWaterline.Y >= projectile.Center.Y) { projectile.velocity.Y += 0.4f; - } else + } + else { projectile.velocity.Y -= 0.1f; } @@ -3541,8 +3546,8 @@ namespace CalamityMod.Projectiles PersistentFishingData = Main.rand.NextBool() ? 1 : -1; var timer = TimerToCatch - 300; SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); - - SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0),DustID.BlueCrystalShard); + + SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0), DustID.BlueCrystalShard); } if (TimerToCatch >= 300 && CatchTime >= 0) { @@ -3628,33 +3633,19 @@ namespace CalamityMod.Projectiles case CalamityPlayer.FishingMinigames.TheDevourerOfCods: - var fishToEat = new List() - { - ItemID.Bass, - ItemID.AtlanticCod, - ItemID.Flounder, - ItemID.NeonTetra, - ItemID.RedSnapper, - ItemID.RockLobster, - ItemID.Salmon, - ItemID.Shrimp, - ItemID.Trout, - ItemID.Tuna, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; + var fishToEat = TheDevourerofCods.FishToEat; if (projectile.ai[1] < -1) { + //Coonsuming a fish provides/increases the player's food buffs. if (fishToEat.Contains((int)projectile.localAI[1])) { projectile.ai[1] = 0; projectile.localAI[1] = 0; - SoundEngine.PlaySound(SoundID.Item2,projectile.Center); + SoundEngine.PlaySound(SoundID.Item2, projectile.Center); + //If the player doesn't have Ex. Stuffed, either give them Plenty Satisfied or inrease existing Plenty Satisfied duration if (!owner.HasBuff(BuffID.WellFed3)) { + if (owner.HasBuff(BuffID.WellFed2)) { var bIndex = owner.FindBuffIndex(BuffID.WellFed2); @@ -3662,12 +3653,14 @@ namespace CalamityMod.Projectiles { owner.buffTime[bIndex] += 300; } - } else + } + else { owner.AddBuff(BuffID.WellFed2, 300); } - } else + } + else //If the player DOES have Ex. Stuffed, increase the duration of it { var bIndex = owner.FindBuffIndex(BuffID.WellFed3); if (owner.buffTime[bIndex] < 60000) @@ -3676,12 +3669,12 @@ namespace CalamityMod.Projectiles } } } - else + else //If the hooked item isn't consumable, make it stay hooked forever. { projectile.ai[1] = -30; } } - + return false; @@ -3713,6 +3706,7 @@ namespace CalamityMod.Projectiles if (projectile.wet) projectile.velocity *= 0.99f; + //When in lava, give the bobber a particle over it to show its location if (projectile.lavaWet) { var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); @@ -3731,7 +3725,7 @@ namespace CalamityMod.Projectiles projectile.velocity.X -= 0.25f; if (owner.Calamity().pressedRight) projectile.velocity.X += 0.25f; - if (Waterline.Y <= projectile.Center.Y-8) + if (Waterline.Y <= projectile.Center.Y - 8) TimerToCatch -= Main.rand.Next(1, 5); if (TimerToCatch <= 0) { @@ -3802,9 +3796,6 @@ namespace CalamityMod.Projectiles break; } - - case CalamityPlayer.FishingMinigames.EarlyBloomRod: - break; } return false; } From 0124bc21d5b8b8ebe3e0161185dc9e2bcc37f4ed Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 8 Sep 2025 17:42:54 -0500 Subject: [PATCH 6/6] Fixed DoC duration, Feral Double now scales with equipment & bait power for dmg --- Projectiles/CalamityGlobalProjectile.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b3e0db582e..99e983d179 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3254,7 +3254,7 @@ namespace CalamityMod.Projectiles if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) { owner.lifeRegenCount -= 600; // -5 health per 10 ticks - var projID = Projectile.NewProjectile(projectile.GetSource_FromThis(), Main.npc[(int)PersistentFishingData].Center, Vector2.Zero, ModContent.ProjectileType(), (int)owner.GetBestClassDamage().ApplyTo(owner.HeldItem.fishingPole), 0f, owner.whoAmI, Main.npc[(int)PersistentFishingData].whoAmI); + var projID = Projectile.NewProjectile(projectile.GetSource_FromThis(), Main.npc[(int)PersistentFishingData].Center, Vector2.Zero, ModContent.ProjectileType(), (int)owner.GetBestClassDamage().ApplyTo(owner.HeldItem.fishingPole + owner.fishingSkill + owner.ChooseAmmo(owner.HeldItem).bait), 0f, owner.whoAmI, Main.npc[(int)PersistentFishingData].whoAmI); if (Main.projectile.IndexInRange(projID)) { Main.projectile[projID].ArmorPenetration = 100; //This should ignore almost all armor @@ -3417,7 +3417,7 @@ namespace CalamityMod.Projectiles if (owner.HasBuff(BuffID.WellFed2)) { var bIndex = owner.FindBuffIndex(BuffID.WellFed2); - if (owner.buffTime[bIndex] < 60000) + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) { owner.buffTime[bIndex] += 300; } @@ -3431,7 +3431,7 @@ namespace CalamityMod.Projectiles else //If the player DOES have Ex. Stuffed, increase the duration of it { var bIndex = owner.FindBuffIndex(BuffID.WellFed3); - if (owner.buffTime[bIndex] < 60000) + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) //Requires fishing once per day if you'd like to keep free ExStuffed forever { owner.buffTime[bIndex] += 300; }