Template:Resistances: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(DRAFT-WIP)
 
mNo edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><table class="wikitable">
<includeonly><table class="wikitable" style="width: 62%;">
<caption>Resistances</caption> {{#if:{{{Bludgeoning|}}}|<tr><td><code>[[File:Bludgeoning_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Bludgeoning|Bludgeoning}}</td><td>{{{Bludgeoning}}}</td></tr>|}} {{#if:{{{Piercing|}}}|<tr><td><code>[[File:Piercing_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Piercing|Piercing}}</td><td>{{{Piercing}}}</td></tr>|}} {{#if:{{{Slashing|}}}|<tr><td><code>[[File:Slashing_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Slashing|Slashing}}</td><td>{{{Slashing}}}</td></tr>|}} {{#if:{{{Acid|}}}|<tr><td><code>[[File:Acid Damage Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Acid|Acid}}</td><td>{{{Acid}}}</td></tr>|}} {{#if:{{{Cold|}}}|<tr><td><code>[[File:Cold_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Cold|Cold}}</td><td>{{{Cold}}}</td></tr>|}} {{#if:{{{Fire|}}}|<tr><td><code>[[File:Fire_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Fire|Fire}}</td><td>{{{Fire}}}</td></tr>|}} {{#if:{{{Force|}}}|<tr><td><code>[[File:Force_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Force|Force}}</td><td>{{{Force}}}</td></tr>|}} {{#if:{{{Lightning|}}}|<tr><td><code>[[File:Lightning_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Lightning|Lightning}}</td><td>{{{Lightning}}}</td></tr>|}} {{#if:{{{Necrotic|}}}|<tr><td><code>[[File:Necrotic_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Necrotic|Necrotic}}</td><td>{{{Necrotic}}}</td></tr>|}} {{#if:{{{Poison|}}}|<tr><td><code>[[File:Poison_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Poison|Poison}}</td><td>{{{Poison}}}</td></tr>|}} {{#if:{{{Radiant|}}}|<tr><td><code>[[File:Radiant_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Radiant|Radiant}}</td><td>{{{Radiant}}}</td></tr>|}} {{#if:{{{Thunder|}}}|<tr><td><code>[[File:Thunder_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Thunder|Thunder}}</td><td>{{{Thunder}}}</td></tr>|}} {{#if:{{{Psychic|}}}|<tr><td><code>[[File:Psychic_Damage_Icon.png|frameless|upright=0.1]]</code> {{DamageColor|Psychic|Psychic}}</td><td>{{{Psychic}}}</td></tr>|}}
<caption>Resistances</caption>
</table></includeonly><noinclude>
{{#if:{{{Bludgeoning|}}}|<tr><td>{{DamageType|Bludgeoning}}</td><td>{{{Bludgeoning}}}</td></tr>
== WORK IN PROGRESS - TESTING ==
|}}{{#if:{{{Piercing|}}}|<tr><td>{{DamageType|Piercing}}</td><td>{{{Piercing}}}</td></tr>
|}}{{#if:{{{Slashing|}}}|<tr><td>{{DamageType|Slashing}}</td><td>{{{Slashing}}}</td></tr>
|}}{{#if:{{{Acid|}}}|<tr><td>{{DamageType|Acid}}</td><td>{{{Acid}}}</td></tr>
|}}{{#if:{{{Cold|}}}|<tr><td>{{DamageType|Cold}}</td><td>{{{Cold}}}</td></tr>
|}}{{#if:{{{Fire|}}}|<tr><td>{{DamageType|Fire}}</td><td>{{{Fire}}}</td></tr>
|}}{{#if:{{{Force|}}}|<tr><td>{{DamageType|Force}}</td><td>{{{Force}}}</td></tr>
|}}{{#if:{{{Lightning|}}}|<tr><td>{{DamageType|Lightning}}</td><td>{{{Lightning}}}</td></tr>
|}}{{#if:{{{Necrotic|}}}|<tr><td>{{DamageType|Necrotic}}</td><td>{{{Necrotic}}}</td></tr>
|}}{{#if:{{{Poison|}}}|<tr><td>{{DamageType|Poison}}</td><td>{{{Poison}}}</td></tr>
|}}{{#if:{{{Psychic|}}}|<tr><td>{{DamageType|Psychic}}</td><td>{{{Psychic}}}</td></tr>
|}}{{#if:{{{Radiant|}}}|<tr><td>{{DamageType|Radiant}}</td><td>{{{Radiant}}}</td></tr>
|}}{{#if:{{{Thunder|}}}|<tr><td>{{DamageType|Thunder}}</td><td>{{{Thunder}}}</td></tr>
|}}</table></includeonly><noinclude>
Generate a table of resistances for a creature or object. All parameter names (e.g. Fire) and values (e.g. Vulnerable) '''must be Capitalized'''.


Would like to get this template to work without HTML tags, but mediawiki markup is not playing nice with displaying rows conditionally, even with liberal use of the <code><nowiki>{{!}}</nowiki></code> magic word.
Example:


== Examples ==
<nowiki>{{Resistances|Slashing=Resistant|Fire=Immune|Cold=Vulnerable}}</nowiki>


'''Usage example 1:'''
Result:
 
<pre style="white-space: pre-wrap;"><nowiki>{{Resistances|Slashing=Resistant|Fire=Immune|Cold=Vulnerable}}</nowiki></pre>


Result:
{{Resistances|Slashing=Resistant|Fire=Immune|Cold=Vulnerable}}
{{Resistances|Slashing=Resistant|Fire=Immune|Cold=Vulnerable}}


'''Usage example 2 (all possible damage types, accepts damage types in any order):'''
All possible damage types; accepts damage types in any order:


<pre style="white-space: pre-wrap;"><nowiki>{{Resistances|Bludgeoning=Immune|Slashing=Immune|Piercing=Resistant|Acid=Resistant|Cold=Resistant|Fire=Resistant|Force=Vulnerable|Lightning=Resistant|Necrotic=Resistant|Poison=Resistant|Radiant=Resistant|Thunder=Resistant|Psychic=Resistant}}</nowiki></pre>
<pre><nowiki>{{Resistances
| Bludgeoning = Immune
| Slashing = Immune
| Piercing = Resistant
| Acid = Resistant
| Cold = Resistant
| Fire = Resistant
| Force = Vulnerable
| Lightning = Resistant
| Necrotic = Resistant
| Poison = Resistant
| Radiant = Resistant
| Thunder = Resistant
| Psychic = Resistant
}}</nowiki></pre>


Result:
Result:
{{Resistances|Bludgeoning=Immune|Slashing=Immune|Piercing=Resistant|Acid=Resistant|Cold=Resistant|Fire=Resistant|Force=Vulnerable|Lightning=Resistant|Necrotic=Resistant|Poison=Resistant|Radiant=Resistant|Thunder=Resistant|Psychic=Resistant}}
 
{{Resistances
| Bludgeoning = Immune
| Slashing = Immune
| Piercing = Resistant
| Acid = Resistant
| Cold = Resistant
| Fire = Resistant
| Force = Vulnerable
| Lightning = Resistant
| Necrotic = Resistant
| Poison = Resistant
| Radiant = Resistant
| Thunder = Resistant
| Psychic = Resistant
}}

Latest revision as of 14:00, 17 May 2023

Generate a table of resistances for a creature or object. All parameter names (e.g. Fire) and values (e.g. Vulnerable) must be Capitalized.

Example:

{{Resistances|Slashing=Resistant|Fire=Immune|Cold=Vulnerable}}

Result:

Resistances
Damage TypesSlashingResistant
Damage TypesColdVulnerable
Damage TypesFireImmune

All possible damage types; accepts damage types in any order:

{{Resistances
| Bludgeoning = Immune
| Slashing = Immune
| Piercing = Resistant
| Acid = Resistant
| Cold = Resistant
| Fire = Resistant
| Force = Vulnerable
| Lightning = Resistant
| Necrotic = Resistant
| Poison = Resistant
| Radiant = Resistant
| Thunder = Resistant
| Psychic = Resistant
}}

Result:

Resistances
Damage TypesBludgeoningImmune
Damage TypesPiercingResistant
Damage TypesSlashingImmune
Damage TypesAcidResistant
Damage TypesColdResistant
Damage TypesFireResistant
Damage TypesForceVulnerable
Damage TypesLightningResistant
Damage TypesNecroticResistant
Damage TypesPoisonResistant
Damage TypesPsychicResistant
Damage TypesRadiantResistant
Damage TypesThunderResistant