60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using CalamityMod.Projectiles.Magic;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Magic
|
|
{
|
|
public class Lazhar : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Lazhar");
|
|
Tooltip.SetDefault("Fires a bouncing laser that explodes on enemy hits");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 100;
|
|
item.magic = true;
|
|
item.mana = 4;
|
|
item.width = 42;
|
|
item.height = 20;
|
|
item.useTime = 7;
|
|
item.useAnimation = 7;
|
|
item.useStyle = ItemUseStyleID.HoldingOut;
|
|
item.noMelee = true;
|
|
item.knockBack = 5f;
|
|
item.value = Item.buyPrice(0, 95, 0, 0);
|
|
item.rare = 9;
|
|
item.UseSound = SoundID.Item12;
|
|
item.autoReuse = true;
|
|
item.shootSpeed = 15f;
|
|
item.shoot = ModContent.ProjectileType<SolarBeam2>();
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f;
|
|
float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f;
|
|
Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.HeatRay);
|
|
recipe.AddIngredient(ModContent.ItemType<Zapper>());
|
|
recipe.AddIngredient(ItemID.FragmentSolar, 10);
|
|
recipe.AddIngredient(ItemID.ChlorophyteBar, 6);
|
|
recipe.AddTile(TileID.LunarCraftingStation);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|