Difference between revisions of "Template:Skill range"
Jump to navigation
Jump to search
SurtrFan8511 (talk | contribs) |
SurtrFan8511 (talk | contribs) (Fixed center suffixes) |
||
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 s|{{#explode:{{{1}}}| |4}}}}{{#vardefine:range| | <includeonly><onlyinclude><!--keywords:center, adjust, target (get replaced at the end with proper strings)-->{{#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 s|{{#explode:{{{1}}}| |4}}}}{{#vardefine:range| | ||
<!--matching targets and ranges-->{{#switch:{{#var:target definition}} {{{1}}} | <!--matching targets and ranges-->{{#switch:{{#var:target definition}} {{{1}}} | ||
| {{#var:self target}} 1 1 0 0 0 = in a Slash range | | {{#var:self target}} 1 1 0 0 0 = in a Slash range | ||
Line 31: | Line 31: | ||
| <!--horizontal line-->{{#ifexpr:{{#var:range h}} > 0 and {{#var:range v}} = 0 and {{#var:range d}} = 0|in a {{#expr:1 + 2 * {{#var:range h}}}}-square horizontal line center | | <!--horizontal line-->{{#ifexpr:{{#var:range h}} > 0 and {{#var:range v}} = 0 and {{#var:range d}} = 0|in a {{#expr:1 + 2 * {{#var:range h}}}}-square horizontal line center | ||
| <!--vertical line-->{{#ifexpr:{{#var:range v}} > 0 and {{#var:range h}} = 0 and {{#var:range d}} = 0|in a {{#expr:1 + 2 * {{#var:range v}}}}-square vertical line center | | <!--vertical line-->{{#ifexpr:{{#var:range v}} > 0 and {{#var:range h}} = 0 and {{#var:range d}} = 0|in a {{#expr:1 + 2 * {{#var:range v}}}}-square vertical line center | ||
| <!--star shape-->{{#ifexpr:{{#var:range h}} = {{#var:range v}} and {{#var:range h}} = {{#var:range d}}|{{#var:range h}} squares horizontally, vertically and diagonally away from | | <!--star shape-->{{#ifexpr:{{#var:range h}} = {{#var:range v}} and {{#var:range h}} = {{#var:range d}}|{{#var:range h}} squares horizontally, vertically and diagonally away from adjust | ||
|<!--add cases here--> | |<!--add cases here--> | ||
}} | }} | ||
Line 39: | Line 39: | ||
}} | }} | ||
}}}}}}}}{{#if:{{#var:range|}}||<!--default-->{{#vardefine:range| | }}}}}}}}{{#if:{{#var:range|}}||<!--default-->{{#vardefine:range| | ||
{{#ifeq:{{#var:range h}}|0||{{#var:range h}} squares horizontally, }}{{#ifeq:{{#var:range h}}|0||{{#var:range v}} squares vertically, }}{{#ifeq:{{#var:range d}}|0||{{#var:range d}} squares diagonally, }}, away from | {{#ifeq:{{#var:range h}}|0||{{#var:range h}} squares horizontally, }}{{#ifeq:{{#var:range h}}|0||{{#var:range v}} squares vertically, }}{{#ifeq:{{#var:range d}}|0||{{#var:range d}} squares diagonally, }}, away from adjust | ||
}}}}<!-- | }}}}<!-- | ||
{{#vardefine:range|{{#switch:{{#var:range o|}} | {{#vardefine:range|{{#switch:{{#var:range o|}} | ||
Line 64: | Line 64: | ||
}}}}}} | }}}}}} | ||
-->{{#vardefine:center| | -->{{#vardefine:center| | ||
{{#ifeq:{{#var:range o}}|0| | centered {{#vardefineecho:adjust|{{#ifeq:{{#var:range o}}|0|around target|{{#ifexpr:{{#var:range o}} > 0 | ||
|<!--front-->{{#ifeq:{{#var:range o}}|1|in front of target|{{#var:range o}} squares in front of target}} | |<!--front-->{{#ifeq:{{#var:range o}}|1|in front of target|{{#var:range o}} squares in front of target}} | ||
|<!--back-->{{#ifeq:{{#var:range o}}|-1|behind target|{{#expr: -{{#var:range o}}}} squares behind target}}}} | |<!--back-->{{#ifeq:{{#var:range o}}|-1|behind target|{{#expr: -{{#var:range o}}}} squares behind target}}}} |
Revision as of 10:15, 11 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 0}}
{{Skill range|1 0 0 2 0}}
2 squares diagonally away from in front of target
{{Skill range|-2 0 0 1 0}}
1 squares diagonally away from 2 squares behind target
{{Skill range|1 0 1 0 0}}
in a Thrust range
{{Skill range|-2 1 0 0 0}}
in a 3-square horizontal line centered 2 squares behind target
{{Skill range|0 1 1 0 0}}
directly adjacent to target
{{Skill range|0 2 2 0 0}}
in a 2-square cross radius centered around target
{{Skill range|0 1 1 1 0}}
1 square around target
{{Skill range|5 6 7 8 0}}
6 squares horizontally, 7 squares vertically, 8 squares diagonally away from 5 squares in front of target