From GamingWiki
Line 6: | Line 6: | ||
-->{{#vardefine: cols | {{{columns|6}}} }}<!-- | -->{{#vardefine: cols | {{{columns|6}}} }}<!-- | ||
− | debug: hard-code it for now. | + | debug: hard-code some of it for now. |
− | + | @todo: implement skill point expenditure | |
− | |||
− | |||
− | |||
-->{{#hashdefine: sectionParams}}<!-- | -->{{#hashdefine: sectionParams}}<!-- | ||
Line 18: | Line 15: | ||
-->{{#hashinclude: sectionParams | -->{{#hashinclude: sectionParams | ||
| columns = {{#var:cols}} | | columns = {{#var:cols}} | ||
+ | | header = {{{label|Skill modes}}} | ||
| labelclass1 = label | | labelclass1 = label | ||
| llabel1 = | | llabel1 = | ||
Line 25: | Line 23: | ||
| llabel5 = Fair (+2) | | llabel5 = Fair (+2) | ||
| llabel6 = Average (+1) | | llabel6 = Average (+1) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}}<!-- end section | }}<!-- end section | ||
− | + | TERMINOLOGY: | |
− | + | * Rank: position on the adjective ladder. May be divided into rankName and rankVal | |
− | + | * Level: skill level, i.e, untrained, trained, focused or specialized | |
− | |||
− | |||
− | -->{{# | + | -->{{#vardefine:modeGood|{{{mode good|Hemocrat}}}}}<!-- |
− | + | -->{{#vardefine:modeFair|{{{mode fair|Space}}}}}<!-- | |
− | + | -->{{#vardefine:modeAverage|{{{mode average|Science}}}}}<!-- | |
− | -->{{# | + | |
− | + | Some initial arrays and hashes: | |
− | + | * modeArray lists the three modes in ascending rank | |
− | + | * levelArray lists all four levels in ascending order | |
− | + | * levelSubArray is like levelArray, without "untrained". | |
− | + | * modeHash is to be populated later. The eventual structure will be: | |
− | + | * keys are mode names | |
− | + | * values are hashtables, defined as: | |
− | + | * keys are levels | |
− | + | * values are arrays of skill names | |
− | + | ||
− | + | -->{{#arraydefine: modeArray | {{#var: modeFair}}, {{#var: modeAverage}}, {{#var: modeGood}} | , }}<!-- | |
− | + | -->{{#arraydefine: levelArray | untrained, trained, focused, specialized | , }}<!-- | |
− | + | -->{{#arrayslice: levelSubarray | levelArray | 1 }}<!-- | |
− | + | -->{{#arraytohash: levelModeHash | modeArray | levelSubarray}}<!-- | |
− | + | -->{{#arrayprint: modeArray | | <mode> | <!-- | |
− | + | -->{{#hashinclude: modeHash | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!-- | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
-->}}<!-- | -->}}<!-- | ||
− | -->{{# | + | Query all skills found belonging to our three modes. |
− | | | + | -->{{#arraydefine:skillArray | |
− | + | {{#ask: [[is a :: skill]] [[skill in mode :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | |
− | + | |?Name | |
− | + | |?Skill in mode=Mode | |
− | + | | format=array | |
− | + | }} | |
− | | | + | }}<!-- |
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | }}<!-- | ||
− | -->{{# | + | Now iterate over all the skills returned from our query |
+ | -->{{#arrayprint: skillArray | | <skill> | <!-- | ||
− | + | -->{{#hashdefine: currentSkill}}<!-- | |
− | -->{{#vardefine: | + | Array items are page, name, mode(s) |
− | + | -->{{#vardefine: currentSkillPage | {{#explode:<skill>|<PROP>|0}} }}<!-- | |
− | --> | + | -->{{#vardefine: currentSkillName | {{#explode:<skill>|<PROP>|1}} }}<!-- |
− | |||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | + | First we create an array containing all the modes the current skill | |
+ | belongs to. Then we use that array as a filter so we end up with the | ||
+ | intersection of the skill's modes and the character's modes -- i.e, all | ||
+ | the character's modes that contain the current skill. This final array | ||
+ | is currentSkillModes. | ||
+ | -->{{#arraydefine: currentSkillAllModes | {{#explode:<skill>|<PROP>|2}} |<MANY>}}<!-- | ||
+ | -->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!-- | ||
− | -->{{#vardefine: | + | Now the number of entries in currentSkillModes is the number of the |
− | + | character's modes the current skill appears in. This also happens to be | |
− | -->{{#vardefine: | + | the bonus the skill has as a result of skill reinforcement [FSTK 30]. |
− | + | And the last element of currentSkillModes should be the character's | |
+ | highest-ranked mode for this skill. | ||
+ | -->{{#vardefine: currentSkillPrimaryMode | {{#arrayindex: currentSkillModes | -1 }} }}<!-- | ||
+ | -->{{#vardefine: currentSkillLevel | {{#arrayindex: levelArray | {{#arraysize: currentSkillModes}} }} }}<!-- | ||
− | + | Hash of all the levels of the primary mode, keyed by level name. We're | |
− | + | going to append the current skill to it and then put it back in modeHash. | |
− | -->{{#hashdefine: | + | -->{{#hashdefine: levelsOfPrimaryMode | {{#hashvalue: modeHash | {{#var: currentSkillPrimaryMode}} }} | <LEVELSEP> | <LEVELVAL> }}<!-- |
− | + | Array of the skills defined for the primary mode, at this level. Here we | |
− | + | append the current skill along with a separator. The first time we do | |
− | + | this for any given mode-level combination we'll get an empty element, so | |
− | -->{{# | + | we ensure that the elements are unique. We also sort them because |
− | + | sorting is nice :) | |
− | --> | + | -->{{#arraydefine: modeSkillsAtLevel <!-- |
− | + | -->| {{#hashvalue: modeLevelsHash | {{#var: currentSkillLevel }} }} <LEVELSKILL> {{#var: currentSkillName}} <!-- | |
− | + | -->| <LEVELSKILL> | unique,sort=asc <!-- | |
− | + | -->}}<!-- | |
− | + | Now we reassemble the original hash: | |
− | + | -->{{#hashinclude: levelsOfCurrentMode | {{#var: currentSkillLevel }} = {{#arrayprint: modeSkillsAtLevel | <LEVELSKILL> }} }}<!-- | |
− | + | -->{{#hashinclude: modeHash | <!-- | |
− | + | --> {{#var: currentSkillPrimaryMode}} = {{#hashprint: levelsOfCurrentMode | <LEVELSEP> | <K> | <V> | <K><LEVELVAL><V> }} <!-- | |
− | |||
-->}}<!-- | -->}}<!-- | ||
+ | |||
-->}}<!-- | -->}}<!-- | ||
− | + | Once the above loop is done modeHash should have the desired structure. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | @todo: The next step is to apply spent skill points. We'll do some error-checking here. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Process all three modes: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | -->{{#arraydefine: | + | Each element of modeLoopArray is composed of a rank name, the prefix of the |
− | -->{{# | + | fields each mode should use, and the index of the field that should contain the |
− | -->{{# | + | "trained" level skills. |
− | -->{{# | + | -->{{#arraydefine: modeLoopArray | Good;ldata;4, Fair;cdata;5, Average;rdata;6}}<!-- |
− | -->|<!-- | + | -->{{#arrayprint: modeLoopArray | | <currentModeArray> |<!-- |
− | + | ||
− | + | -->{{#vardefine: currentModeRank | {{#explode: <currentModeArray> | ; | 0 }} }}<!-- | |
− | + | -->{{#vardefine: currentFieldPrefix | {{#explode: <currentModeArray> | ; | 1 }} }}<!-- | |
− | + | -->{{#vardefine: currentTrainedIndex | {{#explode: <currentModeArray> | ; | 2 }} }}<!-- | |
− | + | -->{{#vardefine: currentModeName | {{#var: mode{{#var:currentModeRank}} }} }}<!-- | |
− | + | ||
− | + | Head each column with a mode name | |
− | + | -->{{#hashinclude: sectionParams | {{#var: currentFieldPrefix}}1 = {{#var:currentModeName}} }}<!-- | |
− | + | ||
− | -->{{# | + | Create a hash, currentModeHash, to contain all the information we need about |
− | -->{{#hashinclude: | + | the current mode's skills. |
+ | -->{{#hashdefine: currentModeHash | {{#hashValue: modeHash | {{#var: currentModeName}} }} | <LEVELSEP> | <LEVELVAL> }}<!-- | ||
+ | |||
+ | Iterate over the indices of our parameter fields to populate our param | ||
+ | hash with skill names. | ||
+ | -->{{#loop: fieldIndex | 6 | -5 | <!-- | ||
+ | -->{{#vardefine: fieldName | {{#var: currentFieldPrefix}}{{#var: fieldIndex}} }}<!-- | ||
+ | -->{{#vardefine: fieldClass | {{#var: currentFieldPrefix}}class{{#var: fieldIndex}} }}<!-- | ||
+ | |||
+ | Map the elements of our list of levels onto the indices of our fields. | ||
+ | This means that for the Good mode, trained skills will go in field 4, | ||
+ | focused in field 3 and specialized in field 2. | ||
+ | -->{{#vardefine: currentLevelIndex | {{#expr: {{#var: currentTrainedIndex}} - {{#var: fieldIndex}} }} }}<!-- | ||
+ | -->{{#vardefine: currentLevel | <!-- | ||
+ | -->{{#ifexpr: ( {{#var: currentLevelIndex}} >= 0 ) and ( {{#var: currentLevelIndex}} < {{#arraysize: levelSubarray}}) <!-- | ||
+ | -->| {{#arrayindex: levelSubarray | {{#var: currentLevelIndex}} }}<!-- | ||
+ | -->| <!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | |||
+ | By default, give all fields a non-breaking space for content and the | ||
+ | "shaded" class: | ||
+ | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = | {{#var: fieldClass}} = shaded }}<!-- | ||
+ | -->{{#if: {{#var: currentLevel}} |<!-- | ||
+ | Here the current loop index corresponds to a level. We set the | ||
+ | appropriate CSS class and look for skills at this level. | ||
+ | -->{{#hashinclude: sectionParams | {{#var: fieldClass}} = {{#var: currentLevel}} skill }}<!-- | ||
+ | Now look for skills and print them, if any | ||
+ | -->{{#arraydefine: levelSkills | {{#hashvalue: currentModeHash | {{#var: currentLevel}} }} | <LEVELSKILL> }}<!-- | ||
+ | -->{{#if: {{#vardefineecho: levelSkillList | {{#arrayprint: levelSkills}} }} |<!-- | ||
+ | There are skills at this level. Save them to the param hash. | ||
+ | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = {{#var: levelSkillList}} }}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
− | -->}}<!-- | + | -->}}<!-- end loop |
− | -->}}<!-- end | + | |
+ | End mode processing. | ||
+ | |||
+ | -->}}<!-- end arrayprint | ||
− | |||
− | |||
− | |||
− | |||
− | + | -->{{#hashtotemplate: Character sheet/section | sectionParams }}<!-- | |
− | --> | ||
− | {{Character sheet/section | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Print the section footer. This contains a summary of advancement points available and spent. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | -->{{#vardefine:skillsused|0}}<!-- | |
− | + | -->{{#vardefine:skillsallowed|7}}<!-- | |
− | + | -->{{Character sheet/section | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | --> | ||
− | |||
− | |||
− | |||
− | {{Character sheet/section | ||
| columns = {{#var:cols}} | | columns = {{#var:cols}} | ||
| llabel1 = Points used | ldata1 = {{#var:skillsused}} | | llabel1 = Points used | ldata1 = {{#var:skillsused}} | ||
Line 272: | Line 184: | ||
-->}}<!-- end if | -->}}<!-- end if | ||
− | + | end debug | |
− | + | ||
--></onlyinclude> | --></onlyinclude> | ||
|} | |} |
Revision as of 15:13, 26 May 2014
[create]
Error creating thumbnail: File missing
Template documentation Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |
Skill modes | |||||
---|---|---|---|---|---|
Hemocrat | Space | Science | |||
Superb (+5) | |||||
Great (+4) | |||||
Good (+3) | |||||
Fair (+2) | |||||
Average (+1) | |||||
Points used | 0 | remaining | 7 | total | 7 |