69 lines
3.0 KiB
C#
69 lines
3.0 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Siva.Items;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace Siva.Weapons
|
|
{
|
|
public class MasterworkedOutbreak : ModItem
|
|
{
|
|
public static readonly int ItemType = ModContent.ItemType<MasterworkedOutbreak>();
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
// Modders can use Item.DefaultToRangedWeapon to quickly set many common properties, such as: useTime, useAnimation, useStyle, autoReuse, DamageType, shoot, shootSpeed, useAmmo, and noMelee. These are all shown individually here for teaching purposes.
|
|
|
|
// Common Properties
|
|
Item.width = 22; // Hitbox width of the item.
|
|
Item.height = 10; // Hitbox height of the item.
|
|
Item.scale = 0.75f;
|
|
Item.rare = ItemRarityID.Yellow; // The color that the item's name will be in-game.
|
|
|
|
|
|
// Use Properties
|
|
Item.useTime = 4; // one third of useAnimation for three burst effect I think
|
|
Item.useAnimation = 12; // The length of the item's use animation in ticks
|
|
Item.reuseDelay = 12; // The delay before you can shoot again, crazy I know
|
|
Item.useStyle = ItemUseStyleID.Shoot; // How you use the item (swinging, holding out, etc.)
|
|
Item.autoReuse = true; // Whether or not you can hold click to automatically use it again
|
|
|
|
// Weapon Properties
|
|
Item.consumeAmmoOnLastShotOnly = true;
|
|
Item.DamageType = DamageClass.Ranged; // Sets the damage type to ranged.
|
|
Item.damage = 22; // Sets the item's damage. Note that projectiles shot by this weapon will use its and the used ammunition's damage added together.
|
|
Item.knockBack = 5f; // Sets the item's knockback. Note that projectiles shot by this weapon will use its and the used ammunition's knockback added together.
|
|
Item.noMelee = true; // So the item's animation doesn't do damage.
|
|
Item.crit = 34; // Sets the item's crit chance. Note that the player's base crit chance is 4% and will be added to the item's crit chance.
|
|
|
|
// Gun Properties
|
|
Item.shoot = ProjectileID.PurificationPowder; // For some reason, all the guns in the vanilla source have this.
|
|
Item.shootSpeed = 20f; // The speed of the projectile (measured in pixels per frame.)
|
|
Item.useAmmo = AmmoID.Bullet; // The "ammo Id" of the ammo item that this weapon uses. Ammo IDs are magic numbers that usually correspond to the item id of one item that most commonly represent the ammo type.
|
|
|
|
// The sound that this item plays when used.
|
|
Item.UseSound = new SoundStyle($"{nameof(Siva)}/Sounds/Pew") {
|
|
Volume = 1f,
|
|
PitchVariance = 0,
|
|
MaxInstances = 3,
|
|
};
|
|
|
|
}
|
|
|
|
// This method lets you adjust position of the gun in the player's hands. Play with these values until it looks good with your graphics.
|
|
public override Vector2? HoldoutOffset() {
|
|
return new Vector2(2f, 0f);
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe()
|
|
.AddIngredient<Outbreak>()
|
|
.AddIngredient<OutbreakCatalyst>()
|
|
.AddTile(TileID.MythrilAnvil)
|
|
.Register();
|
|
}
|
|
|
|
}
|
|
} |