Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- [`FeatureSpec.referee_notes`][osrlib.crawl.dungeon.FeatureSpec.referee_notes] is a new string field for what the referee reads about a feature and the players never do, such as what a cache holds or how its trap is hidden (#318). osrlib never reads it, no event includes it, and no rule depends on it. It's in the adventure document, so a save and [`RefereeView.adventure`][osrlib.crawl.views.RefereeView.adventure] have it, but the player view doesn't include it. It defaults to an empty string, so an adventure document written before this release loads unchanged, and [`SCHEMA_VERSION`][osrlib.versioning.SCHEMA_VERSION] stays 4.
- [`EncounterView.can_back_stab`][osrlib.crawl.views.EncounterView.can_back_stab] lists the members who can declare an `attack` with [`back_stab`][osrlib.crawl.commands.BattleDeclaration.back_stab] this round: those whose class has the `back_stab` ability, in the party's free round or while they're hiding (#319). The session never refuses a back-stab by a member in it with `battle.declaration.back_stab_no_ability` or `battle.declaration.back_stab_target_aware`, and always refuses one by any other declarer with one of them, because the list comes from the same checks. So a client no longer needs to combine the class catalog, `party_free_round`, and `hiding`, and the list is also correct for a custom class, which isn't in the catalog. [`BattleRoundPreview.can_hide`][osrlib.crawl.battle.BattleRoundPreview.can_hide] and [`BattleRoundPreview.can_back_stab`][osrlib.crawl.battle.BattleRoundPreview.can_back_stab] give the two lists beside the declarations planned so far, judging each member as if the `hide` or the back-stab took the place of their own planned declaration. So another member's planned fighting withdrawal can take a thief out of `can_hide`, and another member's planned `close` can put one in it. A preview with no planned move gives the view's lists. Building the lists takes no draw, and each new field has an empty default, so a view or a preview from 2.7.0 still parses.
- Every equipment and magic item template has a `display_name` and a `display_name_plural`, what to call one unit and two or more in a sentence, such as `"vial of holy water"` and `"vials of holy water"` for the gear printed as `Holy water (vial)` (#316). They're on [`WeaponTemplate`][osrlib.core.items.WeaponTemplate], [`ArmourTemplate`][osrlib.core.items.ArmourTemplate], [`GearTemplate`][osrlib.core.items.GearTemplate], [`AmmunitionTemplate`][osrlib.core.items.AmmunitionTemplate], and [`MagicItemTemplate`][osrlib.core.items.MagicItemTemplate]. Each name refers to the unit that an instance's `quantity` counts, not to a lot from the price list, so `Torches (6)` is `"torch"` and `Arrows +1 (3d10 arrows)` is `"arrow +1"`. The SRD compiler fills them for the built-in catalogs. A template you write that leaves them out gets its `name`, and a plural with the regular English ending on the word that names the item, the last word before the first `of`, `with`, or `vs` in any case, a comma, a bonus such as `+1`, a closing Roman numeral, or an opening parenthesis, or the last word of a name with none of them. So `"Idol of the drowned saint"` becomes `"Idols of the drowned saint"`, `"Staff Of Power"` becomes `"Staves Of Power"`, and spaces after the word stay after the ending. Every compiled plural follows the same rule. An adventure document from 2.7.0 still loads.
- [`PlayerView.item_names`][osrlib.crawl.views.PlayerView.item_names] and [`PlayerView.item_names_plural`][osrlib.crawl.views.PlayerView.item_names_plural] name every item whose id the view shows, keyed by that id: a mundane stack's catalog id, and a magic item's or a valuable's instance id, in a member's inventory or a known pile (#316). A mundane stack, carried or in a pile, is named from the session's catalog, [`GameSession.effective_equipment`][osrlib.crawl.session.GameSession.effective_equipment], so an item the adventure bundles is named, and a stack from a 2.7.0 save or party document, which embeds a template without display names, is named as a new stack is. A carried stack whose id the catalog lacks, such as an item another adventure bundled, is named from the template it embeds. An unidentified magic item is named by its masked name without the article, like `"potion"` or `"shield with a faint aura"`, so a cursed item has the names of the item it passes for, and the view never includes its template id. An identified item is named by its template's display names, under its instance id, and under its template id while a member carries it, because a pile shows a magic item by its instance id alone. A gem is `"gem"` and a piece of jewellery `"piece of jewellery"`. Before, a client with only the view and the events couldn't word "The party finds 2 vials of holy water".
- [`PlayerView.item_names`][osrlib.crawl.views.PlayerView.item_names] and [`PlayerView.item_names_plural`][osrlib.crawl.views.PlayerView.item_names_plural] name every item whose id the view shows, keyed by that id: a mundane stack's catalog id, and a magic item's or a valuable's instance id, in a member's inventory or a known pile (#316). A stack a member carries is named from the template it embeds, and a stack in a pile from the session's catalog, [`GameSession.effective_equipment`][osrlib.crawl.session.GameSession.effective_equipment], so an item the adventure bundles is named in both places. A carried stack whose id the catalog lacks, such as an item another adventure bundled, keeps the names its template has. An unidentified magic item is named by its masked name without the article, like `"potion"` or `"shield with a faint aura"`, so a cursed item has the names of the item it passes for, and the view never includes its template id. An identified item is named by its template's display names, under its instance id, and under its template id while a member carries it, because a pile shows a magic item by its instance id alone. A gem is `"gem"` and a piece of jewellery `"piece of jewellery"`. Before, a client with only the view and the events couldn't word "The party finds 2 vials of holy water".
- [`PileView.contents`][osrlib.crawl.views.PileView.contents] gives each thing in a pile as a [`PileItemView`][osrlib.crawl.views.PileItemView], with the id that the events use for it and its count, in the order of `items` (#316). A client reads `"holy_water"` and 2 there where `items` has `"holy_water×2"`. `items` doesn't change.
- [`ItemIdentifiedEvent`][osrlib.crawl.events.ItemIdentifiedEvent] has two new fields, `display_name` and `display_name_plural`, the identified item's display names, like `"potion of healing"` (#316). A potion drunk before the party knew what it was is identified and used up in one command, so no view contains its name, but the event does. An event recorded before this release has empty names. Every field this release adds has a default, so a 2.7.0 save, view, or event still parses, and [`SCHEMA_VERSION`][osrlib.versioning.SCHEMA_VERSION] stays 4.
- The gear in a save or a party document that osrlib 2.7.0 wrote takes the display names of the session's catalog (#316). Its embedded templates have no display names, so they validate with the defaults from the price-list `name`, like `"Holy water (vial)"`. When a session starts, when [`load_game`][osrlib.persistence.load_game] restores one, and when [`AddMember`][osrlib.crawl.commands.AddMember] adds a member, each template that a party member's or an NPC adventurer's stack embeds takes the `display_name` and `display_name_plural` of the catalog's template with the same id, with the `overrides_applied` entries that name those two fields. So holy water from a 2.7.0 save reads `"vial of holy water"` in `MemberView.inventory`, in the referee view, and in [`PlayerView.item_names`][osrlib.crawl.views.PlayerView.item_names], and the next save writes those names. Nothing else in the template changes, a template whose id the catalog lacks keeps its names, `AddMember`'s logged character keeps the templates it arrived with, and loading a save draws nothing.
- [`MemberView.preparable_spells`][osrlib.crawl.views.MemberView.preparable_spells] and [`MemberView.learnable_spells`][osrlib.crawl.views.MemberView.learnable_spells] list the spells a member may select in a [`PrepareSpells`][osrlib.crawl.commands.PrepareSpells] and write into their spell book with [`LearnSpell`][osrlib.crawl.commands.LearnSpell], in the order of [`GameSession.effective_spells`][osrlib.crawl.session.GameSession.effective_spells] (#326). The view and the commands make the same checks. A spell is in `preparable_spells` exactly when a `PrepareSpells` that selects one copy of it in its normal form is accepted, or is refused only for the moment and with none of `magic.memorize.not_a_caster`, `magic.memorize.unknown_spell`, `magic.memorize.wrong_list`, `magic.memorize.not_in_book`, and `magic.memorize.slots_exceeded`. An arcane caster may also prepare the reverse of a listed spell that `reversed_spell_names` names. A spell is in `learnable_spells` exactly when a `LearnSpell` for it is accepted, or is refused only for the moment and with none of `magic.book.not_arcane`, `magic.book.unknown_spell`, `magic.book.wrong_list`, `magic.book.duplicate`, and `magic.book.capacity_exceeded`. A selection made only of listed spells is still refused when it has more copies at a spell level than the member has slots there. A divine caster's `preparable_spells` has every spell on the class's list at the spell levels where the caster has a slot, including the spells the adventure bundles for that list. An arcane caster's `learnable_spells` has the spells on the list that aren't in the book, at the spell levels where the book has room. Neither list depends on the moment, so each is the same before the party has slept, during an encounter or a battle, and while the member can't act, although the session refuses the commands then. Before, the view named a spell only once a member had it, so a player couldn't find out that the adventure adds a spell their cleric may prepare or their magic-user may learn.
- [`MemberView.spell_slots`][osrlib.crawl.views.MemberView.spell_slots] is how many spells the member can memorize at each spell level, from the class's progression row for the member's level, so it's right for a custom class too, and [`PlayerView.spell_levels`][osrlib.crawl.views.PlayerView.spell_levels] is the level of each spell in `spell_names` (#326). With them, a client groups a prepare or learn dialog by spell level and fits it to the slots. `spell_names`, `reversed_spell_names`, and `spell_levels` name every spell in the two lists, and a spell that the members can't choose stays hidden, such as one the adventure bundles for a list that the party's classes don't cast from. The session works the four new fields out from the characters and the catalog, so a 2.7.0 save loads with them filled in. Every new field has a default, so a 2.7.0 player view still parses, and [`SCHEMA_VERSION`][osrlib.versioning.SCHEMA_VERSION] stays 4.

### Changed

- The gear in a save or a party document that osrlib 2.7.0 wrote takes the display names of the session's catalog (#316). Its embedded templates have no display names, so they validate with the defaults from the price-list `name`, like `"Holy water (vial)"`. When a session starts, when [`load_game`][osrlib.persistence.load_game] restores one, and when [`AddMember`][osrlib.crawl.commands.AddMember] adds a member, each template that a party member's or an NPC adventurer's stack embeds takes the `display_name` and `display_name_plural` of the catalog's template with the same id, with the `overrides_applied` entries that name those two fields. So holy water from a 2.7.0 save reads `"vial of holy water"` in `MemberView.inventory`, in the referee view, and in [`PlayerView.item_names`][osrlib.crawl.views.PlayerView.item_names], and the next save writes those names. Nothing else in the template changes, a template whose id the catalog lacks keeps its names, `AddMember`'s logged character keeps the templates it arrived with, and loading a save draws nothing.

### Fixed

- The docstrings of [`FeatureSpec.description`][osrlib.crawl.dungeon.FeatureSpec.description] and [`MapFeatureView.description`][osrlib.crawl.views.MapFeatureView.description], and the guide to authoring custom content, say who reads a feature's description (#318). Since 2.6.0, the player view shows a cache's authored description as soon as the cache comes into view, before anyone opens it and after the party empties it. Before 2.6.0, only a referee read that text, but neither the 2.6.0 changelog nor the docstring, which called it "Text to show when the party finds the feature", said that the players now read it. If you wrote an adventure before 2.6.0, check each cache's description for its contents, the identity of a magic item the players see masked, and a trap the party hasn't found. Leave in `description` what the party sees from outside the cache, and move the rest: the contents to the cache's `item_ids`, `magic_item_ids`, `coins`, and `valuables`, the trap to its `trap`, and what only the referee reads to the new `referee_notes`.
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/views-and-visibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Each party member appears in `PlayerView.party` as a [`MemberView`][osrlib.crawl

A spell id appears in five places in the view: in a member's `spell_book`, `preparable_spells`, `learnable_spells`, and `memorized_spells`, and as the `kind` of a spell's effect in `PlayerView.effects`. Show the names in [`PlayerView.spell_names`][osrlib.crawl.views.PlayerView.spell_names], keyed by those ids, and the names of reversed forms, like *darkness* for *light*, in [`PlayerView.reversed_spell_names`][osrlib.crawl.views.PlayerView.reversed_spell_names]. Group spells by the level in [`PlayerView.spell_levels`][osrlib.crawl.views.PlayerView.spell_levels]. The view reads all three from the session's catalog, so a spell the adventure bundles has its name and level there too. They name only the spells whose ids the view shows. A spell the adventure bundles for a list that the party's classes don't cast from stays hidden. So does a spell at a spell level where the members can neither prepare nor learn it. A spell on a scroll is named only when the view shows its id in one of the five places: in a member's book, either list, or memorized copies, or as the kind of an effect on a member.

Items work the same way. An inventory identifies a mundane stack by its template's catalog id, like `"holy_water"`, and a magic item or a gem or piece of jewellery by its instance id, like `"magic-item-0003"`, and the item events use the same ids. Show the names in [`PlayerView.item_names`][osrlib.crawl.views.PlayerView.item_names], a noun phrase for one with no article, like `"vial of holy water"`, and in [`PlayerView.item_names_plural`][osrlib.crawl.views.PlayerView.item_names_plural] for a count, so you can word "The party finds 2 vials of holy water". Both have a key for each item id that the inventories and the known piles show, and only for those ids. A mundane stack, carried or in a pile, is named as the session's catalog names it, so an item the adventure bundles has its name there too. The session gives the template each carried stack embeds the catalog's display names when it starts, when a save loads, and when [`AddMember`][osrlib.crawl.commands.AddMember] adds a member, so a stack from a 2.7.0 save, whose template has no display names, shows the catalog's names in `inventory` too, and the next save writes them. A carried stack whose id the catalog lacks, such as an item another adventure bundled, keeps the names its template has. A valuable is named by its kind, `"gem"` or `"piece of jewellery"`, whereas the inventory's `valuables` contain the piece's name and value. A potion drunk before the party knew what it was is identified and used up in one command, so no view contains its name, and the [`ItemIdentifiedEvent`][osrlib.crawl.events.ItemIdentifiedEvent] contains its names instead.
Items work the same way. An inventory identifies a mundane stack by its template's catalog id, like `"holy_water"`, and a magic item or a gem or piece of jewellery by its instance id, like `"magic-item-0003"`, and the item events use the same ids. Show the names in [`PlayerView.item_names`][osrlib.crawl.views.PlayerView.item_names], a noun phrase for one with no article, like `"vial of holy water"`, and in [`PlayerView.item_names_plural`][osrlib.crawl.views.PlayerView.item_names_plural] for a count, so you can word "The party finds 2 vials of holy water". Both have a key for each item id that the inventories and the known piles show, and only for those ids. A stack in a pile is named from the session's catalog, and a stack a member carries from the template it embeds, so an item the adventure bundles has its name in both places. The session gives the template each carried stack embeds the catalog's display names when it starts, when a save loads, and when [`AddMember`][osrlib.crawl.commands.AddMember] adds a member, so a stack from a 2.7.0 save, whose template has no display names, shows the catalog's names in `inventory` too, and the next save writes them. A carried stack whose id the catalog lacks, such as an item another adventure bundled, keeps the names its template has. A valuable is named by its kind, `"gem"` or `"piece of jewellery"`, whereas the inventory's `valuables` contain the piece's name and value. A potion drunk before the party knew what it was is identified and used up in one command, so no view contains its name, and the [`ItemIdentifiedEvent`][osrlib.crawl.events.ItemIdentifiedEvent] contains its names instead.

Derived combat and exploration stats include bonuses from worn equipment (such as armour, a shield, or a ring of protection), even before the party identifies a magic item:

Expand Down
Loading
Loading