Render-time gating for an attack card's defender-response buttons.
The attack card is built once (on the attacker's client) and emits all four
defense buttons — Dodge / Counterstrike / Block / Ignore. Which ones a given
client may actually use is decided here, when the card renders on that client,
because the decision is viewer-dependent (ownership) and needs the defender's
own view of its strike modes (an attacker may not be able to enumerate them):
Owner gate: only a user who owns the defender actor (a GM owns all) may
respond — everyone else sees no defense buttons.
Incapacitation gate (owner only): if the defender is dead/unconscious/
asleep/restrained/paralyzed/frozen/incapacitated, Ignore is the only viable
defense — Dodge / Block / Counterstrike are all removed.
Capability gate (owner only):Block shows only if the defender has a
non-noBlock melee mode; Counterstrike only if it has a non-noAttack
melee mode. Dodge and Ignore are always available to the owner.
Composes the pure, unit-tested capability helpers and manipulates the DOM.
Foundry document resolution is injected via resolveDefender (the caller
passes foundry.utils.fromUuidSync), so the gating itself carries no Foundry
dependency and is unit-testable with a stub element + stub defender. A no-op
on any card without these buttons.
Parameters
element: HTMLElement
The chat message's rendered root element.
resolveDefender: (uuid:string)=>any
Resolves the defender document from a button's
data-handler-actor-uuid (the caller supplies the Foundry lookup).
Render-time gating for an attack card's defender-response buttons.
The attack card is built once (on the attacker's client) and emits all four defense buttons — Dodge / Counterstrike / Block / Ignore. Which ones a given client may actually use is decided here, when the card renders on that client, because the decision is viewer-dependent (ownership) and needs the defender's own view of its strike modes (an attacker may not be able to enumerate them):
noBlockmelee mode; Counterstrike only if it has a non-noAttackmelee mode. Dodge and Ignore are always available to the owner.Composes the pure, unit-tested capability helpers and manipulates the DOM. Foundry document resolution is injected via
resolveDefender(the caller passesfoundry.utils.fromUuidSync), so the gating itself carries no Foundry dependency and is unit-testable with a stub element + stub defender. A no-op on any card without these buttons.