90 lines
3.3 KiB
C#
90 lines
3.3 KiB
C#
using CalamityMod.Items.Materials;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class NettlelineGreatbow : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Nettlevine Greatbow");
|
|
Tooltip.SetDefault("Shoots 4 arrows at once\n" +
|
|
"Fires 2 additional venom or chlorophyte arrows");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 120;
|
|
item.ranged = true;
|
|
item.width = 36;
|
|
item.height = 64;
|
|
item.useTime = 17;
|
|
item.useAnimation = 17;
|
|
item.useStyle = 5;
|
|
item.noMelee = true;
|
|
item.knockBack = 3f;
|
|
item.value = Item.buyPrice(1, 20, 0, 0);
|
|
item.rare = 10;
|
|
item.UseSound = SoundID.Item5;
|
|
item.autoReuse = true;
|
|
item.shoot = 10;
|
|
item.shootSpeed = 16f;
|
|
item.useAmmo = 40;
|
|
item.Calamity().postMoonLordRarity = 12;
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
|
float num117 = 0.314159274f;
|
|
int num118 = 4;
|
|
Vector2 vector7 = new Vector2(speedX, speedY);
|
|
vector7.Normalize();
|
|
vector7 *= 40f;
|
|
bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0);
|
|
for (int num119 = 0; num119 < num118; num119++)
|
|
{
|
|
float num120 = (float)num119 - ((float)num118 - 1f) / 2f;
|
|
Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default);
|
|
if (!flag11)
|
|
{
|
|
value9 -= vector7;
|
|
}
|
|
int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f);
|
|
Main.projectile[num121].noDropItem = true;
|
|
}
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f;
|
|
float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f;
|
|
switch (Main.rand.Next(2))
|
|
{
|
|
case 0:
|
|
type = ProjectileID.VenomArrow;
|
|
break;
|
|
case 1:
|
|
type = ProjectileID.ChlorophyteArrow;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f);
|
|
Main.projectile[index].noDropItem = true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<UeliaceBar>(), 12);
|
|
recipe.AddTile(TileID.LunarCraftingStation);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|