Template:Hp: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(add temphp category)
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}
<includeonly>{{Icon|HP Icon.png|{{{size|25}}}}} {{{1|}}} {{#ifeq:{{{1|}}}|1|[[Hit points|hit point]]|[[hit points]]}}</includeonly><noinclude>Represents HP or Temp HP. See also [[Template:Temp hp]] for the equivalent template for temporary HP.
<!--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|}}}|[[Category:Sources of Temporary Hit Points]] [[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.
 
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 14: Line 5:
|-
|-
| <code><nowiki>{{Hp}}</nowiki></code> || {{Hp}}
| <code><nowiki>{{Hp}}</nowiki></code> || {{Hp}}
|-
| <code><nowiki>{{Hp|temp=1}}</nowiki></code> || {{Hp|temp=1}}
|-
|-
| <code><nowiki>{{Hp|1}}</nowiki></code> || {{Hp|1}}
| <code><nowiki>{{Hp|1}}</nowiki></code> || {{Hp|1}}
Line 21: Line 10:
| <code><nowiki>{{Hp|2}}</nowiki></code> || {{Hp|2}}
| <code><nowiki>{{Hp|2}}</nowiki></code> || {{Hp|2}}
|-
|-
| <code><nowiki>{{Hp|1|temp=1}}</nowiki></code> || {{Hp|1|temp=1}}
| <code><nowiki>{{Hp|2d4}}</nowiki></code> || {{Hp|2d4}}
|-
| <code><nowiki>{{Hp|2|temp=1}}</nowiki></code> || {{Hp|2|temp=1}}
|-
| <code><nowiki>{{Hp|1|plural=t}}</nowiki></code> || {{Hp|1|plural=t}}
|-
| <code><nowiki>{{Hp|text=2d4}}</nowiki></code> || {{Hp|text=2d4}}
|-
|-
| <code><nowiki>{{Hp|3|size=40}}</nowiki></code> || {{Hp|3|size=40}}
| <code><nowiki>{{Hp|3|size=40}}</nowiki></code> || {{Hp|3|size=40}}
Line 43: Line 26:
"description": "The number of hitpoints to represent.",
"description": "The number of hitpoints to represent.",
"type": "number"
"type": "number"
},
"plural": {
"description": "If specified, will force plural.",
"type": "boolean"
},
"temp": {
"description": "If specified, will format as temporary HP"
},
"text": {
"description": "If specified, will replace the number with this text instead."
},
},
"size": {
"size": {
Line 61: Line 34:
"paramOrder": [
"paramOrder": [
"1",
"1",
"size",
"size"
"plural",
],
"temp",
"format": "inline"
"text"
]
}
}
</templatedata></noinclude>
</templatedata></noinclude>

Latest revision as of 22:20, 25 October 2023

Represents HP or Temp HP. See also Template:Temp hp for the equivalent template for temporary HP.

Code Result
{{Hp}} HP Icon.png hit points
{{Hp|1}} HP Icon.png 1 hit point
{{Hp|2}} HP Icon.png 2 hit points
{{Hp|2d4}} HP Icon.png 2d4 hit points
{{Hp|3|size=40}} HP Icon.png 3 hit points

Template data

No description.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
value1

The number of hitpoints to represent.

Numberoptional
sizesize

The icon size.

Default
25
Unknownoptional