Difference between revisions of "Template:Skill range"
Jump to navigation
Jump to search
SurtrFan8511 (talk | contribs) (Removed dot) |
SurtrFan8511 (talk | contribs) |
||
Line 1: | Line 1: | ||
<includeonly><onlyinclude>{{#vardefine:range o|{{#explode:{{{1|0}}}| |0}}}}{{#vardefine:range h|{{#explode:{{{1}}}| |1}}}}{{#vardefine:range v|{{#explode:{{{1}}}| |2}}}}{{#vardefine:range d|{{#explode:{{{1}}}| |3}}}}{{#vardefine:range|{{#switch:{{#var:range o|}} | <includeonly><onlyinclude>{{#vardefine:range o|{{#explode:{{{1|0}}}| |0}}}}{{#vardefine:range h|{{#explode:{{{1}}}| |1}}}}{{#vardefine:range v|{{#explode:{{{1}}}| |2}}}}{{#vardefine:range d|{{#explode:{{{1}}}| |3}}}}{{#vardefine:range|{{#switch:{{#var:range o|}} | ||
| 0 = | | 0 = | ||
| 1 = in front of target | | 1 = in front of target, | ||
| -1 = behind target | | -1 = behind target, | ||
|#default = {{#expr:abs({{#var:range o|}})}} square(s) {{#ifexpr: {{#var:range o|}} > 0 |in front of|behind}} target, | |#default = {{#expr:abs({{#var:range o|}})}} square(s) {{#ifexpr: {{#var:range o|}} > 0 |in front of|behind}} target, | ||
}}{{#ifexpr:{{#var:range d}} != 0 and {{#var:range d}} = {{#var:range h}} and {{#var:range h}} = {{#var:range v}} | | }} {{#ifexpr:{{#var:range d}} != 0 and {{#var:range d}} = {{#var:range h}} and {{#var:range h}} = {{#var:range v}} |{{#var:range d}} squares away | ||
|{{#ifexpr: {{#var:range h}} != 0 and {{#var:range h}} = {{#var:range v}} |{{#switch:{{#var:range h|}} | |{{#ifexpr: {{#var:range h}} != 0 and {{#var:range h}} = {{#var:range v}} |{{#switch:{{#var:range h|}} | ||
| 1 = | | 1 = directly adjacent, | ||
| #default = | | #default = {{#var:range h}} squares away horizontally and vertically, | ||
}}|{{#switch:{{#var:range h|}} | }}|{{#switch:{{#var:range h|}} | ||
| 0 = | | 0 = | ||
| 1 = | | 1 = horizontally adjacent, | ||
|#default = | |#default = {{#var:range h|}} squares horizontally, | ||
}}{{#switch:{{#var:range v|}} | }} {{#switch:{{#var:range v|}} | ||
| 0 = | | 0 = | ||
| 1 = | | 1 = vertically adjacent, | ||
|#default = | |#default = {{#var:range v|}} squares vertically, | ||
}}}}{{#switch:{{#var:range d|}} | }}}} {{#switch:{{#var:range d|}} | ||
| 0 = | | 0 = | ||
| 1 = | | 1 = 1 square diagonally | ||
|#default = | |#default = {{#var:range d|}} squares diagonally | ||
}}}}}}{{ | }}}}}}{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|, .|.}}}}{{ | #vardefine:range|{{#replace:{{#var:range}}|, .|.}}}}{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|,.|.}}}}{{ | #vardefine:range|{{#replace:{{#var:range}}|,.|.}}}}{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|target|<abbr title='Either the caster or the unit hit'>target</abbr>}}}}{{ | #vardefine:range|{{#replace:{{#var:range}}|target|<abbr title='Either the caster or the unit hit'>target</abbr>}}}}{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|diagonally|<abbr title='X-ward, in the corners'>diagonally</abbr>}}}}{{ | #vardefine:range|{{#replace:{{#var:range}}|diagonally|<abbr title='X-ward, in the corners'>diagonally</abbr>}}}}{{ |
Revision as of 04:37, 9 August 2020
Description
Parses a string in the format of [distance] [horizontal] [vertical] [diagonal] into something human readable.
Examples
{{Skill range|0 0 0 0}}
{{Skill range|1 0 0 2}}
in front of target, 2 squares diagonally
{{Skill range|-2 0 0 1}}
2 square(s) behind target, 1 square diagonally
{{Skill range|1 0 1 0}}
in front of target, vertically adjacent,
{{Skill range|-2 1 0 0}}
2 square(s) behind target, horizontally adjacent,
{{Skill range|0 1 1 0}}
directly adjacent,
{{Skill range|0 2 2 0}}
2 squares away horizontally and vertically,
{{Skill range|0 1 1 1}}
1 squares away
{{Skill range|5 6 7 8}}
5 square(s) in front of target, 6 squares horizontally, 7 squares vertically, 8 squares diagonally