using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { public class TerraRay : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Ray"); Tooltip.SetDefault("Casts an energy ray that splits into energy on enemy hits\n" + "More energy is created the farther along the ray the hit enemy is"); Item.staff[item.type] = true; } public override void SetDefaults() { item.damage = 50; item.magic = true; item.mana = 10; item.width = 54; item.height = 54; item.useTime = 24; item.useAnimation = 24; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item60; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; } public override Vector2? HoldoutOrigin() { return new Vector2(15, 15); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootPosition = position + shootVelocity * 8f; Projectile.NewProjectile(shootPosition, shootVelocity, type, damage, knockBack, player.whoAmI); return false; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } } }