Files
CalamityModPublic/Items/Weapons/Ranged/Deathwind.cs
T

61 lines
2.5 KiB
C#

using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Deathwind : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetDefaults()
{
Item.damage = 248;
Item.DamageType = DamageClass.Ranged;
Item.width = 40;
Item.height = 82;
Item.useTime = 14;
Item.useAnimation = 14;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 5f;
Item.value = CalamityGlobalItem.Rarity14BuyPrice;
Item.rare = ModContent.RarityType<DarkBlue>();
Item.UseSound = SoundID.Item5;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<DWArrow>();
Item.shootSpeed = 20f;
Item.useAmmo = AmmoID.Arrow;
Item.Calamity().canFirePointBlankShots = true;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/DeathwindGlow").Value);
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
for (int index = 0; index < 4; ++index)
{
float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f;
float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f;
if (CalamityUtils.CheckWoodenAmmo(type, player))
{
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<DWArrow>(), damage, knockback, player.whoAmI);
}
else
{
int num121 = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockback, player.whoAmI);
Main.projectile[num121].noDropItem = true;
}
}
return false;
}
}
}