Start code for corrupted swarm, add placeholder sprites for new sets, add Corrupted rarity.
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Graphics;
|
||||
using System;
|
||||
using ForgottenWawiTech.Content.Rarities;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Items.Global
|
||||
{
|
||||
public class CorruptedRarityTooltip : GlobalItem
|
||||
{
|
||||
public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset)
|
||||
{
|
||||
// Only apply special rendering to items with CorruptedItem rarity
|
||||
if (item.rare != ModContent.RarityType<CorruptedItem>())
|
||||
return base.PreDrawTooltipLine(item, line, ref yOffset);
|
||||
|
||||
// Only modify the ItemName line
|
||||
if (line.Mod == "Terraria" && line.Name == "ItemName")
|
||||
{
|
||||
float time = Main.GlobalTimeWrappedHourly;
|
||||
|
||||
// Create a glitchy/corrupted offset effect
|
||||
const float glitchHz = 3.0f;
|
||||
float glitchT = (float)((Math.Sin(time * glitchHz * MathHelper.TwoPi) + 1f) * 0.5f);
|
||||
|
||||
// Random glitch offsets (subtle)
|
||||
float xGlitch = (float)(Math.Sin(time * 7.3f) * 2f * glitchT);
|
||||
float yGlitch = (float)(Math.Cos(time * 5.7f) * 1.5f * glitchT);
|
||||
|
||||
Vector2 position = new Vector2(line.X + xGlitch, line.Y + yGlitch);
|
||||
|
||||
// Draw multiple offset copies for a "corrupted" chromatic aberration effect
|
||||
Color redShift = new Color(255, 50, 50, 100);
|
||||
Color blueShift = new Color(50, 150, 255, 100);
|
||||
Color greenShift = new Color(50, 255, 150, 100);
|
||||
|
||||
// Draw offset shadow layers for RGB split effect
|
||||
DynamicSpriteFontExtensionMethods.DrawString(
|
||||
Main.spriteBatch,
|
||||
line.Font,
|
||||
line.Text,
|
||||
position + new Vector2(-2f, 0f),
|
||||
redShift,
|
||||
line.Rotation,
|
||||
line.Origin,
|
||||
line.BaseScale.X,
|
||||
SpriteEffects.None,
|
||||
0f
|
||||
);
|
||||
|
||||
DynamicSpriteFontExtensionMethods.DrawString(
|
||||
Main.spriteBatch,
|
||||
line.Font,
|
||||
line.Text,
|
||||
position + new Vector2(2f, 0f),
|
||||
blueShift,
|
||||
line.Rotation,
|
||||
line.Origin,
|
||||
line.BaseScale.X,
|
||||
SpriteEffects.None,
|
||||
0f
|
||||
);
|
||||
|
||||
DynamicSpriteFontExtensionMethods.DrawString(
|
||||
Main.spriteBatch,
|
||||
line.Font,
|
||||
line.Text,
|
||||
position + new Vector2(0f, -1.5f),
|
||||
greenShift,
|
||||
line.Rotation,
|
||||
line.Origin,
|
||||
line.BaseScale.X,
|
||||
SpriteEffects.None,
|
||||
0f
|
||||
);
|
||||
|
||||
// Get the animated rarity color
|
||||
ModRarity modRarity = RarityLoader.GetRarity(item.rare);
|
||||
Color mainColor = modRarity.RarityColor;
|
||||
|
||||
// Add extra pulsing glow effect
|
||||
const float glowHz = 1.5f;
|
||||
float glow = (float)((Math.Sin(time * glowHz * MathHelper.TwoPi) + 1f) * 0.5f);
|
||||
mainColor = Color.Lerp(mainColor, Color.White, glow * 0.3f);
|
||||
|
||||
// Draw black outline for better readability
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 offset = Vector2.Zero;
|
||||
switch (i)
|
||||
{
|
||||
case 0: offset = new Vector2(-1, 0); break;
|
||||
case 1: offset = new Vector2(1, 0); break;
|
||||
case 2: offset = new Vector2(0, -1); break;
|
||||
case 3: offset = new Vector2(0, 1); break;
|
||||
}
|
||||
|
||||
DynamicSpriteFontExtensionMethods.DrawString(
|
||||
Main.spriteBatch,
|
||||
line.Font,
|
||||
line.Text,
|
||||
position + offset,
|
||||
Color.Black * 0.8f,
|
||||
line.Rotation,
|
||||
line.Origin,
|
||||
line.BaseScale.X,
|
||||
SpriteEffects.None,
|
||||
0f
|
||||
);
|
||||
}
|
||||
|
||||
// Draw main text
|
||||
DynamicSpriteFontExtensionMethods.DrawString(
|
||||
Main.spriteBatch,
|
||||
line.Font,
|
||||
line.Text,
|
||||
position,
|
||||
mainColor,
|
||||
line.Rotation,
|
||||
line.Origin,
|
||||
line.BaseScale.X,
|
||||
SpriteEffects.None,
|
||||
0f
|
||||
);
|
||||
|
||||
return false; // Prevent default drawing
|
||||
}
|
||||
|
||||
return base.PreDrawTooltipLine(item, line, ref yOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user