Public API: JCA.register / register_pair / register_clash

Other mods can teach the advisor their jokers (which otherwise score 0):
JCA.register(key, gives, wants, opts) adds a db entry with tag
validation — unknown tags are dropped with a log line so a typo can't
break anyone's load; opts.no_generic opts out of the mult/xmult
complement. register_pair adds a famous pair (discoverable, shown in
the Combos tab — its sort cache now invalidates via JCA._pairs_dirty)
and warns when a blurb exceeds the 34-char tooltip budget.
register_clash adds a warning-only trap line. Usage example in README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-07-10 14:06:43 -07:00
parent 1d28180db0
commit cbbf9babf5
2 changed files with 81 additions and 1 deletions
+22
View File
@@ -86,6 +86,28 @@ Defaults live in `config.lua`.
`j('j_key', {gives...}, {wants...})`, or add a famous pair to the `PAIRS`
table at the bottom. Modded jokers can be added the same way using their
full key (e.g. `j_mymod_cooljoker`) — unknown jokers simply score 0.
- **From another mod:** if your mod adds jokers, teach the advisor about
them at load time (any point after Combo Advisor has loaded):
```lua
if JCA then
-- gives/wants use the tag names from synergies.lua
JCA.register('j_mymod_cooljoker', {'xmult'}, {'faces'})
-- optional: opts {no_generic = true} if the generic
-- "+Mult feeds the multiplier" logic misreads your joker
JCA.register('j_mymod_slotless', {'xmult'}, nil, {no_generic = true})
-- famous pair (+4, discoverable, shown in the Combos tab);
-- keep the blurb under ~34 characters
JCA.register_pair('j_mymod_cooljoker', 'j_pareidolia',
'every card becomes a face for it')
-- known trap: warning-only red tooltip line
JCA.register_clash('j_mymod_cooljoker', 'j_vampire',
'drains the enhancements it needs')
end
```
Unknown tags are dropped with a `JCA:` log line instead of erroring, so
a typo in your registration can never break a load.
- **Tune sensitivity:** use the in-game Config tab, or change the defaults
in `config.lua`.