64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Summon;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Summon
|
|
{
|
|
public class SunSpiritStaff : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Sun Spirit Staff");
|
|
Tooltip.SetDefault("Summons a solar spirit to protect you");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 12;
|
|
item.mana = 10;
|
|
item.width = 44;
|
|
item.height = 42;
|
|
item.useTime = 36;
|
|
item.useAnimation = 36;
|
|
item.useStyle = 1;
|
|
item.noMelee = true;
|
|
item.knockBack = 1.15f;
|
|
item.value = Item.buyPrice(0, 2, 0, 0);
|
|
item.rare = 2;
|
|
item.UseSound = SoundID.Item44;
|
|
item.autoReuse = true;
|
|
item.shoot = ModContent.ProjectileType<SolarPixie>();
|
|
item.summon = true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.SandstoneBrick, 20);
|
|
recipe.AddIngredient(ModContent.ItemType<DesertFeather>(), 2);
|
|
recipe.AddTile(TileID.Anvils);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
position = Main.MouseWorld;
|
|
speedX = 0;
|
|
speedY = 0;
|
|
for (int x = 0; x < 1000; x++)
|
|
{
|
|
Projectile projectile = Main.projectile[x];
|
|
if (projectile.active && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType<SolarPixie>())
|
|
{
|
|
projectile.Kill();
|
|
}
|
|
}
|
|
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);
|
|
return false;
|
|
}
|
|
}
|
|
}
|