Difference between revisions of "Template:Skill range"
Jump to navigation
Jump to search
SurtrFan8511 (talk | contribs) (Smoky god range fix) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 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 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 Slash range | | {{#var:self target}} 1 0 1 0 0 0 = in Slash range | ||
| {{#var:self target}} -1 1 0 0 0 = in reverse Slash range | | {{#var:self target}} -1 0 1 0 0 0 = in reverse Slash range | ||
| {{#var:self target}} 1 2 0 0 0 = in Long Slash range | | {{#var:self target}} 1 0 2 0 0 0 = in Long Slash range | ||
| {{#var:self target}} -1 2 0 0 0 = in reverse Long Slash range | | {{#var:self target}} -1 0 2 0 0 0 = in reverse Long Slash range | ||
| {{#var:self target}} 1 0 1 0 0 = in Thrust range | | {{#var:self target}} 1 0 0 1 0 0 = in Thrust range | ||
| {{#var:self target}} -1 0 1 0 0 = in reverse Thrust range | | {{#var:self target}} -1 0 0 1 0 0 = in reverse Thrust range | ||
| {{#var:self target}} 2 0 1 0 0 = in Shot range | | {{#var:self target}} 2 0 0 1 0 0 = in Shot range | ||
| {{#var:self target}} -2 0 1 0 0 = in reverse Shot range | | {{#var:self target}} -2 0 0 1 0 0 = in reverse Shot range | ||
| {{#var:self target}} 3 0 2 0 0 = in Snipe range | | {{#var:self target}} 3 0 0 2 0 0 = in Snipe range | ||
| {{#var:self target}} -3 0 2 0 0 = in reverse Snipe range | | {{#var:self target}} -3 0 0 2 0 0 = in reverse Snipe range | ||
| {{#var:self target}} 2 1 1 0 0 = in Magic range | | {{#var:self target}} 2 0 1 1 0 0 = in Magic range | ||
| {{#var:self target}} -2 1 1 0 0 = in reverse Magic range | | {{#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 0 1 | 0 99 99 99 1 | 0 99 99 1 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 = on the left and right of target | | 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 = in front of target | | 1 0 0 0 0 0 = in front of target | ||
| -1 0 0 0 0 = behind 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}} | ||
Line 69: | Line 73: | ||
|#default = {{#var:range d|}} squares diagonally | |#default = {{#var:range d|}} squares diagonally | ||
}}}}}} | }}}}}} | ||
-->{{#vardefine:adjust|{{#switch:{{#expr:abs({{#var:range o}})}} | -->{{#vardefine:adjust|{{#ifeq:{{#var:range oh}}|0|{{#switch:{{#expr:abs({{#var:range o}})}} | ||
| 0 = target | | 0 = target | ||
| 1 = {{#ifeq:{{#var:range o}}|1|the front of|the back of}} target | | 1 = {{#ifeq:{{#var:range o}}|1|the front of|the back of}} target | ||
Line 75: | Line 79: | ||
| 3 = the 3rd square {{#ifeq:{{#var:range o}}|3|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 | | #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}}|, ,|}}}}<!--{{ | ||
Line 81: | Line 91: | ||
#vardefine:range|{{#replace:{{#var:range}}|.|}}}}-->{{ | #vardefine:range|{{#replace:{{#var:range}}|.|}}}}-->{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|adjust|{{#var:adjust}}}}}}{{ | #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}}}}|{{#var:range o}}}} {{#var:range h}} {{#var:range v}} {{#var:range d}} {{#var:range s}}}}}}}}}}</onlyinclude></includeonly><noinclude>{{Documentation}}</noinclude> | #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. |