From GamingWiki
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{Documentation}} | + | {{Documentation}}<!-- |
− | {| | + | -->{{#if: {{#vardefineecho: debug | }} | debug mode enabled <br />}}<!-- |
− | < | ||
-->{{#vardefine: cols | {{{columns|6}}} }}<!-- | -->{{#vardefine: cols | {{{columns|6}}} }}<!-- | ||
+ | |||
+ | --> | ||
+ | <onlyinclude><!-- | ||
debug: hard-code some of it for now. | debug: hard-code some of it for now. | ||
Line 15: | Line 17: | ||
-->{{#hashinclude: sectionParams | -->{{#hashinclude: sectionParams | ||
| columns = {{#var:cols}} | | columns = {{#var:cols}} | ||
− | | | + | | subhead = {{{label|Skill modes}}} |
| labelclass1 = label | | labelclass1 = label | ||
| llabel1 = | | llabel1 = | ||
Line 29: | Line 31: | ||
* Level: skill level, i.e, untrained, trained, focused or specialized | * Level: skill level, i.e, untrained, trained, focused or specialized | ||
− | -->{{#vardefine:modeGood|{{{mode good| | + | -->{{#vardefine:modeGood|{{{skill mode good|Banter}}}}}<!-- |
− | -->{{#vardefine:modeFair|{{{mode fair|Space}}}}}<!-- | + | -->{{#vardefine:modeFair|{{{skill mode fair|Space}}}}}<!-- |
− | -->{{#vardefine:modeAverage|{{{mode average| | + | -->{{#vardefine:modeAverage|{{{skill mode average|Action}}}}}<!-- |
+ | |||
+ | --><includeonly><!-- | ||
+ | -->{{#set: | ||
+ | | has good skill mode = {{#var:modeGood}} | ||
+ | | has fair skill mode = {{#var:modeFair}} | ||
+ | | has average skill mode = {{#var:modeAverage}} | ||
+ | }}<!-- | ||
+ | --></includeonly><!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} | | ||
+ | '''debug''' Setting modes to: | ||
+ | * good = {{#vardefineecho:modeGood|Banter}} | ||
+ | * fair = {{#vardefineecho:modeFair|Space}} | ||
+ | * average = {{#vardefineecho:modeAverage|Action}} | ||
+ | }}<!-- | ||
Some initial arrays and hashes: | Some initial arrays and hashes: | ||
Line 43: | Line 60: | ||
* values are arrays of skill names | * values are arrays of skill names | ||
− | -->{{#arraydefine: modeArray | {{#var: | + | -->{{#arraydefine: modeArray | {{#var: modeAverage}}, {{#var: modeFair}}, {{#var: modeGood}} | , }}<!-- |
-->{{#arraydefine: levelArray | untrained, trained, focused, specialized | , }}<!-- | -->{{#arraydefine: levelArray | untrained, trained, focused, specialized | , }}<!-- | ||
-->{{#arrayslice: levelSubarray | levelArray | 1 }}<!-- | -->{{#arrayslice: levelSubarray | levelArray | 1 }}<!-- | ||
− | -->{{# | + | -->{{#hashdefine: modeHash}}<!-- |
-->{{#arrayprint: modeArray | | <mode> | <!-- | -->{{#arrayprint: modeArray | | <mode> | <!-- | ||
-->{{#hashinclude: modeHash | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!-- | -->{{#hashinclude: modeHash | <mode> = {{#arrayprint: levelSubArray | <LEVELSEP> | <level> | <level><LEVELVAL>}} }}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | {{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[mode name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] | ||
+ | |?mode name | ||
+ | |?Includes skill | ||
+ | }} | ||
+ | }}<!-- | ||
Query all skills found belonging to our three modes. | Query all skills found belonging to our three modes. | ||
− | -->{{# | + | -->{{#hashdefine:skillModeHash | |
− | {{#ask: [[is a :: skill]] [[ | + | {{#ask: [[is a::skill mode]] [[campaign::Humans are the Worst]] [[name :: {{#arrayprint: modeArray | {{!}}{{!}} }}]] |
− | + | |?Mode name | |
− | + | |?Includes skill | |
− | + | |format=array | |
+ | |mainlabel=- | ||
}} | }} | ||
+ | | , | ||
+ | | <PROP> | ||
}}<!-- | }}<!-- | ||
− | --><!--{{#arraydefine: | + | |
− | {{# | + | -->{{#if: {{#var: debug}} |<nowiki /> |
− | + | ||
− | + | '''debug''' query result (skillModeHash): {{#hashprint: skillModeHash | | <modename> | <modeskills> | <modename>=<modeskills><br/>}} | |
− | | | + | }}<!-- |
− | + | ||
− | + | Now that we have all the skill mode details, we put them into a hashTable | |
− | + | that maps each skill to the modes it is found in: | |
+ | |||
+ | -->{{#hashdefine: skillHash}}<!-- | ||
+ | -->{{#hashprint: skillModeHash | | <modename> | <modeskills> | <!-- | ||
+ | -->{{#arraydefine: modeSkills | <modeskills> | <MANY> | unique}}<!-- | ||
+ | -->{{#arrayprint: modeSkills | | <skillname> | <!-- | ||
+ | -->{{#arraydefine: skillModes | {{#hashvalue: skillHash | <skillname>}} <MANY> <modename> | <MANY> | unique,sort=asc}}<!-- | ||
+ | -->{{#hashinclude: skillHash | <skillname>={{#arrayprint: skillModes | <MANY>}} }}<!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | '''debug''' skillHash: {{#hashprint: skillHash | | <skillname> | <skillmodes> | <skillname>=<skillmodes><br/>}} | ||
+ | }}<!-- | ||
+ | |||
+ | |||
+ | Apply skill point bumps | ||
+ | @todo: The next step is to apply spent skill points. We'll do some error-checking here. | ||
+ | |||
+ | -->{{#vardefine:skillPointsUsed|0}}<!-- | ||
+ | -->{{#vardefine:pointBuy|point buy}}<!-- | ||
+ | |||
+ | -->{{#vardefine: skillBumps | {{{skill bump|}}} }}<!-- | ||
+ | |||
+ | --></onlyinclude><!-- | ||
+ | -->{{#vardefine: skillBumps | Gunnery, Gunnery, Will, Notice, Fight, Notice }}<!-- | ||
+ | --><onlyinclude><!-- | ||
+ | |||
+ | -->{{#arraydefine: skillBumpArray | {{#var:skillBumps}} }}<!-- | ||
+ | -->{{#arrayprint: skillBumpArray ||<skill>|<!-- | ||
+ | -->{{#hashinclude: skillHash | <skill> = {{#hashvalue: skillHash | <skill>}}<MANY>{{#var:pointBuy}} }}<!-- | ||
+ | -->}}<!-- | ||
+ | |||
+ | -->{{#arraydefine: skillArray | {{#hashprint: skillHash |,| <skillname> | <skillmodes> | <skillname><PROP><skillmodes>}} }}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | '''debug''' skillArray: {{#arrayprint: skillArray | <br/> }} | ||
+ | }}<!-- | ||
+ | |||
Now iterate over all the skills returned from our query | Now iterate over all the skills returned from our query | ||
− | -->{{# | + | |
+ | -->{{#hashprint: skillHash | | <skillname> | <skillmodes> | <!-- | ||
-->{{#hashdefine: currentSkill}}<!-- | -->{{#hashdefine: currentSkill}}<!-- | ||
− | + | -->{{#vardefine: currentSkillName | <skillname> }}<!-- | |
− | -->{{#vardefine: | + | |
− | + | -->{{#if: {{#var: debug}} |<nowiki /> | |
+ | |||
+ | '''debug''' currentSkillName: {{#var: currentSkillName }} | ||
+ | }}<!-- | ||
First we create an array containing all the modes the current skill | First we create an array containing all the modes the current skill | ||
Line 81: | Line 152: | ||
the character's modes that contain the current skill. This final array | the character's modes that contain the current skill. This final array | ||
is currentSkillModes. | is currentSkillModes. | ||
− | -->{{#arraydefine: currentSkillAllModes | | + | -->{{#arraydefine: currentSkillAllModes | <skillmodes> | <MANY> }}<!-- |
-->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!-- | -->{{#arraysearcharray: currentSkillModes | modeArray | /^{{#arrayprint: currentSkillAllModes | {{!}} }}$/ }}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | '''debug''' currentSkillAllModes: {{#arrayprint: currentSkillAllModes | , }} | ||
+ | '''debug''' currentSkillModes: {{#arrayprint: currentSkillModes | , }} | ||
+ | }}<!-- | ||
Now the number of entries in currentSkillModes is the number of the | Now the number of entries in currentSkillModes is the number of the | ||
Line 90: | Line 166: | ||
highest-ranked mode for this skill. | highest-ranked mode for this skill. | ||
-->{{#vardefine: currentSkillPrimaryMode | {{#arrayindex: currentSkillModes | -1 }} }}<!-- | -->{{#vardefine: currentSkillPrimaryMode | {{#arrayindex: currentSkillModes | -1 }} }}<!-- | ||
− | -->{{#vardefine: currentSkillLevel | {{#arrayindex: levelArray | {{# | + | -->{{#vardefine: synergySkillLevel | {{#arraysize: currentSkillModes}} }}<!-- |
+ | -->{{#vardefine: totalSkillLevel | {{#arraysize: currentSkillAllModes}} }}<!-- | ||
+ | -->{{#ifexpr: {{#var: totalSkillLevel}} > 3 | {{#vardefine: totalSkillLevel | 3}} }}<!-- | ||
+ | -->{{#vardefine: pointBuyBumps | {{#expr: {{#var:totalSkillLevel}} - {{#var:synergySkillLevel}} }} }}<!-- | ||
+ | -->{{#vardefine: pointsSpent | {{#expr: {{#var:synergySkillLevel}} * {{#var:pointBuyBumps}} + {{#var:pointBuyBumps}} * ( {{#var:pointBuyBumps}} - 1 ) / 2 }} }}<!-- | ||
+ | -->{{#vardefine: skillPointsUsed | {{#expr: {{#var:skillPointsUsed}} + {{#var:pointsSpent}} }} }}<!-- | ||
+ | -->{{#vardefine: currentSkillLevel | {{#arrayindex: levelArray | {{#var: totalSkillLevel}} }} }}<!-- | ||
Hash of all the levels of the primary mode, keyed by level name. We're | 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. | going to append the current skill to it and then put it back in modeHash. | ||
-->{{#hashdefine: levelsOfPrimaryMode | {{#hashvalue: modeHash | {{#var: currentSkillPrimaryMode}} }} | <LEVELSEP> | <LEVELVAL> }}<!-- | -->{{#hashdefine: levelsOfPrimaryMode | {{#hashvalue: modeHash | {{#var: currentSkillPrimaryMode}} }} | <LEVELSEP> | <LEVELVAL> }}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | '''debug''' currentSkillPrimaryMode: {{#var: currentSkillPrimaryMode }} | ||
+ | '''debug''' synergySkillLevel: {{#var: synergySkillLevel }} | ||
+ | '''debug''' totalSkillLevel: {{#var: totalSkillLevel }} | ||
+ | '''debug''' pointBuyBumps: {{#var: pointBuyBumps }} | ||
+ | '''debug''' pointsSpent: {{#var: pointsSpent }} | ||
+ | '''debug''' skillPointsUsed: {{#var: skillPointsUsed }} | ||
+ | '''debug''' currentSkillLevel: {{#var: currentSkillLevel }} | ||
+ | '''debug''' levelsOfPrimaryMode: {{#hashprint: levelsOfPrimaryMode | <br/> | <level> | <skills> | <level> = <skills> }} | ||
+ | }}<!-- | ||
+ | |||
Array of the skills defined for the primary mode, at this level. Here we | 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 | append the current skill along with a separator. The first time we do | ||
Line 101: | Line 195: | ||
sorting is nice :) | sorting is nice :) | ||
-->{{#arraydefine: modeSkillsAtLevel <!-- | -->{{#arraydefine: modeSkillsAtLevel <!-- | ||
− | -->| {{#hashvalue: | + | -->| {{#hashvalue: levelsOfPrimaryMode | {{#var: currentSkillLevel }} }} <LEVELSKILL> {{#var: currentSkillName}} <!-- |
-->| <LEVELSKILL> | unique,sort=asc <!-- | -->| <LEVELSKILL> | unique,sort=asc <!-- | ||
-->}}<!-- | -->}}<!-- | ||
Now we reassemble the original hash: | Now we reassemble the original hash: | ||
− | -->{{#hashinclude: | + | -->{{#hashinclude: levelsOfPrimaryMode | {{#var: currentSkillLevel }} = {{#arrayprint: modeSkillsAtLevel | <LEVELSKILL> }} }}<!-- |
-->{{#hashinclude: modeHash | <!-- | -->{{#hashinclude: modeHash | <!-- | ||
− | --> {{#var: currentSkillPrimaryMode}} = {{#hashprint: | + | --> {{#var: currentSkillPrimaryMode}} = {{#hashprint: levelsOfPrimaryMode | <LEVELSEP> | <K> | <V> | <K><LEVELVAL><V> }} <!-- |
-->}}<!-- | -->}}<!-- | ||
+ | |||
+ | -->{{#arrayreset: modeSkillsAtLevel | currentSkillAllModes | currentSkillModes }}<!-- | ||
+ | -->{{#hashreset: currentSkill | levelsOfPrimaryMode }}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
Line 114: | Line 211: | ||
Once the above loop is done modeHash should have the desired structure. | Once the above loop is done modeHash should have the desired structure. | ||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | modeHash: {{#hashprint: modeHash | | <modename> | <levels> | <br/> <modename> = <levels> }} | ||
+ | }}<!-- | ||
− | |||
− | Process all three modes: | + | Process and print all three modes: |
Each element of modeLoopArray is composed of a rank name, the prefix of the | Each element of modeLoopArray is composed of a rank name, the prefix of the | ||
Line 159: | Line 259: | ||
-->{{#hashinclude: sectionParams | {{#var: fieldName}} = | {{#var: fieldClass}} = shaded }}<!-- | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = | {{#var: fieldClass}} = shaded }}<!-- | ||
-->{{#if: {{#var: currentLevel}} |<!-- | -->{{#if: {{#var: currentLevel}} |<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | currentModeName: {{#var: currentModeName}} | ||
+ | currentLevel: {{#var: currentLevel }} | ||
+ | }}<!-- | ||
+ | |||
Here the current loop index corresponds to a level. We set the | Here the current loop index corresponds to a level. We set the | ||
appropriate CSS class and look for skills at this level. | appropriate CSS class and look for skills at this level. | ||
+ | |||
-->{{#hashinclude: sectionParams | {{#var: fieldClass}} = {{#var: currentLevel}} skill }}<!-- | -->{{#hashinclude: sectionParams | {{#var: fieldClass}} = {{#var: currentLevel}} skill }}<!-- | ||
+ | |||
Now look for skills and print them, if any | Now look for skills and print them, if any | ||
+ | |||
-->{{#arraydefine: levelSkills | {{#hashvalue: currentModeHash | {{#var: currentLevel}} }} | <LEVELSKILL> }}<!-- | -->{{#arraydefine: levelSkills | {{#hashvalue: currentModeHash | {{#var: currentLevel}} }} | <LEVELSKILL> }}<!-- | ||
− | -->{{#if: {{# | + | -->{{#if: {{#arrayprint: levelSkills}} | <!-- |
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | '''debug''' levelSkills: {{#arrayprint: levelSkills}} | ||
+ | }}<!-- | ||
+ | |||
+ | If a skill belongs to more than one mode, we note it with an <abbr> tag: | ||
+ | |||
+ | -->{{#arraydefine: levelSkillsPrintable | <!-- | ||
+ | -->{{#arrayprint: levelSkills | , | <skillname> | <!-- | ||
+ | -->{{#arraydefine: currentSkillAllModes | {{#hashvalue: skillHash | <skillname> }} | <MANY> | unique }}<!-- | ||
+ | -->{{#ifeq: {{#arraysize: currentSkillAllModes}} | 1 <!-- | ||
+ | -->| <skillname> <!-- | ||
+ | -->| <abbr title="{{#arrayprint:currentSkillAllModes}}"><skillname></abbr> <!-- | ||
+ | -->}}<!-- | ||
+ | --><includeonly><!-- | ||
+ | -->{{#set: has {{#var: currentLevel }} skill = <skillname> }}<!-- | ||
+ | --></includeonly><!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | '''debug''' levelSkillsPrintable: {{#arrayprint: levelSkillsPrintable}} | ||
+ | }}<!-- | ||
+ | |||
There are skills at this level. Save them to the param hash. | There are skills at this level. Save them to the param hash. | ||
− | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = {{# | + | |
+ | -->{{#hashinclude: sectionParams | {{#var: fieldName}} = {{#arrayprint: levelSkillsPrintable}} }}<!-- | ||
+ | |||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
Line 175: | Line 311: | ||
-->}}<!-- end arrayprint | -->}}<!-- end arrayprint | ||
+ | |||
+ | -->{{#if: {{#var: debug}} |<nowiki /> | ||
+ | |||
+ | '''debug''' sectionParams: {{#hashprint: sectionParams | | <key> | <value> | <br/> <key> = <value> }} | ||
+ | }}<!-- | ||
+ | |||
+ | --></onlyinclude><nowiki /> | ||
+ | {| class="infobox" | ||
+ | <onlyinclude><!-- | ||
+ | |||
+ | Now print the table section | ||
-->{{#hashtotemplate: Character sheet/section | sectionParams }}<!-- | -->{{#hashtotemplate: Character sheet/section | sectionParams }}<!-- | ||
Line 181: | Line 328: | ||
Print the section footer. This contains a summary of advancement points available and spent. | Print the section footer. This contains a summary of advancement points available and spent. | ||
− | -->{{#vardefine: | + | -->{{#vardefine:skillsAllowed|7}}<!-- |
− | |||
-->{{Character sheet/section | -->{{Character sheet/section | ||
| columns = {{#var:cols}} | | columns = {{#var:cols}} | ||
− | | llabel1 = | + | | llabel1 = bonus points | ldata1 = {{#var:skillsAllowed}} |
− | | label1 = | + | | label1 = used | data1 = {{#var:skillPointsUsed}} |
− | | rlabel1 = | + | | rlabel1 = remaining | rdata1 = {{#expr: {{#var:skillsAllowed}} - {{#var:skillPointsUsed}} }} |
}}<!-- end section | }}<!-- end section | ||
-->}}<!-- end if | -->}}<!-- end if | ||
− | + | --></onlyinclude><nowiki /> | |
+ | |} | ||
+ | <onlyinclude><!-- | ||
--></onlyinclude> | --></onlyinclude> | ||
− |
Latest revision as of 02:36, 29 July 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 | |||||
Banter | Space | Action | |||
Superb (+5) | Gunnery, Notice | ||||
Great (+4) | Fight, Will | ||||
Good (+3) | |||||
Fair (+2) | |||||
Average (+1) | |||||
bonus points | 7 | used | -4 | remaining | 11 |