79 lines
3.3 KiB
C#
79 lines
3.3 KiB
C#
using CalamityMod.Buffs.Potions;
|
|
using CalamityMod.Items.Materials;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Potions
|
|
{
|
|
public class DraconicElixir : ModItem
|
|
{
|
|
public int frameCounter = 0;
|
|
public int frame = 0;
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Draconic Elixir");
|
|
Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" +
|
|
"Silva invincibility heals you to half HP when triggered\n" +
|
|
"If you trigger the above heal you cannot drink this potion again for 60 seconds and you gain 30 seconds of potion sickness");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 50;
|
|
item.height = 44;
|
|
item.useTurn = true;
|
|
item.maxStack = 30;
|
|
item.rare = ItemRarityID.Orange;
|
|
item.useAnimation = 17;
|
|
item.useTime = 17;
|
|
item.useStyle = ItemUseStyleID.EatingUsing;
|
|
item.UseSound = SoundID.Item3;
|
|
item.consumable = true;
|
|
item.buffType = ModContent.BuffType<DraconicSurgeBuff>();
|
|
item.buffTime = CalamityUtils.SecondsToFrames(480f);
|
|
item.value = Item.buyPrice(0, 2, 0, 0);
|
|
}
|
|
|
|
public override bool CanUseItem(Player player) => !player.Calamity().draconicSurgeCooldown;
|
|
|
|
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
|
{
|
|
Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Potions/DraconicElixir_Animated");
|
|
spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), Color.White, 0f, origin, scale, SpriteEffects.None, 0);
|
|
return false;
|
|
}
|
|
|
|
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
|
|
{
|
|
Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Potions/DraconicElixir_Animated");
|
|
spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.BottledWater);
|
|
recipe.AddIngredient(ModContent.ItemType<HellcasterFragment>());
|
|
recipe.AddIngredient(ItemID.Daybloom);
|
|
recipe.AddIngredient(ItemID.Moonglow);
|
|
recipe.AddIngredient(ItemID.Fireblossom);
|
|
recipe.AddTile(TileID.AlchemyTable);
|
|
recipe.alchemy = true;
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
// Blood orb recipes don't get the Alchemy Table effect
|
|
recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.BottledWater);
|
|
recipe.AddIngredient(ModContent.ItemType<BloodOrb>(), 50);
|
|
recipe.AddIngredient(ModContent.ItemType<HellcasterFragment>());
|
|
recipe.AddTile(TileID.AlchemyTable);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|