Files
CalamityModPublic/Items/Accessories/WulfrumBattery.cs
T
Ozzatron 22afdd3933 1 - Calamity sell prices increase much more sharply with rarity.
2 - (Example) Post DoG items are now 2 platinum instead of 1 platinum 40 gold.
3 - (Example) Dev items are now 2 platinum 80 gold instead of 2 platinum.
4 - Privated numeric rarity item values.
5 - All assigned item values use the rarity's names, e.g. RarityLightPurpleBuyPrice.
2024-04-17 21:20:17 -04:00

91 lines
3.2 KiB
C#

using CalamityMod.Items.Materials;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
public class WulfrumBattery : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static readonly SoundStyle ExtraDropSound = new("CalamityMod/Sounds/Custom/WulfrumExtraDrop") { PitchVariance = 0.3f };
public override void SetStaticDefaults()
{
ItemID.Sets.ExtractinatorMode[Item.type] = Item.type;
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 22;
Item.value = CalamityGlobalItem.RarityBlueBuyPrice;
Item.accessory = true;
Item.rare = ItemRarityID.Blue;
//Needed for extractination
Item.useStyle = ItemUseStyleID.HiddenAnimation;
Item.useAnimation = 10;
Item.useTime = 2;
Item.consumable = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.GetDamage<SummonDamageClass>() += 0.07f;
if (!hideVisual)
player.GetModPlayer<WulfrumBatteryPlayer>().battery = true;
}
//Scrappable for 3-6 wulfrum scrap or a 20% chance to get an energy core
public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack)
{
resultType = ModContent.ItemType<WulfrumMetalScrap>();
resultStack = Main.rand.Next(3, 6);
if (Main.rand.NextFloat() > 0.8f)
{
resultStack = 1;
resultType = ModContent.ItemType<EnergyCore>();
}
}
}
public class WulfrumBatteryPlayer : ModPlayer
{
public bool battery = false;
public override void ResetEffects() => battery = false;
public override void UpdateDead() => battery = false;
}
public class WulfrumBatteryGlobalProjectile : GlobalProjectile
{
public override void AI(Projectile projectile)
{
if (!projectile.npcProj && !projectile.trap && projectile.minion && !ProjectileID.Sets.MinionShot[projectile.type] && Main.player[projectile.owner].GetModPlayer<WulfrumBatteryPlayer>().battery)
{
float lightMult = 1f;
if (Lighting.UpdateEveryFrame) //The light loks wayyy too bright in retro/trippy
lightMult *= 0.25f;
Lighting.AddLight(projectile.Center, Color.LightGreen.ToVector3() * lightMult);
if (Main.rand.NextBool(15))
{
float size = (projectile.Hitbox.Size() / 2f).Length();
Dust zapDust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * size, 66, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(0.5f, 1.3f));
zapDust.noGravity = true;
zapDust.color = Main.rand.NextBool() ? Color.SkyBlue : Color.LightGreen;
zapDust.velocity = projectile.velocity * 0.2f;
}
}
}
}
}