Difference between revisions of "Template:Skill range"
Jump to navigation
Jump to search
SurtrFan8511 (talk | contribs) (Removed the "centered" word) |
SurtrFan8511 (talk | contribs) (Made the center square names singular) |
||
Line 23: | Line 23: | ||
<!--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 = adjust | | 0 0 0 0 = {{#ifeq:{{#var:range o}}|-1||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 h}} > 0 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 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 | | <!--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 | | <!--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 | | <!--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 | | <!--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 | | <!--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 43: | Line 43: | ||
}} | }} | ||
}}}}}}}}{{#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 67: | Line 67: | ||
|#default = {{#var:range d|}} squares diagonally | |#default = {{#var:range d|}} squares diagonally | ||
}}}}}} | }}}}}} | ||
-->{{#vardefine: | -->{{#vardefine:adjust|{{#switch:{{#expr:abs({{#var:range o}})}} | ||
| 0 = target | |||
| | | 1 = {{#ifeq:{{#var:range o}}|1|the front of|behind}} 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 | |||
}}}}{{ | |||
#vardefine:range|{{#replace:{{#var:range}}|, ,|}}}}{{ | #vardefine:range|{{#replace:{{#var:range}}|, ,|}}}}{{ | ||
#vardefine:range|{{#replace:{{#var:range}}|, ,|}}}}<!--{{ | #vardefine:range|{{#replace:{{#var:range}}|, ,|}}}}<!--{{ | ||
Line 77: | Line 79: | ||
#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>}}}}}}{{ | #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}}|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 12:54, 12 August 2020
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}}at target
{{Skill range|1 0 0 0 2 0}}in a 1x1 area around the front of target
{{Skill range|-2 0 0 0 1 0}}in a 1x1 area around the 2nd square behind target
{{Skill range|1 0 0 1 0 0}}1 square diagonally away from the front of target
{{Skill range|-2 0 1 0 0 0}}in a 3-square vertical line around the 2nd square behind target
{{Skill range|0 0 1 1 0 0}}1 square diagonally away from target
{{Skill range|0 0 2 2 0 0}}2 squares diagonally away from target
{{Skill range|0 0 1 1 1 0}}in a 1x3 area around target
{{Skill range|5 0 6 7 8 0}}in a 1x13 area around the 5th square in front of target
{{Skill range|0 1 1 1 1 0}}in a 3x3 area around 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. |