91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using Terraria.DataStructures;
|
|
using CalamityMod.Projectiles.Rogue;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Rogue
|
|
{
|
|
public class Malachite : RogueWeapon
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 28;
|
|
Item.damage = 55;
|
|
Item.noMelee = true;
|
|
Item.noUseGraphic = true;
|
|
Item.useTime = Item.useAnimation = 14;
|
|
Item.useStyle = ItemUseStyleID.Swing;
|
|
Item.knockBack = 1.25f;
|
|
Item.UseSound = SoundID.Item1;
|
|
Item.autoReuse = true;
|
|
Item.height = 58;
|
|
Item.shoot = ModContent.ProjectileType<MalachiteProj>();
|
|
Item.shootSpeed = 10f;
|
|
Item.DamageType = RogueDamageClass.Instance;
|
|
|
|
Item.value = CalamityGlobalItem.Rarity8BuyPrice;
|
|
Item.rare = ItemRarityID.Yellow;
|
|
}
|
|
|
|
public override bool AltFunctionUse(Player player) => true;
|
|
|
|
public override bool CanUseItem(Player player)
|
|
{
|
|
if (player.Calamity().StealthStrikeAvailable())
|
|
{
|
|
Item.UseSound = SoundID.Item109;
|
|
Item.shoot = ModContent.ProjectileType<MalachiteStealth>();
|
|
}
|
|
else if (player.altFunctionUse == 2)
|
|
{
|
|
Item.UseSound = SoundID.Item109;
|
|
Item.shoot = ModContent.ProjectileType<MalachiteBolt>();
|
|
}
|
|
else
|
|
{
|
|
Item.UseSound = SoundID.Item1;
|
|
Item.shoot = ModContent.ProjectileType<MalachiteProj>();
|
|
}
|
|
return base.CanUseItem(player);
|
|
}
|
|
|
|
public override float UseSpeedMultiplier(Player player)
|
|
{
|
|
if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse == 2)
|
|
return 1f;
|
|
return 2f;
|
|
}
|
|
|
|
public override float StealthDamageMultiplier => 1.3f;
|
|
|
|
public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
|
|
{
|
|
if (player.altFunctionUse == 2 && !player.Calamity().StealthStrikeAvailable())
|
|
damage = (int)(damage * 1.75f);
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
if (player.Calamity().StealthStrikeAvailable())
|
|
{
|
|
for (float i = -6.5f; i <= 6.5f; i += 6.5f)
|
|
{
|
|
Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i));
|
|
int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI);
|
|
if (stealth.WithinBounds(Main.maxProjectiles))
|
|
Main.projectile[stealth].Calamity().stealthStrike = true;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|