2 - Changed life fruit upgrade recipes. 3 - DoG phase 2 teleport refactor. 4 - Reduced life fruit spawns pre-mech by 3x.
71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using CalamityMod.CalPlayer;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Items.Potions;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.PermanentBoosters
|
|
{
|
|
public class MiracleFruit : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Miracle Fruit");
|
|
Tooltip.SetDefault("Refreshing and cool, perhaps even a bit minty\n" +
|
|
"Permanently increases maximum life by 25\n" +
|
|
"Can only be used if the max amount of life fruit has been consumed");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 20;
|
|
item.height = 20;
|
|
item.useAnimation = 30;
|
|
item.rare = ItemRarityID.Yellow;
|
|
item.useTime = 30;
|
|
item.useStyle = ItemUseStyleID.HoldingUp;
|
|
item.UseSound = SoundID.Item4;
|
|
item.consumable = true;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player)
|
|
{
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
if (modPlayer.mFruit || player.statLifeMax < 500)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override bool UseItem(Player player)
|
|
{
|
|
if (player.itemAnimation > 0 && player.itemTime == 0)
|
|
{
|
|
player.itemTime = item.useTime;
|
|
if (Main.myPlayer == player.whoAmI)
|
|
{
|
|
player.HealEffect(25);
|
|
}
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
modPlayer.mFruit = true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.LifeFruit, 5);
|
|
recipe.AddIngredient(ItemID.TealMushroom);
|
|
recipe.AddIngredient(ModContent.ItemType<TrapperBulb>(), 5);
|
|
recipe.AddIngredient(ModContent.ItemType<BarofLife>(), 5);
|
|
recipe.AddIngredient(ModContent.ItemType<LivingShard>(), 10);
|
|
recipe.AddTile(TileID.MythrilAnvil);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|