diff --git a/AD&D 2E Revised/2ESheet.html b/AD&D 2E Revised/2ESheet.html index 2c813c1e00..7ff7c936ca 100644 --- a/AD&D 2E Revised/2ESheet.html +++ b/AD&D 2E Revised/2ESheet.html @@ -17,6 +17,8 @@
  • Added Datalists for Paladin, Ranger, Cleric, and Druid spheres. Major and Minor
  • Added buttons for adding all available Priest spells based on spheres
  • Fixed spelling error for Priest spells. Arc changed to Wind
  • +
  • Cleaned up Melf's Acid arrow tempalte
  • +
  • Cleaned up Heat Metal tempalte

  • @@ -3545,7 +3547,7 @@


    - +
    @@ -3553,6 +3555,11 @@
    Wizard caster level
    +
    + + — + +
    @@ -3592,11 +3599,6 @@
    -
    - * Counts down all memorized spells by the number of casts done -
    - * Resets all Cast / Memorized counters to 0 -
    @@ -6909,7 +6911,7 @@

    - +
    @@ -6917,6 +6919,12 @@
    Priest caster level
    +
    + + — + +
    +

    Show Spheres of Influence:
    @@ -22203,10 +22211,10 @@ wiz2['Melf\'s Acid Arrow'] = { 'saving-throw': 'Special', 'materials': 'A dart, powdered rhubarb leaf, and an adder’s stomach.', 'reference': 'PHB p. 186', - 'damage': 'Per round: 2d4', + 'damage': '[[2d4]] + 2d4 for [[floor([[@{level-wizard}]]/3)]] additional rounds of', 'damage-type': 'Acid', 'healing': '', - 'effect': 'By means of this spell, the wizard creates a magical arrow that speeds to its target as if fired from the bow of a fighter of the same level as the wizard. No modifiers for range, nonproficiency, or specialization are used. The arrow has no attack or damage bonus, but it inflicts 2d4 points of acid damage (with saving throws for items on the target); there is no splash damage. For every three levels that the caster has achieved, the acid, unless somehow neutralized, lasts for another round, inflicting another 2d4 points of damage each round. So at 3rd–5th level, the acid lasts two rounds; at 6th–8th level, the acid lasts for three rounds, etc. Currently [[1+floor([[@{level-wizard}]]/3)]] rounds.' + 'effect': 'By means of this spell, the wizard creates a magical arrow that speeds to its target as if fired from the bow of a fighter of the same level as the wizard. No modifiers for range, nonproficiency, or specialization are used. The arrow has no attack or damage bonus, but it inflicts 2d4 points of acid damage (with saving throws for items on the target); there is no splash damage. For every three levels that the caster has achieved, the acid, unless somehow neutralized, lasts for another round, inflicting another 2d4 points of damage each round. So at 3rd–5th level, the acid lasts two rounds; at 6th–8th level, the acid lasts for three rounds, etc. Currently [[1+floor([[@{level-wizard}]]/3)]] total rounds.' }; wiz2['Mirror Image'] = { @@ -30137,12 +30145,19 @@ function setupAddPriestSpell(postfix) { // --- End setup for priest spells based on spheres --- // // --- Start setup rest buttons --- // -function setupRest(longRest) { - - let rest = longRest ? 'long-rest' : 'short-rest' - on(`clicked:${rest}`, function () { +function resetSpentSlots(row, memField, castField) { + row.I[memField] = row.I[memField] - row.I[castField]; + row.I[castField] = 0; +} + +function resetAllSlots(row, memField, castField) { + row.I[memField] = 0; + row.I[castField] = 0; +} + +function setupSpellSlotsReset(buttonName, sections, updateFunction) { + on(`clicked:${buttonName}`, function () { console.log('clicked!'); - let sections = ['', '2', '3', 'wiz1']; sections.forEach(section => { let repSection; let castField; @@ -30157,29 +30172,17 @@ function setupRest(longRest) { memField = `cast-max${section}`; } - let updateFunction; - if (longRest) { - updateFunction = (row) => { - row.I[memField] = 0; - row.I[castField] = 0; - } - } else { - updateFunction = (row) => { - row.I[memField] = row.I[memField] - row.I[castField]; - row.I[castField] = 0; - } - } console.log(updateFunction); TAS.repeating(repSection) .fields(castField, memField) - .each(updateFunction) + .each(function(row) { + updateFunction(row, memField, castField); + }) .execute(); }); }); } -setupRest(false); -setupRest(true); // --- End setup rest buttons --- // let wizardSpellLevelsSections = [ @@ -30244,7 +30247,7 @@ priestSpellLevelsSections.forEach(spellLevel => { }); // --- End setup Spell Slots --- // -// --- Start setup Spell Points, Arc, and Wind --- // +// --- Start setup Spell Points, Arc, and Wind. Also setups reset buttons --- // let wizardSpellPoints = 'spell-points'; let arc = 'total-arc'; let allWizardSpellSections = wizardSpellLevelsSections.flatMap(sl => sl.sections); @@ -30253,6 +30256,8 @@ setupSpellSumming(allWizardSpellSections, wizardSpellPoints, 'spell-points', `${ setupSpellSumming(allWizardSpellSections, 'arc', 'spell-arc', `${arc}-sum`); setupCalculateRemaining(`${wizardSpellPoints}-total`, `${wizardSpellPoints}-sum`, `${wizardSpellPoints}-remaining`); setupCalculateRemaining(arc, `${arc}-sum`, `${arc}-remaining`); +setupSpellSlotsReset('reset-spent-slots-wiz', allWizardSpellSections, resetSpentSlots); +setupSpellSlotsReset('reset-all-slots-wiz', allWizardSpellSections, resetAllSlots); let priestSpellPoints = 'spell-points-priest'; let wind = 'total-wind'; @@ -30262,6 +30267,8 @@ setupSpellSumming(allPriestSpellSections, priestSpellPoints, 'spell-points', `${ setupSpellSumming(allPriestSpellSections, 'wind', 'spell-wind', `${wind}-sum`); setupCalculateRemaining(`${priestSpellPoints}-total`, `${priestSpellPoints}-sum`, `${priestSpellPoints}-remaining`); setupCalculateRemaining(wind, `${wind}-sum`, `${wind}-remaining`); +setupSpellSlotsReset('reset-spent-slots-pri', allPriestSpellSections, resetSpentSlots); +setupSpellSlotsReset('reset-all-slots-pri', allPriestSpellSections, resetAllSlots); // --- End setup Spell Points, Arc, and Wind --- // // --- Start setup Granted Powers --- // diff --git a/AD&D 2E Revised/html/2ESheet-base.html b/AD&D 2E Revised/html/2ESheet-base.html index f7e9717e2b..5330bf1699 100644 --- a/AD&D 2E Revised/html/2ESheet-base.html +++ b/AD&D 2E Revised/html/2ESheet-base.html @@ -17,6 +17,8 @@
  • Added Datalists for Paladin, Ranger, Cleric, and Druid spheres. Major and Minor
  • Added buttons for adding all available Priest spells based on spheres
  • Fixed spelling error for Priest spells. Arc changed to Wind
  • +
  • Cleaned up Melf's Acid arrow tempalte
  • +
  • Cleaned up Heat Metal tempalte

  • @@ -3545,7 +3547,7 @@


    - +
    @@ -3553,6 +3555,11 @@
    Wizard caster level
    +
    + + — + +
    @@ -3592,11 +3599,6 @@
    -
    - * Counts down all memorized spells by the number of casts done -
    - * Resets all Cast / Memorized counters to 0 -
    @@ -5829,7 +5831,7 @@

    - +
    @@ -5837,6 +5839,12 @@
    Priest caster level
    +
    + + — + +
    +

    Show Spheres of Influence:
    diff --git a/AD&D 2E Revised/javascript/sheetWorkers.js b/AD&D 2E Revised/javascript/sheetWorkers.js index 85c5307e87..f684ecaf47 100644 --- a/AD&D 2E Revised/javascript/sheetWorkers.js +++ b/AD&D 2E Revised/javascript/sheetWorkers.js @@ -675,12 +675,19 @@ function setupAddPriestSpell(postfix) { // --- End setup for priest spells based on spheres --- // // --- Start setup rest buttons --- // -function setupRest(longRest) { - - let rest = longRest ? 'long-rest' : 'short-rest' - on(`clicked:${rest}`, function () { +function resetSpentSlots(row, memField, castField) { + row.I[memField] = row.I[memField] - row.I[castField]; + row.I[castField] = 0; +} + +function resetAllSlots(row, memField, castField) { + row.I[memField] = 0; + row.I[castField] = 0; +} + +function setupSpellSlotsReset(buttonName, sections, updateFunction) { + on(`clicked:${buttonName}`, function () { console.log('clicked!'); - let sections = ['', '2', '3', 'wiz1']; sections.forEach(section => { let repSection; let castField; @@ -695,29 +702,17 @@ function setupRest(longRest) { memField = `cast-max${section}`; } - let updateFunction; - if (longRest) { - updateFunction = (row) => { - row.I[memField] = 0; - row.I[castField] = 0; - } - } else { - updateFunction = (row) => { - row.I[memField] = row.I[memField] - row.I[castField]; - row.I[castField] = 0; - } - } console.log(updateFunction); TAS.repeating(repSection) .fields(castField, memField) - .each(updateFunction) + .each(function(row) { + updateFunction(row, memField, castField); + }) .execute(); }); }); } -setupRest(false); -setupRest(true); // --- End setup rest buttons --- // let wizardSpellLevelsSections = [ @@ -782,7 +777,7 @@ priestSpellLevelsSections.forEach(spellLevel => { }); // --- End setup Spell Slots --- // -// --- Start setup Spell Points, Arc, and Wind --- // +// --- Start setup Spell Points, Arc, and Wind. Also setups reset buttons --- // let wizardSpellPoints = 'spell-points'; let arc = 'total-arc'; let allWizardSpellSections = wizardSpellLevelsSections.flatMap(sl => sl.sections); @@ -791,6 +786,8 @@ setupSpellSumming(allWizardSpellSections, wizardSpellPoints, 'spell-points', `${ setupSpellSumming(allWizardSpellSections, 'arc', 'spell-arc', `${arc}-sum`); setupCalculateRemaining(`${wizardSpellPoints}-total`, `${wizardSpellPoints}-sum`, `${wizardSpellPoints}-remaining`); setupCalculateRemaining(arc, `${arc}-sum`, `${arc}-remaining`); +setupSpellSlotsReset('reset-spent-slots-wiz', allWizardSpellSections, resetSpentSlots); +setupSpellSlotsReset('reset-all-slots-wiz', allWizardSpellSections, resetAllSlots); let priestSpellPoints = 'spell-points-priest'; let wind = 'total-wind'; @@ -800,6 +797,8 @@ setupSpellSumming(allPriestSpellSections, priestSpellPoints, 'spell-points', `${ setupSpellSumming(allPriestSpellSections, 'wind', 'spell-wind', `${wind}-sum`); setupCalculateRemaining(`${priestSpellPoints}-total`, `${priestSpellPoints}-sum`, `${priestSpellPoints}-remaining`); setupCalculateRemaining(wind, `${wind}-sum`, `${wind}-remaining`); +setupSpellSlotsReset('reset-spent-slots-pri', allPriestSpellSections, resetSpentSlots); +setupSpellSlotsReset('reset-all-slots-pri', allPriestSpellSections, resetAllSlots); // --- End setup Spell Points, Arc, and Wind --- // // --- Start setup Granted Powers --- // diff --git a/AD&D 2E Revised/javascript/wizardSpells.js b/AD&D 2E Revised/javascript/wizardSpells.js index f766b44212..803fb87097 100644 --- a/AD&D 2E Revised/javascript/wizardSpells.js +++ b/AD&D 2E Revised/javascript/wizardSpells.js @@ -1235,10 +1235,10 @@ wiz2['Melf\'s Acid Arrow'] = { 'saving-throw': 'Special', 'materials': 'A dart, powdered rhubarb leaf, and an adder’s stomach.', 'reference': 'PHB p. 186', - 'damage': 'Per round: 2d4', + 'damage': '[[2d4]] + 2d4 for [[floor([[@{level-wizard}]]/3)]] additional rounds of', 'damage-type': 'Acid', 'healing': '', - 'effect': 'By means of this spell, the wizard creates a magical arrow that speeds to its target as if fired from the bow of a fighter of the same level as the wizard. No modifiers for range, nonproficiency, or specialization are used. The arrow has no attack or damage bonus, but it inflicts 2d4 points of acid damage (with saving throws for items on the target); there is no splash damage. For every three levels that the caster has achieved, the acid, unless somehow neutralized, lasts for another round, inflicting another 2d4 points of damage each round. So at 3rd–5th level, the acid lasts two rounds; at 6th–8th level, the acid lasts for three rounds, etc. Currently [[1+floor([[@{level-wizard}]]/3)]] rounds.' + 'effect': 'By means of this spell, the wizard creates a magical arrow that speeds to its target as if fired from the bow of a fighter of the same level as the wizard. No modifiers for range, nonproficiency, or specialization are used. The arrow has no attack or damage bonus, but it inflicts 2d4 points of acid damage (with saving throws for items on the target); there is no splash damage. For every three levels that the caster has achieved, the acid, unless somehow neutralized, lasts for another round, inflicting another 2d4 points of damage each round. So at 3rd–5th level, the acid lasts two rounds; at 6th–8th level, the acid lasts for three rounds, etc. Currently [[1+floor([[@{level-wizard}]]/3)]] total rounds.' }; wiz2['Mirror Image'] = {