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

This class serves as a place for you to define a new buff and how that buff behaves. More...

+ Collaboration diagram for Terraria.ModLoader.ModBuff:

Public Member Functions

virtual bool Autoload (ref string name, ref string texture)
 Allows you to automatically load a buff instead of using Mod.AddBuff. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name and texture is initialized to the namespace and overriding class name with periods replaced with slashes. Use this method to either force or stop an autoload, and to change the default display name and texture path. More...
 
virtual void ModifyBuffTip (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 (NPC npc, int time, int buffIndex)
 Allows to you make special things happen when adding this buff to an NPC when the NPC already has this 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 (Player player, int time, int buffIndex)
 Allows to you make special things happen when adding this buff to a player when the player already has this 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 void SetDefaults ()
 This is where all buff related assignments go. For example:

  • Main.buffName[Type] = "Display Name";
  • Main.buffTip[Type] = "Buff Tooltip";
  • Main.debuff[Type] = true;
  • Main.buffNoTimeDisplay[Type] = true;
  • Main.vanityPet[Type] = true;
  • Main.lightPet[Type] = true;
More...
 
virtual void Update (NPC npc, ref int buffIndex)
 Allows you to make this buff give certain effects to the given NPC. If you remove the buff from the NPC, make sure to decrement the buffIndex parameter by 1. More...
 
virtual void Update (Player player, ref int buffIndex)
 Allows you to make this buff give certain effects to the given player. If you remove the buff from the player, make sure the decrement the buffIndex parameter by 1. More...
 

Public Attributes

bool canBeCleared = true
 Whether or not it is always safe to call Player.DelBuff on this buff. Setting this to false will prevent the nurse from being able to remove this debuff. Defaults to true. More...
 
bool longerExpertDebuff = false
 If this buff is a debuff, setting this to true will make this buff last twice as long on players in expert mode. Defaults to false. More...
 

Properties

ModTranslation Description [get, set]
 The translations of this buff's description. More...
 
ModTranslation DisplayName [get, set]
 The translations of this buff's display name. More...
 
Mod mod [get, set]
 The mod that added this ModBuff. More...
 
string Name [get, set]
 The internal name of this type of buff. More...
 
int Type [get, set]
 The buff id of this buff. More...
 

Detailed Description

This class serves as a place for you to define a new buff and how that buff behaves.

Definition at line 6 of file ModBuff.cs.

Member Function Documentation

◆ Autoload()

virtual bool Terraria.ModLoader.ModBuff.Autoload ( ref string  name,
ref string  texture 
)
virtual

Allows you to automatically load a buff instead of using Mod.AddBuff. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name and texture is initialized to the namespace and overriding class name with periods replaced with slashes. Use this method to either force or stop an autoload, and to change the default display name and texture path.

Definition at line 57 of file ModBuff.cs.

57 {
58 return mod.Properties.Autoload;
59 }
Mod mod
The mod that added this ModBuff.
Definition: ModBuff.cs:11
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.ModBuff.mod, and Terraria.ModLoader.Mod.Properties.

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

+ Here is the caller graph for this function:

◆ ModifyBuffTip()

virtual void Terraria.ModLoader.ModBuff.ModifyBuffTip ( 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 104 of file ModBuff.cs.

104 {
105 }

Referenced by Terraria.ModLoader.BuffLoader.ModifyBuffTip().

+ Here is the caller graph for this function:

◆ ReApply() [1/2]

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

Allows to you make special things happen when adding this buff to an NPC when the NPC already has this 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 97 of file ModBuff.cs.

97 {
98 return false;
99 }

◆ ReApply() [2/2]

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

Allows to you make special things happen when adding this buff to a player when the player already has this 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 90 of file ModBuff.cs.

90 {
91 return false;
92 }

Referenced by Terraria.ModLoader.BuffLoader.ReApply().

+ Here is the caller graph for this function:

◆ SetDefaults()

virtual void Terraria.ModLoader.ModBuff.SetDefaults ( )
virtual

This is where all buff related assignments go. For example:

  • Main.buffName[Type] = "Display Name";
  • Main.buffTip[Type] = "Buff Tooltip";
  • Main.debuff[Type] = true;
  • Main.buffNoTimeDisplay[Type] = true;
  • Main.vanityPet[Type] = true;
  • Main.lightPet[Type] = true;

Definition at line 72 of file ModBuff.cs.

72 {
73 }

◆ Update() [1/2]

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

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

Definition at line 84 of file ModBuff.cs.

84 {
85 }

◆ Update() [2/2]

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

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

Definition at line 78 of file ModBuff.cs.

78 {
79 }

Referenced by Terraria.ModLoader.BuffLoader.Update().

+ Here is the caller graph for this function:

Member Data Documentation

◆ canBeCleared

bool Terraria.ModLoader.ModBuff.canBeCleared = true

Whether or not it is always safe to call Player.DelBuff on this buff. Setting this to false will prevent the nurse from being able to remove this debuff. Defaults to true.

Definition at line 52 of file ModBuff.cs.

Referenced by Terraria.ModLoader.BuffLoader.CanBeCleared().

◆ longerExpertDebuff

bool Terraria.ModLoader.ModBuff.longerExpertDebuff = false

If this buff is a debuff, setting this to true will make this buff last twice as long on players in expert mode. Defaults to false.

Definition at line 50 of file ModBuff.cs.

Referenced by Terraria.ModLoader.BuffLoader.LongerExpertDebuff().

Property Documentation

◆ Description

ModTranslation Terraria.ModLoader.ModBuff.Description
getset

The translations of this buff's description.

Definition at line 43 of file ModBuff.cs.

43 {
44 get;
45 internal set;
46 }

Referenced by Terraria.ModLoader.ModContent.RefreshModLanguage().

◆ DisplayName

ModTranslation Terraria.ModLoader.ModBuff.DisplayName
getset

The translations of this buff's display name.

Definition at line 35 of file ModBuff.cs.

35 {
36 get;
37 internal set;
38 }

Referenced by Terraria.ModLoader.ModContent.RefreshModLanguage().

◆ mod

Mod Terraria.ModLoader.ModBuff.mod
getset

The mod that added this ModBuff.

Definition at line 11 of file ModBuff.cs.

11 {
12 get;
13 internal set;
14 }

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

◆ Name

string Terraria.ModLoader.ModBuff.Name
getset

The internal name of this type of buff.

Definition at line 19 of file ModBuff.cs.

19 {
20 get;
21 internal set;
22 }

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

◆ Type

int Terraria.ModLoader.ModBuff.Type
getset

The buff id of this buff.

Definition at line 27 of file ModBuff.cs.

27 {
28 get;
29 internal set;
30 }

Referenced by Terraria.ModLoader.ModContent.RefreshModLanguage().