Files
CalamityModPublic/Items/Weapons/Ranged/ClockworkBow.cs
T
Altixal 3e28ef8c78 Hopefully fixes and ranger hell
- Fixed a potential UI softlock with Wulfrum Treasure Pinger
- Fixed Surge Driver left click dealing less damage than intended
- Surge Driver left click now scale with item use time, 6.66x -> 6x dmg
- Fixed Heavenly Gale not scaling with arrow damage. 334 -> 300 dmg
- Adjusted a ton of holdouts to not consume ammo upon spawning
- Clockwork Bow and Condemnation now use arrows as they're loaded
- Heavenly Gale now consumes an arrow for each arrow shot
- Butcher gains 25% innate chance to not consume ammo
- Phangasm now inherits Phantasm's 66% chance to not consume ammo
- similar for Daemon's Flame and Starmada
2023-02-26 13:14:03 +07:00

67 lines
2.5 KiB
C#

using Terraria.DataStructures;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Projectiles.Ranged;
namespace CalamityMod.Items.Weapons.Ranged
{
public class ClockworkBow : ModItem
{
public const int MaxBolts = 6;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Clockwork Bow");
Tooltip.SetDefault("Hold left click to load up to six precision bolts\n" +
"The more precision bolts are loaded, the harder they hit");
SacrificeTotal = 1;
}
public override void SetDefaults()
{
Item.damage = 770;
Item.DamageType = DamageClass.Ranged;
Item.width = 48;
Item.height = 96;
Item.useTime = 60;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.channel = true;
Item.knockBack = 4.25f;
Item.value = CalamityGlobalItem.Rarity10BuyPrice;
Item.rare = ItemRarityID.Red;
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();
}
}
}