2 - (Example) Post DoG items are now 2 platinum instead of 1 platinum 40 gold. 3 - (Example) Dev items are now 2 platinum 80 gold instead of 2 platinum. 4 - Privated numeric rarity item values. 5 - All assigned item values use the rarity's names, e.g. RarityLightPurpleBuyPrice.
59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using CalamityMod.Projectiles.Ranged;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class ClockworkBow : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
public const int MaxBolts = 6;
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 48;
|
|
Item.height = 96;
|
|
Item.damage = 770;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.useTime = Item.useAnimation = 30;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.channel = true;
|
|
Item.knockBack = 4.25f;
|
|
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
|
|
Item.rare = ItemRarityID.Purple;
|
|
Item.noUseGraphic = true;
|
|
Item.UseSound = SoundID.Item20;
|
|
Item.autoReuse = true;
|
|
Item.shoot = ModContent.ProjectileType<ClockworkBowHoldout>();
|
|
Item.shootSpeed = 15f;
|
|
Item.useAmmo = AmmoID.Arrow;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
|
|
|
// Spawning the holdout cannot consume ammo
|
|
public override bool CanConsumeAmmo(Item ammo, 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);
|
|
// Charge-up. Done via a holdout projectile.
|
|
Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType<ClockworkBowHoldout>(), damage, knockback, player.whoAmI);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient(ItemID.LunarBar, 5).
|
|
AddIngredient(ItemID.Cog, 50).
|
|
AddTile(TileID.LunarCraftingStation).
|
|
Register();
|
|
}
|
|
}
|
|
}
|