Now that melee speed isn't everywhere this change that was made as a band aid balance fix once melee speed began effecting projectile weapons can be removed. Also made brimstone sword actually switch between Melee damge and melee no speed damage depending on the attack type and reduced its speed + gave it an extra update so it doesn't phase through enemies when thrown.
116 lines
4.6 KiB
C#
116 lines
4.6 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Melee;
|
|
using CalamityMod.Rarities;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Melee
|
|
{
|
|
[LegacyName("GalacticaBlade")]
|
|
public class GalactusBlade : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Melee";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 60;
|
|
Item.damage = 84;
|
|
Item.DamageType = DamageClass.Melee;
|
|
Item.useAnimation = 17;
|
|
Item.useStyle = ItemUseStyleID.Swing;
|
|
Item.useTime = 17;
|
|
Item.useTurn = true;
|
|
Item.knockBack = 6f;
|
|
Item.UseSound = SoundID.Item105;
|
|
Item.autoReuse = true;
|
|
Item.height = 58;
|
|
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
|
Item.rare = ModContent.RarityType<Turquoise>();
|
|
Item.shoot = ModContent.ProjectileType<GalacticaComet>();
|
|
Item.shootSpeed = 23f;
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
float num72 = Item.shootSpeed;
|
|
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
|
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;
|
|
}
|
|
|
|
int num107 = 5;
|
|
for (int num108 = 0; num108 < num107; num108++)
|
|
{
|
|
vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
|
|
vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
|
|
vector2.Y -= (float)(100 * num108);
|
|
num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
|
num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
|
if (num79 < 0f)
|
|
{
|
|
num79 *= -1f;
|
|
}
|
|
if (num79 < 20f)
|
|
{
|
|
num79 = 20f;
|
|
}
|
|
num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
|
num80 = num72 / num80;
|
|
num78 *= num80;
|
|
num79 *= num80;
|
|
float speedX4 = num78 + (float)Main.rand.Next(-100, 101) * 0.02f;
|
|
float speedY5 = num79 + (float)Main.rand.Next(-100, 101) * 0.02f;
|
|
int projectile = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType<GalacticaComet>(), damage, knockback, player.whoAmI, 0f, (float)Main.rand.Next(10));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void MeleeEffects(Player player, Rectangle hitbox)
|
|
{
|
|
if (Main.rand.NextBool(4))
|
|
{
|
|
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(2) ? 164 : 229);
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
|
|
}
|
|
|
|
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient(ItemID.StarWrath).
|
|
AddIngredient<DivineGeode>(10).
|
|
AddIngredient<GalacticaSingularity>(5).
|
|
AddTile(TileID.LunarCraftingStation).
|
|
Register();
|
|
}
|
|
}
|
|
}
|