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

◆ GetManaCost()

int Terraria.Player.GetManaCost ( Item item)
inline

Calculates the mana needed to use the given item.

Parameters
itemThe item to check.
Returns
The amount of mana needed to use item . Cannot be less than 0.

Definition at line 58616 of file Player.cs.

58617 {
58618 float reduce = manaCost;
58619 float mult = 1f;
58620 if (spaceGun && ItemID.Sets.IsSpaceGun[item.type])
58621 {
58622 mult = 0f;
58623 }
58624 if (item.type == 3852 && altFunctionUse == 2)
58625 {
58626 mult = 2f;
58627 }
58629 int mana = (int)((float)item.mana * reduce * mult);
58630 if (mana < 0)
58631 {
58632 return 0;
58633 }
58634 return mana;
58635 }
static bool[] IsSpaceGun
Set to true to make this Item set its mana cost to 0 whenever F:Terraria.Player.spaceGun is set to tr...
Definition ItemID.cs:1706
static void ModifyManaCost(Player player, Item item, ref float reduce, ref float mult)
float manaCost
The percent of mana actually used when mana is consumed. Cannot reduce an item's mana cost below 0.
Definition Player.cs:2032

References Terraria.Player.altFunctionUse, Terraria.ID.ItemID.Sets.IsSpaceGun, Terraria.Player.manaCost, Terraria.ModLoader.CombinedHooks.ModifyManaCost(), Terraria.Player.spaceGun, and Terraria.Item.type.

Referenced by Terraria.Player.CheckMana(), and Terraria.Player.ItemCheck_ApplyManaRegenDelay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: