From 1bbcf60c1f10298ad8ac4b0fd2cd3abfb223ff08 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 3 Nov 2019 11:55:00 -0500 Subject: [PATCH] added early bloom rod --- Items/Fishing/EarlyBloomRod.cs | 62 +++++++++ Items/Fishing/EarlyBloomRod.png | Bin 0 -> 884 bytes Items/Fishing/EaterofShoals.cs | 2 +- Projectiles/Typeless/EarlyBloomBobber.cs | 153 ++++++++++++++++++++++ Projectiles/Typeless/EarlyBloomBobber.png | Bin 0 -> 363 bytes 5 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 Items/Fishing/EarlyBloomRod.cs create mode 100644 Items/Fishing/EarlyBloomRod.png create mode 100644 Projectiles/Typeless/EarlyBloomBobber.cs create mode 100644 Projectiles/Typeless/EarlyBloomBobber.png diff --git a/Items/Fishing/EarlyBloomRod.cs b/Items/Fishing/EarlyBloomRod.cs new file mode 100644 index 0000000000..c5ef531e80 --- /dev/null +++ b/Items/Fishing/EarlyBloomRod.cs @@ -0,0 +1,62 @@ +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 EarlyBloomRod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Early Bloom Rod"); + Tooltip.SetDefault("Fires six lines at once. Line never snaps.\n" + + "The early bird catches 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 = 60; + item.shootSpeed = 18f; + item.shoot = ModContent.ProjectileType(); + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + } + + public override void HoldItem(Player player) + { + player.accFishingLine = 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 < 6; ++index) + { + 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(ModContent.ItemType(), 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Fishing/EarlyBloomRod.png b/Items/Fishing/EarlyBloomRod.png new file mode 100644 index 0000000000000000000000000000000000000000..65ced9c1fe5a36ac1c4e763251a3aa3170e3b87a GIT binary patch literal 884 zcmV-)1B?8LP)&6Oa%H+C=cN5MzuFVu-1`E^v#) zf56B>H^vPvP?v7m$^uppV^q}mHj>bqU>X{%lGrF1VIf8ou8ZlR&cLOX^bv>tHtn1{ zb9?W6_nbLrZaw5#)it%wQuf$b)RWG6it>FUnbO*PUx4VynGL$3UniA{kTpcodJeNG z@s;D3w*U}-Q3*iB#s~n<`hRHsO+p1CnUYCDbhNPpfG43Y&HkwKD^MV^a+&Ld%%mF$ zZ@2CX(+Ab?;s&p3cd7QLsfgCk8X`GcN9s@Pldq269tV;$eY$xa0DA+w0C+p_0f0M+ z-e;TV6W{6pxY;`j6o{-`vVu>3*X>RIS?!YA&fV9J?>Vp=fZGq$+$YH>6^Q(+{)+bw zKt+Ox_vuGvJ**CgE9U^{>v<2rtIyL~M7=h(NjcGZ)xOmATKk;>5jVN58={%Jiir3` zI6S9~7ZM`_LG3*LK=10vezWEy3-v{!uGn8(4kV*ZEUpemdz7!#wpIZ!|MQ9iP*iet zbykQO%eBNeWW|;`Lewz6Mr-#y*Q1m8L@Hl!lQl$KeI(WHhTCzGL?>^H%4XjMN&xs3 zo&hpPLSzjQ*I96@7e=~OcIt1N)$CHaNpzBRqS~jROO`6psl93k04Fcr%ZQ)aOXSe@ zQU_pXS-oa2?ND9KT3YG|k(reW2{U&Zynf1o0+B^>C2}EHr`aEe)H5$Nbm@>9daP0T z%+{LC08EU119C?~WG@j>Dl$UCw8tmc1Ib+ubA0QqH(A-av7d;@BxCwQEdG1h@n%ky zEm=ckQLbg?P>#Sb<2jdd}yc`i9QJ=DYxb1ReTlNwWCEp-T0WdmL2Ebr>EdUiQ zDk@2qE56d?C(+LBjaWk@W%es%WH($Sb%l`fM8iv-C)?3VWDOD5s3oPuWXLo7!#?(), 0, 0f, player.whoAmI, 0.0f, 0.0f); + 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 diff --git a/Projectiles/Typeless/EarlyBloomBobber.cs b/Projectiles/Typeless/EarlyBloomBobber.cs new file mode 100644 index 0000000000..774d39cee9 --- /dev/null +++ b/Projectiles/Typeless/EarlyBloomBobber.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 EarlyBloomBobber : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Early Bloom 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.1f, 0.5f, 0.15f); + + 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(190, 140, 69, 100)); //yellow + + 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/EarlyBloomBobber.png b/Projectiles/Typeless/EarlyBloomBobber.png new file mode 100644 index 0000000000000000000000000000000000000000..884a9b1d3fd5ba80364551961e03944800eca134 GIT binary patch literal 363 zcmV-x0hIoUP)DNBf$vN+N|K~X;m0ik3I;j3sOF_5#h(0wM zg5u5u7|TzBYFPwZhf}eJYWX7>F%^Q~B@i}OOW@+J5+eog$%%zbI)W&d2P=Eu;Nf(< z^{{piuA83;iGg%nT8|Y@UK?P4em0grsN5vm>far2FW6dSIW