diff --git a/Items/Fishing/ChaoticSpreadRod.cs b/Items/Fishing/ChaoticSpreadRod.cs new file mode 100644 index 0000000000..4e61e57a07 --- /dev/null +++ b/Items/Fishing/ChaoticSpreadRod.cs @@ -0,0 +1,59 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.Items.Materials; +namespace CalamityMod.Items.Fishing +{ + public class ChaoticSpreadRod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Spread Rod"); + Tooltip.SetDefault("Fires three to five lines at once. Can fish in lava.\n" + + "The battlefield is a scene of constant chaos.\n" + + "The winner will be the one who controls that chaos, both the pole and the fish."); + } + + public override void SetDefaults() + { + //item.CloneDefaults(2289); //Wooden Fishing Pole + item.width = 24; + item.height = 28; + item.useAnimation = 8; + item.useTime = 8; + item.useStyle = 1; + item.UseSound = SoundID.Item1; + item.fishingPole = 45; + item.shootSpeed = 16f; + item.shoot = ModContent.ProjectileType(); + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + ItemID.Sets.CanFishInLava[item.type] = true; + } + + 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 < Main.rand.Next(3,6); ++index) //3 to 5 bobbers + { + float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; + int linecolor = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HotlineFishingHook); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Fishing/ChaoticSpreadRod.png b/Items/Fishing/ChaoticSpreadRod.png new file mode 100644 index 0000000000..65b9cd0482 Binary files /dev/null and b/Items/Fishing/ChaoticSpreadRod.png differ diff --git a/Items/Fishing/EarlyBloomRod.cs b/Items/Fishing/EarlyBloomRod.cs index c5ef531e80..b8c1e48b6f 100644 --- a/Items/Fishing/EarlyBloomRod.cs +++ b/Items/Fishing/EarlyBloomRod.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Fishing public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WoodFishingPole); //wood -> fossilized wood recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); diff --git a/Items/Fishing/EaterofShoals.cs b/Items/Fishing/EaterofShoals.cs index f770fcc569..0496b35c80 100644 --- a/Items/Fishing/EaterofShoals.cs +++ b/Items/Fishing/EaterofShoals.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Fishing public override void SetStaticDefaults() { DisplayName.SetDefault("Eater of Shoals"); - Tooltip.SetDefault("Fires ten lines at once. Line never snaps.\n" + + Tooltip.SetDefault("Fires ten lines at once. Line never snaps and can fish from lava.\n" + "The devourer enjoyed eating fish as much as eating gods."); } @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Fishing item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.Calamity().postMoonLordRarity = 14; + ItemID.Sets.CanFishInLava[item.type] = true; } public override void HoldItem(Player player) @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Fishing int linecolor = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI, 0.0f, 0.0f); if (Main.rand.NextBool(2)) //randomizing line color { - Main.projectile[linecolor].Calamity().stealthStrike = true; //probably should use a different variable + Main.projectile[linecolor].localAI[0] = 1; } } return false; diff --git a/Items/Fishing/SlurperPole.cs b/Items/Fishing/SlurperPole.cs new file mode 100644 index 0000000000..9cb3a2bfe8 --- /dev/null +++ b/Items/Fishing/SlurperPole.cs @@ -0,0 +1,37 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.Items.Materials; +namespace CalamityMod.Items.Fishing +{ + public class SlurperPole : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slurper Pole"); + Tooltip.SetDefault("Can fish in lava.\n" + + "It is the burning lava of the soul that has a furnace within--a very volcano of grief and sorrow."); + } + + public override void SetDefaults() + { + //item.CloneDefaults(2289); //Wooden Fishing Pole + item.width = 24; + item.height = 28; + item.useAnimation = 8; + item.useTime = 8; + item.useStyle = 1; + item.UseSound = SoundID.Item1; + item.fishingPole = 25; + item.shootSpeed = 14f; + item.shoot = ModContent.ProjectileType(); + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + ItemID.Sets.CanFishInLava[item.type] = true; + } + } +} diff --git a/Items/Fishing/SlurperPole.png b/Items/Fishing/SlurperPole.png new file mode 100644 index 0000000000..198fbc32cd Binary files /dev/null and b/Items/Fishing/SlurperPole.png differ diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 9d2a045b11..8247a4b339 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Fishing; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -225,14 +226,9 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - if (CalamityWorld.downedProvidence && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } - if (Main.hardMode && Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } public override void HitEffect(int hitDirection, double damage) diff --git a/Projectiles/Typeless/ChaoticSpreadBobber.cs b/Projectiles/Typeless/ChaoticSpreadBobber.cs new file mode 100644 index 0000000000..f8cc5bc35e --- /dev/null +++ b/Projectiles/Typeless/ChaoticSpreadBobber.cs @@ -0,0 +1,153 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Fishing; +namespace CalamityMod.Projectiles.Typeless +{ + public class ChaoticSpreadBobber : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaotic Bobber"); + } + + public override void SetDefaults() + { + //projectile.CloneDefaults(360); //Wooden Bobber + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 61; + projectile.bobber = true; + projectile.penetrate = -1; + } + + public override bool PreDrawExtras(SpriteBatch spriteBatch) + { + Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); + + Player player = Main.player[projectile.owner]; + if (projectile.bobber && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].holdStyle > 0) + { + float pPosX = player.MountedCenter.X; + float pPosY = player.MountedCenter.Y; + pPosY += Main.player[projectile.owner].gfxOffY; + int type = Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type; + float gravDir = Main.player[projectile.owner].gravDir; + + if (type == ModContent.ItemType()) + { + pPosX += (float)(65 * Main.player[projectile.owner].direction); + if (Main.player[projectile.owner].direction < 0) + { + pPosX -= 13f; + } + pPosY -= 30f * gravDir; + } + + if (gravDir == -1f) + { + pPosY -= 12f; + } + Vector2 value = new Vector2(pPosX, pPosY); + value = Main.player[projectile.owner].RotatedRelativePoint(value + new Vector2(8f), true) - new Vector2(8f); + float projPosX = projectile.position.X + (float)projectile.width * 0.5f - value.X; + float projPosY = projectile.position.Y + (float)projectile.height * 0.5f - value.Y; + Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); + float rotation2 = (float)Math.Atan2((double)projPosY, (double)projPosX) - 1.57f; + bool flag2 = true; + if (projPosX == 0f && projPosY == 0f) + { + flag2 = false; + } + else + { + float projPosXY = (float)Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); + projPosXY = 12f / projPosXY; + projPosX *= projPosXY; + projPosY *= projPosXY; + value.X -= projPosX; + value.Y -= projPosY; + projPosX = projectile.position.X + (float)projectile.width * 0.5f - value.X; + projPosY = projectile.position.Y + (float)projectile.height * 0.5f - value.Y; + } + while (flag2) + { + float num = 12f; + float num2 = (float)Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); + float num3 = num2; + if (float.IsNaN(num2) || float.IsNaN(num3)) + { + flag2 = false; + } + else + { + if (num2 < 20f) + { + num = num2 - 8f; + flag2 = false; + } + num2 = 12f / num2; + projPosX *= num2; + projPosY *= num2; + value.X += projPosX; + value.Y += projPosY; + projPosX = projectile.position.X + (float)projectile.width * 0.5f - value.X; + projPosY = projectile.position.Y + (float)projectile.height * 0.1f - value.Y; + if (num3 > 12f) + { + float num4 = 0.3f; + float num5 = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); + if (num5 > 16f) + { + num5 = 16f; + } + num5 = 1f - num5 / 16f; + num4 *= num5; + num5 = num3 / 80f; + if (num5 > 1f) + { + num5 = 1f; + } + num4 *= num5; + if (num4 < 0f) + { + num4 = 0f; + } + num5 = 1f - projectile.localAI[0] / 100f; + num4 *= num5; + if (projPosY > 0f) + { + projPosY *= 1f + num4; + projPosX *= 1f - num4; + } + else + { + num5 = Math.Abs(projectile.velocity.X) / 3f; + if (num5 > 1f) + { + num5 = 1f; + } + num5 -= 0.5f; + num4 *= num5; + if (num4 > 0f) + { + num4 *= 2f; + } + projPosY *= 1f + num4; + projPosX *= 1f - num4; + } + } + rotation2 = (float)Math.Atan2((double)projPosY, (double)projPosX) - 1.57f; + Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)value.X / 16, (int)(value.Y / 16f), new Microsoft.Xna.Framework.Color(138, 50, 73, 100)); //dark red + + Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2(value.X - Main.screenPosition.X + (float)Main.fishingLineTexture.Width * 0.5f, value.Y - Main.screenPosition.Y + (float)Main.fishingLineTexture.Height * 0.5f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.fishingLineTexture.Width, (int)num)), color2, rotation2, new Vector2((float)Main.fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); + } + } + } + return false; + } + } +} diff --git a/Projectiles/Typeless/ChaoticSpreadBobber.png b/Projectiles/Typeless/ChaoticSpreadBobber.png new file mode 100644 index 0000000000..030ec6d5c6 Binary files /dev/null and b/Projectiles/Typeless/ChaoticSpreadBobber.png differ diff --git a/Projectiles/Typeless/EaterofShoalsBobber.cs b/Projectiles/Typeless/EaterofShoalsBobber.cs index de16aa125e..d8e82e9edc 100644 --- a/Projectiles/Typeless/EaterofShoalsBobber.cs +++ b/Projectiles/Typeless/EaterofShoalsBobber.cs @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Typeless } rotation2 = (float)Math.Atan2((double)projPosY, (double)projPosX) - 1.57f; - if (projectile.Calamity().stealthStrike == true) //pink line + if (projectile.localAI[0] == 1) //pink line { red = 252; green = 109; diff --git a/Projectiles/Typeless/SlurperBobber.cs b/Projectiles/Typeless/SlurperBobber.cs new file mode 100644 index 0000000000..41562fda79 --- /dev/null +++ b/Projectiles/Typeless/SlurperBobber.cs @@ -0,0 +1,153 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Fishing; +namespace CalamityMod.Projectiles.Typeless +{ + public class SlurperBobber : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slurper Bobber"); + } + + public override void SetDefaults() + { + //projectile.CloneDefaults(360); //Wooden Bobber + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 61; + projectile.bobber = true; + projectile.penetrate = -1; + } + + public override bool PreDrawExtras(SpriteBatch spriteBatch) + { + Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); + + Player player = Main.player[projectile.owner]; + if (projectile.bobber && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].holdStyle > 0) + { + float pPosX = player.MountedCenter.X; + float pPosY = player.MountedCenter.Y; + pPosY += Main.player[projectile.owner].gfxOffY; + int type = Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type; + float gravDir = Main.player[projectile.owner].gravDir; + + if (type == ModContent.ItemType()) + { + pPosX += (float)(45 * Main.player[projectile.owner].direction); + if (Main.player[projectile.owner].direction < 0) + { + pPosX -= 13f; + } + pPosY -= 35f * gravDir; + } + + if (gravDir == -1f) + { + pPosY -= 12f; + } + Vector2 value = new Vector2(pPosX, pPosY); + value = Main.player[projectile.owner].RotatedRelativePoint(value + new Vector2(8f), true) - new Vector2(8f); + float projPosX = projectile.position.X + (float)projectile.width * 0.5f - value.X; + float projPosY = projectile.position.Y + (float)projectile.height * 0.5f - value.Y; + Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); + float rotation2 = (float)Math.Atan2((double)projPosY, (double)projPosX) - 1.57f; + bool flag2 = true; + if (projPosX == 0f && projPosY == 0f) + { + flag2 = false; + } + else + { + float projPosXY = (float)Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); + projPosXY = 12f / projPosXY; + projPosX *= projPosXY; + projPosY *= projPosXY; + value.X -= projPosX; + value.Y -= projPosY; + projPosX = projectile.position.X + (float)projectile.width * 0.5f - value.X; + projPosY = projectile.position.Y + (float)projectile.height * 0.5f - value.Y; + } + while (flag2) + { + float num = 12f; + float num2 = (float)Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); + float num3 = num2; + if (float.IsNaN(num2) || float.IsNaN(num3)) + { + flag2 = false; + } + else + { + if (num2 < 20f) + { + num = num2 - 8f; + flag2 = false; + } + num2 = 12f / num2; + projPosX *= num2; + projPosY *= num2; + value.X += projPosX; + value.Y += projPosY; + projPosX = projectile.position.X + (float)projectile.width * 0.5f - value.X; + projPosY = projectile.position.Y + (float)projectile.height * 0.1f - value.Y; + if (num3 > 12f) + { + float num4 = 0.3f; + float num5 = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); + if (num5 > 16f) + { + num5 = 16f; + } + num5 = 1f - num5 / 16f; + num4 *= num5; + num5 = num3 / 80f; + if (num5 > 1f) + { + num5 = 1f; + } + num4 *= num5; + if (num4 < 0f) + { + num4 = 0f; + } + num5 = 1f - projectile.localAI[0] / 100f; + num4 *= num5; + if (projPosY > 0f) + { + projPosY *= 1f + num4; + projPosX *= 1f - num4; + } + else + { + num5 = Math.Abs(projectile.velocity.X) / 3f; + if (num5 > 1f) + { + num5 = 1f; + } + num5 -= 0.5f; + num4 *= num5; + if (num4 > 0f) + { + num4 *= 2f; + } + projPosY *= 1f + num4; + projPosX *= 1f - num4; + } + } + rotation2 = (float)Math.Atan2((double)projPosY, (double)projPosX) - 1.57f; + Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)value.X / 16, (int)(value.Y / 16f), new Microsoft.Xna.Framework.Color(227, 79, 79, 100)); //red + + Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2(value.X - Main.screenPosition.X + (float)Main.fishingLineTexture.Width * 0.5f, value.Y - Main.screenPosition.Y + (float)Main.fishingLineTexture.Height * 0.5f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.fishingLineTexture.Width, (int)num)), color2, rotation2, new Vector2((float)Main.fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); + } + } + } + return false; + } + } +} diff --git a/Projectiles/Typeless/SlurperBobber.png b/Projectiles/Typeless/SlurperBobber.png new file mode 100644 index 0000000000..0d2dc1610f Binary files /dev/null and b/Projectiles/Typeless/SlurperBobber.png differ