Files
CalamityModPublic/Items/Accessories/DynamoStemCells.cs
T

56 lines
1.8 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Terraria;
using Terraria.ID;
using Terraria.DataStructures;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Terraria.GameContent;
namespace CalamityMod.Items.Accessories
{
public class DynamoStemCells : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void SetStaticDefaults()
{
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 5));
ItemID.Sets.AnimatesAsSoul[Type] = true;
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.value = CalamityGlobalItem.Rarity11BuyPrice;
Item.rare = ItemRarityID.Purple;
Item.accessory = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.Calamity().dynamoStemCells = true;
player.moveSpeed += 0.1f;
player.buffImmune[BuffID.Electrified] = true;
player.buffImmune[ModContent.BuffType<Dragonfire>()] = true;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
CalamityUtils.DrawInventoryCustomScale(
spriteBatch,
texture: TextureAssets.Item[Type].Value,
position,
frame,
drawColor,
itemColor,
origin,
scale,
wantedScale: 0.95f,
drawOffset: new(0f, 0f)
);
return false;
}
}
}