Merge branch 'Rarity-and-tags' into dev-weaver-tail

This commit is contained in:
doze-zoze committed 2026-04-07 18:12:39 -05:00
commit 9847892d9f
63 files changed
+633 -352

No files matched your search

+156
View File
@@ -0,0 +1,156 @@
using System;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.Rarities;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.UI.Chat;
namespace CalamityMod.ChatTags
{
// This is a tag handler for storing custom color effects for text all within the "ceffect" tag; the parameter determining the actual effect in use.
// i.e [ceffect/darksun:Hello World] would apply darksun effect to "Hello World".
public sealed class CustomColorEffectHandler : AbstractTagHandler<CustomColorEffectHandler>
{
protected override string[] TagNames { get; } = ["ceffect", "ce"];
public override TextSnippet Parse(string text, Color baseColor = new(), string options = null)
{
if (!CalamityClientConfig.Instance.TextEffects)
return new TextSnippet(text);
if (options.Equals("darksun", StringComparison.OrdinalIgnoreCase))
return new DarksunTextSnippet(text);
if (options.Equals("drunk", StringComparison.OrdinalIgnoreCase))
return new DrunkTextSnippet(text);
if (options.Equals("dog", StringComparison.OrdinalIgnoreCase))
return new DoGTextSnippet(text);
if (options.Equals("cosmic", StringComparison.OrdinalIgnoreCase))
return new CosmicPurple.CustomTextSnippet(text);
if (options.Equals("auric", StringComparison.OrdinalIgnoreCase))
return new BurnishedAuric.CustomTextSnippet(text);
if (options.Equals("calamity", StringComparison.OrdinalIgnoreCase))
return new CalamityRed.CustomTextSnippet(text);
if (options.Equals("exo", StringComparison.OrdinalIgnoreCase))
return new ExoticRainbow.CustomTextSnippet(text);
return new TextSnippet(text);
}
}
public sealed class DarksunTextSnippet(string text) : TextSnippet
{
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var font = FontAssets.MouseText.Value;
var BorderColor = new Color(255, 191, 73);
var HazeColor = new Color(238, 226, 153);
for (float f = 0f; f < MathHelper.TwoPi; f += MathHelper.TwoPi * 0.05f)
{
ChatManager.DrawColorCodedString(spriteBatch, font, text, position + new Vector2(2, 0).RotatedBy(f + Main.GlobalTimeWrappedHourly), Color.Lerp(BorderColor, HazeColor, (Main.mouseTextColor - 190) / 65f * 0.1f), 0f, Vector2.Zero, new Vector2(scale));
}
ChatManager.DrawColorCodedString(spriteBatch, font, text, position, Color.Black, 0f, Vector2.Zero, new Vector2(scale));
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
public sealed class DrunkTextSnippet(string text) : TextSnippet
{
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var matrix = spriteBatch.transformMatrix;
Main.spriteBatch.End(out var ss);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, matrix);
for (int i = 0; i < 3; i++) // Draw 3 lines of differing opacity, color, and displacement.
{
float timer = (float)Math.Sin(Main.GlobalTimeWrappedHourly + 1f) / 2f;
float angle = (Main.GlobalTimeWrappedHourly * 2f) + (i * MathHelper.TwoPi / 3f);
float radius = timer * (3f + i * 6f);
Vector2 offset = new Vector2((float)Math.Cos(angle) * 1.7f, (float)Math.Sin(angle) * 1f) * radius; // Offset in an elliptical pattern
Vector2 pos = position + offset;
color = CalamityUtils.MulticolorLerp(Math.Abs(timer + (i * 0.2f)) % 1f, Color.LightBlue, Color.LightGreen, (i == 3) ? Color.Blue : (i == 2) ? Color.Red : Color.White);
float opacity = 1f - (i * 0.2f);
float rotation = +(timer * (Main.GlobalTimeWrappedHourly * 0.00001f)); // This precision is intended
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, text, pos, color * opacity, rotation, Vector2.Zero, new Vector2(scale));
}
Main.spriteBatch.End();
Main.spriteBatch.Begin(ss);
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
public sealed class DoGTextSnippet(string text) : TextSnippet
{
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var pos = position;
using var lease = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice);
string txt = "";
var matrix = spriteBatch.transformMatrix;
using (spriteBatch.Scope())
{
using (lease.Scope(clearColor: Color.Transparent))
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, matrix);
foreach (var item in text)
{
pos = position;
pos.X += FontAssets.MouseText.Value.MeasureString(txt).X;
float sin = MathHelper.SmoothStep(0, 1, (MathF.Sin(pos.X * 0.02f + Main.GlobalTimeWrappedHourly * -1.5f) + 1) * 0.5f);
var c = Color.Lerp(Color.Cyan, Color.Fuchsia, sin);
ChatManager.DrawColorCodedString(spriteBatch, FontAssets.MouseText.Value, item.ToString(), pos + new Vector2(0, -2 + sin * 4), c, 0, Vector2.Zero, new Vector2(scale));
txt += item;
}
spriteBatch.End();
}
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
foreach (var item in ChatManager.ShadowDirections)
{
spriteBatch.Draw(lease.Target, Vector2.Zero + Vector2.TransformNormal(item * 2,matrix), null, Color.Black, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
spriteBatch.End();
}
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories
{
Item.width = 44;
Item.height = 108;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.accessory = true;
Item.expert = true;
+1 -1
View File
@@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
Item.defense = 20;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.expert = true;
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.GemTech
Item.height = 32;
Item.defense = 31;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.Calamity().donorItem = true;
}
+1 -1
View File
@@ -58,7 +58,7 @@ namespace CalamityMod.Items.Armor.GemTech
Item.height = 32;
Item.defense = 14;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = RarityType<BurnishedAuric>();
Item.rare = RarityType<ExoticRainbow>();
Item.Calamity().donorItem = true;
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.GemTech
Item.height = 26;
Item.defense = 24;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.Calamity().donorItem = true;
}
@@ -45,7 +45,6 @@ namespace CalamityMod.Items.Armor.GodSlayer
modPlayer.godSlayerDamage = true;
var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString();
player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusHurtDamageThreshold, hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds());
player.setBonus = player.setBonus.Replace("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
player.aggro += SetBonusAggroBoost;
if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID))
@@ -45,7 +45,6 @@ namespace CalamityMod.Items.Armor.GodSlayer
modPlayer.godSlayerRanged = true;
var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString();
player.setBonus = this.GetLocalization("SetBonus").Format(ShrapnelRoundCooldown.FramesToSeconds(), hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds());
player.setBonus = player.setBonus.Replace("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID))
{
modPlayer.DeferredDashID = GodslayerArmorDash.ID;
@@ -50,7 +50,6 @@ namespace CalamityMod.Items.Armor.GodSlayer
modPlayer.wearingRogueArmor = true;
var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString();
player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), RogueDamageBoostAtFullHealth.ToPercent(), SetBonusHurtDamageThreshold, hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds());
player.setBonus = player.setBonus.Replace("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID))
{
modPlayer.DeferredDashID = GodslayerArmorDash.ID;
-82
View File
@@ -1655,35 +1655,6 @@ namespace CalamityMod.Items
return false;
}
// IV Drip tooltip FX
if (line.Mod == "Terraria" && item.type == ModContent.ItemType<IVDripOnTheRocks>() && line.Name == "Tooltip4")
{
Vector2 basePosition = new Vector2(line.X, line.Y);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix);
for (int i = 0; i < 3; i++) // Draw 3 lines of differing opacity, color, and displacement.
{
float timer = (float)Math.Sin(Main.GlobalTimeWrappedHourly + 1f) / 2f;
float angle = (Main.GlobalTimeWrappedHourly * 2f) + (i * MathHelper.TwoPi / 3f);
float radius = timer * (3f + i * 6f);
Vector2 offset = new Vector2((float)Math.Cos(angle) * 1.7f, (float)Math.Sin(angle) * 1f) * radius; // Offset in an elliptical pattern
Vector2 pos = basePosition + offset;
Color color = MulticolorLerp(Math.Abs(timer + (i * 0.2f)) % 1f, Color.LightBlue, Color.LightGreen, (i == 3) ? Color.Blue : (i == 2) ? Color.Red : Color.White);
float opacity = 1f - (i * 0.2f);
float rotation = line.Rotation + (timer * (Main.GlobalTimeWrappedHourly * 0.00001f)); // This precision is intended
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, pos, color * opacity, rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread);
}
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
return false;
}
if (line.Mod == "Terraria" && item.type == ModContent.ItemType<OntologicalDespoiler>() && (line.Name == "Tooltip1" || line.Name == "Tooltip2" || line.Name == "Tooltip4" || line.Name == "Tooltip5" || line.Name == "Tooltip7"))
{
Color rarityColor = Color.Black;
@@ -1791,60 +1762,7 @@ namespace CalamityMod.Items
// Might be used for Miracle stuff later or something idk
/*if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType<Orderbringer>())
{
Color rarityColor = Color.White;
Vector2 basePosition = new Vector2(line.X, line.Y);
float rate = Main.GlobalTimeWrappedHourly * 29;
List<Color> eColors = new List<Color>()
{
Color.PaleVioletRed,
Color.Coral,
Color.Khaki,
Color.PaleGreen,
Color.Turquoise,
Color.Violet
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3 / MathHelper.Pi);
sine = (float)Math.Pow(MathHelper.Lerp(sine, 0, 0.35f), 5);
Vector2 backScale = line.BaseScale;
Color backColor = usedColor;
Vector2 shake = Main.rand.NextVector2Circular(15, 15) * sine;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix);
int draws = 20;
for (int i = 0; i < draws; i++)
{
shake = Main.rand.NextVector2Circular(15, 15) * sine;
Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (5 + 0.5f * sine);
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake * 4 + backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread);
}
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Vector2 drawPosition = basePosition;
Color drawColor = backColor;
Vector2 rotationPoint = texture.Size() * 0.5f;
for (int i = 0; i < 6; i++)
{
int length = line.Text.Length;
Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 10 + Vector2.UnitX * (i % 2 == 0 ? -7 * i : 7 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(1 - 0.05f * i * (1 + 0.2f * -sine), 1 + 0.75f * i * (1 + 0.2f * sine) * 1f) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None);
}
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
// Draw the front text as usual.
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake + basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread);
return false;
}*/
return true;
}
+1 -1
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes
public override void SafeSetDefaults()
{
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.value = Item.sellPrice(gold: 2, silver: 50);
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Dyes
public override void SafeSetDefaults()
{
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.value = Item.sellPrice(gold: 2, silver: 50);
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials
Item.height = 56;
Item.maxStack = Item.CommonMaxStack;
Item.value = Item.sellPrice(gold: 6, silver: 66, copper: 66);
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
}
public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale)
{
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Materials
Item.height = 52;
Item.maxStack = Item.CommonMaxStack;
Item.value = Item.sellPrice(gold: 7);
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale)
{
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials
Item.height = 80;
Item.maxStack = Item.CommonMaxStack;
Item.value = Item.sellPrice(platinum: 1);
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, Vector2 origin, float baseScale)
+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Pets
{
Item.DefaultToVanitypet(ModContent.ProjectileType<SCalPet>(), ModContent.BuffType<ClassicSCalPetBuff>());
Item.value = Item.sellPrice(gold: 20);
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.Calamity().donorItem = true;
}
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations
{
Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.Furniture.CraftingStations.DraedonsForge>());
Item.value = Item.sellPrice(platinum: 4);
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup)
+1 -1
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.SummonItems
{
Item.width = 34;
Item.height = 54;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
}
public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup)
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.noUseGraphic = true;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
@@ -16,11 +16,6 @@ namespace CalamityMod.Items.Weapons.Magic
public class HyperdeathRiftScepter : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Magic";
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
tooltips.FindAndReplaceAll("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
}
public override void SetStaticDefaults()
{
Item.staff[Type] = true;
+1 -1
View File
@@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.shoot = ModContent.ProjectileType<EnormousConsumingVortex>();
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = SoundID.Item84;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.noMelee = true;
Item.channel = true;
+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.shoot = ModContent.ProjectileType<VehemenceHoldout>();
Item.shootSpeed = 16.5f;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
}
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<VividBeam>();
Item.shootSpeed = 6f;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
+1 -1
View File
@@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.shoot = ProjectileType<ExobladeProj>();
Item.shootSpeed = 9f;
Item.rare = RarityType<BurnishedAuric>();
Item.rare = RarityType<ExoticRainbow>();
}
public override bool CanShoot(Player player)
-4
View File
@@ -20,10 +20,6 @@ namespace CalamityMod.Items.Weapons.Melee
{
base.SetStaticDefaults();
}
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
tooltips.FindAndReplaceAll("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
}
public override void SetDefaults()
{
Item.width = 78;
+1 -1
View File
@@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.shoot = ModContent.ProjectileType<PhotonRipperProjectile>();
Item.shootSpeed = 1f;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.width = Item.height = 28;
Item.damage = 128;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.noMelee = true;
Item.noUseGraphic = true;
Item.channel = true;
-2
View File
@@ -20,8 +20,6 @@ namespace CalamityMod.Items.Weapons.Melee
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
tooltips.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"));
if (!Main.zenithWorld)
tooltips.FindAndReplaceAll("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
}
public override void SetStaticDefaults()
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.shoot = ModContent.ProjectileType<ViolenceThrownProjectile>();
Item.shootSpeed = 15f;
Item.channel = true;
+1 -1
View File
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.noMelee = true;
Item.knockBack = 5f;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<CondemnationArrow>();
Item.shootSpeed = 16f;
+1 -1
View File
@@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.shootSpeed = 12f;
Item.useAmmo = AmmoID.Arrow;
Item.useTurn = true;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.shoot = ModContent.ProjectileType<MagnomalyRocket>();
Item.shootSpeed = 15f;
Item.useAmmo = AmmoID.Rocket;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override Vector2? HoldoutOffset() => new Vector2(-30, -10);
+1 -1
View File
@@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.noMelee = true;
Item.noUseGraphic = true;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
}
+1 -1
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.channel = true;
Item.knockBack = 8f;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<PrismEnergyBullet>();
Item.shootSpeed = 11f;
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.noMelee = true;
Item.knockBack = 8f;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.UseSound = SoundID.Item14;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<PrismMine>();
@@ -22,10 +22,6 @@ namespace CalamityMod.Items.Weapons.Ranged
{
CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true;
}
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
tooltips.FindAndReplaceAll("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
}
public override void SetDefaults()
{
Item.width = 40;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.shoot = ModContent.ProjectileType<CelestusProj>();
Item.useStyle = ItemUseStyleID.Swing;
Item.UseSound = SoundID.Item1;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.autoReuse = true;
Item.noMelee = true;
@@ -35,11 +35,6 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.shootSpeed = Speed;
}
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
tooltips.FindAndReplaceAll("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.noMelee = true;
Item.noUseGraphic = true;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override float StealthDamageMultiplier => 0.3f;
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.shootSpeed = 16f;
Item.DamageType = RogueDamageClass.Instance;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.shoot = ModContent.ProjectileType<SupernovaBomb>();
Item.shootSpeed = 16f;
Item.DamageType = RogueDamageClass.Instance;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override float StealthDamageMultiplier => 0.7f;
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.noMelee = true;
Item.noUseGraphic = true;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
+1 -1
View File
@@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.knockBack = 1f;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.UseSound = SoundID.Item117;
Item.shoot = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
+1 -1
View File
@@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.shootSpeed = 10f;
Item.noUseGraphic = true;
Item.DamageType = DamageClass.Summon;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
Item.sentry = true;
}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.noMelee = true;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<ExoticRainbow>();
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 10;
+1 -1
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.noMelee = true;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
Item.useStyle = ItemUseStyleID.Swing;
Item.UseSound = SoundID.DD2_EtherianPortalOpen;
}
+1 -1
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.DamageType = DamageClass.Summon;
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
Item.rare = ModContent.RarityType<BurnishedAuric>();
Item.rare = ModContent.RarityType<CalamityRed>();
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
@@ -19,11 +19,6 @@ namespace CalamityMod.Items.Weapons.Summon
public new string LocalizationCategory => "Items.Weapons.Summon";
public bool FocusFetch = false;
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
tooltips.FindAndReplaceAll("ff00ff", Utils.Hex3(DevourerofGodsHead.SpecialMoveColor));
}
public override void SetDefaults()
{
Item.width = 68;
@@ -1032,7 +1032,7 @@ IVDripOnTheRocks: {
Multiplies all weapon damage by {1}x
Counts as an alcohol stack toward Alcohol Poisoning
{$Common.AlcoholWarning}
'(drunken mumbling)'
[ceffect/drunk:'(drunken mumbling)']
'''
}
@@ -422,10 +422,10 @@ GodSlayerChestplate: {
Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}"
CommonSetBonus:
'''
Press {0} to [c/ff00ff:Dimensional Drive] towards your cursor for 2 seconds
Press {0} to [ceffect/dog:Dimensional Drive] towards your cursor for 2 seconds
Enemies you dash through take massive damage
During [c/ff00ff:Dimensional Drive] you are immune to damage and most debuffs
[c/ff00ff:Dimensional Drive] has a {1} second cooldown
During [ceffect/dog:Dimensional Drive] you are immune to damage and most debuffs
[ceffect/dog:Dimensional Drive] has a {1} second cooldown
'''
}
@@ -71,7 +71,7 @@ CosmicWorm: {
'''
Summons the Devourer of Gods
{$Common.NotConsumable}
'The Nameless Serpent has set out for you.'
[ceffect/dog:'The Nameless Serpent has set out for you.']
'''
}
@@ -437,7 +437,7 @@ Heresy: {
HyperdeathRiftScepter: {
DisplayName: Hyperdeath Rift Scepter
Tooltip: Tears space in two with [c/ff00ff:Hyperdeath Rift Ripper]
Tooltip: Tears space in two with [ceffect/dog:Hyperdeath Rift Ripper]
}
HyphaeRod: {
@@ -849,8 +849,8 @@ MawOfInfinity: {
'''
Swings a blade forged from the Devourer's maw in a 3-swing combo
The first swing only hits close range
The second swing additionally launches [c/ff00ff:Faith Incinerator]
The third swing unleashes [c/ff00ff:Divinity Devourer] at your cursor, exploding for massive damage
The second swing additionally launches [ceffect/dog:Faith Incinerator]
The third swing unleashes [ceffect/dog:Divinity Devourer] at your cursor, exploding for massive damage
'''
}
@@ -1380,7 +1380,7 @@ TheObliterator: {
{$Common.YoyoStatsInfinite}
[GFB]
'''
TooltipNormal: Occasionally performs a miniature [c/ff00ff:Dimensional Drive] at nearby foes
TooltipNormal: Occasionally performs a miniature [ceffect/dog:Dimensional Drive] at nearby foes
TooltipGFB: just a slight bit of dust spam on this weapon im afraid
}
@@ -1406,9 +1406,9 @@ ThreadOfEradication: {
DisplayName: Thread of Eradication
Tooltip:
'''
Charges up [c/ff00ff:God's Bane Doombeam]
Channelling the weapon causes it to charge up [c/ff00ff:Hyperdeath Rift] instead
While charging [c/ff00ff:Hyperdeath Rift], the bow's turning speed is slowed down
Charges up [ceffect/dog:God's Bane Doombeam]
Channelling the weapon causes it to charge up [ceffect/dog:Hyperdeath Rift] instead
While charging [ceffect/dog:Hyperdeath Rift], the bow's turning speed is slowed down
'''
}
@@ -308,7 +308,7 @@ DimensionTearingDisk: {
Tooltip:
'''
Throws a disk that tears space in the direction of the nearest enemy
Stealth strikes stick to enemies and unleash [c/ff00ff:God's Bane Doombeam Array]
Stealth strikes stick to enemies and unleash [ceffect/dog:God's Bane Doombeam Array]
'''
}
@@ -901,7 +901,7 @@ VoidEaterMarionette: {
'''
Contains the power to control a miniature Devourer
Repeated summons increase the length and power of the Devourer
The Devourer attacks with [c/ff00ff:Divinity Devourer], [c/ff00ff:Faith Incinerator] and [c/ff00ff:Ultracosmic Maelstrom]
The Devourer attacks with [ceffect/dog:Divinity Devourer], [ceffect/dog:Faith Incinerator] and [ceffect/dog:Ultracosmic Maelstrom]
Can play fetch with dropped items
Shift-<right> this item in your inventory when the Devourer has been spawned to prioritize fetching
'''
@@ -63,9 +63,9 @@ DoGBeam.DisplayName: Portal Laser
DoGBeamPortal.DisplayName: Beam Portal
DoGDeath.DisplayName: Death Beam
DoGDeathBoom.DisplayName: Cosmic Explosion
DoGFire.DisplayName: Faith Incinerator
DoGLaserWalls.DisplayName: God's Bane Doombeam Array
DoGLaserWallsBigBeam.DisplayName: Hyperdeath Rift Ripper
DoGFire.DisplayName: "[ceffect/dog:Faith Incinerator]"
DoGLaserWalls.DisplayName: "[ceffect/dog:God's Bane Doombeam Array]"
DoGLaserWallsBigBeam.DisplayName: "[ceffect/dog:Hyperdeath Rift Ripper]"
DoGP1EndPortal.DisplayName: Portal
DoGRiftCrack.DisplayName: DoG Distortion Crack
DoGTeleportRift.DisplayName: DoG Distortion Rift
@@ -61,10 +61,10 @@ Dragonfire1: "{0}'s ashes scatter in the wind."
Dragonfire2: "{0}'s embers fade away in a warm glow."
Dragonfire3: "{0} can no longer feel the heat of the dragonfire."
Dragonfire4: This was a fight {0} could not win.
DimensionalDrive: "{0} was blasted apart into space dust by the Dimensional Drive."
DivinityDevourer1: "{0} fell victim to the Divinity Devourer."
DivinityDevourer2: "{0} was consumed by the Divinity Devourer."
DivinityDevourer3: "{0}'s essence was snuffed by the Divinity Devourer."
DimensionalDrive: "{0} was blasted apart into space dust by [ceffect/dog:Dimensional Drive]."
DivinityDevourer1: "{0} fell victim to [ceffect/dog:Divinity Devourer]."
DivinityDevourer2: "{0} was consumed by [ceffect/dog:Divinity Devourer]."
DivinityDevourer3: "{0}'s essence was snuffed by [ceffect/dog:Divinity Devourer]."
ElementalMix1: "{0} was reduced to technicolor confetti."
ElementalMix2: "{0} was blasted apart by a harmonized elemental onslaught."
ElementalMix3: "{0} was overwhelmed by elemental turbulence."
@@ -110,8 +110,8 @@ SulphuricPoisoning1: "{0} was melted by the toxic waste."
SulphuricPoisoning2: "{0} ingested too many caustic chemicals."
SulphuricPoisoning3: "{0} couldn't handle the industrial backwash."
ThornBlossom: "{0} was violently pricked by a flower."
UltracosmicMaelstrom1: "{0} was sublimated by the Ultracosmic Maelstrom."
UltracosmicMaelstrom2: "{0} got cut down to size by the Ultracosmic Maelstrom."
UltracosmicMaelstrom1: "{0} was sublimated by [ceffect/dog:Ultracosmic Maelstrom]."
UltracosmicMaelstrom2: "{0} got cut down to size by [ceffect/dog:Ultracosmic Maelstrom]."
Vaporfied: "{0} vaporized into thin air."
VermillionFlux1: "{0} burst apart in a shower of scarlet sparks."
VermillionFlux2: "{0} went deathly stiff, still crackling with crimson."
+90 -59
View File
@@ -1,12 +1,14 @@
using System;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using Terraria.GameContent;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI.Chat;
using Terraria.ID;
namespace CalamityMod.Rarities
{
@@ -17,9 +19,83 @@ 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);
public static Color TextClr = new Color(157, 110, 11, 255);
static float lastFlashTime = 0f;
static bool isFlashing = false;
public sealed class CustomTextSnippet(string text) : TextSnippet
{
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (color == default || color == Main.MouseTextColorReal)
{
color = Colors.AlphaDarken(TextClr);
}
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var borderColor = color * 2f;
var coreColor = new Color(77, 0, 33);
var shineColor = new Color(254, 231, 117);
if (isFlashing)
{
shineColor = new Color(90, 207, 255);
position += Main.rand.NextVector2Circular(8f, 4.8f);
}
var pos = position;
using var lease = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice);
var matrix = spriteBatch.transformMatrix;
using (spriteBatch.Scope())
{
using (lease.Scope(clearColor: Color.Transparent))
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
ChatManager.DrawColorCodedString(spriteBatch, FontAssets.MouseText.Value, text, pos, Color.White, 0, Vector2.Zero, new Vector2(scale));
spriteBatch.End();
}
//Draw the base text
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, matrix);
for (float f = 0f; f < MathHelper.TwoPi; f += MathHelper.TwoPi * 0.125f)
{
spriteBatch.Draw(lease.Target, Vector2.Zero + new Vector2(2, 0).RotatedBy(f), null, borderColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
spriteBatch.Draw(lease.Target, Vector2.Zero, null, coreColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
spriteBatch.End();
//Draw the shine character-by-character
using (lease.Scope(clearColor: Color.Transparent))
{
string txt = "";
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
foreach (var item in text)
{
pos = position;
pos.X += FontAssets.MouseText.Value.MeasureString(txt).X;
float sin = (MathF.Sin(pos.X * 0.02f + Main.GlobalTimeWrappedHourly * -1.5f) + 1) * 0.5f;
var c = shineColor * MathF.Pow(sin, 120);
ChatManager.DrawColorCodedString(spriteBatch, FontAssets.MouseText.Value, item.ToString(), pos, c, 0, Vector2.Zero, new Vector2(scale));
txt += item;
}
spriteBatch.End();
}
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, matrix);
spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
spriteBatch.End();
}
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
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)
{
@@ -38,26 +114,20 @@ namespace CalamityMod.Rarities
isFlashing = false;
}
}
var fontSize = font.MeasureString(text);
var center = fontSize / 2.0f;
// Get all snippets and convert all plain text snippets to the custom rarity snippet
TextSnippet[] snippets = ChatManager.ParseMessage(text, textColor).ToArray();
for (int i = 0; i < snippets.Length; i++)
{
TextSnippet textSnippet = snippets[i];
if (snippets[i].GetType() == typeof(TextSnippet))
{
snippets[i] = new CustomTextSnippet(textSnippet.Text);
}
}
if (Item.expert)
textColor = Main.DiscoColor;
var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f);
textColor.A = 0;
float pulsing = 1.5f + (float)Math.Sin(time * 5f);
for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f)
{
ChatManager.DrawColorCodedString(
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 && CalamityClientConfig.Instance.TextEffects)
origin += Main.rand.NextVector2Circular(2f, 1.2f); // Small shake
}
if (isFlashing)
{
textColor = new Color(0, 183, 241, 50);
@@ -65,47 +135,8 @@ namespace CalamityMod.Rarities
}
textColor.A = 255;
ChatManager.DrawColorCodedString(spriteBatch, font, snippets, new(X, Y), textColor, 0, Vector2.Zero, baseScale, out _, -1, true);
// Shadow
ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale);
// Outline base
ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), new Color(77, 0, 33), rotation, origin, baseScale);
float shineWidth = 40f; //set to charSize
float shineSpeed = 80f;
float shineDisp = time * shineSpeed; //predicted current location of the shine based on the time and speed
float shinePos = (shineDisp % (fontSize.X + shineWidth));
Vector2 basePos = new Vector2(X, Y);
if (isFlashing && CalamityClientConfig.Instance.TextEffects)
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();
Vector2 charSize = font.MeasureString(c);
Vector2 charOrigin = charSize * 0.5f;
Vector2 charPos = basePos + new Vector2(charOffsetX, 0f);
float centerX = charPos.X + (charSize.X * baseScale.X) / 2f + 10.5f;
float dist = Math.Abs(centerX - (X + shinePos - shineWidth * 0.15f));
float intensity = 1f - MathHelper.Clamp(dist / shineWidth, 0f, 1f);
if (intensity > 0f)
{
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);
}
charOffsetX += charSize.X - text.Length * 0.0085f;
}
}
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)
+108 -87
View File
@@ -2,115 +2,136 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using Terraria.GameContent;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI.Chat;
using Terraria.ID;
namespace CalamityMod.Rarities
{
public class CalamityRed : ModRarity
{
// 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 => 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 sealed class CustomTextSnippet(string text) : TextSnippet
{
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (color == default || color == Main.MouseTextColorReal)
{
color = Colors.AlphaDarken(TextClr);
}
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var font = FontAssets.MouseText.Value;
var time = Main.GlobalTimeWrappedHourly;
var crystalTextGlow = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/CrystalTextGlow").Value;
var sparkle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/CrystalTextSparkle").Value;
var fontSize = ChatManager.GetStringSize(font, text, new Vector2(1));
var center = fontSize / 2f;
var glowPosition = position + new Vector2(size.X * 0.5f, size.Y * 0.5f);// new Vector2(X + center.X, Y + center.Y / 1.5f);
color.A = 0;
float pulsing = 10f + (float)Math.Sin(time * 20f);
float baseScalePulse = 1.03f;
float flameHeight = 5f;
float distortionAmount = 2f;
for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f)
{
float angle = f + (time * 2f % MathHelper.TwoPi);
float distortion = (float)Math.Sin((position.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 vscale = new Vector2(baseScalePulse * scaleVariation) * scale;
Color flameLayerColor = new Color(
(int)(color.R * 0.5f),
(int)(color.G * 0.5f),
(int)(color.B * 0.5f),
(int)(color.A * 0.5f)
);
ChatManager.DrawColorCodedString(
spriteBatch,
font,
text,
position + offset,
flameLayerColor,
0,
Vector2.Zero,
vscale
);
}
// Draw crisp center text
ChatManager.DrawColorCodedString(
spriteBatch,
font,
text,
position,
color,
0,
Vector2.Zero,
new Vector2(baseScalePulse)
);
color.A = 255;
var bloomColor = ColorTool.Rainbowing(time * 4 - 0.9f);
spriteBatch.Draw(crystalTextGlow, glowPosition, null, BloomClr, MathHelper.PiOver2, new Vector2(6f, 33f),
new Vector2(1.6f, fontSize.X / crystalTextGlow.Height * 1.2f), SpriteEffects.None, 0f);
ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, position, Color.Lerp(color,Color.White,0.67f), 0, Vector2.Zero, new(scale));
ChatManager.DrawColorCodedString(spriteBatch, font, text, position, Color.Black, 0, Vector2.Zero, new(scale));
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
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;
// Get all snippets and convert all plain text snippets to the custom rarity snippet
TextSnippet[] snippets = ChatManager.ParseMessage(text, textColor).ToArray();
for (int i = 0; i < snippets.Length; i++)
{
TextSnippet textSnippet = snippets[i];
if (snippets[i].GetType() == typeof(TextSnippet))
{
snippets[i] = new CustomTextSnippet(textSnippet.Text);
}
}
if (Item.expert)
textColor = Main.DiscoColor;
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);
// Is this a scrapped visual feature of the rarity?
/*int sparkleCount = Main.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(Main.rand.NextFloat(fontSize.X), Main.rand.NextFloat(fontSize.Y * 0.6f) + 1f);
float lifeTime = Main.GlobalTimeWrappedHourly * 4f + Main.rand.NextFloat(MathHelper.TwoPi * 7f);
lifeTime %= MathHelper.TwoPi * 1f;
}*/
ChatManager.DrawColorCodedString(spriteBatch, font, snippets, new(X, Y), textColor, 0, Vector2.Zero, baseScale, out _, -1, true);
return;
}
+7
View File
@@ -9,6 +9,7 @@ namespace CalamityMod.Rarities
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 static int RarityExoticRainbow => ModContent.GetInstance<ExoticRainbow>().Type;
public override bool PreDrawTooltipLine(Item Item, DrawableTooltipLine line, ref int yOffset)
@@ -30,6 +31,12 @@ namespace CalamityMod.Rarities
CalamityRed.Draw(Item, line);
return false;
}
if (Item.rare == RarityExoticRainbow)
{
ExoticRainbow.Draw(Item, line);
return false;
}
}
return true;
}
+53 -36
View File
@@ -1,13 +1,14 @@
using System;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using Terraria.GameContent;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI.Chat;
using Terraria.Utilities;
using Terraria.ID;
namespace CalamityMod.Rarities
{
@@ -19,59 +20,75 @@ namespace CalamityMod.Rarities
public static float MaxY = 4.5f;
public static Color BloomClr = new Color(65, 38, 87, 0);
public static Color TextClr = new Color(103, 66, 138, 255);
public static UnifiedRandom rand = new UnifiedRandom(1);
public sealed class CustomTextSnippet(string text) : TextSnippet
{
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (color == default || color == Main.MouseTextColorReal)
{
color = Colors.AlphaDarken(TextClr);
}
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var font = FontAssets.MouseText.Value;
color.A = 255;
float pulsing = 2.5f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 5f);
for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f)
{
ChatManager.DrawColorCodedString(spriteBatch, font, text, position + new Vector2(pulsing, 0f).RotatedBy(f + Main.GlobalTimeWrappedHourly * 2f % MathHelper.TwoPi), color with { A = 0 } * 0.5f, 0, Vector2.Zero, new(scale));
}
ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, position, color * 2f, 0, Vector2.Zero, new(scale));
ChatManager.DrawColorCodedString(spriteBatch, font, text, position, Color.Black, 0, Vector2.Zero, new(scale));
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
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 fontSize = ChatManager.GetStringSize(font, text, new Vector2(1));
var center = fontSize / 2f;
if (Item.expert) textColor = Main.DiscoColor;
// this was intended behavior. i'm commenting it out for now because it seems like people do not like it.
/*
if (Item.expert)
textColor = Main.DiscoColor;
*/
var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f);
textColor.A = 0;
float pulsing = 2.5f + (float)Math.Sin(time * 5f);
for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f)
// Get all snippets and convert all plain text snippets to the custom rarity snippet
TextSnippet[] snippets = ChatManager.ParseMessage(text, textColor).ToArray();
for (int i = 0; i < snippets.Length; i++)
{
ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y) + new Vector2(pulsing, 0f).RotatedBy(f + time * 2f % MathHelper.TwoPi), textColor * 0.5f, rotation, origin, baseScale);
TextSnippet textSnippet = snippets[i];
if (snippets[i].GetType() == typeof(TextSnippet))
{
snippets[i] = new CustomTextSnippet(textSnippet.Text);
}
}
if (Item.expert)
textColor = Main.DiscoColor;
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);
//Draw backglow
var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f);
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);
//Draw text
ChatManager.DrawColorCodedString(spriteBatch, font, snippets, new(X,Y), textColor, 0, Vector2.Zero, baseScale, out _, -1, true);
//Draw sparkles
if (!renderTextSparkles)
return;
static int Hash(int x)
{
x ^= x >> 16;
x *= unchecked((int)0x7feb352d);
x ^= x >> 15;
x *= unchecked((int)0x846ca68b);
x ^= x >> 16;
return x;
}
// why was this using a string hash previously??????
var rand = new UnifiedRandom(Hash((int)(center.X + center.Y)));
rand.SetSeed(1);
int sparkleCount = rand.Next((int)fontSize.X / 7, (int)fontSize.X / 5) + 1;
var color2 = lightColor;
color2.A = 0;
+159
View File
@@ -0,0 +1,159 @@
using System;
using System.Collections.Generic;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI.Chat;
namespace CalamityMod.Rarities
{
public class ExoticRainbow : ModRarity
{
// Exotic Rainbow is Rarity 17 (same as Calamity Red)
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 sealed class CustomTextSnippet(string text) : TextSnippet
{
public bool IsExpert = false;
public override bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = new Vector2(), Color color = new Color(), float scale = 1)
{
size = new Vector2(GetStringLength(FontAssets.MouseText.Value), FontAssets.MouseText.Value.MeasureString(" ").Y * scale);
if (color == default || color == Main.MouseTextColorReal)
{
color = Colors.AlphaDarken(TextClr);
}
if (!justCheckingString && (color.R != 0 || color.G != 0 || color.B != 0))
{
var font = FontAssets.MouseText.Value;
var time = Main.GlobalTimeWrappedHourly;
List<Color> eColors = new List<Color>()
{
new Color(255,107,107), //Ares
new Color(125,196,225), //Thanatos
new Color(211,235,108), //Apollo
//new Color(255,160,71), //Artemis
};
if (IsExpert)
eColors = new List<Color>()
{
new Color(255,70,70),
new Color(255,70,255),
new Color(70,70,255),
new Color(70,255,255),
new Color(70,255,90),
new Color(255,255,70)
};
var pos = position;
using var lease = ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice);
var matrix = spriteBatch.transformMatrix;
using (spriteBatch.Scope())
{
using (lease.Scope(clearColor: Color.Transparent))
{
string txt = "";
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
foreach (var item in text)
{
pos = position;
pos.X += FontAssets.MouseText.Value.MeasureString(txt).X;
float rate = Main.GlobalTimeWrappedHourly * (IsExpert ? 2 : 1) + pos.X * (IsExpert ? 0.01f : 0.005f);
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : MathF.Round(rate % 1f));
ChatManager.DrawColorCodedString(spriteBatch, FontAssets.MouseText.Value, item.ToString(), pos, usedColor, 0, Vector2.Zero, new Vector2(scale));
txt += item;
}
spriteBatch.End();
}
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, matrix);
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2 / MathHelper.Pi);
sine = (float)Math.Pow(MathHelper.Lerp(sine, 0, 0.35f), 5);
int draws = 16;
for (int i = 0; i < draws; i++)
{
Vector2 backPosition = (MathHelper.TwoPi * i / (float)draws + Main.GlobalTimeWrappedHourly * 1.7f).ToRotationVector2() * (4 + 16 * sine);
spriteBatch.Draw(lease.Target, Vector2.Zero + backPosition, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
Main.spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, matrix);
for (float f = 0f; f < MathHelper.TwoPi; f += MathHelper.TwoPi * 0.125f)
{
spriteBatch.Draw(lease.Target, Vector2.Zero + new Vector2(2, 0).RotatedBy(f), null, Color.Black, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
spriteBatch.End();
}
}
return true;
}
public override float GetStringLength(DynamicSpriteFont font)
{
float size = font.MeasureString(text).X;
return size * Scale;
}
}
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)
{
// Get all snippets and convert all plain text snippets to the custom rarity snippet
TextSnippet[] snippets = ChatManager.ParseMessage(text, textColor).ToArray();
for (int i = 0; i < snippets.Length; i++)
{
TextSnippet textSnippet = snippets[i];
if (snippets[i].GetType() == typeof(TextSnippet))
{
snippets[i] = new CustomTextSnippet(textSnippet.Text) { IsExpert = Item.expert };
}
}
ChatManager.DrawColorCodedString(spriteBatch, font, snippets, new(X, Y), textColor, 0, Vector2.Zero, baseScale, out _, -1, true);
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 ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly,
renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, 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);
}
// TODO: Add a cooler alternative for reforge rarities
/*public override int GetPrefixedRarity(int offset, float valueMult) => offset switch
{
-2 => ModContent.RarityType<BurnishedAuric>(),
-1 => ModContent.RarityType<HotPink>(),
_ => Type,
};*/
}
}