Skip to content

Show each member's distance, reach, and sight in the encounter view - #219

Merged
mmacy merged 3 commits into
mainfrom
chunk/view-and-codes
Oct 31, 2026
Merged

mmacy merged 3 commits into
mainfrom
chunk/view-and-codes

Conversation

@mmacy

@mmacy mmacy commented Oct 31, 2026

Copy link
Copy Markdown
Owner

This is the view chunk of issue #209. The encounter view now gives a battle screen what it needs once party members stand at their own distances:

  • Each group's member_distance_feet, front_rank (who can make a melee attack on it this round without moving, and whom its melee reaches), lit, and seen_by.
  • EncounterView.advance_feet, formation_width, and party_free_round, the round in which a back-stab is legal.
  • MemberView.encounter_rate_feet, the member's feet per round after encumbrance and haste.

EncounterGroupView.front_rank always equals group_front_rank for the same group. Light and sight are reported only, so nothing new is refused. Every new field reads party state and the group distances the view already shows, so the player view reveals nothing referee-only. The Ring of Protection's 5' radius now counts the defender's rank-mates toward the attacking group.

The docstrings of MemberMovedEvent and GroupMovedEvent now say to read positions from the view after the round, because a shift of the party line changes them with no event. preview_battle_round says how a partial plan judges a defensive move. The battle module's docstring describes the round as it now works.

The test of the maintainer's goal battle passes: the thief closes and back-stabs in the free round, the elf shoots from 30', the fighters close, and the magic-user casts magic missile from the back.

https://claude.ai/code/session_01V7ErtnsmhaP7aLwcfmzohD

mmacy added 3 commits October 31, 2026 00:49
The player view now reports each member's advance, each member's distance to
each group, who can fight each group hand to hand, the formation width, the
party's free round after a surprise, and each member's encounter rate. Each
group's front rank comes from the same helper as group_front_rank, so the two
always agree. The encounter's own front rank is now the first row toward the
nearest group instead of the first rank of the marching order.

Each group also reports whether the party's light reaches it and which
members can see it. A group is lit when a living member carrying a light
stands within that light's radius of it. A member sees a lit group, or a group
within the range of their working infravision. Blind members see nothing, and
darkness puts out the light and can stop infravision. The session refuses
nothing new because of sight.

The ring of protection's 5' radius now shields the defender's rank-mates
toward the attacking group, the members at the same distance from it, instead
of the defender's marching-order rank.

Claude-Session: https://claude.ai/code/session_01V7ErtnsmhaP7aLwcfmzohD
…after it

The battle module's docstring now walks through the round step by step: the
judgement of every declaration at the places its moves would reach, the
party's movement step, missiles and spells from each member's own place, melee
only within reach and in the front rank, and monsters that close and attack in
the same round. It also points a battle screen at the encounter view.

MemberMovedEvent and GroupMovedEvent report a distance right after the move,
before any shift of the party line, so their docstrings now tell a client to
narrate the move from the event and to read EncounterView.advance_feet after
the round to draw positions.

preview_battle_round's docstring now says that a partial plan judges a
defensive move as one member's own move, and that the complete plan can turn
into a formation move when every declarer makes the same one.

The rejection reference for combat.attack.out_of_reach and
combat.attack.out_of_range now says the distance is the member's own, after
any close the same declaration makes.

Claude-Session: https://claude.ai/code/session_01V7ErtnsmhaP7aLwcfmzohD
The encounter view tests for positions, reach, and sight pass, including the round-by-round battle with the thief's back-stab, the elf's bow, the fighters' close, and the magic-user's spell, so their expected-to-fail markers come off.

Claude-Session: https://claude.ai/code/session_01V7ErtnsmhaP7aLwcfmzohD
@mmacy
mmacy merged commit 7a02cdd into main Oct 31, 2026
5 checks passed
@mmacy
mmacy deleted the chunk/view-and-codes branch October 31, 2026 07:54
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.

1 participant