The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

86 个评价
StatAPI
   
奖励
收藏
已收藏
取消收藏
Tags: Lua, Tweaks
文件大小
发表于
更新日期
75.840 KB
2018 年 1 月 7 日 下午 1:50
2018 年 1 月 14 日 下午 12:42
12 项改动说明 ( 查看 )

订阅以下载
StatAPI

描述
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!
热门讨论 查看全部(1)
3
2018 年 1 月 9 日 上午 10:17
Questions
Crashington
31 条留言
Keryu 2022 年 4 月 9 日 下午 1:04 
.
『Sora』  [作者] 2022 年 1 月 20 日 下午 5:09 
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 2022 年 1 月 16 日 上午 8:14 
Oh? Is modding for Repentance planning on making stats like damage be applied using normal damage calculation rather than solely flat increases?
『Sora』  [作者] 2022 年 1 月 15 日 下午 2:51 
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 2022 年 1 月 12 日 上午 12:25 
does this work on repentance?
『Sora』  [作者] 2020 年 5 月 9 日 上午 10:26 
Hello!
Zack n Barrys Mom 2020 年 5 月 9 日 上午 8:36 
hello!
『Sora』  [作者] 2018 年 7 月 12 日 上午 8:32 
its ab+. Also its outdated - use statAPI 2.0 or tell other mod authors to update to it
montain 2018 年 7 月 12 日 上午 1:19 
does this work in afterbirth?
warmCabin 2018 年 5 月 4 日 下午 11:28 
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.