Template:Hp: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<includeonly>{{#ifexpr: {{{1|2}}} > 1 | {{#lvardef:plural|true}}}}{{#if:{{{plural|}}}|{{#lvardef:plural|true}}}}{{Icon|HP Icon.png|{{{2|25}}}}} {{{1|}}} {{#if:{{{temp|}}}|Temporary Hit Point{{#if:{{#lvar:plural}}|s}}|Hit Point{{#if:{{#lvar:plural}}|s}}}}</includeonly><noinclude> {{underConstruction}} Represents HP or Temp HP. See also Template:Temp hp for a simpler way to display temporary HP. {| class="wikitable" !...") |
(Finish.) |
||
Line 1: | Line 1: | ||
<includeonly>{{#ifexpr: {{{1|2}}} > 1 | {{#lvardef:plural|true}}}}{{#if:{{{plural|}}}|{{#lvardef:plural|true}}}}{{Icon|HP Icon.png|{{{ | <includeonly>{{#if:{{{1|}}} | ||
<!--if =1 is defined, calculate plurality--> | |||
|{{#lvardef:text|{{{1|}}}}}{{#ifexpr: {{{1|2}}} > 1 | {{#lvardef:plural|true}}}}{{#if:{{{plural|}}}|{{#lvardef:plural|true}}}} | |||
<!--otherwise if it's a non-number assume always plural--> | |||
|{{#lvardef:text|{{{text|}}}}}{{#lvardef:plural|true}} | |||
}}{{Icon|HP Icon.png|{{{size|25}}}}} {{#lvar:text}} {{#if:{{{temp|}}}|[[Hit Points#Temporary Hit Points|Temporary Hit Point{{#if:{{#lvar:plural}}|s}}]]|[[Hit Points|Hit Point{{#if:{{#lvar:plural}}|s}}]]}}</includeonly><noinclude> | |||
Represents HP or Temp HP. See also [[Template:Temp hp]] for a simpler way to display temporary HP. | Represents HP or Temp HP. See also [[Template:Temp hp]] for a simpler way to display temporary HP. | ||
If the number to be displayed isn't really a number (e.g. "3 ~ 6" or "2d4"), provide it with the {{c|text}} parameter. | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 20: | Line 27: | ||
| <code><nowiki>{{Hp|1|plural=t}}</nowiki></code> || {{Hp|1|plural=t}} | | <code><nowiki>{{Hp|1|plural=t}}</nowiki></code> || {{Hp|1|plural=t}} | ||
|- | |- | ||
| <code><nowiki>{{Hp|2d4}}</nowiki></code> || {{Hp|2d4}} | | <code><nowiki>{{Hp|text=2d4}}</nowiki></code> || {{Hp|text=2d4}} | ||
|- | |||
| <code><nowiki>{{Hp|3|size=40}}</nowiki></code> || {{Hp|3|size=40}} | |||
|} | |} | ||
Line 34: | Line 43: | ||
"description": "The number of hitpoints to represent.", | "description": "The number of hitpoints to represent.", | ||
"type": "number" | "type": "number" | ||
}, | }, | ||
"plural": { | "plural": { | ||
Line 46: | Line 50: | ||
"temp": { | "temp": { | ||
"description": "If specified, will format as temporary HP" | "description": "If specified, will format as temporary HP" | ||
}, | |||
"text": { | |||
"description": "If specified, will replace the number with this text instead." | |||
}, | |||
"size": { | |||
"description": "The icon size.", | |||
"default": "25" | |||
} | } | ||
}, | }, | ||
"paramOrder": [ | "paramOrder": [ | ||
"1", | "1", | ||
" | "size", | ||
"plural", | "plural", | ||
"temp" | "temp", | ||
"text" | |||
] | ] | ||
} | } | ||
</templatedata></noinclude> | </templatedata></noinclude> |
Revision as of 14:02, 10 October 2023
Represents HP or Temp HP. See also Template:Temp hp for a simpler way to display temporary HP.
If the number to be displayed isn't really a number (e.g. "3 ~ 6" or "2d4"), provide it with the text
parameter.
Code | Result |
---|---|
{{Hp}} |
Hit Points |
{{Hp|temp=1}} |
Temporary Hit Points |
{{Hp|1}} |
1 Hit Point |
{{Hp|2}} |
2 Hit Points |
{{Hp|1|temp=1}} |
1 Temporary Hit Point |
{{Hp|2|temp=1}} |
2 Temporary Hit Points |
{{Hp|1|plural=t}} |
1 Hit Points |
{{Hp|text=2d4}} |
2d4 Hit Points |
{{Hp|3|size=40}} |
3 Hit Points |
Template data
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
value | 1 | The number of hitpoints to represent. | Number | optional |
size | size | The icon size.
| Unknown | optional |
plural | plural | If specified, will force plural. | Boolean | optional |
temp | temp | If specified, will format as temporary HP | Unknown | optional |
text | text | If specified, will replace the number with this text instead. | Unknown | optional |