Template:StatTable: Difference between revisions

From I-Pixelmon
Jump to navigation Jump to search
No edit summary
No edit summary
 
(48 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}}}">


<!--
<tr>
  Parameters:  HP Attack Defense SpAtk SpDef Speed
<th class="hdr-stat" colspan="2" rowspan="2">Stat</th>
              Total (optional – will be auto-calculated if omitted)
<th class="hdr-range" colspan="2">Range</th>
-->
</tr>
<tr>
<th class="hdr-sub">At Lv 50</th>
<th class="hdr-sub">At Lv 100</th>
</tr>


{{#vardefine:hp  | {{{HP  |0}}} }}
{{#vardefine:atk  | {{{Attack |0}}} }}
{{#vardefine:def  | {{{Defense|0}}} }}
{{#vardefine:spa  | {{{SpAtk  |0}}} }}
{{#vardefine:spd  | {{{SpDef  |0}}} }}
{{#vardefine:spe  | {{{Speed  |0}}} }}


{{#vardefine:tot
<!-- HP -->
  | {{#if:{{{Total|}}} | {{{Total}}}
<tr class="row-hp">
    | {{#expr:{{#var:hp}}+{{#var:atk}}+{{#var:def}}+{{#var:spa}}+{{#var:spd}}+{{#var:spe}} }}
<td class="lab">HP:<span class=statnumber>{{{HP}}}</span></td>
  }} }}
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{HP|0}}} * 100 / 255 ) round 0}}%;"></div></td>
<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>
<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>


{| class="pkmn-stats" style="border:1px solid #555; background:#dcdce9; border-radius:6px; padding:2px;"
<!-- Attack -->
|-
<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>


! colspan="3" style="display:none;" |  <!-- invisible header keeps table validators happy -->
</tr>


<!-- 6 stat rows -->
<!-- Defense -->
{{#lsth:StatTable |row|hp  |HP      |HP          }}
<tr class="row-def">
{{#lsth:StatTable |row|atk |Attack  |Attack      }}
<td class="lab">Defense:<span class=statnumber>{{{Defense}}}</span></td>
{{#lsth:StatTable |row|def |Defense |Defense      }}
<td class="bar"><div class="fill" style="width:{{#expr: ( {{{Defense|0}}} * 100 / 255 ) round 0}}%;"></div></td>
{{#lsth:StatTable |row|spa |Sp.&nbsp;Atk |SpAtk  }}
<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>
{{#lsth:StatTable |row|spd |Sp.&nbsp;Def |SpDef  }}
<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>
{{#lsth:StatTable |row|spe |Speed  |Speed        }}


<!-- total -->
</tr>
|-
| class="total-row" colspan="3" | Total: {{#var:tot}}
|}


<noinclude>
<!-- Sp. Atk -->
==== Helper for the six rows ====
<tr class="row-spa">
<onlyinclude>{{#if:{{{row|}}}|
<td class="lab">Sp.&nbsp;Atk:<span span class=statnumber>{{{SpAtk}}}</span></td>
<!-- invoked through {{#lsth:StatTable |row|class|Label|Param}} -->
<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>
| class="stat-row {{{1}}}" |
<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>
! class="stat-lbl" | {{{2}}}:
</tr>
| class="stat-bar {{{1}}}" |
 
  <span class="stat-fill"
<!-- Sp. Def -->
        style="width: {{#expr: min( ({{{3}}}), 255 ) * 100 / 255 round 2 }}%"></span>
<tr class="row-spd">
| class="stat-val" | {{{3}}}
<td class="lab">Sp.&nbsp;Def:<span class=statnumber>{{{SpDef}}}</span></td>
}}</onlyinclude>
<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