69 lines
2.3 KiB
C#
69 lines
2.3 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Rogue;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class SpectreRifle : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Spectre Rifle");
|
|
Tooltip.SetDefault("Converts musket balls into powerful homing souls");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 150;
|
|
item.ranged = true;
|
|
item.width = 88;
|
|
item.height = 30;
|
|
item.useTime = 25;
|
|
item.useAnimation = 25;
|
|
item.useStyle = ItemUseStyleID.HoldingOut;
|
|
item.noMelee = true;
|
|
item.knockBack = 7f;
|
|
item.value = Item.buyPrice(0, 80, 0, 0);
|
|
item.rare = ItemRarityID.Yellow;
|
|
item.UseSound = SoundID.Item40;
|
|
item.autoReuse = false;
|
|
item.shoot = ProjectileID.LostSoulFriendly;
|
|
item.shootSpeed = 12f;
|
|
item.useAmmo = AmmoID.Bullet;
|
|
item.Calamity().canFirePointBlankShots = true;
|
|
}
|
|
|
|
// Terraria seems to really dislike high crit values in SetDefaults
|
|
public override void GetWeaponCrit(Player player, ref int crit) => crit += 22;
|
|
|
|
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
if (type == ProjectileID.Bullet)
|
|
{
|
|
int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 2f, 0f);
|
|
Main.projectile[proj].Calamity().forceRanged = true;
|
|
Main.projectile[proj].extraUpdates += 2;
|
|
}
|
|
else
|
|
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.SpectreBar, 7);
|
|
recipe.AddIngredient(ModContent.ItemType<CoreofEleum>(), 3);
|
|
recipe.AddTile(TileID.MythrilAnvil);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|