113 lines
4.1 KiB
C#
113 lines
4.1 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Rogue;
|
|
using CalamityMod.Tiles.Furniture.CraftingStations;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Rogue
|
|
{
|
|
public class RoyalKnives : RogueWeapon
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Illustrious Knives");
|
|
Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user");
|
|
}
|
|
|
|
public override void SafeSetDefaults()
|
|
{
|
|
item.width = 18;
|
|
item.damage = 1600;
|
|
item.noMelee = true;
|
|
item.noUseGraphic = true;
|
|
item.useAnimation = 12;
|
|
item.useStyle = 1;
|
|
item.useTime = 12;
|
|
item.knockBack = 3f;
|
|
item.UseSound = SoundID.Item39;
|
|
item.autoReuse = true;
|
|
item.height = 20;
|
|
item.value = Item.buyPrice(5, 0, 0, 0);
|
|
item.rare = 10;
|
|
item.shoot = ModContent.ProjectileType<IllustriousKnife>();
|
|
item.shootSpeed = 9f;
|
|
item.Calamity().rogue = true;
|
|
item.Calamity().postMoonLordRarity = 16;
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
float num72 = item.shootSpeed;
|
|
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
|
Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default);
|
|
Vector2 vector3 = Main.MouseWorld - vector2;
|
|
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
|
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
|
if (player.gravDir == -1f)
|
|
{
|
|
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
|
|
}
|
|
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
|
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
|
|
{
|
|
num78 = (float)player.direction;
|
|
num79 = 0f;
|
|
num80 = num72;
|
|
}
|
|
else
|
|
{
|
|
num80 = num72 / num80;
|
|
}
|
|
num78 *= num80;
|
|
num79 *= num80;
|
|
int num146 = 4;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
num146++;
|
|
}
|
|
if (Main.rand.NextBool(4))
|
|
{
|
|
num146++;
|
|
}
|
|
if (Main.rand.NextBool(8))
|
|
{
|
|
num146++;
|
|
}
|
|
if (Main.rand.NextBool(16))
|
|
{
|
|
num146++;
|
|
}
|
|
for (int num147 = 0; num147 < num146; num147++)
|
|
{
|
|
float num148 = num78;
|
|
float num149 = num79;
|
|
float num150 = 0.05f * (float)num147;
|
|
num148 += (float)Main.rand.Next(-35, 36) * num150;
|
|
num149 += (float)Main.rand.Next(-35, 36) * num150;
|
|
num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149));
|
|
num80 = num72 / num80;
|
|
num148 *= num80;
|
|
num149 *= num80;
|
|
float x4 = vector2.X;
|
|
float y4 = vector2.Y;
|
|
Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType<IllustriousKnife>(), damage, knockBack, player.whoAmI, 0f, 0f);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<ShadowspecBar>(), 5);
|
|
recipe.AddIngredient(ModContent.ItemType<CoreofCalamity>(), 3);
|
|
recipe.AddIngredient(ModContent.ItemType<EmpyreanKnivesThrown>());
|
|
recipe.AddTile(ModContent.TileType<DraedonsForge>());
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|