Skip to content

Implement Nebula sectors (Galactic Events expansion) - #378

Open
guygranger wants to merge 2 commits into
AsyncEclipse:mainfrom
guygranger:feature/nebula-sectors
Open

Implement Nebula sectors (Galactic Events expansion)#378
guygranger wants to merge 2 commits into
AsyncEclipse:mainfrom
guygranger:feature/nebula-sectors

Conversation

@guygranger

Copy link
Copy Markdown

Closes #303.

Adds full support for the Nebula sector mechanic from the Galactic Events expansion. Uses synthetic subsector position codes (295A/295B/295C) layered onto the existing single-position-string model — the parent hex acts as a render anchor and the three subsectors are exposed as first-class board entries that mirror the regular sector schema.

Highlights:

  • helpers/NebulaHelper.py: subsector model, internal/external adjacency, parent neighbour-rewrite with rotation
  • helpers/GamestateHelper.add_tile: branches on enable_nebulas to build parent + 3 subsector records, places ai-anc in the Ancient subsector
  • helpers/GamestateHelper.setup_techs_and_outer_rim: shuffles 295 into ring II and 395 into ring III when nebulas are enabled (per rulebook p. 4 the ring-III tile is appended after the regular sector_draws)
  • Buttons/Move.getTilesInRange: skips parent records, walks subsector adjacency including internal sibling hops (matches rulebook example of 'two Move Activations' to cross an internal wormhole)
  • Buttons/Influence: areTwoTilesAdjacent returns True for sibling subsectors; getTilesToInfluence excludes any tile of type='nebula' (parent or subsector) — nebulas may never contain Influence Discs
  • Buttons/Explore: handles the nebula-as-explore-source case via the parent-rewrite, and shows a one-line explanation when a nebula is placed (no influence prompt, no immediate discovery prompt)
  • Buttons/DiscoveryTile._maybe_reroll_for_nebula: implements the Ancient Orbital / Ancient Monolith reroll rule — if either is drawn for a nebula subsector, shuffle it back and draw again before presenting the player's choice
  • helpers/CombatHelper.claimNebulaDiscoveries + Turn.runUpkeep hook: end-of-Combat-Phase discovery resolution. A discovery in a nebula subsector is claimed only by a single non-AI player whose ships remain there at that point. Errors surface to the channel so a GM can recover via /tile resolve_specific_discovery_tile
  • helpers/DrawHelper: subsector positions return None from board_tile_image (their ships are drawn on top of the parent's hex); _render_ships extracted so the parent hex can render all three subsectors' ships using each subsector's *_snap coords
  • commands/setup_commands + setup/GameInit: enable_nebulas flag on /setup create_new_game (default True)
  • tests/test_nebulas.py: 19 cases covering setup, three-subsector creation, disctile/ancient distribution, internal + external + rotated adjacency, the influence-target type filter, deck population with the flag on/off, and the orbital/monolith reroll edge cases

Verified subsector layout against printed art for both NGC 5189 (295) and NGC 1952 (395) — Ancient in the right subsector (B), Discoveries in the top (A) and bottom-left (C). All 23 tests pass.

guygranger and others added 2 commits May 9, 2026 21:49
Closes AsyncEclipse#303.

Adds full support for the Nebula sector mechanic from the Galactic
Events expansion. Uses synthetic subsector position codes (295A/295B/295C)
layered onto the existing single-position-string model — the parent hex
acts as a render anchor and the three subsectors are exposed as
first-class board entries that mirror the regular sector schema.

Highlights:
- helpers/NebulaHelper.py: subsector model, internal/external adjacency,
  parent neighbour-rewrite with rotation
- helpers/GamestateHelper.add_tile: branches on enable_nebulas to build
  parent + 3 subsector records, places ai-anc in the Ancient subsector
- helpers/GamestateHelper.setup_techs_and_outer_rim: shuffles 295 into
  ring II and 395 into ring III when nebulas are enabled (per rulebook
  p. 4 the ring-III tile is appended after the regular sector_draws)
- Buttons/Move.getTilesInRange: skips parent records, walks subsector
  adjacency including internal sibling hops (matches rulebook example
  of 'two Move Activations' to cross an internal wormhole)
- Buttons/Influence: areTwoTilesAdjacent returns True for sibling
  subsectors; getTilesToInfluence excludes any tile of type='nebula'
  (parent or subsector) — nebulas may never contain Influence Discs
- Buttons/Explore: handles the nebula-as-explore-source case via the
  parent-rewrite, and shows a one-line explanation when a nebula is
  placed (no influence prompt, no immediate discovery prompt)
- Buttons/DiscoveryTile._maybe_reroll_for_nebula: implements the
  Ancient Orbital / Ancient Monolith reroll rule — if either is drawn
  for a nebula subsector, shuffle it back and draw again before
  presenting the player's choice
- helpers/CombatHelper.claimNebulaDiscoveries + Turn.runUpkeep hook:
  end-of-Combat-Phase discovery resolution. A discovery in a nebula
  subsector is claimed only by a single non-AI player whose ships
  remain there at that point. Errors surface to the channel so a GM
  can recover via /tile resolve_specific_discovery_tile
- helpers/DrawHelper: subsector positions return None from
  board_tile_image (their ships are drawn on top of the parent's hex);
  _render_ships extracted so the parent hex can render all three
  subsectors' ships using each subsector's *_snap coords
- commands/setup_commands + setup/GameInit: enable_nebulas flag on
  /setup create_new_game (default True)
- tests/test_nebulas.py: 19 cases covering setup, three-subsector
  creation, disctile/ancient distribution, internal + external +
  rotated adjacency, the influence-target type filter, deck population
  with the flag on/off, and the orbital/monolith reroll edge cases

Verified subsector layout against printed art for both NGC 5189 (295)
and NGC 1952 (395) — Ancient in the right subsector (B), Discoveries
in the top (A) and bottom-left (C). All 23 tests pass.
Moved message delete into the loops. I believe if the button is pressed but then the user receives a "bot busy" error...then the buttons are deleted but the user is not added to the draw queue
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.

Nebulas

2 participants