Template:StatTable: Difference between revisions

From I-Pixelmon
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{| style="background: #{{{{{type|???}}} color}}; {{roundy|10px}}; border: 3px solid #{{{{{type2|{{{type|???}}}}}} color dark}}; border-collapse: separate; white-space: nowrap"
<includeonly>
|-
<!-- ============================================================
! colspan="2" rowspan="2" style="background: #{{{{{type|???}}} color light}}; {{roundytl|10px}}" | {{color2|000|Stat}}
  Template:StatTable  –  standalone Bulbapedia-style base-stat bars
! colspan="2" style="background: #{{{{{type|???}}} color light}}; {{roundytr|10px}}" | Range
  Parameters (all required)
|-
      |HP |Attack |Defense |SpAtk |SpDef |Speed
! style="background: #{{{{{type|???}}} color light}};" | <small>At Lv. 50</small>
  Optional
! style="background: #{{{{{type|???}}} color light}};" | <small>At Lv. 100</small>
      |frame = #hex  (border / frame colour, default #444)
|- style="background: #{{HP color light}}; text-align:center"
================================================================ -->
! style="padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>{{color2|000|HP}}:</div><div>{{{HP|1}}}</div>
<div class="statbox">
| style="width: 255px" | <div class="statbar" style="background-color: #{{HP color}}; border: 1px solid #{{HP color dark}}; width: calc(100% * {{{HP|1}}}/255); height:20px"></div>
 
| <small>{{#ifexpr: {{{HP|1}}} = 1|1|{{#expr: ((0 + 2 * {{{HP|1}}} + (0/4)) * 50/100) + 10 + 50}}}} - {{#ifexpr: {{{HP|1}}} = 1|1|{{#expr: ((31 + 2 * {{{HP|1}}} + (252/4)) * 50/100) + 10 + 50}}}}</small>
<style>
| <small>{{#ifexpr: {{{HP|1}}} = 1|1|{{#expr: ((0 + 2 * {{{HP|1}}} + (0/4)) * 100/100) + 10 + 100}}}} - {{#ifexpr: {{{HP|1}}} = 1|1|{{#expr: ((31 + 2 * {{{HP|1}}} + (252/4)) * 100/100) + 10 + 100}}}}</small>
/* ▨▨▨  frame & layout  ▨▨▨ */
|- style="background: #{{Attack color light}}; text-align:center"
.statbox table{
! style="padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>{{color2|000|Stat#Attack|Attack}}:</div><div>{{{Attack|1}}}</div>
  border:3px solid var(--frame,#444);      /* overridable via |frame */
| style="width: 255px" | <div class="statbar" style="background-color: #{{Attack color}}; border: 1px solid #{{Attack color dark}}; width: calc(100% * {{{Attack|1}}}/255); height:20px"></div>
  border-radius:10px;
| <small>{{#expr: floor((((0 + 2 * {{{Attack|1}}} + (0/4)) * 50/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{Attack|1}}} + (252/4)) * 50/100) + 5) * 1.1)}}</small>
  background:#d7d8e8;                      /* light lavender */
| <small>{{#expr: floor((((0 + 2 * {{{Attack|1}}} + (0/4)) * 100/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{Attack|1}}} + (252/4)) * 100/100) + 5) * 1.1)}}</small>
  border-collapse:separate;
|- style="background: #{{Defense color light}}; text-align:center"
  margin:auto; max-width:620px; width:100%;
! style="padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>{{color2|000|Stat#Defense|Defense}}:</div><div>{{{Defense|1}}}</div>
  font-family:inherit;
| style="width: 255px" | <div class="statbar" style="background-color: #{{Defense color}}; border: 1px solid #{{Defense color dark}}; width: calc(100% * {{{Defense|1}}}/255); height:20px"></div>
}
| <small>{{#expr: floor((((0 + 2 * {{{Defense|1}}} + (0/4)) * 50/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{Defense|1}}} + (252/4)) * 50/100) + 5) * 1.1)}}</small>
.statbox th{
| <small>{{#expr: floor((((0 + 2 * {{{Defense|1}}} + (0/4)) * 100/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{Defense|1}}} + (252/4)) * 100/100) + 5) * 1.1)}}</small>
  width:110px; padding:6px 4px; text-align:left;
|- style="background: #{{Special Attack color light}}; text-align:center"
  font-weight:700; font-size:110%;
! style="padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>{{color2|000|Stat#Special Attack|Sp. Atk}}:</div><div>{{{SpAtk|1}}}</div>
}
| style="width: 255px" | <div class="statbar" style="background-color: #{{Special Attack color}}; border: 1px solid #{{Special Attack color dark}}; width: calc(100% * {{{SpAtk|1}}}/255); height:20px"></div>
.statbox td.val{
| <small>{{#expr: floor((((0 + 2 * {{{SpAtk|1}}} + (0/4)) * 50/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{SpAtk|1}}} + (252/4)) * 50/100) + 5) * 1.1)}}</small>
  width:48px; text-align:right; padding-right:6px; font-weight:700;
| <small>{{#expr: floor((((0 + 2 * {{{SpAtk|1}}} + (0/4)) * 100/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{SpAtk|1}}} + (252/4)) * 100/100) + 5) * 1.1)}}</small>
}
|- style="background: #{{Special Defense color light}}; text-align:center"
.statbox td.bar{
! style="padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>{{color2|000|Stat#Special Defense|Sp. Def}}:</div><div>{{{SpDef|1}}}</div>
  width:255px; padding:0;
| style="width: 255px" | <div class="statbar" style="background-color: #{{Special Defense color}}; border: 1px solid #{{Special Defense color dark}}; width: calc(100% * {{{SpDef|1}}}/255); height:20px"></div>
}
| <small>{{#expr: floor((((0 + 2 * {{{SpDef|1}}} + (0/4)) * 50/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{SpDef|1}}} + (252/4)) * 50/100) + 5) * 1.1)}}</small>
.statbox td.bar::before{                    /* coloured bar */
| <small>{{#expr: floor((((0 + 2 * {{{SpDef|1}}} + (0/4)) * 100/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{SpDef|1}}} + (252/4)) * 100/100) + 5) * 1.1)}}</small>
  content:''; display:block; height:20px;
|- style="background: #{{Speed color light}}; text-align:center"
  background:var(--bar,#777);
! style="padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>{{color2|000|Stat#Speed|Speed}}:</div><div>{{{Speed|1}}}</div>
  border:1px solid rgba(0,0,0,.25);
| style="width: 255px" | <div class="statbar" style="background-color: #{{Speed color}}; border: 1px solid #{{Speed color dark}}; width: calc(100% * {{{Speed|1}}}/255); height:20px"></div>
  width:calc( var(--percent,0) * 1% );
| <small>{{#expr: floor((((0 + 2 * {{{Speed|1}}} + (0/4)) * 50/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{Speed|1}}} + (252/4)) * 50/100) + 5) * 1.1)}}</small>
}
| <small>{{#expr: floor((((0 + 2 * {{{Speed|1}}} + (0/4)) * 100/100) + 5) * .9)}} - {{#expr: floor((((31 + 2 * {{{Speed|1}}} + (252/4)) * 100/100) + 5) * 1.1)}}</small>
 
|- style="background: #{{{{{type|???}}} color light}};"
/* ▨▨▨  row backgrounds + bar colours  ▨▨▨ */
! style="width: 6.5em; padding-left: 0.2em; padding-right: 0.2em; display: flex; justify-content: space-between;" | <div>Total:</div><div>{{#expr: {{{HP|1}}} + {{{Attack|1}}} + {{{Defense|1}}} + {{{SpAtk|1}}} + {{{SpDef|1}}} + {{{Speed|1}}}}}</div>
.row-hp {background:#ff9a9a}  .row-hp  td.bar::before{--bar:#ff5757}
| colspan="3" style="background: #{{{{{type|???}}} color light}}; padding-left:0.2em" | {{#if:{{{nocat|}}}||[[:Category:Pokémon with a base stat total of {{#expr: {{{HP|1}}} + {{{Attack|1}}} + {{{Defense|1}}} + {{{SpAtk|1}}} + {{{SpDef|1}}} + {{{Speed|1}}}}}|{{color|000|Other Pokémon with this total}}]]}}
.row-atk{background:#f6c19e} .row-atk td.bar::before{--bar:#e48a39}
|-
.row-def{background:#fff2b3}  .row-def td.bar::before{--bar:#f2cf45}
| colspan="4" style="background: #{{{{{type|???}}} color light}}; white-space:normal; font-size: smaller; width:min-content; {{roundybottom|10px}}" |
.row-spa{background:#bcd0ff} .row-spa td.bar::before{--bar:#6d93ff}
*Minimum stats are calculated with 0 {{color2|000|Effort values|EVs}}, {{color2|000|Individual values|IVs}} of 0, and (if applicable) a hindering {{color2|000|nature}}.
.row-spd{background:#cfe8c4} .row-spd td.bar::before{--bar:#62b455}
*Maximum stats are calculated with 252 {{color2|000|Effort values|EVs}}, {{color2|000|Individual values|IVs}} of 31, and (if applicable) a helpful {{color2|000|nature}}.{{#if: {{{Special|}}}|
.row-spe{background:#f8bfd8} .row-spe td.bar::before{--bar:#f27ab0}
*This Pokémon's [[Statistic#Special|<span style="background-color:#2F97E8; color:#000; padding-left: 0.5em; padding-right: 0.5em">Special</span>]] base stat in {{color2|000|Generation I}} was '''{{{Special}}}'''.}}
 
|}{{#if:{{{nocat|}}}||<includeonly>{{#ifeq:{{{cat|yes}}}|no||[[Category:Pokémon with a base stat total of {{#expr: {{{HP|1}}} + {{{Attack|1}}} + {{{Defense|1}}} + {{{SpAtk|1}}} + {{{SpDef|1}}} + {{{Speed|1}}}}}]]{{#ifeq:{{PAGESINCAT:Pokémon with a base stat total of {{#expr: {{{HP|1}}} + {{{Attack|1}}} + {{{Defense|1}}} + {{{SpAtk|1}}} + {{{SpDef|1}}} + {{{Speed|1}}}}}|pages}}|1|[[Category:Pokémon with a unique base stat total]]}}{{#ifexpr: ({{{Special|0}}} + {{{SpAtk|1}}} + {{{SpDef|1}}}) div 3 = {{{Special|0}}}|[[Category:Pokémon whose Special stat became both Special Attack and Special Defense]]|{{#ifexpr: {{{Special|0}}} = {{{SpAtk|1}}}|[[Category:Pokémon whose Special stat became their Special Attack]]}}{{#ifexpr: {{{Special|0}}} = {{{SpDef|1}}}|[[Category:Pokémon whose Special stat became their Special Defense]]}}}}{{#ifexpr: {{{HP|1}}} > 100|[[Category:Pokémon whose base HP stat is greater than 100]]}}{{#ifexpr: {{{Attack|1}}} > 100|[[Category:Pokémon whose base Attack stat is greater than 100]]}}{{#ifexpr: {{{Defense|1}}} > 100|[[Category:Pokémon whose base Defense stat is greater than 100]]}}{{#ifexpr: {{{SpAtk|1}}} > 100|[[Category:Pokémon whose base Special Attack stat is greater than 100]]}}{{#ifexpr: {{{SpDef|1}}} > 100|[[Category:Pokémon whose base Special Defense stat is greater than 100]]}}{{#ifexpr: {{{Special|1}}} > 100|[[Category:Pokémon whose base Special stat is greater than 100]]}}{{#ifexpr: {{{Speed|1}}} > 100|[[Category:Pokémon whose base Speed stat is greater than 100]]}}}}</includeonly>}}<noinclude>
/* total */
{{Documentation}}
.statbox .total-lab{padding:6px;font-weight:700;background:#d7d8e8}
[[Category:Templates]]</noinclude>
.statbox .total-val{padding:6px;text-align:right;background:#ffffff;font-weight:700}
</style>
 
<table style="--frame:{{{frame|#444}}}">
<!-- HP -->
<tr class="row-hp">
  <th>HP:</th>
  <td class="val">{{{HP}}}</td>
  <td class="bar" style="--percent:{{#expr: round({{{HP}}}*100/255,0) }}"></td>
</tr>
<!-- Attack -->
<tr class="row-atk">
  <th>Attack:</th>
  <td class="val">{{{Attack}}}</td>
  <td class="bar" style="--percent:{{#expr: round({{{Attack}}}*100/255,0) }}"></td>
</tr>
<!-- Defense -->
<tr class="row-def">
  <th>Defense:</th>
  <td class="val">{{{Defense}}}</td>
  <td class="bar" style="--percent:{{#expr: round({{{Defense}}}*100/255,0) }}"></td>
</tr>
<!-- Sp. Atk -->
<tr class="row-spa">
  <th>Sp.&nbsp;Atk:</th>
  <td class="val">{{{SpAtk}}}</td>
  <td class="bar" style="--percent:{{#expr: round({{{SpAtk}}}*100/255,0) }}"></td>
</tr>
<!-- Sp. Def -->
<tr class="row-spd">
  <th>Sp.&nbsp;Def:</th>
  <td class="val">{{{SpDef}}}</td>
  <td class="bar" style="--percent:{{#expr: round({{{SpDef}}}*100/255,0) }}"></td>
</tr>
<!-- Speed -->
<tr class="row-spe">
  <th>Speed:</th>
  <td class="val">{{{Speed}}}</td>
  <td class="bar" style="--percent:{{#expr: round({{{Speed}}}*100/255,0) }}"></td>
</tr>
<!-- Total -->
<tr>
  <th class="total-lab">Total:</th>
  <td colspan="2" class="total-val">{{#expr:{{{HP}}}+{{{Attack}}}+{{{Defense}}}+{{{SpAtk}}}+{{{SpDef}}}+{{{Speed}}}}}</td>
</tr>
</table>
</div>
</includeonly><noinclude>
==Usage==
<nowiki>{{StatTable
|HP=80 |Attack=82 |Defense=83 |SpAtk=100 |SpDef=100 |Speed=80
|frame=#78C850  <!-- optional border colour -->
}}</nowiki>
[[Category:Template documentation]]
</noinclude>

Revision as of 03:55, 19 May 2025

Usage

{{StatTable
 |HP=80 |Attack=82 |Defense=83 |SpAtk=100 |SpDef=100 |Speed=80
 |frame=#78C850   <!-- optional border colour -->
}}