using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace JoshuasMod.Items.Weapons.DragonDancer
{
public class DragonDancer : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Dragon Dancer"); //The weapon's name when shown in-game.
}
public override void SetDefaults()
{
item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing.
item.UseSound = SoundID.Item71; //The sound played when using your Weapon. "Item71" is the Death Sickle's swing sound.
item.damage = 1000;
item.width = 34; //The size of the width of the hitbox in pixels.
item.height = 34; //The size of the height of the hitbox in pixels.
item.useTime = 8; //How fast the Weapon is used.
item.useAnimation = 8; //How long the Weapon is used for.
item.autoReuse = true;
item.noMelee = false;
item.melee = false;
item.expert = true;
item.useTurn = true;
item.shoot = 0;
}
public override bool AltFunctionUse(Player player)
{
return true;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
item.useStyle = 5; //The way your Weapon will be used, 5 is for holding out (Guns, Spellbooks, and the like).
item.UseSound = SoundID.Item71; //The sound played when using your Weapon. "Item71" is the Death Sickle's swing sound.
item.damage = 1000;
item.width = 34; //The size of the width of the hitbox in pixels.
item.height = 34; //The size of the height of the hitbox in pixels.
item.useTime = 10; //How fast the Weapon is used.
item.useAnimation = 10; //How long the Weapon is used for.
item.channel = true;
item.autoReuse = true;
item.noMelee = true;
item.useTurn = false;
item.melee = false;
item.expert = true;
item.shoot = mod.ProjectileType("DragonStorm1");
item.shootSpeed = 32f;
}
else
{
item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing.
item.UseSound = SoundID.Item71; //The sound played when using your Weapon. "Item71" is the Death Sickle's swing sound.
item.damage = 1000;
item.width = 34; //The size of the width of the hitbox in pixels.
item.height = 34; //The size of the height of the hitbox in pixels.
item.useTime = 8; //How fast the Weapon is used.
item.useAnimation = 8; //How long the Weapon is used for.
item.autoReuse = true;
item.noMelee = false;
item.melee = false;
item.expert = true;
item.useTurn = true;
item.shoot = 0;
}
return base.CanUseItem(player);
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.CursedInferno, 5 * 60); //Add CursedInferno buff to the NPC for 5 seconds.
int healingAmount = damage/40;
player.statLife +=healingAmount;
player.HealEffect(healingAmount, true);
}
// The Projectile's "Shoot" Function [Inaccurate Gun Style]
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 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(5)); // "5" is the angle of degrees where the projectiles can shoot within.
speedX = perturbedSpeed.X;
speedY = perturbedSpeed.Y;
return true;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(10, 0);
}
}
}