tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.GlobalBuff Class Reference

This class allows you to modify the behavior of any buff in the game. More...

Public Member Functions

virtual bool Autoload (ref string name)
 Allows you to automatically load a GlobalBuff instead of using Mod.AddGlobalBuff. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload or to control the internal name. More...
 
virtual void CustomBuffTipSize (string buffTip, List< Vector2 > sizes)
 If you are using the DrawCustomBuffTip hook, then you must use this hook as well. Calculate the location (relative to the origin) of the bottom-right corner of everything you will draw, and add that location to the sizes parameter. More...
 
virtual void DrawCustomBuffTip (string buffTip, SpriteBatch spriteBatch, int originX, int originY)
 Allows you to draw whatever you want when a buff tooltip is drawn. The originX and originY parameters are the top-left corner of everything that's drawn; you should add these to the position argument passed to SpriteBatch.Draw. More...
 
virtual void ModifyBuffTip (int type, ref string tip, ref int rare)
 Allows you to modify the tooltip that displays when the mouse hovers over the buff icon, as well as the color the buff's name is drawn in. More...
 
virtual bool ReApply (int type, NPC npc, int time, int buffIndex)
 Allows to you make special things happen when adding the given buff type to an NPC when the NPC already has that buff. Return true to block the vanilla re-apply code from being called; returns false by default. The vanilla re-apply code sets the buff time to the "time" argument if that argument is larger than the current buff time. More...
 
virtual bool ReApply (int type, Player player, int time, int buffIndex)
 Allows to you make special things happen when adding the given type of buff to a player when the player already has that buff. Return true to block the vanilla re-apply code from being called; returns false by default. The vanilla re-apply code sets the buff time to the "time" argument if that argument is larger than the current buff time. (For Mana Sickness, the vanilla re-apply code adds the "time" argument to the current buff time.) More...
 
virtual void Update (int type, NPC npc, ref int buffIndex)
 Allows you to make the buff with the given ID give certain effects to an NPC. If you remove the buff from the NPC, make sure to decrement the buffIndex parameter by 1. More...
 
virtual void Update (int type, Player player, ref int buffIndex)
 Allows you to make the buff with the given ID give certain effects to a player. If you remove the buff from the player, make sure the decrement the buffIndex parameter by 1. More...
 

Properties

Mod mod [get, set]
 The mod to which this GlobalBuff belongs. More...
 
string Name [get, set]
 The internal name of this GlobalBuff instance. More...
 

Detailed Description

This class allows you to modify the behavior of any buff in the game.

Definition at line 10 of file GlobalBuff.cs.

Member Function Documentation

◆ Autoload()

virtual bool Terraria.ModLoader.GlobalBuff.Autoload ( ref string  name)
virtual

Allows you to automatically load a GlobalBuff instead of using Mod.AddGlobalBuff. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload or to control the internal name.

Definition at line 31 of file GlobalBuff.cs.

31 {
32 return mod.Properties.Autoload;
33 }
Mod mod
The mod to which this GlobalBuff belongs.
Definition: GlobalBuff.cs:15
ModProperties Properties
Definition: Mod.cs:52
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...

References Terraria.ModLoader.ModProperties.Autoload, Terraria.ModLoader.GlobalBuff.mod, and Terraria.ModLoader.Mod.Properties.

Referenced by Terraria.ModLoader.Mod.AutoloadGlobalBuff().

+ Here is the caller graph for this function:

◆ CustomBuffTipSize()

virtual void Terraria.ModLoader.GlobalBuff.CustomBuffTipSize ( string  buffTip,
List< Vector2 >  sizes 
)
virtual

If you are using the DrawCustomBuffTip hook, then you must use this hook as well. Calculate the location (relative to the origin) of the bottom-right corner of everything you will draw, and add that location to the sizes parameter.

Definition at line 70 of file GlobalBuff.cs.

70 {
71 }

◆ DrawCustomBuffTip()

virtual void Terraria.ModLoader.GlobalBuff.DrawCustomBuffTip ( string  buffTip,
SpriteBatch  spriteBatch,
int  originX,
int  originY 
)
virtual

Allows you to draw whatever you want when a buff tooltip is drawn. The originX and originY parameters are the top-left corner of everything that's drawn; you should add these to the position argument passed to SpriteBatch.Draw.

Definition at line 76 of file GlobalBuff.cs.

76 {
77 }

◆ ModifyBuffTip()

virtual void Terraria.ModLoader.GlobalBuff.ModifyBuffTip ( int  type,
ref string  tip,
ref int  rare 
)
virtual

Allows you to modify the tooltip that displays when the mouse hovers over the buff icon, as well as the color the buff's name is drawn in.

Definition at line 64 of file GlobalBuff.cs.

64 {
65 }

◆ ReApply() [1/2]

virtual bool Terraria.ModLoader.GlobalBuff.ReApply ( int  type,
NPC  npc,
int  time,
int  buffIndex 
)
virtual

Allows to you make special things happen when adding the given buff type to an NPC when the NPC already has that buff. Return true to block the vanilla re-apply code from being called; returns false by default. The vanilla re-apply code sets the buff time to the "time" argument if that argument is larger than the current buff time.

Definition at line 57 of file GlobalBuff.cs.

57 {
58 return false;
59 }

◆ ReApply() [2/2]

virtual bool Terraria.ModLoader.GlobalBuff.ReApply ( int  type,
Player  player,
int  time,
int  buffIndex 
)
virtual

Allows to you make special things happen when adding the given type of buff to a player when the player already has that buff. Return true to block the vanilla re-apply code from being called; returns false by default. The vanilla re-apply code sets the buff time to the "time" argument if that argument is larger than the current buff time. (For Mana Sickness, the vanilla re-apply code adds the "time" argument to the current buff time.)

Definition at line 50 of file GlobalBuff.cs.

50 {
51 return false;
52 }

◆ Update() [1/2]

virtual void Terraria.ModLoader.GlobalBuff.Update ( int  type,
NPC  npc,
ref int  buffIndex 
)
virtual

Allows you to make the buff with the given ID give certain effects to an NPC. If you remove the buff from the NPC, make sure to decrement the buffIndex parameter by 1.

Definition at line 44 of file GlobalBuff.cs.

44 {
45 }

◆ Update() [2/2]

virtual void Terraria.ModLoader.GlobalBuff.Update ( int  type,
Player  player,
ref int  buffIndex 
)
virtual

Allows you to make the buff with the given ID give certain effects to a player. If you remove the buff from the player, make sure the decrement the buffIndex parameter by 1.

Definition at line 38 of file GlobalBuff.cs.

38 {
39 }

Property Documentation

◆ mod

Mod Terraria.ModLoader.GlobalBuff.mod
getset

The mod to which this GlobalBuff belongs.

Definition at line 15 of file GlobalBuff.cs.

15 {
16 get;
17 internal set;
18 }

Referenced by Terraria.ModLoader.GlobalBuff.Autoload().

◆ Name

string Terraria.ModLoader.GlobalBuff.Name
getset

The internal name of this GlobalBuff instance.

Definition at line 23 of file GlobalBuff.cs.

23 {
24 get;
25 internal set;
26 }

Referenced by Terraria.ModLoader.Mod.AutoloadGlobalBuff().