57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
using CalamityMod.Items.Weapons.Ranged;
|
|
using CalamityMod.Projectiles.Melee;
|
|
using CalamityMod.Rarities;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Melee
|
|
{
|
|
public class Violence : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Melee";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = Item.height = 142;
|
|
Item.damage = 485;
|
|
Item.DamageType = DamageClass.MeleeNoSpeed;
|
|
Item.noMelee = true;
|
|
Item.useTurn = true;
|
|
Item.noUseGraphic = true;
|
|
Item.useAnimation = 60;
|
|
Item.useTime = 25;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.knockBack = 9f;
|
|
Item.UseSound = SoundID.Item1;
|
|
Item.autoReuse = true;
|
|
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
|
|
Item.rare = ModContent.RarityType<CalamityRed>();
|
|
Item.shoot = ModContent.ProjectileType<ViolenceThrownProjectile>();
|
|
Item.shootSpeed = 15f;
|
|
Item.channel = true;
|
|
}
|
|
|
|
public override bool AltFunctionUse(Player player)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
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)
|
|
{
|
|
if (player.altFunctionUse == 2)
|
|
{
|
|
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
|
|
player.itemAnimation = player.itemAnimationMax = player.itemTime = player.itemTimeMax = 60;
|
|
Projectile.NewProjectile(source, position, velocity*1.6666f, type, (int)(damage * 15), knockback, player.whoAmI, 0f, velocity.ToRotation(), 0);
|
|
}
|
|
else
|
|
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, velocity.ToRotation(), 1);
|
|
return false;
|
|
}
|
|
}
|
|
}
|