Advertisement
Guest User

Untitled

a guest
May 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.IO;
  5. using Terraria;
  6. using Terraria.ID;
  7. using Terraria.ModLoader;
  8.  
  9. namespace KhaelisPotionExpansion.Items
  10. {
  11.     public class FearlessPotion : ModItem
  12.     {
  13.         public override void SetDefaults()
  14.         {
  15.             base.SetDefaults();
  16.             item.name = "Fearless Potion"; //Name of the item
  17.             item.width = 14; //Width of the sprite when used
  18.             item.height = 24; //Height of the sprite when used
  19.             item.maxStack = 30; //Highest possible stack
  20.             AddTooltip("Increases Melee attack speed by 10%"); //Mouseover discription
  21.             item.buffType = mod.BuffType("FearlessBuff"); //Adds the buff type to the potion. Uses the "Name" from ModBase.cs
  22.             item.value = 1000; //Item shop value. 10 silver buy, 2 silver sell.
  23.             item.rare = 1; //Item rarity: Blue
  24.             item.useAnimation = 17; //How many frames it takes to fully use the item
  25.             item.useTime = 17; //Probably the same as useAnimation. So leave these values the same.
  26.             item.useStyle = 2; //The way an item is used. 2 = eating/drinking animation
  27.             item.consumable = true; //The item is consumed when used
  28.             item.useTurn = true; //Allowed to turn your character's direction while being used.
  29.             item.useSound = 3; //The sound played when using the item.
  30.         }
  31.         public override bool CanUseItem(Player player)
  32.         {
  33.             if (player.HasBuff(mod.BuffType("KhaelisSuperFearlessBuff")) >= 0)
  34.             {
  35.                 return false;
  36.             }
  37.             return true;
  38.         }
  39.         public override bool UseItem(Player player)
  40.         {
  41.             player.AddBuff(item.buffType, 21600); //Adds the buff when used.
  42.             return true;
  43.         }
  44.         public override void AddRecipes() //Adds the recipe list for this item
  45.         {
  46.             ModRecipe recipe = new ModRecipe(mod); //This is needed and will always be the same for every item.
  47.             recipe.AddIngredient(ItemID.BottledWater, 1); //These should be self explanitory. though, heres some more info. AddIngredient("ItemID", "AmountNeeded")
  48.             recipe.AddIngredient(ItemID.Deathweed, 1);
  49.             recipe.AddIngredient(ItemID.Fireblossom, 1);
  50.             recipe.AddIngredient(ItemID.AntlionMandible, 1);
  51.             recipe.SetResult(this, 1); //The items above will result in this item with a count of 1
  52.             recipe.AddTile(13); //The tile requirement for crafting. 13 = alchemy/bottle
  53.             recipe.AddRecipe(); //Adds the recipe to the list.
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement