Also I forgot to push my reality rupture and ichor spear minor tweaks before hand so they're in here too. Reality rupture stealth hit sound is louder. Reality rupture stealth visual always has at least one big crack, cracks fade out. There's more consistency in the spark particles on realty rupture stealth and ichor spear on hit sparks. Reality Rupture stealth produces light.
100 lines
3.8 KiB
C#
100 lines
3.8 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Dusts;
|
|
using CalamityMod.Items.Materials;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
namespace CalamityMod.Items.Weapons.Melee
|
|
{
|
|
public class AstralBlade : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Melee";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 85;
|
|
Item.DamageType = DamageClass.Melee;
|
|
Item.width = 80;
|
|
Item.height = 80;
|
|
Item.scale = 1.5f;
|
|
Item.useTime = 12;
|
|
Item.useAnimation = 12;
|
|
Item.useTurn = true;
|
|
Item.useStyle = ItemUseStyleID.Swing;
|
|
Item.knockBack = 4f;
|
|
Item.value = CalamityGlobalItem.Rarity9BuyPrice;
|
|
Item.rare = ItemRarityID.Cyan;
|
|
Item.UseSound = SoundID.Item1;
|
|
Item.autoReuse = true;
|
|
}
|
|
|
|
// Terraria seems to really dislike high crit values in SetDefaults
|
|
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25;
|
|
|
|
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 300);
|
|
}
|
|
|
|
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 300);
|
|
}
|
|
|
|
public override void MeleeEffects(Player player, Rectangle hitbox)
|
|
{
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool() ? ModContent.DustType<AstralOrange>() : ModContent.DustType<AstralBlue>(), 0.7f, 55, 110, -0.07f, 0.07f);
|
|
if (d != null)
|
|
{
|
|
d.customData = 0.03f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers)
|
|
{
|
|
// Avoid dividing by 0 at all costs.
|
|
if (target.lifeMax <= 0)
|
|
return;
|
|
|
|
float lifeRatio = MathHelper.Clamp(target.life / (float)target.lifeMax, 0f, 1f);
|
|
float multiplier = MathHelper.Lerp(1f, 2f, lifeRatio);
|
|
|
|
modifiers.SourceDamage *= multiplier;
|
|
modifiers.Knockback *= multiplier;
|
|
|
|
if (Main.rand.NextBool((int)MathHelper.Clamp((Item.crit + player.GetCritChance<MeleeDamageClass>()) * multiplier, 0f, 99f), 100))
|
|
modifiers.SetCrit();
|
|
|
|
if (multiplier > 1.5f)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item105, player.Center);
|
|
bool blue = Main.rand.NextBool();
|
|
float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi);
|
|
float var = 0.05f + (2f - multiplier);
|
|
for (float angle = 0f; angle < MathHelper.TwoPi; angle += var)
|
|
{
|
|
blue = !blue;
|
|
Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f);
|
|
Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType<AstralBlue>() : ModContent.DustType<AstralOrange>(), velocity);
|
|
d.customData = 0.025f;
|
|
d.scale = multiplier - 0.75f;
|
|
d.noLight = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient<AstralBar>(8).
|
|
AddTile(TileID.LunarCraftingStation).
|
|
Register();
|
|
}
|
|
}
|
|
}
|