Files
CalamityModPublic/Items/Weapons/Summon/HauntedScroll.cs
T

60 lines
2.3 KiB
C#

using Terraria.DataStructures;
using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.Creative;
namespace CalamityMod.Items.Weapons.Summon
{
public class HauntedScroll : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Haunted Scroll");
Tooltip.SetDefault("Summons a stack of haunted dishes to fight for you");
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
}
public override void SetDefaults()
{
Item.damage = 25;
Item.mana = 10;
Item.width = 52;
Item.height = 52;
Item.useTime = Item.useAnimation = 24;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.noMelee = true;
Item.knockBack = 3f;
Item.value = CalamityGlobalItem.Rarity4BuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.UseSound = SoundID.Item60;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<HauntedDishes>();
Item.shootSpeed = 10f;
Item.DamageType = DamageClass.Summon;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.altFunctionUse != 2)
{
position = Main.MouseWorld;
velocity.X = 0;
velocity.Y = 0;
int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f);
if (Main.projectile.IndexInRange(p))
Main.projectile[p].originalDamage = Item.damage;
//projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks
}
return false;
}
public override void AddRecipes()
{
CreateRecipe(1).AddIngredient(ItemID.Wood, 10).AddIngredient(ItemID.SoulofLight, 5).AddIngredient(ItemID.SoulofNight, 5).AddIngredient(ItemID.Bowl).AddTile(TileID.Anvils).Register();
}
}
}