57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using CalamityMod.Projectiles.Magic;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Magic
|
|
{
|
|
[LegacyName("Purge")]
|
|
public class NanoPurge : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Magic";
|
|
public const int UseTime = 20;
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 73;
|
|
Item.DamageType = DamageClass.Magic;
|
|
Item.mana = 6;
|
|
Item.width = 62;
|
|
Item.height = 34;
|
|
Item.useTime = Item.useAnimation = UseTime;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.noUseGraphic = true;
|
|
Item.channel = true;
|
|
Item.knockBack = 3f;
|
|
Item.rare = ItemRarityID.Red;
|
|
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
|
|
Item.autoReuse = true;
|
|
Item.shoot = ModContent.ProjectileType<NanoPurgeHoldout>();
|
|
Item.shootSpeed = 16f;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
Vector2 shootVelocity = velocity;
|
|
Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction);
|
|
Projectile.NewProjectile(source, position, shootDirection, type, damage, knockback, player.whoAmI);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient(ItemID.LaserMachinegun).
|
|
AddIngredient(ItemID.FragmentVortex, 6).
|
|
AddIngredient(ItemID.Nanites, 100).
|
|
AddTile(TileID.LunarCraftingStation).
|
|
Register();
|
|
}
|
|
}
|
|
}
|