Template:UnitInfobox: Difference between revisions

From Mechabellum Wiki
m (test)
No edit summary
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<!-- define parameter as variable so they can be used later on the page -->
{{#vardefine:names |
{{#vardefine:atk|{{{atk|0}}} }}
; 1 Crawler
{{#vardefine:hp|{{{hp|0}}} }}
; 2 Fang
{{#vardefine:mobility|{{{mobility|Ground}}} }}
; 3 Marksman
{{#vardefine:giant|{{{giant|No}}} }}
; 4 Arclight
{{#vardefine:cost|{{{cost|0}}} }}
; 5 Wasp
{{#vardefine:unlockcost|{{{unlockcost|0}}} }}
; 6 Mustang
{{#vardefine:units|{{{units|1}}} }}
; 7 Sledgehammer
{{#vardefine:target|{{{target|Ground Only}}} }}
; 8 Steel Ball
{{#vardefine:atkint|{{{atkint|1}}} }}
; 9 Stormcaller
{{#vardefine:splashdmg|{{{splashdmg|0}}} }}
; 10 Phoenix
{{#vardefine:range|{{{range|0}}} }}
; 11 Rhino
{{#vardefine:speed|{{{speed|0}}} }}
; 12 Hacker
<!-- calculated variables -->
; 13 Wraith
{{#vardefine:burst|{{#ifexpr: ({{{atk|0}}})<1 | 0 | {{#expr: abs({{{atk|0}}}) * {{{units|1}}} round 0 }} }} }}
; 14 Scorpion
{{#vardefine:dps|
; 15 Vulcan
  {{#ifexpr: ({{{atk|0}}}) < 1 <!-- if melting damage -->
; 16 Fortress
    | {{#expr: {{#explode: {{{atk|-0}}} | - | 1 }} * {{{units|1}}} / {{{atkint|1}}} round 0 }} 
; 17 Melting Point
    | {{#expr: abs({{{atk|0}}}) * {{{units|1}}} / {{{atkint|1}}} round 0 }}
; 18 Overlord
  }}
; 19 War Factory
}}
; 20 Tarantula
<div class="infobox" style="max-width: 100%;">
; 21 Sandworm
<div class="infobox-title">{{PAGENAME}}</div>
; 22 Fire Badger
; 23 Sabertooth
; 24 Typhoon
; 25 Farseer
; 26 Larva
; 27 Spider Mine
}}{{#vardefine:max | 27
}}{{#vardefine:pos | {{#sub:{{#var:names}} | {{#expr: {{#pos:{{#var:names}}|{{PAGENAME}}}} - 3}} | 3}}
}}{{#vardefine:prev | {{#ifexpr: {{#var:pos}} = 1 | {{#var:max}} | {{#expr: {{#var:pos}} - 1}} }}
}}{{#vardefine:next | {{#ifexpr: {{#var:pos}} = {{#var:max}} | 1 | {{#expr: {{#var:pos}} + 1}} }}
}}{{UnitData}}<div class="infobox" style="max-width: 100%;">
{| class="infobox-nav"
|[[{{#sub: {{#explode: {{#var:names}} | ; | {{#var:prev}} }} | 2 }}|<span class="carousel-control-prev-icon"></span>]]
|<div class="infobox-title" {{#ifeq: {{PAGENAME}} | Sledgehammer | style="font-size: 1.75em;" }}>{{PAGENAME}}</div>
| style="text-align:right;" | [[{{#sub: {{#explode: {{#var:names}} | ; | {{#var:next}} }} | 2 }}|<span class="carousel-control-next-icon"></span>]]
|}
{{#if:{{{type|}}}|<p class="text-center h5">{{{type}}}</p>}}
{{#if:{{{type|}}}|<p class="text-center h5">{{{type}}}</p>}}
{{#if:{{{image|}}}|
{{#if:{{{image|}}}|
Line 28: Line 43:
<tr>
<tr>
     <th>Mobility</th>
     <th>Mobility</th>
     <td>{{{mobility|Ground}}}</td>
     <td>{{#var:mobility|Ground}}</td>
</tr>
</tr>
<tr>
<tr>
     <th>Giant</th>
     <th>Giant</th>
     <td>{{{giant|No}}}</td>
     <td>{{#var:giant|No}}</td>
</tr>
</tr>
{{#if:{{{cost|}}}|<tr>
<tr>
     <th>Cost</th>
     <th>Cost</th>
     <td>{{{cost}}}</td>
     <td>{{#var:cost|0}}</td>
</tr>
{{#ifeq:{{#var:upkeep|0}}|0||
<tr>
    <th>Upkeep</th>
    <td>{{#var:upkeep|Free}}</td>
</tr>
</tr>
}}
}}
<tr>
<tr>
     <th>Unlock cost</th>
     <th>Unlock cost</th>
     <td>{{{unlockcost|Free}}}</td>
     <td>{{#var:unlockcost|Free}}</td>
</tr>
</tr>
<tr>
<tr>
     <th>Units</th>
     <th>Units</th>
     <td>{{{units|1}}}</td>
     <td>{{#var:units|1}}</td>
</tr>
</tr>
{{#if:{{{hp|}}}|<tr>
<tr>
     <th>HP</th>
     <th>HP</th>
     <td>{{{hp}}}</td>
     <td>{{#var:hp|0}}</td>
</tr>
</tr>
}}
<tr>
{{#if:{{{atk|}}}|<tr>
     <th>Attack</th>
     <th>Attack</th>
     <td>{{#replace:{{{atk}}}|*| &times; }}</td>
     <td>{{#replace:{{#var:atk|0}}|*| &times; }}</td>
</tr>
</tr>
}}
<tr>
<tr>
     <th>Target</th>
     <th>Target</th>
     <td>{{{target|Ground Only}}}</td>
     <td>{{#var:target|Ground Only}}</td>
</tr>
</tr>
{{#if:{{{atkint|}}}|<tr>
<tr>
     <th>Attack Interval</th>
     <th>Attack Interval</th>
     <td>{{{atkint}}}s</td>
     <td>{{#var:atkint|1}}s</td>
</tr>
</tr>
}}
<tr>
<tr>
     <th>Splash Damage</th>
     <th>Splash Damage</th>
     <td>{{#ifeq:{{{splashdmg|0}}}|0|No|{{{splashdmg}}}m }}</td>
     <td>{{#ifeq:{{#var:splash|0}}|0|No|{{#var:splash}}m }}</td>
</tr>
</tr>
<tr>
<tr>
     <th>Burst Damage</th>
     <th>Burst Damage</th>
     <td>{{#ifexpr: ({{{atk|0}}})<1 | Minimal | {{#expr: abs({{{atk|0}}}) * {{{units|1}}} round 0 }} }}</td>
     <td>{{#ifexpr: {{#var:burst|0}}<1 | Minimal | {{#var:burst}} }}</td>
</tr>
</tr>
<tr>
<tr>
     <th>Max DPS</th>
     <th>Max DPS</th>
     <td>{{#expr: abs({{{atk|0}}}) * {{{units|1}}} / {{{atkint|1}}} round 0 }}</td>
     <td>{{#var:dps|0}}</td>
</tr>
</tr>
<tr>
<tr>
     <th>Range</th>
     <th>Range</th>
     <td>{{#ifeq:{{{range|0}}}|0|Melee|{{{range}}}m }}</td>
     <td>{{#ifeq:{{#var:range|0}}|0|Melee|{{#var:range}}m }}</td>
</tr>
</tr>
{{#if:{{{speed|}}}|<tr>
<tr>
     <th>Speed</th>
     <th>Speed</th>
     <td>{{{speed}}}m/s</td>
     <td>{{#var:speed|0}}m/s</td>
</tr>
</tr>
}}
{{#if:{{{igdesc|}}}|<tr>
{{#if:{{{igdesc|}}}|<tr>
     <td colspan="2">
     <td colspan="2">
Line 95: Line 111:
}}
}}
</table>
</table>
{{#ifeq:{{#var:cost|0}}|0||
<table class="infobox-table mw-collapsible mw-collapsed">
<caption style="padding:0;"></caption>
<tr style="border-top:1px solid #0002;line-height:1.1">
    <td colspan="2"><small>Values are normalized to the supply cost of the unit to make it easier to compare units.<br>The Splash Index tries to calculate the effectiveness vs spam by multiply attacks with slash area and a penalty for damage below 350.</small>
    </td>
</tr>
<tr>
    <th>Unit Cost</th>
    <td>
{{#var:min_cost}}
{{#ifeq:{{#var:unlockcost}} | 0 || - {{#var:max_cost}} }}
    </td>
</tr>
<tr>
    <th>HP Value</th>
    <td>
{{#ifeq:{{#var:unlockcost}} | 0 || {{#var:min_hp_val}} - }}
{{#var:max_hp_val}}
    </td>
</tr>
<tr>
    <th>Burst Value</th>
    <td>
{{#ifeq:{{#var:unlockcost}} | 0 || {{#var:min_burst_val}} - }}
{{#var:max_burst_val}}
    </td>
</tr>
<tr>
    <th>DPS Value</th>
    <td>
{{#ifeq:{{#var:unlockcost}} | 0 || {{#var:min_dps_val}} - }}
{{#var:max_dps_val}}
    </td>
</tr>
<tr>
    <th>Splash Index</th>
    <td>
{{#var:splash_index}}
    </td>
</tr>
</table>
}}<small class="pull-right">[[Template:UnitData|v{{#var:update}}]]</small>
</div>
</div>
<noinclude>
<noinclude>
Line 105: Line 164:
"type": "string",
"type": "string",
"suggested": true
"suggested": true
},
},
"giant": {
"default": "No",
"label": "Giant",
"description": "Is unit a Giant? No if not set",
"type": "string",
"suggestedvalues": [
"Yes",
"No"
],
"autovalue": "No",
"suggested": true
},
"type": {
"type": {
"label": "Unit Type",
"label": "Unit Type",
Line 123: Line 170:
"example": "\"Light aircraft\" or \"High-speed anti-unit bot\"",
"example": "\"Light aircraft\" or \"High-speed anti-unit bot\"",
"type": "string",
"type": "string",
"suggested": true
},
"cost": {
"label": "Cost",
"description": "Purchase cost",
"type": "number",
"required": true
},
"units": {
"default": "1",
"label": "Units",
"description": "Number of units. Default 1 if not set",
"type": "number",
"autovalue": "1",
"suggested": true
},
"hp": {
"label": "HP",
"description": "Hit Points",
"type": "number",
"required": true
},
"atk": {
"label": "Attack",
"description": "Damage of the unit. Usually a number for the damage of one unit. Can have a range or a multiplier.",
"example": "\"9001\" or \"1 - 1000\" or \"555 * 4\"",
"type": "string",
"required": true
},
"target": {
"default": "Ground Only",
"label": "Target",
"description": "Can attack ground and/or air units? Default \"Ground Only\" if not set",
"suggestedvalues": [
"Ground Only",
"Air Only",
"Ground & Air"
],
"autovalue": "Ground Only",
"suggested": true,
"type": "string"
},
"atkint": {
"label": "Attack Interval",
"description": "Time between shots",
"type": "number",
"suggested": true
},
"range": {
"default": "Melee",
"label": "Range",
"description": "Range of the unit. Defaults to 0=Melee if not set",
"type": "number",
"autovalue": "0",
"suggested": true
},
"speed": {
"label": "Speed",
"description": "The Speed in meter per second (m/s)",
"type": "number",
"suggested": true
"suggested": true
},
},
Line 190: Line 177:
"example": "A high-speed and high HP unit that attacks enemies at close range with a laser beam that gradually grows in size. The bane of all high HP units",
"example": "A high-speed and high HP unit that attacks enemies at close range with a laser beam that gradually grows in size. The bane of all high HP units",
"type": "string",
"type": "string",
"suggested": true
},
"mobility": {
"default": "Ground",
"label": "Mobility",
"description": "Air or Ground unit, defaults to Ground if not set",
"type": "string",
"suggestedvalues": [
"Ground",
"Air"
],
"autovalue": "Ground",
"suggested": true
},
"unlockcost": {
"default": "Free",
"label": "Unlock Cost",
"description": "The cost for unlocking the unit. Defaults to 0=Free if not set",
"type": "number",
"autovalue": "0",
"suggested": true
},
"splashdmg": {
"default": "No",
"label": "Splash Damage",
"description": "The AOE in meter, Defaults to 0=No if not set",
"type": "number",
"autovalue": "0",
"suggested": true
"suggested": true
}
}
Line 224: Line 183:
"paramOrder": [
"paramOrder": [
"image",
"image",
"mobility",
"giant",
"type",
"type",
"unlockcost",
"cost",
"units",
"hp",
"atk",
"splashdmg",
"target",
"atkint",
"range",
"speed",
"igdesc"
"igdesc"
]
]

Latest revision as of 11:32, 19 October 2024

Error: Unit "UnitInfobox" undefined!

[[|]]
UnitInfobox
[[|]]


Mobility Ground
Giant No
Cost 0
Unlock cost Free
Units 1
HP 0
Attack 0
Target Ground Only
Attack Interval 1s
Splash Damage No
Burst Damage Minimal
Max DPS 0
Range Melee
Speed 0m/s

v1.0

Infobox for all ingame stats for this unit

Template parameters

ParameterDescriptionTypeStatus
Imageimage

File name

Stringsuggested
Unit Typetype

A short description of the purpose

Example
"Light aircraft" or "High-speed anti-unit bot"
Stringsuggested
Descriptionigdesc

The in-game description

Example
A high-speed and high HP unit that attacks enemies at close range with a laser beam that gradually grows in size. The bane of all high HP units
Stringsuggested