Skip to content

feat(gamestate): expose tags, joker targets, and economy helpers - #222

Closed
BGarber42 wants to merge 1 commit into
coder:mainfrom
BGarber42:feat/gamestate-run-context
Closed

BGarber42 wants to merge 1 commit into
coder:mainfrom
BGarber42:feat/gamestate-run-context

Conversation

@BGarber42

Copy link
Copy Markdown

Summary

  • Expose held skip tags (tags) from G.GAME.tags with key/name/effect.
  • Add round joker targets (idol_card, mail_card, ancient_card, castle_card) and free_rerolls.
  • Add economy (interest_cap/amount, bankrupt_at, discount_percent, shop_slots), probabilities, pool_flags, skips, starting_deck_size, and optional consumable_usage_total.
  • Document in OpenRPC, api.md, and CLAUDE.md; add integration tests.

Test plan

  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateTopLevel::test_tags_empty_at_run_start -v
  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateTopLevel::test_tags_and_skips_after_skip -v
  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateTopLevel::test_economy_defaults -v
  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateTopLevel::test_probabilities_normal_default_and_oops -v
  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateTopLevel::test_pool_flags_and_starting_deck_size -v
  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateTopLevel::test_consumable_usage_total_after_using_tarot -v
  • uv run pytest tests/lua/endpoints/test_gamestate.py::TestGamestateRound::test_round_joker_targets_and_free_rerolls -v

Surface held skip tags, Idol/Mail/Ancient/Castle targets, interest/shop
economy fields, probabilities, pool_flags, skips, starting_deck_size, and
consumable_usage_total so bots can act on run context the game already tracks.
@S1M0N38

S1M0N38 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

thanks for PRs #221 and #222. I prolly review then add to dev branch instead of main. dev branch (almost ready) will become balatrobot v2 introducing breaking changes.

S1M0N38 added a commit that referenced this pull request Nov 11, 2026
Expose the run's economy state as four top-level scalars so bots can
plan money decisions without parsing localized effect text:

- interest_cap: cap on interest, in interest units (max interest
  dollars = interest_cap/5 * interest_amount; Seed Money raises to
  50, Money Tree to 100)
- interest_amount: interest dollars per $5 held (default 1; To the
  Moon adds 1 per copy)
- no_interest: true when the run disables interest entirely (Green
  Deck, The Omelette, Mad World) - the raw interest values stay
  nominal, so the gate flag keeps bots from computing interest that
  never pays
- bankrupt_at: the spendable floor - purchases are blocked when
  cost > money - bankrupt_at (Credit Card lowers it to -20, allowing
  debt)

PR #222 proposed these inside a thematic "economy" object; we placed
them flat next to money instead, following the codebase's lifecycle
grouping (run-persistent scalars at top level, round-scoped state in
round). Deliberately skipped from the PR: discount_percent and
inflation (already materialized in every card's cost.buy) and
shop_slots (already exposed as the shop area's limit).

All four are always present during a run (init_game_object
initializes them), so they are assigned directly alongside the other
always-present scalars rather than guarded as conditionally absent.
Documented in types.lua, openrpc.json, and api.md alongside the
extraction, with tests covering defaults and the voucher/joker/deck
mutations.

Co-authored-by: Brent Garber <me@bgarber.work>
@BGarber42 BGarber42 closed this by deleting the head repository Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants