Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ QuickBuff()

void Terraria.Player.QuickBuff ( )
inline

Definition at line 4802 of file Player.cs.

4803 {
4804 if (cursed || CCed || dead)
4805 {
4806 return;
4807 }
4809 if (CountBuffs() == maxBuffs)
4810 {
4811 return;
4812 }
4814 if (item != null && ItemCheck_CheckCanUse(item))
4815 {
4816 legacySoundStyle = item.UseSound;
4817 int num = item.buffTime;
4818 if (num == 0)
4819 {
4820 num = 3600;
4821 }
4822 AddBuff(item.buffType, num);
4823 if (item.consumable)
4824 {
4825 item.stack--;
4826 if (item.stack <= 0)
4827 {
4828 item.TurnToAir();
4829 }
4830 }
4831 }
4832 if (CountBuffs() != maxBuffs)
4833 {
4834 int num2 = 58;
4835 if (useVoidBag())
4836 {
4837 num2 = 98;
4838 }
4839 for (int i = 0; i < num2; i++)
4840 {
4841 Item item2 = ((i >= 58) ? bank4.item[i - 58] : inventory[i]);
4842 if (item2.stack <= 0 || item2.type <= 0 || item2.buffType <= 0 || item2.summon || !ItemCheck_CheckCanUse(item2))
4843 {
4844 continue;
4845 }
4846 int num3 = item2.buffType;
4848 if (item2.mana > 0 && flag)
4849 {
4850 if (statMana >= (int)((float)item2.mana * manaCost))
4851 {
4853 statMana -= (int)((float)item2.mana * manaCost);
4854 }
4855 else
4856 {
4857 flag = false;
4858 }
4859 }
4860 if (whoAmI == Main.myPlayer && item2.type == 603 && !Main.runningCollectorsEdition)
4861 {
4862 flag = false;
4863 }
4864 if (num3 == 27)
4865 {
4866 num3 = Main.rand.Next(3);
4867 if (num3 == 0)
4868 {
4869 num3 = 27;
4870 }
4871 if (num3 == 1)
4872 {
4873 num3 = 101;
4874 }
4875 if (num3 == 2)
4876 {
4877 num3 = 102;
4878 }
4879 }
4880 if (!flag)
4881 {
4882 continue;
4883 }
4884 legacySoundStyle = item2.UseSound;
4885 int num4 = item2.buffTime;
4886 if (num4 == 0)
4887 {
4888 num4 = 3600;
4889 }
4890 AddBuff(num3, num4);
4891 if (item2.consumable)
4892 {
4893 item2.stack--;
4894 if (item2.stack <= 0)
4895 {
4896 item2.TurnToAir();
4897 }
4898 }
4899 if (CountBuffs() == maxBuffs)
4900 {
4901 break;
4902 }
4903 }
4904 }
4905 if (legacySoundStyle != null)
4906 {
4908 Recipe.FindRecipes();
4909 }
4910 }
static void PlaySound(int type, Vector2 position, int style=1)
Item[] item
Definition Chest.cs:41
Vector2 position
Definition Entity.cs:14
static readonly int maxBuffs
Definition Player.cs:1191
bool ItemCheck_CheckCanUse(Item sItem)
Definition Player.cs:48702
bool useVoidBag()
Definition Player.cs:22085
float manaRegenDelay
Definition Player.cs:1577
int CountBuffs()
Definition Player.cs:4634
float maxRegenDelay
Definition Player.cs:1123
Item QuickBuff_PickBestFoodItem()
Definition Player.cs:4912
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441
Item[] inventory
Definition Player.cs:1257
bool QuickBuff_ShouldBotherUsingThisBuff(int attemptedType)
Definition Player.cs:4970

References Terraria.Player.AddBuff(), Terraria.Player.bank4, Terraria.Player.CCed, Terraria.Player.CountBuffs(), Terraria.Player.cursed, Terraria.Player.dead, Terraria.Recipe.FindRecipes(), Terraria.Player.inventory, System.item, Terraria.Chest.item, Terraria.Player.ItemCheck_CheckCanUse(), Terraria.Player.manaCost, Terraria.Player.manaRegenDelay, Terraria.Player.maxBuffs, Terraria.Player.maxRegenDelay, Terraria.Main.myPlayer, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Player.QuickBuff_PickBestFoodItem(), Terraria.Player.QuickBuff_ShouldBotherUsingThisBuff(), Terraria.Main.rand, Terraria.Main.runningCollectorsEdition, Terraria.Player.statMana, Terraria.Player.useVoidBag(), and Terraria.Entity.whoAmI.

Referenced by Terraria.GameInput.TriggersSet.CopyInto().