Template:Stats: Difference between revisions

From MTG Wiki
Jump to navigation Jump to search
>Yandere-sliver
No edit summary
>Jerodast
m (oops, Example should match)
 
(44 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><span class="mw-collapsible {{#ifeq:{{{state|}}}|collapsed|mw-collapsed|}}"><!--
<includeonly>{{#vardefine:total|{{#expr:{{{C|0}}}+{{{W|0}}}+{{{U|0}}}+{{{B|0}}}+{{{R|0}}}+{{{G|0}}}+{{{WU|0}}}+{{{UB|0}}}+{{{BR|0}}}+{{{RG|0}}}+{{{GW|0}}}+{{{WB|0}}}+{{{UR|0}}}+{{{BG|0}}}+{{{RW|0}}}+{{{GU|0}}}+{{{A|0}}}+{{{L|0}}}+{{{M|0}}}}}}}<!--
-->{{#vardefine:total|{{#expr:{{{C|0}}}+{{{W|0}}}+{{{U|0}}}+{{{B|0}}}+{{{R|0}}}+{{{G|0}}}+{{{WU|0}}}+{{{UB|0}}}+{{{BR|0}}}+{{{RG|0}}}+{{{GW|0}}}+{{{WB|0}}}+{{{UR|0}}}+{{{BG|0}}}+{{{RW|0}}}+{{{GU|0}}}+{{{A|0}}}+{{{L|0}}}+{{{M|0}}}}}}}<!--
--><div class="{{#ifeq:{{#var:total}}|0||mw-collapsible}} {{#ifeq:{{{state|}}}|collapsed|mw-collapsed|}}"><!--
-->{{#vardefine:round|1}}<!--
-->{{#vardefine:round|1}}<!--
-->{{#var:total}} {{#switch:{{{1|}}}|split=split cards/<br/>{{#expr:{{#var:total}}/2}} whole|#default={{{1|}}}&#32;}}card{{#ifeq:{{#var:total}}|1||s}}<ul class="mw-collapsible-content"><!--
-->{{#var:total}} {{#switch:{{{1|}}}|split=split cards/<br/>{{#expr:{{#var:total}}/2}} whole&#32;|#default={{{1|}}}&#32;}}card{{#ifeq:{{#var:total}}|1||s}}{{#switch:{{{1|}}}|meld|"partner with"=<br/>{{#expr:{{#var:total}}/2}} {{{1|}}} pairs}}<div class="mw-collapsible-content stats-container"><!--
Colorless (non-artifact, non land)
Colorless (non-artifact, non land)
-->{{#if:{{{C|}}}|<li>{{C}} {{#expr:(100*{{{C}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{C|}}}|{{nowrap|{{C}} {{#expr:(100*{{{C}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
Monocolored
Monocolored
-->{{#if:{{{W|}}}|<li>{{W}} {{#expr:(100*{{{W}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{W|}}}|{{nowrap|{{W}} {{#expr:(100*{{{W}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{U|}}}|<li>{{U}} {{#expr:(100*{{{U}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{U|}}}|{{nowrap|{{U}} {{#expr:(100*{{{U}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{B|}}}|<li>{{B}} {{#expr:(100*{{{B}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{B|}}}|{{nowrap|{{B}} {{#expr:(100*{{{B}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{R|}}}|<li>{{R}} {{#expr:(100*{{{R}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{R|}}}|{{nowrap|{{R}} {{#expr:(100*{{{R}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{G|}}}|<li>{{G}} {{#expr:(100*{{{G}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{G|}}}|{{nowrap|{{G}} {{#expr:(100*{{{G}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
Twocolored or Hybrid
Twocolored or Hybrid
-->{{#if:{{{WU|}}}|<li>{{W/U}} {{#expr:(100*{{{WU}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{WU|}}}|{{nowrap|{{W/U}} {{#expr:(100*{{{WU}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{UB|}}}|<li>{{U/B}} {{#expr:(100*{{{UB}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{UB|}}}|{{nowrap|{{U/B}} {{#expr:(100*{{{UB}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{BR|}}}|<li>{{B/R}} {{#expr:(100*{{{BR}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{BR|}}}|{{nowrap|{{B/R}} {{#expr:(100*{{{BR}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{RG|}}}|<li>{{R/G}} {{#expr:(100*{{{RG}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{RG|}}}|{{nowrap|{{R/G}} {{#expr:(100*{{{RG}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{GW|}}}|<li>{{G/W}} {{#expr:(100*{{{GW}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{GW|}}}|{{nowrap|{{G/W}} {{#expr:(100*{{{GW}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{WB|}}}|<li>{{W/B}} {{#expr:(100*{{{WB}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{WB|}}}|{{nowrap|{{W/B}} {{#expr:(100*{{{WB}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{UR|}}}|<li>{{U/R}} {{#expr:(100*{{{UR}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{UR|}}}|{{nowrap|{{U/R}} {{#expr:(100*{{{UR}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{BG|}}}|<li>{{B/G}} {{#expr:(100*{{{BG}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{BG|}}}|{{nowrap|{{B/G}} {{#expr:(100*{{{BG}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{RW|}}}|<li>{{R/W}} {{#expr:(100*{{{RW}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{RW|}}}|{{nowrap|{{R/W}} {{#expr:(100*{{{RW}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
-->{{#if:{{{GU|}}}|<li>{{G/U}} {{#expr:(100*{{{GU}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{GU|}}}|{{nowrap|{{G/U}} {{#expr:(100*{{{GU}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
Multicolored
Multicolored
-->{{#if:{{{M|}}}|<li>{{symbol|5Colors|type=png|link=Multicolor}} {{#expr:(100*{{{M}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{M|}}}|{{nowrap|{{M}} {{#expr:(100*{{{M}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
Colorless artifact
Colorless artifacts
-->{{#if:{{{A|}}}|<li>{{type|artifact|link=Artifact}} {{#expr:(100*{{{A}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}<!--
-->{{#if:{{{A|}}}|{{nowrap|{{type|artifact}} {{#expr:(100*{{{A}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}<!--
Lands
Lands
-->{{#if:{{{L|}}}|<li>{{type|land|link=Land}} {{#expr:(100*{{{L}}}/{{#var:total}}) round {{#var:round}}}}%</li>}}</ul></span></includeonly><noinclude>This template is meant to make the statistical breakdown by color easier and more consistent across the wiki.  
-->{{#if:{{{L|}}}|{{nowrap|{{type|land}} {{#expr:(100*{{{L}}}/{{#var:total}}) round {{#var:round}}}}%|class=stats}}&#32;}}</div></div></includeonly><noinclude>This template is meant to make the statistical breakdown by color easier and more consistent across the wiki.  


The template calculates the total and the percentage breakdown.
The template calculates the total and the percentage breakdown.


==Parameter==
==Parameter==
*<code>{{{1}}}</code> (optional) If there should be a descriptor before the word "cards" (e.g. XX morph cards)
*<code>{{{1}}}</code> (optional) If there should be a descriptor before the word "cards" (e.g. XX morph cards).
*<code>{{{state}}}</code> (optional) Can be set to 'collapsed' to start in a collapsed state.
**If set to '''split''' the number of whole cards will be calculated as well.
**If set to '''meld''' or '''"partner with"''' the number of pairs will be calculated as well.
*<code>{{{state}}}</code> (optional) Can be set to "collapsed" to start in a collapsed state.
Each of the following parameter requires the number of cards of that certain characteristic:
Each of the following parameter requires the number of cards of that certain characteristic:
*<code>{{{C}}}</code> [[Colorless]] non-artifact non-land cards (e.g. [[Eldrazi]])
*<code>{{{C}}}</code> [[Colorless]] non-artifact non-land cards (e.g. [[Eldrazi]])
*[[Monocolor]]ed cards
*[[Monocolored]] cards
**<code>{{{W}}}</code> [[White]]  
**<code>{{{W}}}</code> [[White]]  
**<code>{{{U}}}</code> [[Blue]]  
**<code>{{{U}}}</code> [[Blue]]  
Line 53: Line 55:
**<code>{{{RW}}}</code> Red/White  
**<code>{{{RW}}}</code> Red/White  
**<code>{{{GU}}}</code> Green/Blue
**<code>{{{GU}}}</code> Green/Blue
*<code>{{{M}}}</code> [[Multicolor]]ed cards
*<code>{{{M}}}</code> [[Multicolored]] cards  
*<code>{{{A}}}</code> Colorless [[artifact]]s
*<code>{{{A}}}</code> Colorless [[artifact]]s  
*<code>{{{L}}}</code> [[Land]]s
*<code>{{{L}}}</code> [[Land]]s


==Usage==
==Usage==
Code: <code><nowiki>{{stats|C=1|W=2|U=3|B=4|R=5|G=6|M=7|A=8|L=9}}</nowiki></code>
;Typical Example
<div style="width:400px;">
:'''Code''': <code><nowiki>{{stats|C=1|W=2|U=3|B=4|R=5|G=6|M=7|A=8|L=9}}</nowiki></code>
:'''Result''': {{stats|C=1|W=2|U=3|B=4|R=5|G=6|M=7|A=8|L=9}}
</div>
 
 
;Collapsed Example with Color Pairs
<div style="width:400px;">
:'''Code''': <code><nowiki>{{stats|W=1|B=2|UB=2|BR=1|BG=3|state=collapsed}}</nowiki></code>
:'''Result''': {{stats|W=1|B=2|UB=2|BR=1|BG=3|state=collapsed}}
</div>
 
 
;Zero Card Example
<div style="width:400px;">
:'''Code''': <code><nowiki>{{stats}}</nowiki></code>
:'''Result''': {{stats}}
</div>


Result: {{stats|C=1|W=2|U=3|B=4|R=5|G=6|M=7|A=8|L=9}}
[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Latest revision as of 15:54, 4 June 2023

This template is meant to make the statistical breakdown by color easier and more consistent across the wiki.

The template calculates the total and the percentage breakdown.

Parameter

  • {{{1}}} (optional) If there should be a descriptor before the word "cards" (e.g. XX morph cards).
    • If set to split the number of whole cards will be calculated as well.
    • If set to meld or "partner with" the number of pairs will be calculated as well.
  • {{{state}}} (optional) Can be set to "collapsed" to start in a collapsed state.

Each of the following parameter requires the number of cards of that certain characteristic:

  • {{{C}}} Colorless non-artifact non-land cards (e.g. Eldrazi)
  • Monocolored cards
  • Hybrid or Twocolored cards
    • {{{WU}}} White/Blue
    • {{{UB}}} Blue/Black
    • {{{BR}}} Black/Red
    • {{{RG}}} Red/Green
    • {{{GW}}} Green/White
    • {{{WB}}} White/Black
    • {{{UR}}} Blue/Red
    • {{{BG}}} Black/Green
    • {{{RW}}} Red/White
    • {{{GU}}} Green/Blue
  • {{{M}}} Multicolored cards
  • {{{A}}} Colorless artifacts
  • {{{L}}} Lands

Usage

Typical Example
Code: {{stats|C=1|W=2|U=3|B=4|R=5|G=6|M=7|A=8|L=9}}
Result:
45 cards
{C} 2.2% {W} 4.4% {U} 6.7% {B} 8.9% {R} 11.1% {G} 13.3% {M} 15.6% {artifact symbol} 17.8% {land symbol} 20%


Collapsed Example with Color Pairs
Code: {{stats|W=1|B=2|UB=2|BR=1|BG=3|state=collapsed}}
Result:
9 cards
{W} 11.1% {B} 22.2% {U/B} 22.2% {B/R} 11.1% {B/G} 33.3%


Zero Card Example
Code: {{stats}}
Result:
0 cards