40 lines
1.6 KiB
C#
40 lines
1.6 KiB
C#
using Terraria.DataStructures;
|
|
using CalamityMod.Projectiles.Summon;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Summon
|
|
{
|
|
public class DeathstareRod : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Summon";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 33;
|
|
Item.mana = 10;
|
|
Item.width = Item.height = 42;
|
|
Item.useTime = Item.useAnimation = 35;
|
|
Item.useStyle = ItemUseStyleID.Swing;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 2f;
|
|
Item.value = CalamityGlobalItem.Rarity2BuyPrice;
|
|
Item.rare = ItemRarityID.Green;
|
|
Item.UseSound = SoundID.NPCHit8;
|
|
Item.shoot = ModContent.ProjectileType<DeathstareEyeball>();
|
|
Item.shootSpeed = 10f;
|
|
Item.DamageType = DamageClass.Summon;
|
|
}
|
|
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
CalamityUtils.KillShootProjectiles(true, type, player);
|
|
int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f);
|
|
if (Main.projectile.IndexInRange(p))
|
|
Main.projectile[p].originalDamage = Item.damage;
|
|
return false;
|
|
}
|
|
}
|
|
}
|