79 lines
2.6 KiB
C#
79 lines
2.6 KiB
C#
using CalamityMod.CalPlayer;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Rarities;
|
|
using Microsoft.Xna.Framework;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.PermanentBoosters
|
|
{
|
|
public class PhantomHeart : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Misc";
|
|
|
|
public const int ManaBoost = 50;
|
|
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost);
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
// For some reason Life/Mana boosting items are in this set (along with Magic Mirror+)
|
|
ItemID.Sets.SortingPriorityBossSpawns[Type] = 21; // Mana Crystal
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 20;
|
|
Item.height = 20;
|
|
Item.useAnimation = 30;
|
|
Item.useTime = 30;
|
|
Item.useStyle = ItemUseStyleID.HoldUp;
|
|
Item.UseSound = SoundID.Item29;
|
|
Item.consumable = true;
|
|
Item.rare = ModContent.RarityType<PureGreen>();
|
|
}
|
|
|
|
public override bool CanUseItem(Player player) => player.ConsumedManaCrystals == Player.ManaCrystalMax;
|
|
|
|
public override bool? UseItem(Player player)
|
|
{
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
if (player.itemAnimation > 0 && player.itemTime == 0)
|
|
{
|
|
player.itemTime = Item.useTime;
|
|
if (modPlayer.pHeart)
|
|
{
|
|
string key = "Mods.CalamityMod.Misc.PhantomHeartText";
|
|
Color messageColor = Color.Magenta;
|
|
CalamityUtils.DisplayLocalizedText(key, messageColor);
|
|
return false;
|
|
}
|
|
|
|
player.UseManaMaxIncreasingItem(ManaBoost);
|
|
modPlayer.pHeart = true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void ModifyTooltips(List<TooltipLine> list)
|
|
{
|
|
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1");
|
|
|
|
if (line != null && Main.LocalPlayer.Calamity().pHeart)
|
|
line.Text += "\n" + CalamityUtils.GetTextValue("Misc.GenericConsumedText");
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient<RuinousSoul>(5).
|
|
AddIngredient<Polterplasm>(25).
|
|
AddTile(TileID.LunarCraftingStation).
|
|
Register();
|
|
}
|
|
}
|
|
}
|