Template:UnitInfobox: Difference between revisions

From Mechabellum Wiki
(remove noinclude and space)
(remove parameter, use UnitData)
Line 1: Line 1:
<!-- define parameter as variable so they can be used later on the page
{{UnitData}}<div class="infobox" style="max-width: 100%;">
-->{{#vardefine:atk|{{{atk|0}}}
}}{{#vardefine:hp|{{{hp|0}}}
}}{{#vardefine:mobility|{{{mobility|Ground}}}
}}{{#vardefine:giant|{{{giant|No}}}
}}{{#vardefine:cost|{{{cost|0}}}
}}{{#vardefine:unlockcost|{{{unlockcost|0}}}
}}{{#vardefine:units|{{{units|1}}}
}}{{#vardefine:target|{{{target|Ground Only}}}
}}{{#vardefine:atkint|{{{atkint|1}}}
}}{{#vardefine:splashdmg|{{{splashdmg|0}}}
}}{{#vardefine:range|{{{range|0}}}
}}{{#vardefine:speed|{{{speed|0}}}
}}<!-- calculated variables
-->{{#vardefine:burst|{{#ifexpr: ({{{atk|0}}})<1 | 0 | {{#expr: abs({{{atk|0}}}) * {{{units|1}}} round 0 }} }}
}}{{#vardefine:dps|
  {{#ifexpr: ({{{atk|0}}}) < 1 <!-- if melting damage -->
    | {{#expr: {{#explode: {{{atk|-0}}} | - | 1 }} * {{{units|1}}} / {{{atkint|1}}} round 0 }} 
    | {{#expr: abs({{{atk|0}}}) * {{{units|1}}} / {{{atkint|1}}} round 0 }}
  }}
}}<!-- end vardefine
--><div class="infobox" style="max-width: 100%;">
<div class="infobox-title">{{PAGENAME}}</div>
<div class="infobox-title">{{PAGENAME}}</div>
{{#if:{{{type|}}}|<p class="text-center h5">{{{type}}}</p>}}
{{#if:{{{type|}}}|<p class="text-center h5">{{{type}}}</p>}}
Line 28: Line 7:
<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>
</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:splashdmg|0}}|0|No|{{#var:splashdmg}}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 105: Line 79:
"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 85:
"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 92:
"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 98:
"paramOrder": [
"paramOrder": [
"image",
"image",
"mobility",
"giant",
"type",
"type",
"unlockcost",
"cost",
"units",
"hp",
"atk",
"splashdmg",
"target",
"atkint",
"range",
"speed",
"igdesc"
"igdesc"
]
]

Revision as of 15:00, 8 June 2023

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

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