Migration guide: v0.6 → v0.7
v0.7.0 is a breaking minor release of dnd5e-engine, dnd5e-srd-data and
nat20-bridge, in lockstep. It makes GridScene the only spatial backend,
drops the duplicate concentration SaveRolled, and closes the gaps a grid host
meets first. After the checklist, each section is one chunk of that work; every
seeded pin a chunk moved is listed with its reason.
Upgrade checklist
Upgrade the three packages together: dnd5e-engine requires
dnd5e-srd-data>=0.7.0, and nat20-bridge requires both at >=0.7.0.
Then:
- Pass a
GridSceneto everystart_combat, with every start position one of its cells (C25). A host still on zones fails loudly there:scene_zones=raisesTypeError, and a start position that is not a cell raisesValueErrornaming the combatant and the cell — the emptyCombatInstance.zone_iddefault of a character built withbuild_party_memberincluded. - Read a concentration save from
ConcentrationCheck(C25): itsSaveRolledtwin is gone. - Handle
AreaTargeted(C26a), on monster turns too (C26b): a host that matchesCombatEventexhaustively needs a branch for it. - Expect opportunity attacks and monster flee on the grid (C24), and give
a character whose spec carries no
equipmentanopportunity_attack_weapon_id. - Decide whom an area "of your choice" spares with
excluded_target_ids(C26a). - Expect templated monsters to see with their stat-block senses and to keep their condition immunities (C27).
- Match a background's feat by its canonical slug, and expect it on the
sheet; a feat taken twice that is not repeatable raises
ValueError(C28). nat20-bridgeclients: send onlyPlayerIntentfields in an intent body, stop readingmember.attack_bonus, and end the combats you are done with (C29).
C24 — grid movement and reactions
What a host has to do
- Expect opportunity attacks on the grid. On v0.6 no move on a
GridSceneever drew one. Now every walk does, whoever drives it: a character's or a host-driven foe'smoveintent, the monster AI's closing walk and its flee. RenderIntentSubmitted(intent_type="reaction")andAttackRolled(is_opportunity_attack=True)mid-move. - Handle a split
ActorMoved. Amoveintent still emits oneActorMovedfor an uninterrupted walk, but a step that provokes closes the run walked so far: the attack lands between twoActorMovedevents, so a host can place the hit. The monster AI's walks emit one per step, as before. - Name the weapon a character strikes with if your specs carry no
equipment. A character's opportunity attack uses the newPartyMemberSpec.opportunity_attack_weapon_id, else the first melee weapon inequipment, else an Unarmed Strike (a flat 1 + Strength modifier, Bludgeoning).start_combatraisesValueErrorfor anopportunity_attack_weapon_idthat names no melee weapon.
Behaviour changes
- One trigger per step. A step provokes a creature when it takes the mover from inside that creature's reach to outside it. Reach is Chebyshev, so stepping around inside it never provokes. The reactor must be the mover's enemy, conscious, not Incapacitated, with its Reaction, able to see the mover, and not Charmed by it (SRD 5.2 Charmed: "You can't attack the charmer"). Disengage now suppresses attacks from either side; it used to protect only a character from monsters.
- Summons make none (unchanged): a summon takes no reactions.
- The walk stops where an attack drops the mover to 0 HP or its Speed to 0. A character knocked unconscious no longer finishes its move. A mover a Push mastery hit carries off also stops there, keeping its unspent movement, rather than finishing the step the push interrupted.
- Reach. A character reaches with its weapon (10 ft with the Reach
property), or with
reach_ftwhen it makes an Unarmed Strike. A monster reaches with its first non-ranged stat-block attack: its own range if that attack is a melee attack with one (a Pike's 10 ft), else 5 ft. A melee-or-thrown attack's range is its throw, not its reach (SRD 5.2 Spear: "reach 5 ft. or range 20/60 ft."). - The attack goes through the activity context, like one on the
reactor's own turn: cover, Fighting Styles, Martial Arts, proficiency,
enchantments, weapon mastery, Sneak Attack and the target's readied Shield
all apply. A monster or a transformed creature uses its stat-block attack, so
AttackRolled.modifier/roll_totalandDamageApplied.amount/damage_type/source_idchange: a weapon's slug,"unarmed-strike", orNonefor a stat-block attack (the on-turn convention). A template-less foe, or a character when your asset loader carries neither its weapon norunarmed-strike, still swings itsattack_bonus/damage_dice(source_id="synth:legacy-swing"). Cleave, the Light property's extra attack, Loading and Bardic Inspiration don't apply. A Versatile weapon swings its one-handed die, so Great Weapon Fighting doesn't apply to it. A template monster's to-hit is still its spec'sattack_bonus(+0 by default). - A template monster's opportunity-attack damage now reports
DamageApplied.source_id=None, the on-turn convention; it was"synth:legacy-swing". - A foe whose
monster_template_slugdoesn't resolve makes no opportunity attack at all, matching its on-turn behaviour; it used to swing its legacyattack_bonus/damage_dicefields regardless. - A hidden reactor that makes an opportunity attack stops being hidden (SRD-correct; new).
- Prone at range. An opportunity attack on a Prone creature more than 5 ft away has Disadvantage (it used to assume 5 ft).
- Sneak Attack is once per turn of any creature. The spent flag now clears at every turn start, so a rogue's opportunity attack on another creature's turn can deal it.
- Monsters flee on the grid. A monster under its flee threshold runs as far
from its nearest enemy as its movement allows: reachable, unoccupied cells
only, never through an enemy's space, ties broken by the cheaper route then
the lower column and row. It takes no Disengage or Dash, so leaving a
character's reach provokes. A cornered monster holds. An Incapacitated
monster takes no flee stance (
has_fledstaysFalse).
New API
PartyMemberSpec.opportunity_attack_weapon_id: str | None = None.GridTopology.reachable_cells(start, budget_ft, *, avoid=())→{cell: (cost_ft, previous_cell)}: every cell a creature can walk to within a movement budget (difficult terrain costs double), for planning a route.
Moved seeded pins
Every assertion still holds; these streams changed.
| Test | Why |
|---|---|
e2e/test_c14_action_economy.py::test_c14_s04_grapple_shove_and_stand_up |
The Target's own move out of the Brute's reach now draws the Brute's opportunity attack: an Unarmed Strike at +7. |
e2e/test_c18_monster_economy.py::test_c18_s08_combat_ends_flee_when_every_foe_has_fled |
The goblin flees from beside the hero and draws its attack (a natural 5, a miss); ended_reason is still "flee". |
e2e/test_c10_monster_behavior.py::test_c10_s01_fleeing_monster_never_actually_retreats |
Ported to the grid: the goblin runs 30 ft, to 9,0. |
test_c18_monster_economy_units.py: test_fleeing_goblin_sets_has_fled_and_combat_ends_with_flee, test_flee_requires_every_living_foe_to_have_fled, test_dead_foes_do_not_block_flee, test_flag_clears_when_the_monster_fights_again |
The fleeing goblin now walks (six ActorMoved, no dice). In the last one its next turn starts 45 ft away, so it Dashes instead of attacking. |
test_orchestrator_monster_typed.py::test_wounded_aggressive_monster_below_flee_threshold_passes |
Ported to the grid; the hero's opportunity attack as the monster flees is unchanged in shape. |
test_opportunity_attack_primitive.py::test_condition_free_aoo_determinism_pin_matches_pre_change_natural, ::test_opportunity_attack_nat_20_damage_is_attributed_and_flagged_crit |
Ported to the grid. The weaponless hero's critical opportunity attack is now an Unarmed Strike: source_id "synth:legacy-swing" → "unarmed-strike". The natural-5 determinism pin survives. |
e2e/test_c06_reactions.py::test_c06_s05_…, ::test_c06_s06_… |
Ported to the grid; the same draws (natural 5). |
test_c16b_vision.py: test_a_host_driven_foe_draws_no_opportunity_attack_from_its_own_side, …_has_advantage_when_mover_cannot_see_reactor, …_against_invisible_mover_seen_by_blindsight_is_normal, …_populates_split_source_lists |
Ported to the grid without stacking two creatures on one cell. In …_has_advantage_when_mover_cannot_see_reactor, …_against_invisible_mover_seen_by_blindsight_is_normal and …_populates_split_source_lists the hero's attack is now an Unarmed Strike at its pinned +5. |
test_c21_summon_allegiance.py::test_every_reactor_still_reacts_after_a_summon_leaves_mid_loop |
Ported to the grid; the same draws. |
demo hold-the-line |
Doran's advance past the two bandits draws both their opportunity attacks (natural 2 and 3, both misses). |
demo goblin-ambush |
Brynn's opportunity attack on Goblin 2 is now a longsword hit (her equipment), not 1d4. |
C25 — zone-graph removal; one event per concentration save
What a host has to do
- Pass a
GridScene.start_combatrequiresgrid_scene=. Passingscene_zones=raisesTypeError, andgrid_scene=NoneraisesValueError("start_combat: grid_scene is required"), both before any combat state exists. EveryPartyMemberSpec.zone_id/EncounterMemberSpec.zone_idmust be one of the scene's in-bounds, unblocked cells (cell_id(col, row)). A character built withbuild_party_membertakes its cell fromCombatInstance.zone_id, whose""default is never a cell: set it. - Port your zone layouts with the recipe below.
- Replace the removed names (table below).
- Read a concentration save from
ConcentrationCheck. The damage-triggered concentration save no longer emits aSaveRolled(ability="con")beside it. A dice display, a list of save targets or a save counter that read theSaveRollednow readsConcentrationCheck, which carries the samedc,roll_total,succeeded,natural,modifier,advantageandsources. - Delete a warning filter for the
start_combat(scene_zones=DeprecationWarningif your test configuration has one: nothing raises it.
Removed names
| Removed | Use instead |
|---|---|
start_combat(scene_zones=...) |
start_combat(grid_scene=GridScene(...)) |
SceneTopology, ZoneEdge (from dnd5e_engine, dnd5e_engine.specs and dnd5e_engine.orchestrator) |
GridScene (dnd5e_engine.orchestrator.__all__ now exports it, so a star import still brings every type start_combat takes) |
dnd5e_engine.testing.ZoneGraph |
dnd5e_engine.spatial.GridTopology(GridScene(...)), which answers within_range, distance_ft and the rest of SpatialTopology |
the SaveRolled(ability="con") a concentration save emitted beside its ConcentrationCheck |
ConcentrationCheck |
LiveCombatView, every event and every spec keep their zone-named fields:
zone_id, target_zone_id, actor_zone, and from_zone / to_zone on
ActorMoved and CombatantMoved. On the grid each holds a cell id.
Porting a zone layout
- Give each zone a block of cells: its members stand on mutually adjacent
cells, a 2×2 block for up to four creatures, so every pair is 5 ft apart. For
a block at
(c, r)usecell_id(c, r),cell_id(c, r + 1),cell_id(c + 1, r)andcell_id(c + 1, r + 1), in that order. - Place the blocks of two zones joined by an edge of d feet along one row so that their nearest cells are ⌈d / 5⌉ cells apart: the closest creatures of the two zones then stand d feet apart (rounded up to the next 5 ft).
- Make the
GridScenewide and tall enough for every block. - Never seat two creatures on one cell. The 0.6 stopgap,
GridScene(width=len(zones), height=1)withzone_id = cell_id(i, 0), puts a zone's members on one cell;start_combatdoesn't refuse that yet, but no move can ever produce it.
A former zone combat now gets everything the grid resolves: occupancy (a move
can't end on a creature, and enemies block the route), routes of many cells in
one move, reach-based opportunity attacks, areas of effect shaped by their
templates rather than by zones, cover, line of sight and light from the scene,
a summon seated on a free cell, pushes that move their target, and monsters
that flee.
Behaviour changes
- The zone graph's fallbacks are gone with it: the single step to an adjacent zone, an area hitting every creature in a zone, a summon seated in its caster's zone, a push that moved nothing, and a fleeing monster that held. None of them ever applied on a grid.
- A zone name where a cell belongs is refused, never a crash.
start_combatraisesValueErrorfor a start position that is not one of the scene's cells; amoveto a zone name emitsMoveFailed(reason="unreachable"); a Spiritual Weapon placed or moved there is refused without_of_range(CastFailedon the cast,AttackFailedon a later Bonus-Action move); and a Summon Dragon placed there getsCastFailed(reason="target_invalid"). Nothing is spent or moved. - An area the engine can't map onto the grid — the five
walltemplates and Confusion, whose size is a formula — affects its named target only: see C26a below. - One event per concentration save. Each damage-triggered concentration
check emits one event fewer, so every later event in
event_log,narration_eventsanddrain_pending_eventssits one position earlier per check. The order is nowConcentrationCheck, thenLegendaryResistanceUsedwhen a Legendary Resistance converts the failure, then the drop events on a failure. The dice are unchanged: the twin never drew one. - Rage. An enemy's concentration check no longer counts as a saving throw the barbarian forced (SRD 5.2 Rage: "Force an enemy to make a saving throw"). The attack or save that dealt the damage already extends Rage, so the change shows only in a turn where nothing else extends it.
- Repeat saves. A failed concentration check can no longer stand in for the failed save behind a condition's end-of-turn repeat save. When a target concentrating on a spell of its own failed its concentration check during the resolution that applied the condition, the repeat save used to roll Constitution against the concentration DC; it now uses the spell's own save.
- nat20-bridge narration renders the check as its own line,
Elara rolls a concentration save: 14 vs DC 10 — succeeds., where it used to narrate the twin asElara rolls a con save: …. ZoneTransitis never emitted. It stays in theCombatEventunion so a host that still imports it keeps working; a later breaking release removes it.
Moved seeded pins
None. Every zone-graph test whose rule holds on a grid was ported with the
recipe above and keeps its assertions and its dice; the tests that pinned
zone-only behaviour were deleted. The tests that read the concentration
SaveRolled now read ConcentrationCheck, with the same values.
C26a — areas of effect for every intent kind; the corrected monster areas
What a host has to do
- Handle
AreaTargeted. Every area a cast, item use or feature use places now emits one, before anything in it rolls: the actor, the source slug, the SRD 5.2 shape (sphere,cylinder,emanation,cube,cone,line), its size, its origin cell and aim, and the creatures it affects and spares. A host that matchesCombatEventexhaustively needs a branch for it; one that skips unknown types needs nothing. An attack never gets one. Ause_itemwhose item has several activities gets one only whenactivity_idnames the area activity, or when the area activity is the one the item charges automatically; a feature with several activities already needsactivity_id. - Decide whom an area "of your choice" spares. Sleep, Weird, Slow, Mass
Cure Wounds, the Pipes of Haunting, the Mace of Terror, Intimidating
Presence and every other area whose activity sets
affects.choicenow spares the actor and its allies when it harms, and the actor's enemies when it heals. Passexcluded_target_ids=()to catch everyone in the area (up to six for Slow and Mass Cure Wounds), as a v0.6 cast did, or list the creatures to spare. - Send
excluded_target_idsonly with an area of your choice. On any other attack, cast, item use or feature use — a Fireball, a sword swing — it is refused withtarget_invalid(AttackFailedfor an attack,CastFailedotherwise) before anything is spent, and so is an id that is not in the combat. - Aim feature and item areas. A Breath Weapon, the Horn of Blasting or a
Javelin of Lightning's bolt needs
directionor atarget_id, as a cast already did; with neither it is refused withCastFailed(reason="target_invalid")before its use is spent.
Behaviour changes
- Feature and item areas resolve against every creature in their area; v0.6 resolved them against the named target alone. Cover is measured from their point of origin, as for a cast.
- "Of your choice" (above) and "each enemy" / "each ally"
(
affects.type) are honoured. No character-side area in the corpus is typed "each enemy" or "each ally" today. - "Up to N creatures." Slow and Mass Cure Wounds affect up to six
creatures: the ones
target_idsnames, else the first six the default keeps, in initiative order. Phantasmal Force affects the one creaturetarget_idnames; v0.6 hit whoever stood in a 10-foot cube in front of the caster. More names than the count, a repeated name or a name not in the combat is refused withtarget_invalid; the named creatures are not checked against the template. - An attack roll is never an area. The Torch's and the Hammer of Thunderbolts' templated attacks stay single-target.
- A template the engine can't map (the five
wallspells; Confusion, whose size is a formula) affects its named target only, and nobody when the intent names none; it used to fall back to the caster's own cell. The log line readsaoe_template_unsupported … falling back to the named target. - nat20-bridge narrates the event:
Elara's sleep fills a 5-ft sphere at 5,5: catches Goblin 1, Goblin 2; spares Elara. - A monster's own area action, a monster's cast and a legendary action still resolve against one target; C26b, below, aims them.
New API
PlayerIntent.excluded_target_ids: tuple[str, ...] | None = None. Ids must be distinct and non-empty (ValidationErrorotherwise).dnd5e_engine.events.AreaTargetedanddnd5e_engine.events.AreaShape, in theCombatEventunion andALL_COMBAT_EVENT_TYPES.
Data changes (dnd5e-srd-data)
affects.choiceon Sleep, Slow, Mass Cure Wounds and the Mace of Terror's Wave of Terror;affects.count: "6"on Slow and Mass Cure Wounds.- Recharge 5–6 on the adult blue, adult copper, ancient copper, ancient gold, ancient green and young red dragons' breaths and the Centaur Trooper's Trampling Charge (they had none, so those dragons never breathed: a dragon now opens with its breath) and on the Tarrasque's Thunderous Bellow (it had 6).
- The adult gold, ancient gold and gold wyrmling Fire Breath and the magma mephit's are Cones; the adult copper's Acid Breath is a 60-foot Line, the adult gold's Cone 60 feet, the ancient gold's and the ancient green's 90 feet.
- The four green dragons' and the iron golem's Poison Breath affect each
creature (
affects.type: "creature"), not only enemies. - A recharge with no formula recharges on a 6, Foundry's own default.
Moved seeded pins
None. Every existing test keeps its dice. The one corrected monster a test
fights, the magma mephit, now breathes a Cone, but a monster's area still
resolves against one target; no test casts a spell whose choice flag or count
changed, or stands a second creature in a feature or item area; and the Pipes
of Haunting tests stand one foe in range, whom the choice default still picks.
The unmappable-template test was renamed (…_targets_the_anchor_cell_only →
…_targets_the_named_target_only) with its same single save.
C26b — monsters aim their areas; a Multiattack's recharge; Shield and saves
What a host has to do
- Expect
AreaTargetedon monster turns. A monster's breath or other area action, its stat-block spell and its legendary action now emit one before anything in it rolls.source_idis the action's slug ("fire-breath") or, for a spell, the spell's ("fireball"). A host that handles the event (C26a) needs nothing more.IntentSubmitted.target_idon a monster's turn still names the creature the AI targets; read where the area lies and whom it affects fromAreaTargeted. - Re-check fixtures that put a monster beside its foes or far from them. A monster never places an area that affects itself, nor one that affects no enemy: a Mage beside its only foe casts Cone of Cold rather than a Fireball centred on that foe, and a dragon whose breath reaches no one walks instead.
Behaviour changes
- A monster's areas resolve against the creatures in them — its stat-block
actions, its stat-block spells and its legendary actions; v0.6 resolved them
against one target. The AI aims from the cell it stands in and takes the
placement that affects the most enemies minus allies, never itself; ties go
to fewer allies, then to the foes nearest the area's centre line, then to a
fixed order (directions clockwise from north, Sphere centres in initiative
order). Whom it affects follows the activity's
affects, as for any actor: "each enemy" spares the monster's allies, and an area of your choice spares its side. Cover is measured from the area's point of origin. - Whom it affects includes a dying foe. A monster's area affects every creature it catches there, a creature at 0 Hit Points included (SRD 5.2: an Unconscious creature auto-fails a Dexterity save, and damage at 0 HP is a death saving throw failure); only a choice or counted area spares the monster's charmer. The AI itself scores candidate placements only against creatures above 0 HP.
- Areas have a reach. A Sphere or Cylinder centres on a foe the monster can see within the action's or the spell's range; a Cone, Cube, Line or Emanation reaches its own size from the monster. v0.6 landed a monster's area on its target at any distance.
- An area that would affect no enemy is not an option. The monster takes
its next action (a charged breath stays charged), its next spell, or its next
legendary action; with none left,
advance_monster_turn(..., legendary=True)raisesIntentRejectedError("no_legendary_action")and spends no use. - "One creature" keeps one target. An action whose template counts one creature (the Aboleth's Dominate Mind, the Chuul's Paralyzing Tentacles) and a template the grid can't place still resolve against the AI's target.
- Multiattack. An action a Multiattack uses "if available" sits out while it isn't — once spent, the Doppelganger's Unsettling Visage no longer forces a Wisdom save every turn — and a Recharge action it uses is spent when it fires. An area it uses (the Sphinx of Valor's Roar) resolves against that area. When a Multiattack's description offers alternatives, it repeats only an attack the description names: the Djinni makes Storm Blade or Storm Bolt attacks rather than three Create Whirlwinds, and the iron golem, medusa, stone giant, storm giant, tarrasque, horned devil and bugbear stalker no longer repeat an action their Multiattack doesn't name. A description is no longer cut short at an item whose id starts with a capital letter (the goblin boss's Shortbow); the pirate's "two Dagger attacks" now joins exactly.
- A Multiattack's fallback never repeats a Recharge or X/Day action. Such an action joins a Multiattack only through the precise join, where availability gates it: the Aboleth's fallback now repeats Tentacle, or Consume Memories at 30 ft, never its 2/Day Dominate Mind, and the Ancient Gold Dragon's Multiattack now makes Rend within reach or Weakening Breath at 60 ft, not a second Fire Breath; nor does a fallback repeat an area that would affect no enemy from where the monster stands: beyond its breaths' 90 feet the Ancient Gold Dragon walks in to Rend.
- A readied Shield answers attack rolls only. A monster's save action (a Breath Weapon) leaves it readied, its Reaction and slot unspent.
- nat20-bridge narrates a monster's area with the existing line:
Adult Red Dragon's fire-breath fills a 60-ft cone at 5,5: catches ….
New API
dnd5e_engine.areas.best_aim,AreaAimandAIM_DIRECTIONS: the placement the monster AI uses, for a host that wants it for its own creatures.dnd5e_engine.activities.monster_actions.expand_action_to_parts: a monster action's activities, each with the stat-block action it comes from.
Moved seeded pins
None. A monster area with one creature in it draws what its single target
drew, so every existing test keeps its dice, the legendary-action and
magma-mephit tests included. Seven tests now set their monster outside its own
area or their target within its reach — the stat-block-spellcaster scenario
and two Fireball unit tests (the Mage 30 ft from the hero), the adult red
dragon's breath, Fireball and Multiattack sequence, the polymorphed Giant Ape,
the Lich's legendary action that drops a summon, and the self-centred breath
test — with every assertion and every draw unchanged. The polymorphed-monster
test's ids gained a column parameter.
C27 — monster senses; the condition clauses
What a host has to do
- Expect templated monsters to see. A foe with a
monster_template_slugnow has its stat block's Blindsight, Darkvision, Tremorsense and Truesight. In a scene withlightingorobscurement_cells, or against an Invisible creature, its attacks, its opportunity attacks, its own Dodge and Hide follow the SRD: a Goblin Warrior attacks a character in Darkness without Disadvantage, a Bat's Blindsight sees an Invisible character, and a character can no longer Hide in Darkness from a Goblin Warrior within 60 feet —submit_player_intentraisesIntentRejectedError("target_invalid")before any roll. PassEncounterMemberSpec(senses={})to keep a creature without senses, or anysensesto give an un-templated creature its own. - Drop host-side condition immunities if you like. A templated foe whose
spec leaves
condition_immunitiesempty takes its stat block's: a Skeleton can't be Poisoned, a Ghost can't be Grappled. A non-empty list still wins outright. - Expect more
MoveFailed(reason="frightened"). A Frightened creature can't move closer to its fear source even when it can't see it.
Behaviour changes
- Frightened's Disadvantage on ability checks applies only while its source
is in sight, as its attack-roll half already did: a
CheckActivityrolled by a creature Frightened of a source it can't see rolls one d20, not two. - Poisoned and Frightened reach Hide and escaping a grapple. Hide's Stealth
check and an
escape_grapplecheck roll at Disadvantage (CheckRolledsources["condition:attacker"], a second d20) for a Poisoned creature, or one Frightened of a creature it can see. - Frightened's no-approach rule has no sight clause (SRD 5.2: "You can't willingly move closer to the source of fear"). An unknown, dead or untracked source still imposes nothing.
- Petrified resists Poison damage (SRD 5.2: "Resistance to all damage")
instead of being immune to it, and has Immunity to the Poisoned condition:
a Poisoned rider never lands on a Petrified creature, and one it already had
imposes nothing while it is Petrified.
project_passive_damage_modifiers(["petrified"])["immunities"]is now[]. - One immunity check on every action and effect path. A creature immune
to a condition (
condition_immunities, or Petrified's grant) never gets it from an effect's rider, a seeded effect, Grapple, Shove's Prone or Hide's Invisible. Grapple's and Shove's save still rolls; a Shove's push still lands. LiveCombatView.initiative[*].conditionsnow lists one entry per effect imposing a condition at runtime too (seeded stacking already did). For display, dedupe by name or readactive_conditions, which stays deduplicated.- A condition two effects impose outlives the first one's ending by a
successful repeat save or a concentration drop (a timed expiry already
kept it), on both stores: when two casters' Hold Person hold one creature
and the first caster's concentration ends, it stays Paralyzed in
active_conditionstoo.
New API
EncounterMemberSpec.senses: CombatantSenses | None = None—Nonetakes the template's senses; a value (a dict coerces) wins.dnd5e_engine.rules.conditions.CONDITION_GRANTED_IMMUNITIESandgranted_condition_immunities(conditions): the immunities a condition grants (Petrified → Poisoned).- A keyword-only
fear_source_in_sight: bool = Trueonconditions_grant_disadvantage_on_ability_checksandproject_passive_check_modifiers, matchingconditions_grant_advantage_on_attack's.
Moved seeded pins
None. Every existing test keeps its dice: no fixture fights a templated monster
in Darkness or against an Invisible creature, or rolls Hide or an escape while
Poisoned or Frightened. Two assertions changed with the rule they pinned, each
test renamed with its dice unchanged: the Frightened mover facing a source in
Darkness is now stopped (test_frightened_mover_cannot_approach_source_it_cannot_see),
and Petrified projects Resistance without Poison immunity
(test_petrified_projects_resistance_to_all_damage_and_no_immunity).
C28 — feats
What a host has to do
- Match a background's feat by its slug.
Background.starting_feat_slugnames the canonical feat (alert,magic-initiate,savage-attacker); it held the Foundry compendium id (phbftAlert000000).derive_sheetraisesValueErrorfor a background whose feat your loader doesn't have, such as a custom background that still names a Foundry id. - Expect the background's feat on the sheet.
derive_sheetputs it first inDerivedSheet.feats, andbuild_party_memberforwards it: a Criminal has Alert, a Soldier Savage Attacker, an Acolyte or a Sage Magic Initiate. - Drop a feat a build takes twice.
derive_sheetraisesValueErrorfor a feat taken twice unless it is repeatable (Ability Score Improvement, Magic Initiate, Skilled) — a Criminal Human picking Alert from Versatile, a Fighting Style taken again at an Ability Score Improvement — and for an Epic Boon taken at an Ability Score Improvement below character level 19 (v0.6 accepted Boon of Fate and Boon of Irresistible Offense from level 4, and any Epic Boon at any Ability Score Improvement once the build reached level 19). - Add Alert's bonus to an Initiative you roll. The engine adds a
character's Proficiency Bonus to an Initiative it rolls
(
initiative=None); an Initiative your spec passes in is seated as given. For a characterbuild_party_memberbuilds, passCombatInstance(initiative=None)to have the engine roll (C29, below). - Carry Magic Initiate's slotless cast between combats. Its level 1 spell
is cast once without a spell slot, tallied in
custom_countersunderslotless_cast:<spell>. Persist it with the feature counters, and restore it after a Long Rest withrecover_slotless_casts(counters, "lr").
Behaviour changes
- Savage Attacker: a character's first weapon hit of each turn — any
creature's turn, an opportunity attack included — rolls the weapon's damage
dice twice and keeps the higher roll; an Unarmed Strike never does. Its
DamageApplied.amountcan rise, and every later draw shifts. - Grappler: an attack roll against a creature the attacker grapples has
Advantage, with the
"trait"source and a second d20. A construct's attack (Spiritual Weapon) gets no Grappler Advantage, and only the first grappler of a creature counts. - Alert: an engine-rolled Initiative adds the Proficiency Bonus, so the turn order can change.
- Magic Initiate: a spell in
PartyMemberSpec.spell_abilitiesis cast with that ability instead of the class's, on the caster's turn, as a readied reaction or Counterspell, and for a Spiritual Weapon's or summon's attack; a spell inslotless_castscast at its own level spends its slotless cast before a slot, and still spends it when countered (SRD 5.2 Counterspell spares only a slot).
New API
Feat.repeatable(dnd5e-srd-data).PartyMemberSpec.spell_abilities: dict[str, SpellcastingAbility]andPartyMemberSpec.slotless_casts: tuple[str, ...], also onDerivedSheetandCombatant;SpellcastingAbility(dnd5e_engine.types.combat).Combatant.featsandCombatant.savage_attacker_spent_this_turn.- The
magic-initiate:<list>:<ability>:<cantrip>,<cantrip>:<spell>choice token (dnd5e_engine.rules.choices.MagicInitiatePick,ParsedChoices.magic_initiate). recover_slotless_castsanddnd5e_engine.rest.SLOTLESS_CAST_COUNTER_PREFIX.
Moved seeded pins
None. No existing test builds a character with a background into combat, has the engine roll Initiative for a character with Alert, or fights with Savage Attacker, Grappler or Magic Initiate.
C29 — bridge parity
What a host has to do
Items 1–4 are for a nat20-bridge client; item 5 is for an engine host.
- Send only
PlayerIntentfields in an intent body. An unknown key is now refused with 422; it used to be dropped silently, so a misspelt field looked like an intent the engine had refused. An unknownintent_typeis 422 too, where it was a 500. - Stop reading
member.attack_bonusfrom/v1/party/validate. The key is gone: it was always0, the spec's placeholder. To-hit is per weapon, in eachattack_rolled.modifier. - End the combats you are done with, or let the cap end them: at most
--max-combats(16) stay live, and starting one more ends the least recently used, which then answers 404 (unknown or expired combat). - Expect 422 where the bridge answered 500: an intent the engine can't
resolve as sent (Divine Spark's save, among the feature activities
BACKLOG.mdlists), an empty party or monster list, or more than 12 on a side. - Let the engine roll a built character's Initiative.
CombatInstance(initiative=None)now passes throughbuild_party_member, sostart_combatrolls it with the derived Dexterity and Alert; the0default and an int you pass are seated as before.
Behaviour changes
/v1/party/validateand/v1/combatapply every build key a member sends (background_slug,selected_choices,hp_rolls,hp_mode,ac_calc_mode, …), where both used to ignore all but six. A forwarded saved character now builds exactly as it would throughmake_build_spec, andhp_rollssent withouthp_mode: "rolled"is now refused with 422 where the character used to validate and the combat to start.- The engine rolls a bridge combat's Initiative from the combat's own seeded generator, the party first, then the foes: the same d20s the bridge rolled, so the turn order holds for a build whose Dexterity nothing adjusts, while a background's increase and Alert now count. The bridge rolled from a second generator with the combat's seed, so the first round's attacks repeated those Initiative d20s.
/v1/rolland/v1/checkdraw from a generator seeded by the request, not the process-globalrandom: the same result for every seed, and safe when requests run at once./v1/combatno longer reseeds the global module either.- Each response holds exactly its own request's events, whatever the client's event loop. The per-combat collector tasks and event logs are gone, and a combat's session goes when it ends or is evicted. A 422 can still leave a half-paid turn: the engine may already have spent the actor's Action and a feature's use, or moved a retreating character only partway, before it raised.
- A summon narrates by its name ("Draconic Spirit's turn begins."), and its joining and leaving narrate as lines.
- A foe the bridge builds sees with its stat block's senses (C27, above).
New API
BuildRequest:classes,selected_choices,background_slug,hp_mode,hp_rolls,ac_calc_mode,attuned_itemsandability_score_method;class_slugandlevelare optional.- The intent body: every
PlayerIntentfield. - The view:
seed,turn,summons,transformations,constructs, and eachorderrow'sinitiative. nat20-bridge --max-combats.BridgeState.max_combats,BridgeState.sessionsandCombatSessionreplaceBridgeState.combats,events_log,seeds,names,gridsandcollectors.CombatInstance.initiative: int | None(dnd5e-engine).
Moved seeded pins
- Bridge combat streams. A seeded
/v1/combatkeeps its Initiative and turn order, but every roll after Initiative moves: the engine draws the Initiative d20s from the combat's generator before the first attack. The seven bridge tests that start a combat roll new dice; none asserts a rolled value, so none changed. - No engine or demo pin moved.
/v1/roll,/v1/checkand/v1/rest/*are byte-identical for every seed.
C30 — the 0.7.0 release
C30 changes no behaviour and no public name.
What a host has to do
- Upgrade the three packages together.
dnd5e-engine0.7.0 requiresdnd5e-srd-data>=0.7.0: it readsFeat.repeatableand the canonical background feat slugs, and its areas rely on the corrected area data.nat20-bridge0.7.0 requiresdnd5e-engine>=0.7.0anddnd5e-srd-data>=0.7.0: it builds every member withCombatInstance(initiative=None), which a 0.6 engine refuses.
Moved seeded pins
None.