Skip to content

v0.8.0

Choose a tag to compare

@tapestria tapestria released this 15 Nov 00:48
176b923

Lockstep release of dnd5e-srd-data, dnd5e-engine and nat20-bridge 0.8.0, an additive minor release. Encounter members can fight on the party's side, a host can choose a monster's target, melee attacks can knock a creature out (SRD 5.2), item casts place their spell's area, a monster's closing walk honours occupancy, a move takes a detour around walls, and walled grids are faster. Every new name and field is defaulted, and a payload stored under 0.7.0 still validates. The dataset is unchanged. Upgrade notes: docs/migration/v0.7-to-v0.8.md.

What a host may notice

  • KnockedOut joins the closed CombatEvent union, and knock_out_not_melee joins the rejection reasons. Both appear only when a host asks for a knock-out.
  • A move takes a detour. A move to an adjacent cell whose direct step crosses a wall or cuts a blocked corner walks the shortest legal route around, priced and provoking like any route. blocked_path now means no route exists; a detour that costs more than the movement left is insufficient_movement.
  • The monster AI's closing walk honours occupancy. It passes through allies, never ends on another creature and never enters an enemy's cell. A walk with no creature in the way is unchanged.
  • An item that casts a spell targets as that spell. A Wand of Fireballs places Fireball's Sphere, and a Wand of Magic Missiles splits its darts at the item's cast level.
  • DeathRecord.killer_id names the creature that dealt the killing damage, whoever's turn it was (an opportunity attack's reactor, a legendary action's monster, a summon). It used to name the creature whose turn it was.
  • XP goes to surviving characters only, and a foe still knocked out at the end is worth its XP.

dnd5e-engine

Added

  • Sides: EncounterMemberSpec.side ("encounter" by default, or "party") and Side. A party-side member fights the encounter side, is fought by it, and dies at 0 Hit Points as a monster does. A standing ally keeps the party in the fight, so a combat ended after every character has died while an ally stands reads forced (or flee), not defeat_tpk.
  • A host-chosen monster target: advance_monster_turn(..., target_id=None). An id outside the monster's target pool, or any id on a summon's turn, raises IntentRejectedError("target_invalid") before the turn starts, with nothing rolled, spent or emitted.
  • Knocking out a creature: PlayerIntent.knock_out. A melee blow that would drop a creature to 0 Hit Points leaves it at 1 Hit Point and Unconscious. New: KnockedOut, DamageApplied.knock_out, KnockOutRecord, CombatOutcome.knock_outs, and LiveCombatView.knocked_out_ids.
  • LiveCombatView.deaths: the deaths so far, with their killers.
  • dnd5e_engine.testing.rng_factory: a test-support context manager that scripts or records every die a combat draws, Initiative included.

Changed

  • Wall segments are indexed by the cells they touch. Step and sight tests read only nearby walls, so their cost no longer grows with the wall count. Every answer is unchanged.
  • end_combat and LiveCombatView.final_outcome return a copy of the kept outcome each time.

Fixed

  • A character already Unconscious from an effect (a sleep) that drops to 0 Hit Points now emits the Unconscious dying marker. It no longer wakes at 0 Hit Points when that effect ends.

Full details: CHANGELOG.

dnd5e-srd-data

No content change: the canonical corpus is byte-identical to 0.7.0. The version moves in lockstep, and dnd5e-engine 0.8.0 requires dnd5e-srd-data>=0.8.0.

nat20-bridge

  • POST /v1/combat takes allies: monster slugs seated on the party's side.
  • POST /v1/combat/{cid}/advance-monster takes an optional {"target_id": ...} body.
  • An intent body accepts knock_out.
  • target_invalid and knock_out_not_melee answer 409.
  • GET /v1/combat/{cid} adds party_ids, encounter_ids, knocked_out_ids and deaths.
  • Narration covers every engine event type. 18 types, including spell casts, effects, concentration, movement, death saves, temporary Hit Points, reactions, recharge and legendary actions, used to fall through to a raw [type] key=value dump. Each now renders as a sentence, and intent types read as words (attempts cast spell). A knock-out narrates as a line. (#47)

Upgrade checklist

  1. Upgrade dnd5e-srd-data, dnd5e-engine and nat20-bridge together: dnd5e-engine requires dnd5e-srd-data>=0.8.0, and nat20-bridge requires both at >=0.8.0.
  2. If you match CombatEvent exhaustively, handle KnockedOut. If you match the rejection reasons exhaustively, handle knock_out_not_melee.
  3. If you pre-validate moves, stop rejecting an adjacent move behind a wall; the engine now walks around it when it can.
  4. List an item that casts a spell with that spell's targeting.
  5. Read DeathRecord.killer_id as the creature that dealt the blow.
  6. If you parse the bridge's narration text, expect sentences where [type] key=value lines used to be.

Every step, with its detail and the three moved seeded pins: docs/migration/v0.7-to-v0.8.md.