68 lines
2.6 KiB
C#
68 lines
2.6 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Ranged;
|
|
using CalamityMod.Rarities;
|
|
using CalamityMod.Tiles.Furniture.CraftingStations;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class Norfleet : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ItemID.Sets.IsRangedSpecialistWeapon[Type] = true;
|
|
}
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 140;
|
|
Item.height = 42;
|
|
Item.damage = 5678;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.crit = 16;
|
|
Item.useTime = Item.useAnimation = 70;
|
|
Item.knockBack = 15f;
|
|
Item.shootSpeed = 30f;
|
|
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.UseSound = null;
|
|
Item.shoot = ModContent.ProjectileType<NorfleetCannon>();
|
|
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
|
|
Item.rare = ModContent.RarityType<CosmicPurple>();
|
|
Item.noMelee = true;
|
|
Item.noUseGraphic = true;
|
|
Item.channel = true;
|
|
Item.autoReuse = true;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
|
// Makes the rotation of the mouse around the player sync in multiplayer.
|
|
public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true;
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<NorfleetCannon>(), damage, knockback, player.whoAmI);
|
|
|
|
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
|
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
|
|
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient<StellarCannon>().
|
|
AddIngredient<CosmiliteBar>(8).
|
|
AddIngredient<DarksunFragment>(20).
|
|
AddTile<CosmicAnvil>().
|
|
Register();
|
|
}
|
|
}
|
|
}
|