Files
Nathanael Overton ed13dc3274 Lucrecia (+lightspeed kinda) changes
- Slowed down base swing speed/frequency for the M1 but increased its energy gain on hit and hitbox size to compensate (hitbox was deceptively small to begin with compared to the visuals); this will require additional testing since it is likely worse overall
- Removed the M1’s projectile hitsound and replaced the sound that plays when reaching max energy (since both Lucrecia and Lightspeed share the latter, it affects both of them)
- Resource is now named “Darklight Energy” and all mentions of the resource have been adjusted accordingly
- Small sparkles burst from the player when at max energy
- More sensible internal naming schemes
- Multiple minor visual adjustments to the M1, the M2, and their projectiles
2025-12-21 16:41:55 -05:00

72 lines
3.8 KiB
C#

using System;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.Localization;
using static CalamityMod.CalamityUtils;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Cooldowns
{
public class DarklightEnergy : CooldownHandler
{
private float AdjustedCompletion => instance.timeLeft / (float)Lucrecia.MaxEnergy;
private Color TextColor => Color.MediumPurple;
private Color TextBorderColor = Color.AntiqueWhite;
public static new string ID => "DarklightEnergy";
public override bool CanTickDown => false;
public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType<Lucrecia>();
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => $"CalamityMod/Cooldowns/{ID}";
public override string OutlineTexture => $"CalamityMod/Cooldowns/{ID}Outline";
public override string OverlayTexture => $"CalamityMod/Cooldowns/{ID}Overlay";
public override Color OutlineColor => Color.SlateGray;
public override Color CooldownStartColor => Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion);
public override Color CooldownEndColor => Color.Lerp(Color.DarkBlue, Color.SlateGray, instance.Completion);
public override void ApplyBarShaders(float opacity)
{
// Use the adjusted completion
GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor);
GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor);
GameShaders.Misc["CalamityMod:CircularBarShader"].Apply();
}
public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
base.DrawExpanded(spriteBatch, position, opacity, scale);
Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f);
DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale);
}
public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = Request<Texture2D>(Texture).Value;
Texture2D outline = Request<Texture2D>(OutlineTexture).Value;
Texture2D overlay = Request<Texture2D>(OverlayTexture).Value;
// Draw the outline
spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f);
// Draw the icon
spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
// Draw the small overlay
int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion);
Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight);
spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f);
DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale);
}
}
}