Template:Resistance: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
No edit summary
(Use template demo/documentation templates)
 
(37 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<includeonly>[[File:{{{1}}} {{#switch: {{{2|}}}| magical = M | vulnerable = V | double = R | immunity = Immunity | immune = Immunity | resistant = NM | Magical = M | Vulnerable = V | Double = R | Immunity = Immunity | Immune = Immunity | Resistant = NM}}.png|{{{3|28px}}}|link=Damage Types]]{{#if:{{{nocat|}}}||[[Category:{{#switch: {{{2|}}}| magical = Resistant | vulnerable = Vulnerable | double = Resistant | immunity = Immune | immune = Immune | resistant = Resistant | Magical = Resistant | Vulnerable = Vulnerable | Double = Resistant | Immunity = Immune | Immune = Immune | Resistant = Resistant}} to {{{1}}}]]}}</includeonly><noinclude>[[Category:Templates]]
<includeonly>{{trim|
Example:
{{Resistance|Psychic|resistant|nocat=1}}{{Resistance|Fire|double|nocat=1}}{{Resistance|Magic|magical|nocat=1}}{{Resistance|Thunder|immune|nocat=1}}{{Resistance|Radiant|vulnerable|nocat=1}}
{{InfoBlob|<nowiki>{{Resistance|Psychic|resistant}}{{Resistance|Fire|double}}{{Resistance|Magic|magical}}{{Resistance|Thunder|immune}}{{Resistance|Radiant|vulnerable}}</nowiki>}}


You can also use {{InfoBlob|<nowiki>{{Resistance|Acid|immune|40px}}</nowiki>}} to make it bigger {{Resistance|Acid|immune|40px|nocat=1}}
{{#lvardef: element | {{ucfirst: {{lc: {{{1}}} }} }} }}
 
{{#lvardef: wording | {{#switch: {{lc: {{{2|}}} }}
| vuln
| vulnerable
| vulnerability = Vulnerable to
| resist
| resistant
| resist nm
| resistant nm
| resistance nm = Resistant to Non-Magical
| magical
| resist m
| resistant m
| resistance m = Resistant to Magical
| double
| full
| resist double
| resist full
| resistant double
| resistance double
| resistant full
| resistance full = Resistant to all
| immunity
| immune
| immunity full
| immune full = Immune to all
| immunity nm
| immune nm = Immune to Non-Magical
| immunity nm plus
| immune nm plus = Immune to Non-Magical and Resistant to Magical
}} {{#lvar:element}} }}
 
{{#lvardef: filename | {{#lvar:element}} {{#switch: {{lc: {{{2|}}} }}
| vuln
| vulnerable
| vulnerability = Vulnerability
| resist
| resistant
| resistance
| resist nm
| resistant nm
| resistance nm = Resistance NM
| magical
| resist m
| resistant m
| resistance m = Resistance M
| double
| full
| resist double
| resistant double
| resistance double
| resist full
| resistant full
| resistance full = Resistance Full
| immune
| immunity = Immunity
| immune nm
| immunity nm = Immunity NM
| immune nm plus
| immunity nm plus = Immunity NM Plus
}}.png }}
 
}}[[File:{{#lvar:filename}}|link=|{{{3|28px}}}|{{#lvar:wording}}]]{{#if:{{{nocat|}}}||{{Main only|[[Category:{{#lvar:wording}}]]}}}}</includeonly><noinclude>{{Documentation|content=
Displays a resistance icon.
 
{{Template demo
| style = table
| <nowiki>{{resistance|acid|vuln}}</nowiki>
| <nowiki>{{resistance|cold|resist nm}}</nowiki>
| <nowiki>{{resistance|fire|resist m}}</nowiki>
| <nowiki>{{resistance|force|resist full}}</nowiki>
| <nowiki>{{resistance|thunder|immune}}</nowiki>
| <nowiki>{{resistance|piercing|immune nm}}</nowiki>
| <nowiki>{{resistance|slashing|immune nm plus}}</nowiki>
}}
 
Here are the "keys" for the resistance/vulnerability/immunity type:
 
* <code>vuln</code>: Self-explanatory
* <code>resist nm</code>: Resistant to non-magical
* <code>resist m</code>: Resistant to magical only
* <code>resist full</code>: Resistant to all (non-magical and magical)
* <code>immune nm</code>: Immune to non-magical
* <code>immune full</code>: Immune to all (non-magical and magical)
* <code>immune nm plus</code>: Immune to non-magical and resistant to magical
 
The abbreviations "vuln", "resist", and "immune" can be written out in full as well, like "vulnerable", "vulnerability", "resistant", "resistance", or "immunity". The template will recognize all ways to write these words.
 
You can also make the icon bigger like so:
{{Template demo
| style = table
| <nowiki>{{resistance|acid|immune|40px}}</nowiki>
}}
 
This template also adds automatic [[:Category:Resistances|resistance categories]]. If you are using this template on a non-creature page, please add {{InfoBlob|<nowiki>|nocat=1</nowiki>}} so that page doesn't get included in the respective resistance category.
 
== Template data ==
<templatedata>
{
"params": {
"1": {
"label": "type",
"description": "The damage type",
"type": "string",
"required": true
},
"2": {
"label": "resistance",
"description": "How resistant?",
"type": "string",
"suggestedvalues": [
"vuln",
"resist nm",
"resist m",
"resist full",
"immune nm",
"immune full",
"immune nm plus"
],
"required": true
},
"3": {
"label": "size",
"description": "Size of the icon.",
"type": "number",
"default": "28"
},
"nocat": {
"description": "If specified, does not insert categories."
}
},
"format": "inline"
}
</templatedata>
}}
[[Category:Templates]]
</noinclude>

Latest revision as of 21:40, 19 January 2025

Template documentation

Displays a resistance icon.

Markup Renders as
{{resistance|acid|vuln}}
Vulnerable to Acid
{{resistance|cold|resist nm}}
Resistant to Non-Magical Cold
{{resistance|fire|resist m}}
Resistant to Magical Fire
{{resistance|force|resist full}}
Resistant to all Force
{{resistance|thunder|immune}}
Immune to all Thunder
{{resistance|piercing|immune nm}}
Immune to Non-Magical Piercing
{{resistance|slashing|immune nm plus}}
Immune to Non-Magical and Resistant to Magical Slashing

Here are the "keys" for the resistance/vulnerability/immunity type:

  • vuln: Self-explanatory
  • resist nm: Resistant to non-magical
  • resist m: Resistant to magical only
  • resist full: Resistant to all (non-magical and magical)
  • immune nm: Immune to non-magical
  • immune full: Immune to all (non-magical and magical)
  • immune nm plus: Immune to non-magical and resistant to magical

The abbreviations "vuln", "resist", and "immune" can be written out in full as well, like "vulnerable", "vulnerability", "resistant", "resistance", or "immunity". The template will recognize all ways to write these words.

You can also make the icon bigger like so:

Markup Renders as
{{resistance|acid|immune|40px}}
Immune to all Acid

This template also adds automatic resistance categories. If you are using this template on a non-creature page, please add |nocat=1 so that page doesn't get included in the respective resistance category.

Template data

No description.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
type1

The damage type

Stringrequired
resistance2

How resistant?

Suggested values
vuln resist nm resist m resist full immune nm immune full immune nm plus
Stringrequired
size3

Size of the icon.

Default
28
Numberoptional
nocatnocat

If specified, does not insert categories.

Unknownoptional