added early bloom rod

This commit is contained in:
termigator1359 committed 2019-11-03 11:55:00 -05:00
1 parent 37b53d7307
commit 1bbcf60c1f
5 files changed
+216 -1

No files matched your search

+62
View File
@@ -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<EarlyBloomBobber>();
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<UeliaceBar>(), 10);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

+1 -1
View File
@@ -45,7 +45,7 @@ namespace CalamityMod.Items.Fishing
{
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, ModContent.ProjectileType<EaterofShoalsBobber>(), 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
+153
View File
@@ -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<EarlyBloomRod>())
{
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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B