Files
CalamityModPublic/Items/Weapons/Melee/Excelsus.cs
T
2023-08-01 06:22:24 +07:00

75 lines
3.0 KiB
C#

using CalamityMod.Projectiles.Melee;
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.Melee
{
public class Excelsus : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public override void SetDefaults()
{
Item.width = 78;
Item.damage = 250;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 15;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 15;
Item.useTurn = true;
Item.knockBack = 8f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.height = 94;
Item.value = CalamityGlobalItem.Rarity14BuyPrice;
Item.rare = ModContent.RarityType<DarkBlue>();
Item.shoot = ModContent.ProjectileType<ExcelsusMain>();
Item.shootSpeed = 12f;
}
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/Melee/ExcelsusGlow").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 < 3; ++index)
{
float SpeedX = velocity.X + Main.rand.NextFloat(-1.5f, 1.5f);
float SpeedY = velocity.Y + Main.rand.NextFloat(-1.5f, 1.5f);
switch (index)
{
case 0:
type = ModContent.ProjectileType<ExcelsusMain>();
break;
case 1:
type = ModContent.ProjectileType<ExcelsusBlue>();
break;
case 2:
type = ModContent.ProjectileType<ExcelsusPink>();
break;
}
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f);
}
return false;
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
var source = player.GetSource_ItemUse(Item);
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<LaserFountain>(), 0, 0, player.whoAmI);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
var source = player.GetSource_ItemUse(Item);
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<LaserFountain>(), 0, 0, player.whoAmI);
}
}
}