Skip to content

osrlib.crawl.party

The crawl party: marching order, group movement, and combat ranks.

The member list order is marching order — there is no separate order field to desync; reorder swaps in place, and ReorderParty is the only command that mutates it. Dead members stay in the party (their gear is carried state; excluding them is a game decision via referee commands) but never count toward movement rate, ranks, checks, or provisions.

Party

Bases: BaseModel

The adventuring party, in marching order.

members class-attribute instance-attribute

members: list[Character] = Field(min_length=1)

living_members

living_members() -> list[Character]

Return the living members, in marching order.

member

member(character_id: str) -> Character

Return the member with character_id.

Parameters:

Name Type Description Default
character_id str

The member's entity id.

required

Returns:

Type Description
Character

The character.

Raises:

Type Description
ValueError

If no member has that id.

movement_rate

movement_rate(ruleset: Ruleset) -> int

Return the party's exploration rate: the slowest living member's (SRD group rule).

Parameters:

Name Type Description Default
ruleset Ruleset

The ruleset whose encumbrance mode governs.

required

Returns:

Type Description
int

The rate in feet per turn; 0 when nobody is alive.

ranks

ranks(width: int) -> list[list[Character]]

Chunk the living members into combat ranks of width, in marching order.

The fallen collapse forward by construction: ranks derive from the living marching order each time they're read.

Parameters:

Name Type Description Default
width int

The formation width (3 in a keyed area, 2 in corridor under the formation_width_limit flag).

required

Returns:

Type Description
list[list[Character]]

The ranks, front first.

Raises:

Type Description
ValueError

If width is not positive.

reorder

reorder(character_ids: Sequence[str]) -> None

Rewrite the marching order — ReorderParty's apply step.

Parameters:

Name Type Description Default
character_ids Sequence[str]

Every member's id, in the new order (a permutation).

required

Raises:

Type Description
ValueError

If the ids are not exactly the current membership.