osrlib.core.ruleset
The Ruleset model: optional-rule and adaptation flags.
Every SRD optional rule and every documented adaptation is a named flag with a
default. Flags are read at resolution time, so a Ruleset is fixed for the life of a
session (it participates in saves and replays). The model is frozen and rejects unknown
flags — a typo'd flag name errors instead of silently doing nothing.
EncumbranceMode
Bases: StrEnum
How carried weight is tracked; see osrlib.core.items.
The wire values are "none", "basic", and "detailed" — lowercase, serialized
into saves; changing them is a schema_version bump.
Ruleset
Bases: BaseModel
The optional-rule and adaptation flags a session plays under.
Each flag is either an optional rule from the OSE SRD or a documented adaptation
(see the adaptations register on the documentation site). Build a Ruleset when a
session starts; it is frozen, and it travels with saves and replays so a game
always resumes under the rules it began with.
Attributes:
| Name | Type | Description |
|---|---|---|
hp_reroll_at_first_level |
bool
|
SRD optional rule, default off: first-level hit-point dice showing 1 or 2 (the raw die, before the CON modifier) are re-rolled until the die shows 3 or more. |
encumbrance |
EncumbranceMode
|
Which encumbrance system tracks carried weight and drives
movement rates; see |
variable_weapon_damage |
bool
|
SRD optional rule, default on: each weapon deals the damage listed in its description. Off means every weapon — and every piece of gear swung as one — deals 1d6, the SRD's baseline "PC attacks inflict 1d6 damage" rule. Unarmed attacks stay 1d2 either way (their own rule, not weapon damage), and monster damage is unaffected: monsters always deal the damage in their descriptions. |
individual_initiative |
bool
|
SRD optional rule, default off: each combat
participant rolls its own 1d6 initiative, DEX-modified for characters
(plus the halfling's |
thac0_arithmetic |
bool
|
SRD optional rule, default off: the attack target number is
unclamped |
weapon_reload |
bool
|
SRD optional rule, default off: a weapon with the reload quality cannot fire two rounds running. The attack validator rejects the shot when the caller-supplied context says the weapon fired last round; round-to-round bookkeeping belongs to the battle layer, and the kernel enforces the rule given honest context. |
hd5_counts_as_magical |
bool
|
The SRD's invulnerabilities optional rule, default off: a monster of 5 or more Hit Dice — or another invulnerable monster — can harm creatures otherwise hurt only by silver or magic weapons. Following the rule's own wording, osrlib applies the flag only to weapon-material requirements limited to silver and magic, and reads "another invulnerable monster" as a monster bearing such a requirement itself. |
deprivation_penalties |
bool
|
A documented adaptation, default off. Food and water consumption is tracked either way; this flag controls whether going without carries penalties. The tabletop game leaves starvation penalties to the referee ("at the referee's discretion, for example..."); osrlib fixes a schedule drawn from the SRD's own examples — see the adaptations register. After one full day without food or water: −1 to attack rolls, and rest is needed twice as often (fatigue after three unrested turns instead of six). After two days: movement also halves. From the third day on: 1d4 hit points lost per day. Food and water deprivation don't stack — the worse track applies. |
magic_item_death_save |
bool
|
The SRD's referee-optional saving throw for magic items whose owner dies to a destructive effect, default on: each magic item in the doomed inventory rolls the owner's save values against the destructive source's category, adding the item's best combat bonus. Survivors land in a drop pile at the victim's cell rather than vanishing — surviving the blast but not the looting would be no survival at all. |
xp_award_timing |
XpAwardTiming
|
When XP awards fire, default |
aoe_friendly_fire |
bool
|
A documented adaptation, default on: an area effect landing on a monster group at melee range catches engaged party members among its candidates. Off means area effects never include party members among a monster group's candidates. |
formation_width_limit |
bool
|
A documented adaptation, default on: passage width caps how many combatants fight abreast — three inside a keyed area, two in corridor cells — following the SRD's "2–3 characters fighting side-by-side in a 10' wide passage". Off lifts the cap: every combatant may melee. |
xp_award_timing
class-attribute
instance-attribute
xp_award_timing: XpAwardTiming = XpAwardTiming.ON_RETURN
XpAwardTiming
Bases: StrEnum
When the XP award fires; see the adventure award procedure.
The wire values are "on_return" and "immediate" — lowercase, serialized
into saves; changing them is a schema_version bump.