Terraria ModLoader  0.10.1.5
A framework for 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 (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 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 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 (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...
 
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...
 

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

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.

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

57  {
58  return mod.Properties.Autoload;
59  }
Mod mod
The mod that added this ModBuff.
Definition: ModBuff.cs:11
ModProperties Properties
Definition: Mod.cs:49
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...

+ Here is the caller graph for this function:

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  }
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  }
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  }
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.

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

72  {
73  }

+ Here is the caller graph for this function:

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  }
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  }

Member Data Documentation

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.

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.

Property Documentation

ModTranslation Terraria.ModLoader.ModBuff.Description
getset

The translations of this buff's description.

Definition at line 43 of file ModBuff.cs.

Referenced by Terraria.ModLoader.Mod.AddBuff(), and Terraria.ModLoader.ModContent.RefreshModLanguage().

ModTranslation Terraria.ModLoader.ModBuff.DisplayName
getset

The translations of this buff's display name.

Definition at line 35 of file ModBuff.cs.

Referenced by Terraria.ModLoader.Mod.AddBuff(), and Terraria.ModLoader.ModContent.RefreshModLanguage().

Mod Terraria.ModLoader.ModBuff.mod
getset

The mod that added this ModBuff.

Definition at line 11 of file ModBuff.cs.

Referenced by Terraria.ModLoader.Mod.AddBuff(), and Terraria.ModLoader.Mod.AutoloadBuff().

string Terraria.ModLoader.ModBuff.Name
getset

The internal name of this type of buff.

Definition at line 19 of file ModBuff.cs.

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

int Terraria.ModLoader.ModBuff.Type
getset