Made Auric Rare more flashy, started on Calamity Red Visuals
I don't know how configs work, can someone make it not weird
This commit is contained in:
1 parent
5a94106954
commit
0b88bb233b
3 files changed
+158
-9
No files matched your search
@@ -22,10 +22,26 @@ namespace CalamityMod.Rarities
|
||||
public static float MaxY = 4.5f;
|
||||
public static Color BloomClr = new Color(48, 33, 4, 0);
|
||||
public static Color TextClr = new Color(157, 110, 11, 50);
|
||||
|
||||
static float lastFlashTime = 0f;
|
||||
static bool isFlashing = false;
|
||||
public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation,
|
||||
Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font)
|
||||
{
|
||||
float flashChance = 0.005f; // Low chance per frame
|
||||
float flashDuration = 0.2f; // Flash lasts ~0.2 seconds
|
||||
|
||||
if (Main.GameUpdateCount - lastFlashTime > flashDuration * 60)
|
||||
{
|
||||
if (Main.rand.NextFloat() < flashChance)
|
||||
{
|
||||
isFlashing = true;
|
||||
lastFlashTime = Main.GameUpdateCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
isFlashing = false;
|
||||
}
|
||||
}
|
||||
var fontSize = font.MeasureString(text);
|
||||
var center = fontSize / 2.0f;
|
||||
|
||||
@@ -39,6 +55,14 @@ namespace CalamityMod.Rarities
|
||||
spriteBatch, font, text,
|
||||
new Vector2(X, Y) + new Vector2(pulsing, 0f).RotatedBy(f + time * 2f % MathHelper.TwoPi),
|
||||
textColor * 0.5f, rotation, origin, baseScale);
|
||||
if (isFlashing)
|
||||
origin += Main.rand.NextVector2Circular(2f, 1.2f); // Small shake
|
||||
}
|
||||
|
||||
if (isFlashing)
|
||||
{
|
||||
textColor = new Color(0, 183, 241, 50);
|
||||
lightColor = new Color(14, 255, 255, 50);
|
||||
}
|
||||
|
||||
textColor.A = 255;
|
||||
@@ -56,9 +80,12 @@ namespace CalamityMod.Rarities
|
||||
float shinePos = (shineDisp % (fontSize.X + shineWidth));
|
||||
|
||||
Vector2 basePos = new Vector2(X, Y);
|
||||
if (isFlashing)
|
||||
basePos += Main.rand.NextVector2Circular(3f, 10f); // Small shake
|
||||
|
||||
float charOffsetX = 0f;
|
||||
|
||||
if (!renderTextSparkles)
|
||||
return;
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
string c = text[i].ToString();
|
||||
@@ -73,7 +100,7 @@ namespace CalamityMod.Rarities
|
||||
|
||||
if (intensity > 0f)
|
||||
{
|
||||
Color shineColor = new Color(255, 233, 155) * intensity * 1f;
|
||||
Color shineColor = isFlashing ? new Color(90, 207, 255) * intensity * 2f : new Color(254, 231, 117) * intensity * 1f;
|
||||
ChatManager.DrawColorCodedString(
|
||||
spriteBatch, font, c, charPos, shineColor, rotation, origin, baseScale);
|
||||
}
|
||||
@@ -81,9 +108,6 @@ namespace CalamityMod.Rarities
|
||||
charOffsetX += charSize.X - text.Length * 0.0085f;
|
||||
}
|
||||
|
||||
if (!renderTextSparkles)
|
||||
return;
|
||||
|
||||
var rand = new UnifiedRandom(Main.LocalPlayer.name.GetHashCode() + (int)(center.X + center.Y));
|
||||
}
|
||||
|
||||
|
||||
+122
-3
@@ -1,5 +1,15 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CatalystMod.Items;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Graphics;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Localization;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.UI.Chat;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Rarities
|
||||
{
|
||||
@@ -8,8 +18,117 @@ namespace CalamityMod.Rarities
|
||||
// Calamity Red is Rarity 17
|
||||
// This rarity should never be assigned to any items.
|
||||
// It is the equivalent of vanilla's Purple rarity (11): only used for positive reforges on top-rarity items.
|
||||
public override Color RarityColor => new Color(163, 25, 26); // #A3191A
|
||||
// (139, 0, 0) is the classic donator item color
|
||||
//public override Color RarityColor => new Color(163, 25, 26); // #A3191A
|
||||
// // (139, 0, 0) is the classic donator item color
|
||||
|
||||
public override Color RarityColor => TextClr * 2f;
|
||||
|
||||
public static float MaxY = 4.5f;
|
||||
public static Color BloomClr = new Color(180, 20, 75, 0);
|
||||
public static Color TextClr = new Color(242, 27, 27, 255);
|
||||
|
||||
public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation,
|
||||
Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font)
|
||||
{
|
||||
var crystalTextGlow = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/CrystalTextGlow").Value;
|
||||
var sparkle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/CrystalTextSparkle").Value;
|
||||
var fontSize = font.MeasureString(text);
|
||||
var center = fontSize / 2f;
|
||||
|
||||
var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f);
|
||||
textColor.A = 0;
|
||||
float pulsing = 10f + (float)Math.Sin(time * 20f);
|
||||
float baseScalePulse = 1.03f;
|
||||
float flameHeight = 5f;
|
||||
float distortionAmount = 2f;
|
||||
|
||||
if (renderTextSparkles)
|
||||
|
||||
for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f)
|
||||
{
|
||||
float angle = f + (time * 2f % MathHelper.TwoPi);
|
||||
|
||||
float distortion = (float)Math.Sin((Y + f * 100f + time * 20f) * 0.05f) * distortionAmount;
|
||||
|
||||
Vector2 offset = new Vector2(
|
||||
(float)Math.Cos(angle) * pulsing * 0.4f + distortion,
|
||||
-(float)Math.Abs((float)Math.Sin(angle)) * flameHeight
|
||||
);
|
||||
|
||||
float scaleVariation = 0.95f + 0.05f * (float)Math.Sin(time * 15f + f * 2f);
|
||||
Vector2 scale = new Vector2(baseScalePulse * scaleVariation);
|
||||
|
||||
Color flameLayerColor = new Color(
|
||||
(int)(textColor.R * 0.5f),
|
||||
(int)(textColor.G * 0.5f),
|
||||
(int)(textColor.B * 0.5f),
|
||||
(int)(textColor.A * 0.5f)
|
||||
);
|
||||
|
||||
ChatManager.DrawColorCodedString(
|
||||
spriteBatch,
|
||||
font,
|
||||
text,
|
||||
new Vector2(X, Y) + offset,
|
||||
flameLayerColor,
|
||||
rotation,
|
||||
origin,
|
||||
scale
|
||||
);
|
||||
}
|
||||
|
||||
// Draw crisp center text
|
||||
ChatManager.DrawColorCodedString(
|
||||
spriteBatch,
|
||||
font,
|
||||
text,
|
||||
new Vector2(X, Y),
|
||||
textColor,
|
||||
rotation,
|
||||
origin,
|
||||
new Vector2(baseScalePulse)
|
||||
);
|
||||
|
||||
textColor.A = 255;
|
||||
|
||||
ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale);
|
||||
|
||||
var bloomColor = ColorTool.Rainbowing(time * 4 - 0.9f);
|
||||
|
||||
spriteBatch.Draw(crystalTextGlow, glowPosition, null, lightColor, rotation + MathHelper.PiOver2, new Vector2(6f, 33f),
|
||||
new Vector2(1.6f, fontSize.X / crystalTextGlow.Height * 1.2f), SpriteEffects.None, 0f);
|
||||
|
||||
ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), Color.Black, rotation, origin, baseScale);
|
||||
|
||||
|
||||
|
||||
var rand = new UnifiedRandom(Main.LocalPlayer.name.GetHashCode() + (int)(center.X + center.Y));
|
||||
|
||||
int sparkleCount = rand.Next((int)fontSize.X / 7, (int)fontSize.X / 5) + 1;
|
||||
var color2 = lightColor * 1.00f;
|
||||
color2.A = 0;
|
||||
var sparkleOrigin = new Vector2(15f, 15f);
|
||||
for (int i = 0; i < sparkleCount; i++)
|
||||
{
|
||||
var v = new Vector2(rand.NextFloat(fontSize.X), rand.NextFloat(fontSize.Y * 0.6f) + 1f);
|
||||
float lifeTime = Main.GlobalTimeWrappedHourly * 4f + rand.NextFloat(MathHelper.TwoPi * 7f);
|
||||
lifeTime %= MathHelper.TwoPi * 1f;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null)
|
||||
{
|
||||
Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor == null ? TextClr : textColor.Value), lightColor == null ? BloomClr : lightColor.Value, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly,
|
||||
renderTextSparkles == null ? Language.ActiveCulture == GameCulture.FromCultureName(GameCulture.CultureName.Chinese) ? false : CalamityClientConfig.Instance.textEffects : renderTextSparkles.Value,
|
||||
FontAssets.MouseText.Value);
|
||||
}
|
||||
|
||||
public static void Draw(Item Item, DrawableTooltipLine line)
|
||||
{
|
||||
Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale);
|
||||
}
|
||||
|
||||
public override int GetPrefixedRarity(int offset, float valueMult) => offset switch
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace CatalystMod.Items
|
||||
{
|
||||
public static int RarityCosmicPurple => ModContent.GetInstance<CosmicPurple>().Type;
|
||||
public static int RarityBurnishedAuric => ModContent.GetInstance<BurnishedAuric>().Type;
|
||||
public static int RarityCalamityRed => ModContent.GetInstance<CalamityRed>().Type;
|
||||
|
||||
|
||||
public override bool PreDrawTooltipLine(Item Item, DrawableTooltipLine line, ref int yOffset)
|
||||
@@ -34,6 +35,11 @@ namespace CatalystMod.Items
|
||||
BurnishedAuric.Draw(Item, line);
|
||||
return false;
|
||||
}
|
||||
if (Item.rare == RarityCalamityRed)
|
||||
{
|
||||
CalamityRed.Draw(Item, line);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user