79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons
|
|
{
|
|
public class Trinity : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Trinity");
|
|
Tooltip.SetDefault("Fires a spread of energy bolts");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 44;
|
|
item.damage = 50;
|
|
item.melee = true;
|
|
item.useAnimation = 25;
|
|
item.useTime = 25;
|
|
item.useTurn = true;
|
|
item.useStyle = 1;
|
|
item.knockBack = 4.5f;
|
|
item.UseSound = SoundID.Item1;
|
|
item.autoReuse = true;
|
|
item.height = 46;
|
|
item.value = Item.buyPrice(0, 36, 0, 0);
|
|
item.rare = 5;
|
|
item.shoot = 125;
|
|
item.shootSpeed = 11f;
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
switch (Main.rand.Next(3))
|
|
{
|
|
case 0:
|
|
type = 125;
|
|
break;
|
|
case 1:
|
|
type = 123;
|
|
break;
|
|
case 2:
|
|
type = 121;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
for (int projectiles = 0; projectiles <= 3; projectiles++)
|
|
{
|
|
float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f;
|
|
float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f;
|
|
int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6), knockBack, Main.myPlayer, 0f, 0f);
|
|
Main.projectile[proj].Calamity().forceMelee = true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(null, "VerstaltiteBar", 9);
|
|
recipe.AddTile(TileID.MythrilAnvil);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
|
|
public override void MeleeEffects(Player player, Rectangle hitbox)
|
|
{
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 73);
|
|
}
|
|
}
|
|
}
|
|
}
|