Files
ForgottenWawiTech/Content/Items/Weapons/Ranged/TranscendentRailcannon.cs
T

64 lines
2.4 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using ForgottenWawiTech.Content.Items.Materials;
using ForgottenWawiTech.Content.Projectiles.Transcendent;
using ForgottenWawiTech.Content.Rarities;
using ForgottenWawiTech.Content.Tiles.CraftingStations;
namespace ForgottenWawiTech.Content.Items.Weapons.Ranged
{
public class TranscendentRailcannon : ModItem
{
public override void SetDefaults()
{
Item.width = 74;
Item.height = 32;
Item.damage = 5000;
Item.DamageType = DamageClass.Ranged;
Item.knockBack = 6f;
Item.crit = 28;
Item.useTime = 7;
Item.useAnimation = 7;
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = SoundID.Item38;
Item.autoReuse = true;
Item.noMelee = true;
Item.value = Item.sellPrice(platinum: 320);
Item.rare = ModContent.RarityType<TranscendentItem>();
Item.shoot = ModContent.ProjectileType<TranscendentRailBolt>();
Item.shootSpeed = 26f;
Item.useAmmo = AmmoID.None;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Vector2 direction = velocity.LengthSquared() > 0.0001f ? Vector2.Normalize(velocity) : new Vector2(player.direction, 0f);
Vector2 muzzleOffset = direction * 32f;
Vector2 spawnPosition = position + muzzleOffset;
Projectile.NewProjectile(source, spawnPosition, direction * Item.shootSpeed, type, damage, knockback, player.whoAmI);
return false;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10f, 0f);
}
public override void AddRecipes()
{
CreateRecipe()
.AddIngredient(ModContent.ItemType<ControlledSingularity>(), 8)
.AddIngredient(ModContent.ItemType<SingularityAlloy>(), 10)
.AddIngredient(ModContent.ItemType<EnergyCore>(), 16)
.AddIngredient(ModContent.ItemType<MalfunctioningNanites>(), 24)
.AddIngredient(ModContent.ItemType<UnstableMatter>(), 8)
.AddTile(ModContent.TileType<SingularitySealingUnit>())
.Register();
}
}
}