Template:AbilityInteraction/doc: Difference between revisionsGive feedback
Update docs for the file to iconfile parameter rename (with help from vergir-bot LLM) |
Rewrite for the interaction registry: three parameters, self-generating registry table, and a pointer to IconBox for custom boxes (with help from vergir-bot LLM) |
||
| Line 1: | Line 1: | ||
== Usage == | == Usage == | ||
{{tl|AbilityInteraction}} displays a boxed note describing how | {{tl|AbilityInteraction}} displays a boxed note describing how an ability interacts with an item or mechanic. It is meant for the {{code|1=interactions}} parameter of {{tl|AbilitySection}}. | ||
The | The interaction is chosen by name from a registry in [[Module:AbilityInteraction]], which supplies the header text, color, icon, and link. Call sites supply only the body text and, where relevant, a state. | ||
Nothing else is customizable, and that is deliberate: it keeps a given mechanic looking identical everywhere it appears. A box that needs custom presentation should use {{tl|IconBox}} directly rather than adding parameters here. | |||
Setting {{code|1=state{{=}}disabled}} always produces a neutral (blue) header, whatever type the registry entry declares. A disabled box means the interaction does not apply, so it carries no positive or negative meaning. | |||
== Parameters == | == Parameters == | ||
| Line 9: | Line 13: | ||
<templatedata> | <templatedata> | ||
{ | { | ||
"description": "", | "description": "A boxed note describing how an ability interacts with an item or mechanic. Presentation comes from a registry in Module:AbilityInteraction.", | ||
"params": { | "params": { | ||
" | "interaction": { | ||
"description": " | "description": "Name of the interaction in the registry. Case-insensitive, and aliases are accepted. The Interactions section of this page lists every available name.", | ||
"type": "string", | "type": "string", | ||
"required": true, | "required": true, | ||
"suggestedvalues": [ " | "example": "debuff resist", | ||
"suggestedvalues": [ "debuff resist", "dispel", "indomitable", "slowing hex", "unstoppable" ] | |||
}, | }, | ||
" | "text": { | ||
"description": " | "description": "Wikitext shown in the box body. May contain wikilinks, templates such as AbilityIcon, and lists.", | ||
"type": " | "type": "content", | ||
"required": true | "required": true | ||
}, | }, | ||
"state": { | "state": { | ||
"description": " | "description": "Omit when the interaction applies normally. Use partial when it applies only in part, or disabled when it does not apply at all.", | ||
"type": "string", | "type": "string", | ||
"suggestedvalues": [ "disabled" ] | "suggestedvalues": [ "partial", "disabled" ] | ||
} | } | ||
}, | }, | ||
"paramOrder": [ " | "paramOrder": [ "interaction", "text", "state" ], | ||
"format": "block" | "format": "block" | ||
} | } | ||
</templatedata> | </templatedata> | ||
An unrecognized {{code|1=interaction}} renders a visible error in place of the box. An unrecognized {{code|1=state}} does not — it renders as though no state were given. | |||
== Interactions == | |||
This table is generated from the registry, so it always matches what the template accepts. | |||
{{#invoke:AbilityInteraction|list}} | |||
== Adding an interaction == | |||
Add an entry to the {{code|REGISTRY}} table at the top of [[Module:AbilityInteraction]]. Each entry sets {{code|aliases}}, {{code|title}}, {{code|type}}, {{code|iconfile}}, and {{code|link}}. The table above and the parameter suggestions update on their own. | |||
The registry key and its aliases are matched in lower case. Aliases are assumed not to collide with each other. | |||
== Examples == | == Examples == | ||
=== | === Standard interaction === | ||
<pre> | <pre> | ||
{{AbilityInteraction | {{AbilityInteraction | ||
| | | interaction = dispel | ||
| text = | |||
* Any dispel immediately "drops" the target off the cart. | |||
| text | |||
* | |||
}} | }} | ||
</pre> | </pre> | ||
{{AbilityInteraction | {{AbilityInteraction | ||
| | | interaction = dispel | ||
| text = | |||
* Any dispel immediately "drops" the target off the cart. | |||
| text | |||
* | |||
}} | }} | ||
=== | === Partial interaction === | ||
<pre> | <pre> | ||
{{AbilityInteraction | {{AbilityInteraction | ||
| | | interaction = unstoppable | ||
| | | state = partial | ||
| text = | |||
* Dispels and protects against [[Move Slow]]. | |||
| text | * Does not dispel or protect against the accuracy debuff. | ||
[[ | |||
}} | }} | ||
</pre> | </pre> | ||
{{AbilityInteraction | {{AbilityInteraction | ||
| | | interaction = unstoppable | ||
| | | state = partial | ||
| text = | |||
* Dispels and protects against [[Move Slow]]. | |||
| text | * Does not dispel or protect against the accuracy debuff. | ||
[[ | |||
}} | }} | ||
=== | === Interaction that does not apply === | ||
<pre> | <pre> | ||
{{AbilityInteraction | {{AbilityInteraction | ||
| | | interaction = slowing hex | ||
| state = disabled | |||
| text = This ability is '''not''' interrupted by [[Slowing Hex]]. | |||
| state | |||
| text | |||
}} | }} | ||
</pre> | </pre> | ||
{{AbilityInteraction | {{AbilityInteraction | ||
| | | interaction = slowing hex | ||
| state = disabled | |||
| text = This ability is '''not''' interrupted by [[Slowing Hex]]. | |||
| state | |||
| text | |||
}} | }} | ||
<noinclude>[[Category:Template documentation]]</noinclude> | <noinclude>[[Category:Template documentation]]</noinclude> | ||
Revision as of 14:27, 15 July 2026
Usage
{{AbilityInteraction}} displays a boxed note describing how an ability interacts with an item or mechanic. It is meant for the interactions parameter of {{AbilitySection}}.
The interaction is chosen by name from a registry in Module:AbilityInteraction, which supplies the header text, color, icon, and link. Call sites supply only the body text and, where relevant, a state.
Nothing else is customizable, and that is deliberate: it keeps a given mechanic looking identical everywhere it appears. A box that needs custom presentation should use {{IconBox}} directly rather than adding parameters here.
Setting state=disabled always produces a neutral (blue) header, whatever type the registry entry declares. A disabled box means the interaction does not apply, so it carries no positive or negative meaning.
Parameters
A boxed note describing how an ability interacts with an item or mechanic. Presentation comes from a registry in Module:AbilityInteraction.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| interaction | interaction | Name of the interaction in the registry. Case-insensitive, and aliases are accepted. The Interactions section of this page lists every available name.
| String | required |
| text | text | Wikitext shown in the box body. May contain wikilinks, templates such as AbilityIcon, and lists. | Content | required |
| state | state | Omit when the interaction applies normally. Use partial when it applies only in part, or disabled when it does not apply at all.
| String | optional |
An unrecognized interaction renders a visible error in place of the box. An unrecognized state does not — it renders as though no state were given.
Interactions
This table is generated from the registry, so it always matches what the template accepts.
| Interaction | Example |
|---|---|
ability duration / duration / duration extender
|
Example text. |
ability range / range / greater expansion
|
Example text. |
cooldown / ability cooldown / superior cooldown
|
Example text. |
debuff resist / debuff reducer
|
Example text. |
dispel / dispel magic / purge / cleanse
|
Example text. |
echo shard
|
Example text. |
heal / healing / healing booster
|
Example text. |
heroic aura
|
Example text. |
indomitable
|
Example text. |
interrupt / knockdown / stun
|
Example text. |
monster rounds
|
Example text. |
plated armor
|
Example text. |
reactive barrier
|
Example text. |
slowing hex
|
Example text. |
stealth / Veil Walker
|
Example text. |
unstoppable
|
Example text. |
Adding an interaction
Add an entry to the REGISTRY table at the top of Module:AbilityInteraction. Each entry sets aliases, title, type, iconfile, and link. The table above and the parameter suggestions update on their own.
The registry key and its aliases are matched in lower case. Aliases are assumed not to collide with each other.
Examples
Standard interaction
{{AbilityInteraction
| interaction = dispel
| text =
* Any dispel immediately "drops" the target off the cart.
}}
- Any dispel immediately "drops" the target off the cart.
Partial interaction
{{AbilityInteraction
| interaction = unstoppable
| state = partial
| text =
* Dispels and protects against [[Move Slow]].
* Does not dispel or protect against the accuracy debuff.
}}
- Dispels and protects against Move Slow.
- Does not dispel or protect against the accuracy debuff.
Interaction that does not apply
{{AbilityInteraction
| interaction = slowing hex
| state = disabled
| text = This ability is '''not''' interrupted by [[Slowing Hex]].
}}
This ability is not interrupted by Slowing Hex.