Skip to content

Integration with Hooks

Mateus Etto edited this page Jun 23, 2023 · 3 revisions

This add-on have some hooks that can be used by other add-ons.

Game over

Whenever the life drops to 0, the hook LifeDrain.gameOver is triggered. You may use it in your add-on to make something interesting happen.

Recover

This hook is broken in the latest version. May be removed if no one contact me and tell me they want it.

And there is a method you can call using hook to recover (or drain) the user's life. It has 3 optional parameters: 1st is increment (boolean), True to recover (default) and False to drain. 2nd is value (integer). Default is the recover value set by the user in the deck preferences. 3rd is damage (boolean). If set to true and no value is supplied, the damage value set by the user in the deck preferences is subtracted. The value of increment is ignored when this parameter is in use.

Examples:

  • runHook('LifeDrain.recover') recovers the life using the default value in deck preferences
  • runHook('LifeDrain.recover', False) drains the life using the default value in deck preferences
  • runHook('LifeDrain.recover', True, 9999) recovers all the life
  • runHook('LifeDrain.recover', True, None, True) drains the life using the damage value in deck preferences
Clone this wiki locally