Template:AbilityInteraction/doc: Difference between revisions

Update docs for the file to iconfile parameter rename (with help from vergir-bot LLM)
Vergir (talk | contribs)
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 a specific ability interacts with an item or mechanic.
{{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 header colour is set by the {{code|1=type}} parameter ({{code|positive}}, {{code|negative}}, or {{code|info}}). Setting {{code|1=state=disabled}} desaturates the icon to mark an interaction that does not apply.
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": {
"title": {
"interaction": {
"description": "Text shown in the box header.",
"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",
"required": true
},
"type": {
"description": "Header colour: positive (green), negative (red), or info (blue).",
"type": "string",
"type": "string",
"required": true,
"required": true,
"suggestedvalues": [ "positive", "negative", "info" ]
"example": "debuff resist",
"suggestedvalues": [ "debuff resist", "dispel", "indomitable", "slowing hex", "unstoppable" ]
},
},
"iconfile": {
"text": {
"description": "File name of the icon image, without the File: prefix.",
"description": "Wikitext shown in the box body. May contain wikilinks, templates such as AbilityIcon, and lists.",
"type": "string",
"type": "content",
"example": "Healing Booster.png",
"required": true
"required": true
},
"link": {
"description": "Where the header and icon link. A bare page name (e.g. Healing Booster) or a full URL.",
"type": "string",
"example": "Healing Booster",
"required": true
},
"text": {
"description": "Wikitext shown in the box body. May contain wikilinks, templates such as AbilityIcon, and <br> for multiple lines.",
"type": "content"
},
},
"state": {
"state": {
"description": "Set to disabled to desaturate the icon.",
"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": [ "title", "text", "type", "iconfile", "link", "state" ],
"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 ==


=== Positive Interaction ===
=== Standard interaction ===


<pre>
<pre>
{{AbilityInteraction
{{AbilityInteraction
| type    = positive
| interaction = dispel
| iconfile = Melee Charge.png
| text =
| link    = Melee Charge
* Any dispel immediately "drops" the target off the cart.
| title    = Melee
| text     =
* This ability benefits from Melee damage bonuses and triggers relevant item effects.
* Once a T3 upgrade is acquired it's considered a Heavy Melee attack.
}}
}}
</pre>
</pre>
{{AbilityInteraction
{{AbilityInteraction
| type    = positive
| interaction = dispel
| iconfile = Melee Charge.png
| text =
| link    = Melee Charge
* Any dispel immediately "drops" the target off the cart.
| title    = Melee
| text     =
* This ability benefits from Melee damage bonuses and triggers relevant item effects.
* Once a T3 upgrade is acquired it's considered a Heavy Melee attack.
}}
}}


=== Negative Interaction ===
=== Partial interaction ===
 
<pre>
<pre>
{{AbilityInteraction
{{AbilityInteraction
| type    = negative
| interaction = unstoppable
| iconfile = Debuff Reducer.png
| state = partial
| link    = Debuff Reducer
| text =
| title    = Debuff Resist
* Dispels and protects against [[Move Slow]].
| text     =
* Does not dispel or protect against the accuracy debuff.
[[Debuff Resist]] shortens the duration of movement slow and accuraccy debuff.
 
The duration of damage-over-time effect is '''not''' shortened.
}}
}}
</pre>
</pre>
{{AbilityInteraction
{{AbilityInteraction
| type    = negative
| interaction = unstoppable
| iconfile = Debuff Reducer.png
| state = partial
| link    = Debuff Reducer
| text =
| title    = Debuff Resist
* Dispels and protects against [[Move Slow]].
| text     =
* Does not dispel or protect against the accuracy debuff.
[[Debuff Resist]] shortens the duration of movement slow and accuraccy debuff.
 
The duration of damage-over-time effect is '''not''' shortened.
}}
}}


=== Neutral interaction with disabled state ===
=== Interaction that does not apply ===


<pre>
<pre>
{{AbilityInteraction
{{AbilityInteraction
| type    = info
| interaction = slowing hex
| iconfile = Slowing Hex.png
| state = disabled
| link    = Slowing Hex
| text = This ability is '''not''' interrupted by [[Slowing Hex]].
| title    = Slowing Hex
| state   = disabled
| text     = This ability is '''not''' interrupted by [[Slowing Hex]].
}}
}}
</pre>
</pre>
{{AbilityInteraction
{{AbilityInteraction
| type    = info
| interaction = slowing hex
| iconfile = Slowing Hex.png
| state = disabled
| link    = Slowing Hex
| text = This ability is '''not''' interrupted by [[Slowing Hex]].
| title    = Slowing Hex
| state   = disabled
| text     = This ability is '''not''' interrupted by [[Slowing Hex]].
}}
}}


<noinclude>[[Category:Template documentation]]</noinclude>
<noinclude>[[Category:Template documentation]]</noinclude>