Difference between revisions of "Template:Skill range"
Jump to navigation
Jump to search
SurtrFan8511 (talk | contribs) (Welp let's try this out) |
|||
(33 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly><onlyinclude>{{#vardefine:range o|{{#explode:{{{1|0}}}| |0}}}}{{#vardefine:range h|{{#explode:{{{1}}}| | | <includeonly><onlyinclude><!--keywords:center, adjust, target (get replaced at the end with proper strings)-->{{#if:{{#var:disable ranges}}|{{#vardefine:disable ranges|}}{{#vardefine:hit form|hit}}|{{#vardefine:range o|{{#explode:{{{1|0}}}| |0}}}}{{#vardefine:range oh|{{#explode:{{{1}}}| | 1}}}}{{#vardefine:range h|{{#explode:{{{1}}}| |2}}}}{{#vardefine:range v|{{#explode:{{{1}}}| |3}}}}{{#vardefine:range d|{{#explode:{{{1}}}| |4}}}}{{#vardefine:range s|{{#explode:{{{1}}}| |5}}}}{{#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 | | {{#var:self target}} 1 0 1 0 0 0 = in Slash range | ||
| {{#var:self target}} -1 1 0 0 0 = in | | {{#var:self target}} -1 0 1 0 0 0 = in reverse Slash range | ||
| {{#var:self target}} 1 2 0 0 0 = in | | {{#var:self target}} 1 0 2 0 0 0 = in Long Slash range | ||
| {{#var:self target}} -1 2 0 0 0 = in | | {{#var:self target}} -1 0 2 0 0 0 = in reverse Long Slash range | ||
| {{#var:self target}} 1 0 1 0 0 = in | | {{#var:self target}} 1 0 0 1 0 0 = in Thrust range | ||
| {{#var:self target}} -1 0 1 0 0 = in | | {{#var:self target}} -1 0 0 1 0 0 = in reverse Thrust range | ||
| {{#var:self target}} 2 0 1 0 0 = in | | {{#var:self target}} 2 0 0 1 0 0 = in Shot range | ||
| {{#var:self target}} -2 0 1 0 0 = in | | {{#var:self target}} -2 0 0 1 0 0 = in reverse Shot range | ||
| {{#var:self target}} 3 0 2 0 0 = in | | {{#var:self target}} 3 0 0 2 0 0 = in Snipe range | ||
| {{#var:self target}} -3 0 2 0 0 = in | | {{#var:self target}} -3 0 0 2 0 0 = in reverse Snipe range | ||
| {{#var:self target}} 2 1 1 0 0 = in | | {{#var:self target}} 2 0 1 1 0 0 = in Magic range | ||
| {{#var:self target}} -2 1 1 0 0 = in | | {{#var:self target}} -2 0 1 1 0 0 = in reverse Magic range | ||
<!--add new cases here--> | <!--add new cases here--> | ||
| #default = <!--matching ranges-->{{#switch:{{{1}}} | | #default = <!--matching ranges-->{{#switch:{{{1}}} | ||
| 0 99 99 99 1 = on the entire board | | 0 0 99 99 0 1 | 0 0 99 99 99 1 | 0 0 99 99 1 1 = on the entire board | ||
| 0 1 1 1 0 = 1 square around target | | 0 0 1 1 1 0 = 1 square around target | ||
| 0 0 0 0 0 = <!--nothing-->, , | | 0 0 0 0 0 0 = <!--nothing-->, , | ||
| 0 1 0 0 0 = | | 0 0 1 0 0 0 = on the left and right of target | ||
| 0 0 1 0 0 = in front and behind of target | | 0 0 0 1 0 0 = in front and behind of target | ||
| 0 1 1 0 0 = directly adjacent to target | | 0 0 1 1 0 0 = directly adjacent to target | ||
| 1 0 0 0 0 0 = in front of target | |||
| -1 0 0 0 0 0 = behind target | |||
| 6 0 99 5 0 1 | 6 0 99 5 99 1 | 6 0 99 5 1 1 | 3 0 5 2 0 1 | 3 0 99 2 0 1 = anywhere in front of target | |||
| -6 0 99 5 0 1 | -6 0 99 5 99 1 | -6 0 99 5 1 1 | -3 0 5 2 0 1 | -3 0 99 2 0 1 = anywhere behind target | |||
| 0 6 5 99 0 1 | 0 6 5 99 99 1 | 0 6 5 99 1 1 | 0 3 2 5 0 1 = anywhere to the right of target | |||
| 0 -6 5 99 0 1 | 0 -6 5 99 99 1 | 0 -6 5 99 1 1 | 0 -3 2 5 0 1 = anywhere to the left of target | |||
<!--add new cases here--> | <!--add new cases here--> | ||
| #default = <!--matching all ranges except center position-->{{#switch:{{#var:range h}} {{#var:range v}} {{#var:range d}} {{#var:range s}} | | #default = <!--matching all ranges except center position-->{{#switch:{{#var:range h}} {{#var:range v}} {{#var:range d}} {{#var:range s}} | ||
| 2 2 1 0 = in a 2-square diamond radius | | 2 2 1 0 = in a 2-square diamond radius around adjust | ||
| 1 1 1 0 = in a 3x3 area | | 1 1 1 0 = in a 3x3 area around adjust | ||
| 0 0 0 0 = at adjust | |||
<!--add new cases here--> | <!--add new cases here--> | ||
| #default = <!--math stuff--><!--filled areas-->{{#ifexpr:{{#var:range s}} > 0|in a {{#expr:1 + 2 * {{#var:range h}}}}x{{#expr:1 + 2 * {{#var:range v}}}} area | | #default = <!--math stuff--><!--filled areas-->{{#ifexpr:{{#var:range s}} > 0|in a {{#expr:1 + 2 * {{#var:range h}}}}x{{#expr:1 + 2 * {{#var:range v}}}} area around adjust | ||
| <!--cross-->{{#ifexpr:{{#var:range h}} = {{#var:range v}} and {{#var:range d}} = 0 and {{#var:range s}} = 0|in a {{#var:range v}}-square cross radius | | <!--cross-->{{#ifexpr:{{#var:range h}} = {{#var:range v}} and {{#var:range h}} > 0 and {{#var:range d}} = 0 and {{#var:range s}} = 0|in a {{#var:range v}}-square cross radius around adjust | ||
| <!--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 | | <!--horizontal line around target-->{{#ifexpr:{{#var:range o}} = 0 and {{#var:range h}} > 0 and {{#var:range v}} = 0 and {{#var:range d}} = 0|{{#var:range h}} squares to the left and right of target | ||
| <!--vertical line-->{{#ifexpr:{{#var:range v}} > 0 and {{#var:range h}} = 0 and {{#var:range d}} = 0|in a {{#expr:1 + 2 * {{#var:range | | <!--vertical line around target-->{{#ifexpr:{{#var:range o}} = 0 and {{#var:range v}} > 0 and {{#var:range h}} = 0 and {{#var:range d}} = 0|{{#var:range v}} squares in front and behind of target | ||
| <!--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 | | <!--other 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 around adjust | ||
| <!--other 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 around adjust | |||
| <!--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 38: | Line 49: | ||
}} | }} | ||
}}}}}}}}{{#if:{{#var:range|}}||<!--default-->{{#vardefine:range| | }}}}}}}}{{#if:{{#var:range|}}||<!--default-->{{#vardefine:range| | ||
{{#ifeq:{{#var:range h}}|0||{{#var:range h}} | {{#ifeq:{{#var:range h}}|0||{{#var:range h}} square{{#ifeq:{{#var:range h}}|1||s}} horizontally, }}{{#ifeq:{{#var:range h}}|0||{{#var:range v}} square{{#ifeq:{{#var:range v}}|1||s}} vertically, }}{{#ifeq:{{#var:range d}}|0||{{#var:range d}} square{{#ifeq:{{#var:range d}}|1||s}} diagonally, }}, away from adjust | ||
}}}}<!-- | }}}}<!-- | ||
{{#vardefine:range|{{#switch:{{#var:range o|}} | {{#vardefine:range|{{#switch:{{#var:range o|}} | ||
Line 62: | Line 73: | ||
|#default = {{#var:range d|}} squares diagonally | |#default = {{#var:range d|}} squares diagonally | ||
}}}}}} | }}}}}} | ||
-->{{#vardefine: | -->{{#vardefine:adjust|{{#ifeq:{{#var:range oh}}|0|{{#switch:{{#expr:abs({{#var:range o}})}} | ||
{{#ifeq:{{#var:range o}}| | | 0 = target | ||
{{# | | 1 = {{#ifeq:{{#var:range o}}|1|the front of|the back of}} target | ||
| | | 2 = the 2nd square {{#ifeq:{{#var:range o}}|2|in front of|behind}} target | ||
| | | 3 = the 3rd square {{#ifeq:{{#var:range o}}|3|in front of|behind}} target | ||
}}}}{{ | | #default = the {{#expr:abs({{#var:range o}})}}th square {{#ifexpr:{{#var:range o}} > 0|in front of|behind}} target | ||
}}|{{#ifeq:{{#var:range o}}|0|{{#switch:{{#expr:abs({{#var:range oh}})}} | |||
| 0 = target | |||
| 1 = the square to the {{#ifeq:{{#var:range oh}}|1|right|left}} of target | |||
| 2 = the 2nd square to the {{#ifeq:{{#var:range oh}}|2|right|left}} of target | |||
| 3 = the 3rd square to the {{#ifeq:{{#var:range oh}}|3|right|left}} of target | |||
| #default = the {{#expr:abs({{#var:range oh}})}}th square to the {{#ifexpr:{{#var:range oh}} > 0|right|left}} of target | |||
}}|{{#expr:abs({{#var:range o}})}} {{#ifexpr:{{#var:range o}} > 0|in front|behind}}, {{#expr:abs({{#var:range oh}})}} {{#ifexpr:{{#var:range oh}} > 0|to the right|to the left}} square relative to target}}}}}}{{ | |||
#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}}|,.|}}}}{{ | #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}}|adjust|{{#var:adjust}}}}}}{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|target|{{#var:target definition|<abbr title='Either the caster or the unit hit'>target</abbr>}}}}}}{{ | #vardefine:range|{{#replace:{{#var:range}}|target|{{#var:target definition|<!--<abbr title='Either the caster or the unit hit'>-->target<!--</abbr>-->}}}}}}{{#if:{{#var:range|}}|{{Tooltip|{{#var:range}}|{{Skill range graphic|size=100|{{#ifeq:{{#var:target definition}}|{{#var:enemy target|them}}|{{#expr:-{{#var:range o}}}} {{#expr:-{{#var:range oh}}}}|{{#var:range o}} {{#var:range oh}}}} {{#var:range h}} {{#var:range v}} {{#var:range d}} {{#var:range s}}}}}}}}}}</onlyinclude></includeonly><noinclude>{{Documentation}}</noinclude> | ||
# | |||
# | |||
#var:range}} | |||
< |
Latest revision as of 06:13, 19 April 2022
Description
Parses a string in the format of [distance] [horizonal distance] [horizontal] [vertical] [diagonal] [is-square] into something human readable.
Examples
{{Skill range|0 0 0 0 0 0}}
{{Skill range|1 0 0 0 2 0}}2 squares diagonally away from the front of target
{{Skill range|-2 0 0 0 1 0}}1 square diagonally away from the 2nd square behind target
{{Skill range|1 0 0 1 0 0}}in Thrust range
{{Skill range|-2 0 1 0 0 0}}in a 3-square horizontal line around the 2nd square behind target
{{Skill range|0 0 1 1 0 0}}directly adjacent to target
{{Skill range|0 0 2 2 0 0}}in a 2-square cross radius around target
{{Skill range|0 0 1 1 1 0}}1 square around target
{{Skill range|5 0 6 7 8 0}}6 squares horizontally, 7 squares vertically, 8 squares diagonally away from the 5th square in front of target
{{Skill range|0 1 1 1 1 0}}in a 3x3 area around the square to the right of target
The above documentation is transcluded from Template:Skill range/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |