Difference between revisions of "Template:Skill range"
Jump to navigation
Jump to search
(50 intermediate revisions by 3 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| | ||
| 0 = | <!--matching targets and ranges-->{{#switch:{{#var:target definition}} {{{1}}} | ||
| {{#var:self target}} 1 0 1 0 0 0 = in Slash range | |||
| {{#var:self target}} -1 0 1 0 0 0 = in reverse Slash range | |||
| {{#var:self target}} 1 0 2 0 0 0 = in Long Slash range | |||
| {{#var:self target}} -1 0 2 0 0 0 = in reverse Long Slash range | |||
| {{#var:self target}} 1 0 0 1 0 0 = in Thrust range | |||
| {{#var:self target}} -1 0 0 1 0 0 = in reverse Thrust range | |||
| {{#var:self target}} 2 0 0 1 0 0 = in Shot range | |||
| {{#var:self target}} -2 0 0 1 0 0 = in reverse Shot range | |||
| {{#var:self target}} 3 0 0 2 0 0 = in Snipe range | |||
| {{#var:self target}} -3 0 0 2 0 0 = in reverse Snipe range | |||
| {{#var:self target}} 2 0 1 1 0 0 = in Magic range | |||
| {{#var:self target}} -2 0 1 1 0 0 = in reverse Magic range | |||
<!--add new cases here--> | |||
| #default = <!--matching ranges-->{{#switch:{{{1}}} | |||
| 0 0 99 99 0 1 | 0 0 99 99 99 1 | 0 0 99 99 1 1 = on the entire board | |||
| 0 0 1 1 1 0 = 1 square around target | |||
| 0 0 0 0 0 0 = <!--nothing-->, , | |||
| 0 0 1 0 0 0 = on the left and right of target | |||
| 0 0 0 1 0 0 = in front and behind of 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--> | |||
| #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 around adjust | |||
| 1 1 1 0 = in a 3x3 area around adjust | |||
| 0 0 0 0 = at adjust | |||
<!--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 around adjust | |||
| <!--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 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 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 | |||
| <!--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--> | |||
}} | |||
}} | |||
}} | |||
}} | |||
}} | |||
}} | |||
}} | |||
}}}}}}}}{{#if:{{#var:range|}}||<!--default-->{{#vardefine:range| | |||
{{#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|}} | |||
| 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 | |#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 = directly adjacent, | | 1 = directly adjacent, | ||
Line 18: | Line 70: | ||
}}}} {{#switch:{{#var:range d|}} | }}}} {{#switch:{{#var:range d|}} | ||
| 0 = . | | 0 = . | ||
| 1 = diagonally | | 1 = 1 square diagonally | ||
|#default = {{#var:range d|}} squares diagonally | |#default = {{#var:range d|}} squares diagonally | ||
}}}}}}{{ | }}}}}} | ||
#vardefine:range|{{# | -->{{#vardefine:adjust|{{#ifeq:{{#var:range oh}}|0|{{#switch:{{#expr:abs({{#var:range o}})}} | ||
# | | 0 = target | ||
# | | 1 = {{#ifeq:{{#var:range o}}|1|the front of|the back of}} target | ||
#vardefine:range|{{#replace:{{#var:range}}| | | 2 = the 2nd square {{#ifeq:{{#var:range o}}|2|in front of|behind}} target | ||
#vardefine:range|{{#replace:{{#var:range}}| | | 3 = the 3rd square {{#ifeq:{{#var:range o}}|3|in front of|behind}} target | ||
#vardefine:range|{{#replace:{{#var:range}}| | | #default = the {{#expr:abs({{#var:range o}})}}th square {{#ifexpr:{{#var:range o}} > 0|in front of|behind}} target | ||
#var:range}} | }}|{{#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}}|adjust|{{#var:adjust}}}}}}{{ | |||
#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> | |||
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. |