Guest User

Scholar Class

a guest
Jul 18th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.30 KB | None | 0 0
  1. /* -INFORMATION-
  2. Subject: Scholar class
  3. Effect: This is the syntax for adding the Scholar class to the sheet
  4. Note that you will need the syntax for adding a subclass as well if you want the class to have any choices for subclasses
  5. Sheet: v13.00.03 (2018-??-??) [identical to v12.999 syntax, except v12.999 uses 'borrow' for the burrow speed]
  6. */
  7.  
  8. var iFileName = "Homebrew Syntax - Scholar.js"; // Optional; This is how the file will be named in the sheet if you import it as a file and not copy-paste its content. Only the first occurrence of this variable will be used
  9. RequiredSheetVersion(12.999); // Optional; This is the minimum required version number of the sheet for the script to work. If the sheet being used to import the script is of an earlier version, the user will be warned
  10.  
  11. ClassList["scholar"] = { //Object name; Note the use of only lower case! Also note the absence of the word "var" and the use of brackets []
  12.  
  13. regExpSearch : /^(?=.*scholar).*$/i, //required; regular expression of what to look for (i.e. now it looks for any entry that has both the words "my" and "class" in it, disregarding capitalization). If this looks to complicated, just write: /myclass/i
  14.  
  15. name : "Scholar", //required; the name to use for the class
  16.  
  17. source : ["wdalright-Tumblr", 0], //required; the source and the page number. "HB" stands for homebrew. See the "Complete SourceList" for an overview of sources that are already defined. Or define a new source using the "Homebrew Syntax - SourceList.js". // This can be an array of arrays to indicate the things appears in multiple sources. For example, if something appears on page 7 of the Elemental Evil Player's Companion and on page 115 of the Sword Coast Adventure Guide, use the following: [["E", 7], ["S", 115]]
  18.  
  19. primaryAbility : "\n \u2022 Scholar: Intelligence;", //required; the text to display when citing the primary ability of the class
  20.  
  21. prereqs : "\n \u2022 Scholar: Intelligence 13;", //required; the text to display when citing the prerequisite for the class when multiclassing
  22.  
  23. die : 8, //required; the type of hit die the class has (i.e. 10 means d10)
  24.  
  25. improvements : [0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5], //required; the amount of ability score improvements (or feats) at each level. Note that there are 20 entries, one for each level. This example uses the Fighter's progression
  26.  
  27. saves : ["Int"], //required; the two save proficiencies.
  28.  
  29. skills : ["\n\n" + toUni("Scholar") + ": Choose four from Acrobatics, Animal Handling, Athletics, History, Insight, Investigation, Medicine, Nature, Perception, Persuasion, and Survival.", "\n\n" + toUni("Scholar") + ": Choose one from Animal Handling, Investigation, Perception, and Survival."], //required; the text to display for skill proficiencies. Note the \n\n at the start, they are important! The first entry is for when the class is the primary class, the second entry is for when the class is taken later as part of a multiclass
  30.  
  31. /* SYNTAX CHANGE v12.998 >> old syntax for 'tools' and 'languages' are no longer supported!! */
  32. toolProfs : { // optional; this is an object with arrays with the tool proficiencies gained. Each entry in an array can be its own array of 2 entries. The first entry is the name of the tool and the second entry is either 1) a number if the tool is yet to be chosen, or 2) the 3-letter ability score abbreviation if the tool is to be listed in the skill section and have a bonus calculated
  33. primary : [["Any Tools", 2]], // optional; the tool proficiencies gained if the class is the primary class (i.e. taken at 1st level)
  34. secondary : [["Any Tool", 1]] // optional; the tool proficiencies gained if the class is not the primary class (i.e. taken at a later level)
  35. },
  36.  
  37. armor : [ //required; the 4 entries are for: ["light", "medium", "heavy", "shields"]
  38. [true, false, false, false], //required; the armor proficiencies if this is the first or only class
  39. [true, false, false, false] //required; the armor proficiencies if this class is multiclassed with (so not taken at level 1, but later)
  40. ],
  41.  
  42. weapons : [ //required; the 3 entries are for: ["simple", "martial", "other"]
  43. [true, false, ["hand crossbow", "heavy crossbow", "rapier", "shortsword"]], //required; the weapon proficiencies if this is the first or only class
  44. [true, false, ["hand crossbow, rapier"]] //required; the weapon proficiencies if this class is multiclassed with (so not taken at level 1, but later)
  45. ],
  46.  
  47. equipment : "Scholar's starting equipment:\n \u2022 A rapier -or- a shortsword -or- any martial weapon (if proficient);\n \u2022 Leather armor -or- scale male (if proficient);\n \u2022 A light crossbow and 20 bolts -or- any simple weapons;\n \u2022 A scholar's pack -or- an explorer's pack;\n \u2022 A medical kit (Physician pursuit only).\n\nAlternatively, choose 4d4 \xD7 10 gp worth of starting equipment instead of both the class' and the background's starting equipment.", //required; the text to display when citing the starting equipment
  48.  
  49. subclasses : ["Pursuit", ["tactician", "physician", "explorer"]], //required; the names of the subclasses. The first entry is the overall name that is given to the subclasses, the second entry is a list of the subclass, using the exact names of the entry of the subclasses in the ClassSubList. //Note that if one of the entries in the array of subclasses doesn't exist in the ClassSubList, the sheet will throw an error as soon as you make a character with levels in this class
  50. //IMPORTANT: for any subclass you add using the AddSubClass() function, don't list them here! The AddSubClass() function makes its own entry in this array! If you have entries here that don't exist (because you didn't add any ClassSubList entry, or added it using the AddSubClass() function, then the sheet will throw strange errors)!
  51.  
  52. attacks : [1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], //required; the amount of attacks at each level. Note that there are 20 entries, one for each level.
  53.  
  54. abilitySave : 4, //optional, but required for a spellcaster; the ability score to use for the Ability Saving Throws. Remove this line if your class has no Ability that requires Saving Throws. (Str=1, Dex=2, Con=3, Int=4, Wis=5, Cha=6)
  55.  
  56. features : { //required; the class features. Each works the same way, so only a couple of example are given. You can add as many as you want
  57.  
  58. "combat insight" : { //note the use of lower case characters
  59. name : "Combat Insight", //required; the name of the class feature
  60. source : ["wdalright-Tumblr", 0], //required; the source of the class feature
  61. minlevel : 1, //required; the level at which the feature is gained
  62. description : "\n " + "At first level, you gain the ability to use your quick wits to gain an edge in combat. You learn gambits that are fueld by special dice called insight dice.", //required; the text to put in the "Class Features" field
  63. choicesNotInMenu : true, //optional: this tells the sheet not to put the choices into the "Choose Options" menu on the second page. Use this is you want to have the choices selected through another class feature. See for an example of this the "Draconic Bloodline" sorcerer archetype. // Note that you always want to have the choices listed in the choices attribute, because otherwise they won't be updated if they have level-dependent features
  64. "great weapon fighting" : { //required if "choices" is defined; has to be exactly the same as how it is written in the "choices" entry. Note the use of lower case!
  65. name : "Great Weapon Fighting Style", //required;
  66. description : "\n " + "Reroll 1 or 2 on damage if wielding two-handed/versatile melee weapon in both hands" //required;
  67. },
  68.  
  69. "protection" : { //has to be exactly the same as how it is written in the "choices" entry. Note the use of lower case!
  70. name : "Protection Fighting Style",
  71. description : "\n " + "As a reaction, I can give disadv. on an attack made vs. someone within 5 ft of me" + "\n " + "I need to be wielding a shield and be able to see the attacker to do this",
  72. action : ["reaction", ""] //optional; adds the name of this choice to the reaction list when chosen. The options are "action", "bonus action", and "reaction" //the second value in the array is added as a suffix for the "name" of the feature when entered into the action field
  73. },
  74.  
  75. "two-weapon fighting" : { //has to be exactly the same as how it is written in the "choices" entry. Note the use of lower case!
  76. name : "Two-Weapon Fighting Style",
  77. description : "\n " + "I can add my ability modifier to the damage of my off-hand attacks",
  78.  
  79. calcChanges : { //optional; adds stuff to the calculation of attacks and/or HP
  80.  
  81. hp : "if (classes.known.sorcerer) {extrahp += classes.known.sorcerer.level; extrastring += \"\\n + \" + classes.known.sorcerer.level + \" from Draconic Resilience (Sorcerer)\";};", //optional; string to be run using eval() when calculating the number of HP in the HP tooltip and automation
  82.  
  83. atkCalc : ["if (isOffHand) {output.modToDmg = true; }; ", "When engaging in two-weapon fighting, I can add my ability modifier to the damage of my off-hand attacks."], //optional; ["eval string", "explanation string"]; change something in the calculation of the Damage and To Hit of attacks; The first value in the array is stringified code that is run using eval(), the second entry is an explanation of what is being altered so that it can be displayed in a dialogue. This second entry can be left empty, as ""
  84.  
  85. atkAdd : ["if (WeaponName.match(/unarmed strike/i)) {fields.Description += 'Counts as magical';}; ", "My unarmed strikes count as magical for overcoming resistances and immunities."], //optional; ["eval string", "explanation string"]; works just like atkDmg, but affects the weapon attributes when they are applied to the sheet. With this you can change the weapon's description, range, damage die, attribute, etc. etc. However, this will only be applied to recognized weapons
  86.  
  87. // Note that you need to use two back slashes for things in the eval code here, because it is first added to a string, and then run as code. See the hp for an example, with the \\n
  88.  
  89. // For the eval strings for the attack calculations ('atkCalc' or 'atkAdd') there are some variables that you can use to test against:
  90.  
  91. // The variable WeaponName contains the recognized weapon object name as it is used in the WeaponsList object (or "" in atkCalc if the weapon is not a recognized weapon);
  92.  
  93. // The object "theWea" is the WeaponsList[WeaponName] object for the recognized weapon (or 'undefined' in atkCalc if the weapon is not a recognized weapon);
  94.  
  95. // You can use the booleans 'isOffHand', 'isMeleeWeapon', 'isRangedWeapon', 'isSpell' (also true for cantrips), 'isDC'
  96.  
  97. // If the attack is a spell that is found on the SpellList, the variable thisWeapon[3] contains the name of the entry in the SpellList
  98.  
  99. // The object "fields" has all the values of the different fields of the attack (fields.Proficiency, fields.Mod, fields.Range, fields.Damage_Type, fields.Description, fields.To_Hit_Bonus, fields.Damage_Bonus, fields.Damage_Die, fields.Weight);
  100.  
  101. // You can change the attributes of the "fields" object with the eval-string of atkAdd to affect what is put into the fields.
  102.  
  103. // You can use the attributes of the "fields" object with the eval-string of atkCalc to check for things, but changing them will have no effect on the sheet.
  104.  
  105. // With the atkCalc you have to change the "output" object in order to affect the outcome of the calculations. This object has the following attributes: output.prof (wether or not to add the proficiency bonus to the To Hit), output.die (Damage Die to use), output.mod (ability modifier), output.modToDmg (whether or not to add the ability modifier to Damage), output.magic (any magic bonus that's to be added to both To Hit and Damage), output.bHit (the To Hit bonus from the Blue Text/Modifier field), output.bDmg (the Damage bonus from the Blue Text/Modifier field), output.extraHit (a number added to the To Hit that is reserved for this eval), output.extraDmg (a number added to the damage that is reserved for this eval)
  106. }
  107. },
  108. },
  109.  
  110. "arcane initiate" : {
  111. name : "Arcane Initiate",
  112. source : ["S", 125],
  113. minlevel : 1,
  114. description : "\n " + "I gain proficiency with Arcana and two wizard cantrips that count as cleric cantrips",
  115.  
  116. skills : ["Arcana"], //optional; an array of skills with which proficiency is gained
  117.  
  118. skillstxt : "\n\n" + toUni("Arcane Domain") + ": Arcana.", //optional; the text that has to be added to the skill tooltips
  119.  
  120. spellcastingBonus : { //optional; an object that adds something to the "Bonus Spells" section of the spell selection dialog //this object can have all the same attributes as the "spellcastingList" object, but must also have a "name" defined" //the other things that can be defined in this that are not in the "spellcastingList" object, are the "selection", "times" and "prepared" values
  121.  
  122. name : "Arcane Initiate", //required; this is used to identify the object, so must be an unique name
  123.  
  124. class : "wizard", //optional but required if not including the "spells" entry; see "spellcastingList" object
  125.  
  126. level : [0, 0], //optional; see "spellcastingList" object
  127.  
  128. school : ["Necro"], //optional; see "spellcastingList" object
  129.  
  130. spells : ["light"], //optional, but required if not including the "class" entry; see "spellcastingList" object
  131.  
  132. notspells : ["mending"], //optional; see "spellcastingList" object
  133.  
  134. selection : ["light"], //optional if "spells" is defined; this is the default selection for the array specified in "spells"
  135.  
  136. times : 2, //optional; this is the number of times the bonus spells should be added. //This can also be an array of 20 values. That way the number of times are level-dependent
  137.  
  138. prepared : true, //optional; if set to 'true', this makes the spell selected for this/these bonus spells to automatically get a checked off checkbox in the first column, similar to domain spells for a cleric
  139.  
  140. atwill : true, //optional; if set to 'true', this makes the spell selected for this/these bonus spells to get "At Will" in the first column
  141.  
  142. oncesr : true, //optional; if set to 'true', this makes the spell selected for this/these bonus spells to get "1×SR" in the first column
  143.  
  144. oncelr : true, //optional; if set to 'true', this makes the spell selected for this/these bonus spells to get "1×LR" in the first column
  145.  
  146. firstCol : "8", //optional; if set to any value, this makes the spell selected for this/these bonus spells to get the first two letters/numbers of that value in the first column
  147. },
  148.  
  149. spellFirstColTitle : "Ki", //optional, only works if spellcastingBonus exists; if set to any value, this makes the first column of the captions on the spell sheet be set to the first two letters/numbers of that value
  150.  
  151. vision : [["Darkvision", 60], ["Sunlight Sensitivity", 0]], //optional; An array of arrays that each have a length of 2; This adds the first value of each array to the Senses field. The second value is the range in feet. If no range is needed, put a 0 there. You can also add a modifier like "+30" or "*2" to have the appropriate calculation done with the range of sense
  152. },
  153.  
  154. "spellcasting" : {
  155. name : "Spellcasting",
  156. source : ["P", 114],
  157. minlevel : 1,
  158. description : "\n " + "I can cast prepared wizard cantrips/spells, using Intelligence as my spellcasting ability" + "\n " + "I can use an arcane focus as a spellcasting focus" + "\n " + "I can cast all wizard spells in my spellbook as rituals if they have the ritual tag",
  159. additional : ["3 cantrips known", "3 cantrips known", "3 cantrips known", "4 cantrips known", "4 cantrips known", "4 cantrips known", "4 cantrips known", "4 cantrips known", "4 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known", "5 cantrips known"], //optional; text to display in the header of the feature. This can be one value, but can also be an array of 20 values, one for each level.
  160. },
  161.  
  162. "second wind" : {
  163. name : "Second Wind",
  164. source : ["P", 72],
  165. minlevel : 1,
  166. description : "\n " + "As a bonus action, I regain 1d10 + fighter level HP; I can use this once per short rest",
  167. additional : ["1d10+1", "1d10+2", "1d10+3", "1d10+4", "1d10+5", "1d10+6", "1d10+7", "1d10+8", "1d10+9", "1d10+10", "1d10+11", "1d10+12", "1d10+13", "1d10+14", "1d10+15", "1d10+16", "1d10+17", "1d10+18", "1d10+19", "1d10+20"],
  168. usages : 1, //optional; number of times it can be used. This can be one value, but can also be an array of 20 values, one for each level. It is recommended to use a numerical value, but if you use a string, include " per " at the end, like "1d10 per "
  169. recovery : "short rest", //required if "usages" is defined; way of getting the limited feature recharged. Only if you define both the 'usages' and 'recovery' will the feature be added to the limited features
  170. action : ["bonus action", ""] //optional; adds the name of this feature to the bonus action list when chosen. The options are "action", "bonus action", and "reaction"
  171. },
  172.  
  173. "action surge" : {
  174. name : "Action Surge",
  175. source : ["P", 72],
  176. minlevel : 2,
  177. description : "\n " + "I can take one additional action on my turn on top of my normally allowed actions",
  178. usages : [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2], //example of usages varying per level
  179. recovery : "short rest",
  180.  
  181. armor : [false, false, true, false], //optional; the 4 entries are for proficiency in: ["light", "medium", "heavy", "shields"]. Be sure to always add all four statements of true/false!
  182.  
  183. weapons : [true, false, ["hand crossbow"]], //optional; the 3 entries are for: ["simple", "martial", "other"]. Be sure to always add both statements of true/false!
  184.  
  185. addMod : { type : "skill", field : "Init", mod : "Int", text : "I can add my Intelligence modifier to initiative rolls." } //optional; This is an object, or an array of similar objects, for adding a modifier to a modifier field. Using this will make it so that the modifier is added to any value that is already there. // The 'mod' attribute can be any combination of numbers, mathematical operators, and three-letter ability score abbreviations // The 'type' attribute can be "skill" or "save", but can also be left empty "" // The 'field' attribute depends on the type, for "skill" it can be the name of a skill, or "Init" for initiative, or "All" for the all skills modifier; for "save" it can be the three-letter abbreviation of an ability score, or "All" for the all saves modifier. // If the 'type' attribute is left empty, the 'field' attribute has to be the exact name of the field the modifier has to be added to // The 'text' attribute is an explanation of why the modifier was added //NOTE: for modifiers to attacks, use calcChanges
  186.  
  187. addarmor : "Stone's Durability", //optional; a string of the name of the armour that is literally put in the Armor Description field when the class feature is applicable, and removed if not
  188. },
  189.  
  190. "subclassfeature3" : { //You need at least one entry named "subclassfeatureX". It signals the sheet to ask the user for which subclass he would like to have. The level of this feature should match the level the class needs to select a subclass. Once a subclass is selected, any feature with "subclassfeature" in the object name in the class entry will be ignored.
  191. name : "Martial Archetype",
  192. source : ["P", 72],
  193. minlevel : 3,
  194. description : "\n " + "Choose a Martial Archetype you strive to emulate and put it in the \"Class\" field" + "\n " + "Choose either Champion, Battle Master, Eldritch Knight, or Purple Dragon Knight",
  195. },
  196.  
  197. "subclassfeature3.1" : {
  198. name : "", //any feature who's name is empty like this one is, will be ignored. Since v12.5 of the sheet, an entry like this serves no function
  199. minlevel : 3,
  200. },
  201.  
  202. "natural antivenom" : {
  203. name : "Natural Antivenom",
  204. source : ["UA:MC", 7],
  205. minlevel : 9,
  206. description : desc([
  207. "I have advantage on saves vs. poison and resistance to poison damage",
  208. "When I use a poultice, in addition to healing, I cure one poison effect on the creature",
  209. "I gain proficiency with Constitution saving throws"
  210. ]),
  211.  
  212. savetxt : { // Optional; this attribute defines entries to add to the field for "Saving Throw Advantages / Disadvantages"
  213.  
  214. text : ["Dex save vs. area effects: fail \u2015 half dmg, success \u2015 no dmg", "Magic can't put me to sleep"], // Optional; this is an array of strings, and each of those strings is added to the field exactly as presented here
  215.  
  216. immune : ["poison", "disease"], // Optional; this is an array of strings that the character is immune to. This is put in the field after the text "Immune to ", so in this example it would result in "Immune to poison and disease"
  217.  
  218. adv_vs : ["traps", "charmed"] // Optional; this is an array of things that the character has advantage on saves against. This is put in the field after the text "Adv. on saves vs. ", so in this example it would result in "Adv. on saves vs. traps and charmed"
  219. },
  220.  
  221. dmgres : ["Poison"], //optional; an array of damage types that the class gets resistance against. // If the resistance has a condition attached to it, like only being against nonmagical attacks, substitute the entry in the array with an array of 2: [the damage type, the damage type with the condition]. // For example: [["Bludgeoning", "Bludg. (nonmagical)"], ["Piercing", "Pierc. (nonmagical)"], ["Slashing", "Slash. (nonmagical)"]]
  222.  
  223. saves : ["Con"] //optional; an array of the ability scores with which the class feature grants proficiency in saving throws
  224.  
  225. toolProfs : [["Musical instrument", 3], ["Thieves' tools", "Dex"]], // optional; this is an array with the tool proficiencies gained. Each entry can be its own array of 2 entries. The first entry is the name of the tool and the second entry is either 1) a number if the tool is yet to be chosen, or 2) the 3-letter ability score abbreviation if the tool is to be listed in the skill section and have a bonus calculated
  226.  
  227. languageProfs : [1, "Elvish"], // optional; this is an array of the language proficiencies gained. An entry can either be 1) a string that represents the language learned or 2) a number which is the number of language gained that can be chosen by the player
  228.  
  229. speed : { //required; This sets a value for one or more speed modes, and/or a value to be added to a specific speed mode or to all speed modes // the attributes of this object can be "walk", "burrow", "climb", "fly", "swim", and "allModes"
  230.  
  231. // all of the following attributes are optional and you can add more ("burrow" isn't part of this example!)
  232.  
  233. walk : { spd : 30, enc : 20 }, // the objects "walk", "burrow", "climb", "fly", "swim" are all the same, they are an object with two attributes, 'spd' for the speed in feet, and 'enc' for the encumbered speed in feet.
  234.  
  235. climb : { spd : "+50", enc : 0 }, // instead of numbers, you can also have modifiers. Modifiers are a string, starting with a mathematical operator, followed by a number (e.g. "-10", "+20"). // a value that is zero is ignored
  236.  
  237. fly : { spd : "walk", enc : 0 }, // instead of a number/modifier, you can also set the attribute to "walk". This makes the speed mode assume the walking speed // Using an underscore as the first character means the value is only added if the value would be non-zero
  238.  
  239. swim : { spd : "fixed 60", enc : "fixed 60" }, // if you include the word "fixed" together with a number, the movement mode will be that number, without any modifiers from other sources (like the Monk's speed bonus). However, if another entry that isn't 'fixed' does end up with a higher total while including any modifiers, that speed is used instead
  240.  
  241. allModes : "+10" // the 'allModes' attribute can only consist of a modifier. This modifier is applied to all speed modes, both normal and encumbered. It is only applied if the speed mode exists, it won't give the character a burrow speed if it would otherwise have none, for example
  242. },
  243. },
  244. }
  245. }
Advertisement
Add Comment
Please, Sign In to add comment