The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

85 ratings
StatAPI
   
Award
Favorite
Favorited
Unfavorite
Tags: Lua, Tweaks
File Size
Posted
Updated
75.840 KB
Jan 7, 2018 @ 1:50pm
Jan 14, 2018 @ 12:42pm
12 Change Notes ( view )

Subscribe to download
StatAPI

Description
Note: OUTDATED! If possible, use Stats API 2.0 instead on the workshop.

Modder tool.

First release, likely has some bugs - leave anything you find strange in the comments below and for now, I left all the debugging strings on so you can check what it thinks yours stats are.

Known bugs:
- Purity Aura Boost (FireDelay) Isn't properly treated as a flat modifier, and may cause modded base-tears up items to have reduced effect while active.
- Kidney Stone scales differently than the base game a bit - its effectively the same item, but with a high firerate (like 30 or so) it may jump every other frame instead of going +1 every time.
- Some effects of multiplier babies may not apply right. Haven't tested it yet.
- Speed is an odd stat to work with and doesn't perfectly mesh with the base game.
- It currently ♥♥♥♥♥ up how bloody lust works - its a bug i know about i just dont have the time to fix it rn.

This is setup to work with the True Coop Mod - as far as I can tell. Haven't been able to test it myself as I don't have a controller really.

Have you ever had that annoying feeling of wanting to make a simple stats item, such as Tears +0.7 like sad onion, only to realize that Nicalis in their infinite wisdom could only give us the FireDelay stat?

This tool fixes that.

In addition, it fixes other problems based on mods stats such as:
1. More options for modifying the speed stat.
2. Automatic implementation of D8 to your stat changing items.
3. Apply modifiers or flat numbers or changes to the base stats, that works with other mods using the same system - incorporating them all in the proper order.

If any of that sounds any bit interesting to you, awesome! Ill explain how to use it below shortly.

If it doesn't - use it anyway. Because really, if we all use it together then all our items will apply correctly in the right order.

So - how to use it. There are four functions.

The first is statAPI.RegisterPlayer(playerType,damageMultiplier). Effectively, if you want a custom character of yours to start with a custom damage modifier, you can apply it here. I may expand this to also include custom tearrate starts and the like in the future, but hold tight on that for now.

The second is statAPI.CacheItem(itemID, FlagTable, stackable). If stackable is true, then the stats it applies will stack with multiple of the same item. If one with the same id already exists, it will be overwritten. Flagtable is a bit special, see below.

The third is statAPI.CacheTrinket(trinketID, FlagTable, momsBox). If momsBox is true, then the effects will be doubled if you hold Mom's Box (excluding negative multipliers. Im not sure how the game handles these on trinkets - so i left it out for now). If one with the same id already exists, it will be overwritten. Flagtable is a bit special, see below.

The fourth is statAPI.CacheNull(Name, FlagTable). Effectively the same as CacheItem, but doesn't require a specific item id - the minute you give it anything, it applies those stats. If one with the same name already exists, it will be overwritten.

The final is statAPI.RemoveNull(Name), because when any null effects you add are always active, you want a way to be able to remove them.

Basically, you set up a table, and then fill it with tables relating to its various properties. These properties are CacheFlag, StatChange, ChangeType, NormBreak, and MultiTag.

CacheFlag is what stat this is adjusting (Damage,TearDelay,Range,Luck,ShotSpeed, or MoveSpeed), StatChange is how much you want that stat to change by (Range is negative because its really "TearHeight"), and ChangeType is how you want to change it - either "Normal", "Multi", or "Flat" [Defaults to Normal]. The last two are just for multipliers (right now) - NormBreak determining if the multiplier is unusually and comes out of order [Defaults to false]. If you include a MultiTag, then any other items with the same MultiTag won't also be used - so you can make certain items not synergize together like Magic Mush and Cricket's Head if you choose. These MultiTags are per-stat only. Below are the built-in stat multipliers for you to perhaps choose to conflict with. If you choose to use one of these multipliers, your multiplier code will run first - so you could perhaps negate the effect of these by setting the multiplier to a value of 1, or increase their effect by setting a higher multiplier than the base one (though you will have to check when to apply the higher multiplier yourself).

Damage - Polyphemus, OddMushroomRate, SoyMilk, OnePointFive (Magic Mush, Cricket's Head, Belial + Martyr), EvesMascara, Proptosis, SacredHeart, Technology2, CrownOfLight, BloodyLust, DeadEye, Haemolacria

Firedelay - PolyShot (Polyphemus, Inner Eye, Mutant Spider), SoyMilk, Brimstone, Azazel, Ipecac, MonstrosLung, DrFetus, EvesMascara

The order that stats are changed goes like this:

1. Normal changes
1.5. Converts normal stat to the displayed stat version
2. NormBreak multipliers
3. Flat modifiers
4. Multipliers

Once you have made a table that fits, simply call the function with that table and it will insert it into the callback checks. This can be called anytime, but if you dont need to dynamically update the stats an item is affecting, you should be good just to check for statAPI and call it in POST_GAME_STARTED.

Example:
Recreating soymilk

SoyFlag =
{
{CacheFlag = CacheFlag.CACHE_FIREDELAY, StatChange = 0.25, ChangeType = "Multi"},
{CacheFlag = CacheFlag.CACHE_FIREDELAY, StatChange = -8, ChangeType = "Flat"},
{CacheFlag = CacheFlag.CACHE_DAMAGE, StatChange = 0.2, ChangeType = "Multi"}
}

statAPI.CacheItem(CollectibleType.COLLECTIBLE_SOY_MILK,SoyFlag,false)

If you have any questions feel free to leave comments below!
Popular Discussions View All (1)
3
Jan 9, 2018 @ 10:17am
Questions
Crashington
31 Comments
Keryu Apr 9, 2022 @ 1:04pm 
.
『Sora』  [author] Jan 20, 2022 @ 5:09pm 
According to Kilburn, "There is no pattern to the order in which stats are changed."

Since a bunch of new items were added to the game in the repentance update, a lot of the new ones don't follow this structure or pattern at all, so essentially the mod no longer works. I could still update it and maybe tinker with it enough to get it mostly working, but I guess the official solution to this issue is "Good Luck" so. Yeah there's that.
JSJosh Jan 16, 2022 @ 8:14am 
Oh? Is modding for Repentance planning on making stats like damage be applied using normal damage calculation rather than solely flat increases?
『Sora』  [author] Jan 15, 2022 @ 2:51pm 
This version is outdated, and was replaced with Stat API 2.0. Stat api 2.0 hasn't been updated yet though, but might be irrelevant based on a chat I had with Kilburn.
Keryu Jan 12, 2022 @ 12:25am 
does this work on repentance?
『Sora』  [author] May 9, 2020 @ 10:26am 
Hello!
Zack n Barrys Mom May 9, 2020 @ 8:36am 
hello!
『Sora』  [author] Jul 12, 2018 @ 8:32am 
its ab+. Also its outdated - use statAPI 2.0 or tell other mod authors to update to it
montain Jul 12, 2018 @ 1:19am 
does this work in afterbirth?
warmCabin May 4, 2018 @ 11:28pm 
You're right, and it's something users would have to see and be annoyed by every time they look at the mod menu. But I hate the idea of having to add an unecessary callback full of things that really ought to be done when the mod is loaded.
Interdependent APIs would certainly be a headache...but wouln't they be anyway? I imagine them looking like,
[code]

function api:postGameStarted()

function api:AddCallback()
other_api.whatever()
end

end
[/code]
Nested nastiness.

But I dunno. POST_GAME_STARTED is the only guaranteed safe way, so it might be the best decision anyway.