Template:StatTable: Difference between revisions

From I-Pixelmon
Jump to navigation Jump to search
No edit summary
No edit summary
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
<templatestyles src="Template:StatTable/styles.css" />
<includeonly><templatestyles src="Template:StatTable/styles.css"/>
<!-- table border colour can be overridden via |frame=#rrggbb -->
<div class="statbox">
<table style="border-color:{{{frame|#444}}}">


<includeonly>
<tr>
<!-- ── pull parameters / set defaults ────────────────────────────── -->
<th class="hdr-stat" colspan="2" rowspan="2">Stat</th>
{{#vardefine:hp  | {{{HP      |0}}} }}
<th class="hdr-range" colspan="2">Range</th>
{{#vardefine:atk | {{{Attack  |0}}} }}
</tr>
{{#vardefine:def | {{{Defense |0}}} }}
<tr>
{{#vardefine:spa | {{{SpAtk  |0}}} }}
<th class="hdr-sub">At Lv 50</th>
{{#vardefine:spd | {{{SpDef  |0}}} }}
<th class="hdr-sub">At Lv 100</th>
{{#vardefine:spe | {{{Speed  |0}}} }}
</tr>


{{#if:{{{Total|}}}
| {{#vardefine:tot | {{{Total}}} }}
| {{#vardefine:tot | {{#expr:
      {{#var:hp}} + {{#var:atk}} + {{#var:def}} +
      {{#var:spa}} + {{#var:spd}} + {{#var:spe}} }} }}
}}


<!-- ── table ─────────────────────────────────────────────────────── -->
<!-- HP -->
{| class="pkmn-stats" style="border:1px solid #555; background:#dcdce9; border-radius:6px; padding:2px;"
<tr class="row-hp">
|-
<td class="lab">HP:<span class=statnumber>{{{HP}}}</span></td>
! colspan="3" style="display:none;" |
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{HP|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<!-- rows -->
<td class="range"><small>{{#ifexpr:{{{HP}}}=1|1|{{#expr:((0+2*{{{HP}}}+(0/4))*50/100)+10+50}}}}–{{#ifexpr:{{{HP}}}=1|1|{{#expr:((31+2*{{{HP}}}+(252/4))*50/100)+10+50}}}}</small></td>
{{#invoke:StatRow|make|hp |HP:        |{{#var:hp}} }}
<td class="range"><small>{{#ifexpr:{{{HP}}}=1|1|{{#expr:((0+2*{{{HP}}}+(0/4))*100/100)+10+100}}}}{{#ifexpr:{{{HP}}}=1|1|{{#expr:((31+2*{{{HP}}}+(252/4))*100/100)+10+100}}}}</small></td>
{{#invoke:StatRow|make|atk|Attack:    |{{#var:atk}}}}
{{#invoke:StatRow|make|def|Defense:  |{{#var:def}}}}
{{#invoke:StatRow|make|spa|Sp.&nbsp;Atk:|{{#var:spa}}}}
{{#invoke:StatRow|make|spd|Sp.&nbsp;Def:|{{#var:spd}}}}
{{#invoke:StatRow|make|spe|Speed:    |{{#var:spe}}}}
|-
| class="total-row" colspan="3" | Total: {{#var:tot}}
|}
</includeonly>


<noinclude>
<!-- Attack -->
Displays a Bulbapedia-style base–stat chart.
<tr class="row-atk">
<td class="lab">Attack:<span class=statnumber>{{{Attack}}}</span></td>
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{Attack|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{Attack}}}+(0/4))*50/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{Attack}}}+(252/4))*50/100)+5)*1.1)}}</small></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{Attack}}}+(0/4))*100/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{Attack}}}+(252/4))*100/100)+5)*1.1)}}</small></td>


**Parameters**
</tr>


`HP | Attack | Defense | SpAtk | SpDef | Speed
<!-- Defense -->
`Total` – optional (auto-calculated if omitted)
<tr class="row-def">
<td class="lab">Defense:<span class=statnumber>{{{Defense}}}</span></td>
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{Defense|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{Defense}}}+(0/4))*50/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{Defense}}}+(252/4))*50/100)+5)*1.1)}}</small></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{Defense}}}+(0/4))*100/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{Defense}}}+(252/4))*100/100)+5)*1.1)}}</small></td>
 
</tr>
 
<!-- Sp. Atk -->
<tr class="row-spa">
<td class="lab">Sp.&nbsp;Atk:<span span class=statnumber>{{{SpAtk}}}</span></td>
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{SpAtk|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{SpAtk}}}+(0/4))*50/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{SpAtk}}}+(252/4))*50/100)+5)*1.1)}}</small></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{SpAtk}}}+(0/4))*100/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{SpAtk}}}+(252/4))*100/100)+5)*1.1)}}</small></td>
</tr>
 
<!-- Sp. Def -->
<tr class="row-spd">
<td class="lab">Sp.&nbsp;Def:<span class=statnumber>{{{SpDef}}}</span></td>
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{SpDef|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{SpDef}}}+(0/4))*50/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{SpDef}}}+(252/4))*50/100)+5)*1.1)}}</small></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{SpDef}}}+(0/4))*100/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{SpDef}}}+(252/4))*100/100)+5)*1.1)}}</small></td>
 
</tr>
 
<!-- Speed -->
<tr class="row-spe">
<td class="lab">Speed:<span class=statnumber>{{{Speed}}}</span></td>
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{Speed|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{Speed}}}+(0/4))*50/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{Speed}}}+(252/4))*50/100)+5)*1.1)}}</small></td>
<td class="range"><small>{{#expr:floor((((0+2*{{{Speed}}}+(0/4))*100/100)+5)*0.9)}}–{{#expr:floor((((31+2*{{{Speed}}}+(252/4))*100/100)+5)*1.1)}}</small></td>
 
</tr>
 
<!-- Total (no bar) -->
<tr class="total">
<td class="lab">Total:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>{{#expr:{{{HP}}}+{{{Attack}}}+{{{Defense}}}+{{{SpAtk}}}+{{{SpDef}}}+{{{Speed}}}}}</span></td>
<td class="bar"></td>
</tr>
 
</table>
</div></includeonly><noinclude>
<pre>{{StatTable
|HP=80 |Attack=82 |Defense=83 |SpAtk=100 |SpDef=100 |Speed=80
}}</pre>
{{StatTable|type=Dragon|HP=105|Attack=150|Defense=90|SpAtk=150|SpDef=90|Speed=95|Total=680}}
{{StatTable|type=Normal|HP=105|Attack=180|Defense=100|SpAtk=180|SpDef=100|Speed=115|Total=780}}
{{StatTable|type=Normal|HP=10|Attack=10|Defense=10|SpAtk=10|SpDef=10|Speed=10|Total=10}}
[[Category:Template documentation]]
</noinclude>
</noinclude>

Latest revision as of 05:13, 2 June 2025

{{StatTable
 |HP=80 |Attack=82 |Defense=83 |SpAtk=100 |SpDef=100 |Speed=80
}}
Stat Range
At Lv 50 At Lv 100
HP:105
165–212 320–414
Attack:150
139–222 274–438
Defense:90
85–156 166–306
Sp. Atk:150
139–222 274–438
Sp. Def:90
85–156 166–306
Speed:95
90–161 175–317
Total:     680
Stat Range
At Lv 50 At Lv 100
HP:105
165–212 320–414
Attack:180
166–255 328–504
Defense:100
94–167 184–328
Sp. Atk:180
166–255 328–504
Sp. Def:100
94–167 184–328
Speed:115
108–183 211–361
Total:     780
Stat Range
At Lv 50 At Lv 100
HP:10
70–117 130–224
Attack:10
13–68 22–130
Defense:10
13–68 22–130
Sp. Atk:10
13–68 22–130
Sp. Def:10
13–68 22–130
Speed:10
13–68 22–130
Total:     60