Files
CalamityModPublic/Items/Weapons/Ranged/AstralBlaster.cs
T

59 lines
2.2 KiB
C#

using Terraria.DataStructures;
using CalamityMod.Items.Placeables;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class AstralBlaster : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetDefaults()
{
Item.damage = 120;
Item.DamageType = DamageClass.Ranged;
Item.width = 40;
Item.height = 24;
Item.useTime = 15;
Item.useAnimation = 15;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 2.75f;
Item.value = CalamityGlobalItem.Rarity9BuyPrice;
Item.rare = ItemRarityID.Cyan;
Item.UseSound = SoundID.Item41;
Item.autoReuse = true;
Item.shootSpeed = 12f;
Item.shoot = ModContent.ProjectileType<AstralRound>();
Item.useAmmo = AmmoID.Bullet;
Item.Calamity().canFirePointBlankShots = true;
}
// Terraria seems to really dislike high crit values in SetDefaults
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25;
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (type == ProjectileID.Bullet)
Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType<AstralRound>(), damage, knockback, player.whoAmI);
else
Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI);
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<AstralBar>(6).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}