Skip to main content

Framework

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace willsweaponpack.Items.Weapons
{
    public class IcyMarrow : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Icy Marrow");
            Tooltip.SetDefault("Transforms wooden arrows into icy arrows");
        }
        public override void SetDefaults()
        {
            item.damage = 55;
            item.crit = 6;
            item.ranged = true;
            item.width = 22;
            item.height = 36;
            item.maxStack = 1;
            item.useTime = 15;
            item.useAnimation = 15;
            item.useStyle = 5;
            item.knockBack = 5;
            item.value = 100000;
            item.rare = 7;
            item.UseSound = SoundID.Item5;
            item.noMelee = true;
            item.shoot = 3;
            item.useAmmo = AmmoID.Arrow;
            item.shootSpeed = 16.0f;
            item.autoReuse = false;
        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            if (type == ProjectileID.WoodenArrowFriendly)
            {
                type = mod.ProjectileType("IcyArrowProj");
            }
            return true; // return true to allow tmodloader to call Projectile.NewProjectile as normal
        }
        public override Vector2? HoldoutOffset()
        {
            return new Vector2(5, 0); // shifts the hold position
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.IceBow, 1);
            recipe.AddIngredient(ItemID.Marrow, 1);
            recipe.AddIngredient(ItemID.FrostCore, 1);
            recipe.AddIngredient(ItemID.Bone, 5);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}