Files
CalamityModPublic/Items/Materials/PlasmaDriveCore.cs
T
Altixal e1c848d45f bulk price changes part 1
- *Re-scaled price of most Calamity materials* (most drastically post-DoG)
- Shimmer transmutation price parity (same as og items)
- Applied consistent vanilla sell anchor values to Calamity items:
 - Buff potions: 2 silver
 - Flask: 5 silver
 - Uncommon critters: 10 silver
 - Potion fish: 15 silver
 - Lootable fish: 10 silver
 - Sashimi fish: 7.5 silver
 - Plentiful fish: 5 silver
 - Added value to Calamity seeds and saplings to match vanilla
2024-09-17 21:42:55 +07:00

54 lines
2.3 KiB
C#

using System;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Materials
{
public class PlasmaDriveCore : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Materials";
public override void SetDefaults()
{
Item.width = 30;
Item.height = 30;
Item.maxStack = 9999;
Item.value = 0;
Item.rare = ModContent.RarityType<DarkOrange>();
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
Texture2D tex = TextureAssets.Item[Item.type].Value;
//Give it an outline. Make it look really important and shiny. The player must not confuse this for a random material
spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
Color outlineColor = Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f);
Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it
GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f);
GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z));
GameShaders.Misc["CalamityMod:BasicTint"].Apply();
float outlineWidth = MathHelper.Lerp(2, 3, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f);
float positionOffset = outlineWidth * scale;
for (float i = 0; i < 1; i += 0.25f)
{
spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * positionOffset, frame, outlineColor, 0f, origin, scale, 0f, 0f);
}
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix);
return true;
}
}
}