Repository navigation
feat(lua.endpoints): add reroll_boss endpoint - #245
Closed
garfield-oo7 wants to merge 2 commits into
Closed
garfield-oo7 wants to merge 2 commits into
garfield-oo7 wants to merge 2 commits into
Conversation
add put the voucher card in G.shop_vouchers without the shop UI, so buy failed with "attempt to index field 'buy_button' (a nil value)". Create it with create_shop_card_ui, as the Voucher Tag does, and wait for the buy button (created in a delayed event) before returning.
Reroll the Boss blind from the blind selection screen, like the in-game Reroll Boss button. It mirrors G.FUNCS.reroll_boss_button: requires Director's Cut (one reroll per ante) or Retcon (unlimited), costs $10 and respects bankrupt_at (Credit Card). The response is sent once the game clears its boss_reroll lock. Expose round.boss_rerolled in the gamestate so clients can tell whether Director's Cut was already used this ante. Docs, OpenRPC spec, types, CLI method enum and tests included.
Author
|
Closing this as a duplicate: I've just seen that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new
reroll_bossendpoint that rerolls the upcoming Boss blind from the blind selection screen, the same as the in-game "Reroll Boss" button that Director's Cut / Retcon add.src/lua/endpoints/reroll_boss.lua(requires_state = BLIND_SELECT) applies the same checks asG.FUNCS.reroll_boss_buttonand then callsG.FUNCS.reroll_boss:NOT_ALLOWEDwithoutv_directors_cutorv_retconinused_vouchersNOT_ALLOWEDwhen Director's Cut was already used this ante (G.GAME.round_resets.boss_rerolled) and Retcon is not ownedNOT_ALLOWEDwhendollars - bankrupt_at < 10(so Credit Card works)G.CONTROLLER.locks.boss_reroll. The wait event is non-blocking because the game clears the lock in an event queued behind it.round.boss_rerolled(boolean), so a client can tell whether Director's Cut is still available this ante. It is always present (falseincluded).docs/api.md,docs/cli.md,CLAUDE.md), the OpenRPC spec (method andRound.boss_rerolled), Lua types and thebalatrobot apimethod enum are updated.A small separate fix (its own commit), found while writing the tests:
addwith av_*key put the voucher in the shop without its shop UI, sobuy {"voucher": i}on it crashed withattempt to index field 'buy_button' (a nil value).addnow callscreate_shop_card_ui(as the Voucher Tag does) and waits for the buy button before it returns.Why
Bots could not use Director's Cut or Retcon at all: the vouchers could be bought, but their effect had no API.
How tested
On Linux (Steam/Proton), with the branch installed as the mod:
tests/lua/endpoints/test_reroll_boss.py(new, 8 tests): Director's Cut reroll (money -10, flag set), the second reroll in an ante is refused, Retcon rerolls 3 times, no voucher, $0, Credit Card at $0 (goes to -10), flag reset and reroll available again next ante,INVALID_STATEfrom SHOP.tests/lua/endpoints/test_add.py::test_add_voucher_then_buy(new).pytest -n 3 tests/lua: everytests/lua/endpointstest passes (433 passed). The failures were alltests/lua/coredispatcher/validator tests that need the debug test endpoints (DebugPlus, not installed on my machine), plustest_concurrent_requests_do_not_crasherroring on a missinginstancefixture. Both are unrelated to this change.pytest tests/cli: passes when run serially. With-n 2(as inmake test),test_api_error_formattedandtest_api_output_is_indented_jsonfail with "Server disconnected" onmainas well, without this change.make qualitypasses (ruff, ty, mdformat, stylua 2.6.0src/lua).reroll_bosschanged the boss and money went $40 → $30. A second call returned the once-per-ante error.