74 lines
2.7 KiB
C#
74 lines
2.7 KiB
C#
using CalamityMod.CustomRecipes;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.DraedonsArsenal;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
|
{
|
|
public class GalvanizingGlaive : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ItemID.Sets.Spears[Item.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
CalamityGlobalItem modItem = Item.Calamity();
|
|
|
|
Item.width = 56;
|
|
Item.height = 52;
|
|
Item.damage = 130;
|
|
Item.noMelee = true;
|
|
Item.noUseGraphic = true;
|
|
Item.channel = true;
|
|
Item.DamageType = DamageClass.Melee;
|
|
Item.useAnimation = Item.useTime = 21;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.knockBack = 9f;
|
|
Item.UseSound = SoundID.Item1;
|
|
Item.autoReuse = true;
|
|
|
|
Item.rare = ItemRarityID.Yellow;
|
|
Item.value = CalamityGlobalItem.Rarity8BuyPrice;
|
|
|
|
Item.shoot = ModContent.ProjectileType<GalvanizingGlaiveProjectile>();
|
|
Item.shootSpeed = 21f;
|
|
|
|
modItem.UsesCharge = true;
|
|
modItem.MaxCharge = 135f;
|
|
modItem.ChargePerUse = 0.075f;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
|
|
|
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3);
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
float swingOffset = Main.rand.NextFloat(0.5f, 1f) * Item.shootSpeed * 1.6f * player.direction;
|
|
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, swingOffset);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient<MysteriousCircuitry>(12).
|
|
AddIngredient<DubiousPlating>(18).
|
|
AddIngredient<InfectedArmorPlating>(10).
|
|
AddIngredient<LifeAlloy>(5).
|
|
AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func<bool> condition), condition).
|
|
AddTile(TileID.MythrilAnvil).
|
|
Register();
|
|
}
|
|
}
|
|
}
|