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> | ||