Custom Buffs

Buff

class CommonBuff(...)

Bases: sphinx.ext.autodoc.importer._MockObject, sims4communitylib.logging.has_class_log.HasClassLog

An inheritable class that provides a way to create Custom Buffs.

classmethod get_log_identifier()

A string identifier for the log of the class.

Note

This is the text that will appear when logging messages.

Returns:The identifier for the log
Return type:str
classmethod get_mod_identity()

Retrieve the identity of the mod that owns the class.

Warning

Override this function with the CommonModIdentity of your mod.

This is a MUST override to allow for proper Exception Handling and Logging!

Returns:An instance of CommonModIdentity
Return type:CommonModIdentity
Raises:NotImplementedError – Thrown when the function is not implemented.
on_added(owner, from_load=False, apply_buff_loot=True)

A hook that occurs upon the Buff being added to the Sim.

Parameters:
  • owner (Sim) – The Sim that owns the Buff.
  • from_load (bool, optional) – True, if the Buff was added from a load. Default is False.
  • apply_buff_loot (bool, optional) – If True, Loot was applied when the Buff was added. Default is True.
on_removed(owner, apply_loot_on_remove=True)

A hook that occurs upon the Buff being removed from the Sim.

Parameters:
  • owner (Sim) – The Sim that owns the Buff.
  • apply_loot_on_remove (bool, optional) – If True, Loot will be applied after the Buff is removed. If False, it won’t. Default is True.
sim

Retrieve the Sim that owns the Buff.

Returns:An instance of the Sim that owns the Buff
Return type:Sim