The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

Player Status Effects API
 This topic has been pinned, so it's probably important
pedroff_1  [developer] 11 Jun, 2020 @ 9:46pm
Using preset effects
While I heavily recommend you create your own effects, so you can adjust all details, values and whatnots, some of you may instead prefer to use some effects I preset myself. Originally, they were meant solely as an example for what you could do with the mod, but their potential use convinced me to expand upon their functionality.

Enabling preset effects
First, for many performance and compatibility issues, all code for the presets needs to be enabled by adding the following line to your code before using any of the further functions:
if _StatusAPI ~= nil then _StatusAPI = {} end _StatusAPI.LoadPresetEffects = true


Effects List
Following, is a list of all effects I added and how each of them works:

Note: [intensity] is an attribute of an effect that, for some of them, reflects how much they'll impact the player. it'll also be mentioned in some functions. Note that, if you add the same effect under different intensities, the higher one will prevail.
[chargevalue] is a value used to determine, among other things, how much "timer" is required to fully fill the effct chargebar. It has also been used, in these effects, to denote the threshold for which some effects trigger (in poison and burning, for example, it is the value above which you take damage)

Burn:
Naturally increases by 1 (per update). Decreases by 3 each frame your movement speed is above 1. Upon reaching [chargevalue] (default 150 updates = 5 seconds), deals [intensity] half-hearts of damage and resets.

Poison:
Naturally decreases by 1 (per update). Upon reaching [chargevalue], deals [intensity] half-hearts of damage.

Slow:
Naturally decreases by 1 (per update). While in effect, reduces the player speed by 10% per [intesity] value.


Freeze:
Naturally decreases by 1. Isn't affected by [intensity]. While in effect, prevents the player from firing, walking, using items, bombs and consumables.

Fear:
Naturally decreases by 1 (per update). Isn't affected by [intensity.] While in effect, prevents the player from firing, using items or consumables.



Curse (may be removed):
Is not affected by [intensity]. Upon reaching a new floor, depletes 1 heart container per 2 curse value and replaces it with a black heart.



Functions List

In addition to working with all normal functions from the mod (listed in another discussion thread), these effects have the following functions to apply themselves to the player. Note that all of them can be replicated by the default functions, but this is meant to simplify the process of using them, if you so choose, as they're targeted at less experienced programmers or people wanting to use simpler functionality instead of going through multiple steps involved in adding your own effect.

_StatusAPI.AddPlayerBurn (player,duration,charge,intensity)
Adds burning to [player] for [duration], with a certain [intensity]. The default values for the arguments are as follows: [charge] = 150; [intensity] = 1; [duration] = 0; [player] = nil.


_StatusAPI.AddPlayerPoison (player,duration,charge,intensity)
Adds poison to [player] for [duration], with a certain [intensity]. The default values for the arguments are as follows: [charge] = 150; [intensity] = 1; [duration] = 0; [player] = nil.


_StatusAPI.AddPlayerSlow (player,duration,intensity,cumulative)
Adds burning to [player] for [duration], with a certain [intensity]. The default values for the arguments are as follows: [intensity] = 1; [duration] = 0; [player] = nil. If [cumulative] is set to true, it adds [duration] to any previous duration left.

_StatusAPI.AddPlayerFreeze (player,duration,cumulative)
Adds burning to [player] for [duration], with a certain [intensity]. The default values for the arguments are as follows: [duration] = 0; [player] = nil. If [cumulative] is set to true, it adds [duration] to any previous duration left.

_StatusAPI.AddPlayerFear (player,duration,cumulative)
Adds burning to [player] for [duration], with a certain [intensity]. The default values for the arguments are as follows: [duration] = 0; [player] = nil. If [cumulative] is set to true, it adds [duration] to any previous duration left.
Last edited by pedroff_1; 11 Jun, 2020 @ 10:14pm