- Added logic for bonus spell points based on wisdom to priests

- Updated change log
This commit is contained in:
Peter Bjerg Lidegaard
2023-02-17 09:07:35 +01:00
parent 28fde39607
commit 7624068b46
6 changed files with 154 additions and 16 deletions
+75 -6
View File
@@ -3904,7 +3904,7 @@
<td></td>
<td>Level</td>
<td class="sheet-padding-right">Specialist</td>
<td class="sheet-padding-right" colspan="2" title="Optional rules for wizards to gain extra spell points from high intelligence">Intelligence</td>
<td class="sheet-padding-right" colspan="2">Intelligence</td>
<td>Total</td>
<td class="sheet-centering-padding-5">|</td>
<td>Remaining</td>
@@ -3914,7 +3914,7 @@
<td><input type="number" name="attr_spell-points-lvl" title="@{spell-points-lvl}" class="sheet-mediumish" value="0"></td>
<td><input type="number" name="attr_spell-points-spc" title="@{spell-points-spc}" class="sheet-table-dynamic" value="0"></td>
<td><input type="number" name="attr_spell-points-int" title="@{spell-points-int}" class="sheet-table-dynamic" value="0"></td>
<td><label><input type="checkbox" name="attr_spell-points-int-enabled" title="@{spell-points-int-enabled}" value='1'/><span></span></label></td>
<td><label><input type="checkbox" name="attr_spell-points-int-enabled" title="@{spell-points-int-enabled}" value="1" checked/><span></span></label></td>
<td><input type="text" name="attr_spell-points-total" title="@{spell-points-total}" class="sheet-short" value="0" readonly></td>
<td class="sheet-centering">|</td>
<td><input type="text" name="attr_spell-points-remaining" title="@{spell-points-remaining}" class="sheet-table-dynamic" value="0" readonly></td>
@@ -8739,7 +8739,7 @@
<tr>
<td></td>
<td>Level</td>
<td class="sheet-padding-right">Wisdom</td>
<td class="sheet-padding-right" colspan="2">Wisdom</td>
<td>Total</td>
<td class="sheet-centering-padding-5">|</td>
<td>Remaining</td>
@@ -8748,11 +8748,16 @@
<td>Spell Points</td>
<td><input type="number" name="attr_spell-points-priest-lvl" title="@{spell-points-priest-lvl}" class="sheet-mediumish" value="0"></td>
<td><input type="number" name="attr_spell-points-priest-wis" title="@{spell-points-priest-wis}" class="sheet-table-dynamic" value="0"></td>
<td><label><input type="checkbox" name="attr_spell-points-priest-wis-enabled" title="@{spell-points-priest-wis-enabled}" value="1"/><span></span></label></td>
<td><input type="text" name="attr_spell-points-priest-total" title="@{spell-points-priest-total}" class="sheet-short" value="0" readonly></td>
<td class="sheet-centering">|</td>
<td><input type="text" name="attr_spell-points-priest-remaining" title="@{spell-points-priest-remaining}" class="sheet-table-dynamic" value="0" readonly></td>
</tr>
</table>
<details>
<summary>Bonus spell points from high Wisdom to Priests</summary>
Priests with high Wisdom scores gain a special bonus spell points to reflect their piety and devotion. (This is a standard rule in this spell point system, unlike the optional bonus spell point rule for wizards with high Intelligence scores.) PO: Spells & Powers, p. 92
</details>
<table class="sheet-default-header-first-row sheet-default-header-first-column sheet-spell-arcs-winds sheet-hidden">
<tr>
<td></td>
@@ -33732,16 +33737,16 @@ intelligenceTable['intimm4th'] = ['Error','','','','','','','','','','','','',''
intelligenceTable['intimm5th'] = ['Error','','','','','','','','','','','','','','','','','','','','','','','5th-level','5th-level','5th-level'];
intelligenceTable['intimm6th'] = ['Error','','','','','','','','','','','','','','','','','','','','','','','','6th-level','6th-level'];
intelligenceTable['intimm7th'] = ['Error','','','','','','','','','','','','','','','','','','','','','','','','','7th-level'];
intelligenceTable['spell-points-int'] = [0,0,0,0,0,0,0,0,0,2,2,2,3,3,4,4,5,6,7,8,9,9,9,9,9,9];
intelligenceTable['intnotes'] = ['INVALID INTELLIGENCE','Communicate by Grunts & Gestures','','','','','','','','','','','','','','','','','','','','','','','','',''];
intelligenceTable['spell-points-int'] = [0,0,0,0,0,0,0,0,0,2,2,2,3,3,4,4,5,6,7,8,9,9,9,9,9,9];
const wisdomTable = {};
wisdomTable['wisdef'] = ['Error','-6','-4','-3','-2','-1','-1','-1','0','0','0','0','0','0','0','+1','+2','+3','+4','+4','+4','+4','+4','+4','+4','+4'];
wisdomTable['wisbonus'] = ['Error','—','—','—','—','—','—','—','—','0','0','0','0','1st','1st','2nd','2nd','3rd','4th','1st,3rd','2nd,4th','3rd,5th','4th,5th','1st,6th','5th,6th','6th,7th'];
wisdomTable['wisdom-wind'] = [0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,3,4,5,6,7,8,9,10,11,12];
wisdomTable['wisfail'] = ['Error','80','60','50','45','40','35','30','25','20','15','10','5','0','0','0','0','0','0','0','0','0','0','0','0','0'];
wisdomTable['wisimmune'] = ['Error','','','','','','','','','','','','','','','','','','','cause fear, charm person, command, friends, hypnotism','forget, hold person, ray of enfeeblement, scare','fear','charm monster, confusion, emotion, fumble, suggestion','chaos, feeblemind, hold monster, magic jar, quest','geas, mass suggestion, rod of rulership','antipathy/sympathy, death spell, mass charm'];
wisdomTable['wisnotes'] = ['INVALID WISDOM','','','','','','','','','','','','','','','','','','','','','','','','','',''];
wisdomTable['wisdom-wind'] = [0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,3,4,5,6,7,8,9,10,11,12];
const charismaTable = {};
charismaTable['chamax'] = ['Error','0','1','1','1','2','2','3','3','4','4','4','5','5','6','7','8','10','15','20','25','30','35','40','45','50'];
@@ -69818,7 +69823,7 @@ on('change:spell-points-int-enabled change:intelligence', function (eventInfo) {
getAttrs(['spell-points-int-enabled', 'intelligence'], function (values) {
let newValue = {'spell-points-int': 0}
if (values['spell-points-int-enabled'] !== '1') {
return setAttrs(newValue)
return setAttrs(newValue);
}
let intelligence = getLookupValue(values['intelligence'], 0);
newValue['spell-points-int'] = intelligenceTable['spell-points-int'][intelligence];
@@ -69835,6 +69840,70 @@ setupRepeatingSpellSumming(allPriestSpellSections, priestSpellPoints, 'spell-poi
setupRepeatingSpellSumming(allPriestSpellSections, 'wind', 'spell-wind', `${wind}-sum`, true);
setupCalculateRemaining(`${priestSpellPoints}-total`, `${priestSpellPoints}-sum`, `${priestSpellPoints}-remaining`);
setupCalculateRemaining(wind, `${wind}-sum`, `${wind}-remaining`);
let PRIEST_SPELL_POINTS_WIS = 'spell-points-priest-wis';
on('change:spell-points-priest-wis-enabled change:wisdom change:level-priest', function (eventInfo) {
getAttrs(['spell-points-priest-wis-enabled', 'wisdom', 'level-priest'], async function (values) {
await keepContextRoll();
let newValue = {};
newValue[PRIEST_SPELL_POINTS_WIS] = 0;
if (values['spell-points-priest-wis-enabled'] !== '1') {
return setAttrs(newValue);
}
let wisdom = getLookupValue(values['wisdom'], 0);
if (wisdom < 13) {
return setAttrs(newValue);
}
if (wisdom === 13) {
newValue[PRIEST_SPELL_POINTS_WIS] = 4;
return setAttrs(newValue);
}
if (wisdom === 14) {
newValue[PRIEST_SPELL_POINTS_WIS] = 8;
return setAttrs(newValue);
}
let level = await extractRollResult(values['level-priest']);
if (isNaN(level) || level < 0) {
level = 1;
}
let spellPoints = 0;
if (wisdom === 15) {
spellPoints = level < 3 ? 8 : 15;
} else if (wisdom === 16) {
spellPoints = level < 3 ? 8 : 20;
} else if (wisdom === 17) {
if (1 <= level && level <= 2) {
spellPoints = 8;
} else if (3 <= level && level <= 4) {
spellPoints = 20;
} else {
spellPoints = 30;
}
} else if (wisdom === 18) {
if (1 <= level && level <= 2) {
spellPoints = 8;
} else if (3 <= level && level <= 4) {
spellPoints = 20;
} else if (5 <= level && level <= 6) {
spellPoints = 30;
} else {
spellPoints = 45;
}
} else if (wisdom >= 19) {
if (1 <= level && level <= 2) {
spellPoints = 12;
} else if (3 <= level && level <= 4) {
spellPoints = 25;
} else if (5 <= level && level <= 6) {
spellPoints = 45;
} else {
spellPoints = 60;
}
}
newValue[PRIEST_SPELL_POINTS_WIS] = spellPoints;
setAttrs(newValue);
});
});
// --- End setup Spell Points, Arc, and Wind --- //
// --- Start setup reset buttons --- //
+4 -4
View File
@@ -13,10 +13,10 @@
<li>Added Spell tracking selection to the Sheet Settings Tab. Choices are: Spell slots, spell points, Arcs / Winds</li>
<li>Redesigned the Spells tab to only show the spell tracking system that selected on the Sheet Settings Tab</li>
<li>High Wisdom now triggers a popup asking if you are a priest. Bonus spells are only added if you are a priest</li>
<li>High Wisdom now autofill bonus Winds for Priests for the Arcs/Winds spell tracking system. If the PO: S&P sub ability scores are used, base Wisdom is still used for determining bonus winds</li>
<li>Added support for automatic Spell Points for Wizards with high Intelligence</li>
<li>High Constitution Regeneration now clarifies that it is per turn(s)</li>
<li>Fixed bonus spells from high Intuition. Willpower was incorrectly used</li>
<li>High Wisdom now autofill bonus Winds for Priests for the Arcs/Winds spell tracking system, based on the same popup as stated above. If the PO: S&P sub ability scores are used, base Wisdom is still used for determining bonus winds</li>
<li>Added support for automatic Spell Points for Wizards with high Intelligence. This is a toggle as the bonus is optional.</li>
<li>Added support for automatic Spell Points for Priests with high Wisdom. This is a toggle as only priests gets this bonus, and not Paladins and rangers. The Priest caster level is used to determine how many spell points should be given</li>
<li>Fixed bonus spells from high Intuition from PO: Skills & Powers. Willpower was incorrectly used</li>
<li>Styled Monster tab to have dynamically sized fields, and larger fields for Hit Dice, HP, and Max HP</li>
<li>2Espell - Sensory signature and Knockdown switched places to make them appear in the same order as in the PO: Spells & Magic book</li>
</ul>
@@ -46,7 +46,7 @@
<tr>
<td></td>
<td>Level</td>
<td class="sheet-padding-right">Wisdom</td>
<td class="sheet-padding-right" colspan="2">Wisdom</td>
<td>Total</td>
<td class="sheet-centering-padding-5">|</td>
<td>Remaining</td>
@@ -55,11 +55,16 @@
<td>Spell Points</td>
<td><input type="number" name="attr_spell-points-priest-lvl" title="@{spell-points-priest-lvl}" class="sheet-mediumish" value="0"></td>
<td><input type="number" name="attr_spell-points-priest-wis" title="@{spell-points-priest-wis}" class="sheet-table-dynamic" value="0"></td>
<td><label><input type="checkbox" name="attr_spell-points-priest-wis-enabled" title="@{spell-points-priest-wis-enabled}" value="1"/><span></span></label></td>
<td><input type="text" name="attr_spell-points-priest-total" title="@{spell-points-priest-total}" class="sheet-short" value="0" readonly></td>
<td class="sheet-centering">|</td>
<td><input type="text" name="attr_spell-points-priest-remaining" title="@{spell-points-priest-remaining}" class="sheet-table-dynamic" value="0" readonly></td>
</tr>
</table>
<details>
<summary>Bonus spell points from high Wisdom to Priests</summary>
Priests with high Wisdom scores gain a special bonus spell points to reflect their piety and devotion. (This is a standard rule in this spell point system, unlike the optional bonus spell point rule for wizards with high Intelligence scores.) PO: Spells & Powers, p. 92
</details>
<table class="sheet-default-header-first-row sheet-default-header-first-column sheet-spell-arcs-winds sheet-hidden">
<tr>
<td></td>
@@ -34,7 +34,7 @@
<td></td>
<td>Level</td>
<td class="sheet-padding-right">Specialist</td>
<td class="sheet-padding-right" colspan="2" title="Optional rules for wizards to gain extra spell points from high intelligence">Intelligence</td>
<td class="sheet-padding-right" colspan="2">Intelligence</td>
<td>Total</td>
<td class="sheet-centering-padding-5">|</td>
<td>Remaining</td>
@@ -44,7 +44,7 @@
<td><input type="number" name="attr_spell-points-lvl" title="@{spell-points-lvl}" class="sheet-mediumish" value="0"></td>
<td><input type="number" name="attr_spell-points-spc" title="@{spell-points-spc}" class="sheet-table-dynamic" value="0"></td>
<td><input type="number" name="attr_spell-points-int" title="@{spell-points-int}" class="sheet-table-dynamic" value="0"></td>
<td><label><input type="checkbox" name="attr_spell-points-int-enabled" title="@{spell-points-int-enabled}" value='1'/><span></span></label></td>
<td><label><input type="checkbox" name="attr_spell-points-int-enabled" title="@{spell-points-int-enabled}" value="1" checked/><span></span></label></td>
<td><input type="text" name="attr_spell-points-total" title="@{spell-points-total}" class="sheet-short" value="0" readonly></td>
<td class="sheet-centering">|</td>
<td><input type="text" name="attr_spell-points-remaining" title="@{spell-points-remaining}" class="sheet-table-dynamic" value="0" readonly></td>
+2 -2
View File
@@ -99,16 +99,16 @@ intelligenceTable['intimm4th'] = ['Error','','','','','','','','','','','','',''
intelligenceTable['intimm5th'] = ['Error','','','','','','','','','','','','','','','','','','','','','','','5th-level','5th-level','5th-level'];
intelligenceTable['intimm6th'] = ['Error','','','','','','','','','','','','','','','','','','','','','','','','6th-level','6th-level'];
intelligenceTable['intimm7th'] = ['Error','','','','','','','','','','','','','','','','','','','','','','','','','7th-level'];
intelligenceTable['spell-points-int'] = [0,0,0,0,0,0,0,0,0,2,2,2,3,3,4,4,5,6,7,8,9,9,9,9,9,9];
intelligenceTable['intnotes'] = ['INVALID INTELLIGENCE','Communicate by Grunts & Gestures','','','','','','','','','','','','','','','','','','','','','','','','',''];
intelligenceTable['spell-points-int'] = [0,0,0,0,0,0,0,0,0,2,2,2,3,3,4,4,5,6,7,8,9,9,9,9,9,9];
const wisdomTable = {};
wisdomTable['wisdef'] = ['Error','-6','-4','-3','-2','-1','-1','-1','0','0','0','0','0','0','0','+1','+2','+3','+4','+4','+4','+4','+4','+4','+4','+4'];
wisdomTable['wisbonus'] = ['Error','—','—','—','—','—','—','—','—','0','0','0','0','1st','1st','2nd','2nd','3rd','4th','1st,3rd','2nd,4th','3rd,5th','4th,5th','1st,6th','5th,6th','6th,7th'];
wisdomTable['wisdom-wind'] = [0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,3,4,5,6,7,8,9,10,11,12];
wisdomTable['wisfail'] = ['Error','80','60','50','45','40','35','30','25','20','15','10','5','0','0','0','0','0','0','0','0','0','0','0','0','0'];
wisdomTable['wisimmune'] = ['Error','','','','','','','','','','','','','','','','','','','cause fear, charm person, command, friends, hypnotism','forget, hold person, ray of enfeeblement, scare','fear','charm monster, confusion, emotion, fumble, suggestion','chaos, feeblemind, hold monster, magic jar, quest','geas, mass suggestion, rod of rulership','antipathy/sympathy, death spell, mass charm'];
wisdomTable['wisnotes'] = ['INVALID WISDOM','','','','','','','','','','','','','','','','','','','','','','','','','',''];
wisdomTable['wisdom-wind'] = [0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,3,4,5,6,7,8,9,10,11,12];
const charismaTable = {};
charismaTable['chamax'] = ['Error','0','1','1','1','2','2','3','3','4','4','4','5','5','6','7','8','10','15','20','25','30','35','40','45','50'];
+65 -1
View File
@@ -1327,7 +1327,7 @@ on('change:spell-points-int-enabled change:intelligence', function (eventInfo) {
getAttrs(['spell-points-int-enabled', 'intelligence'], function (values) {
let newValue = {'spell-points-int': 0}
if (values['spell-points-int-enabled'] !== '1') {
return setAttrs(newValue)
return setAttrs(newValue);
}
let intelligence = getLookupValue(values['intelligence'], 0);
newValue['spell-points-int'] = intelligenceTable['spell-points-int'][intelligence];
@@ -1344,6 +1344,70 @@ setupRepeatingSpellSumming(allPriestSpellSections, priestSpellPoints, 'spell-poi
setupRepeatingSpellSumming(allPriestSpellSections, 'wind', 'spell-wind', `${wind}-sum`, true);
setupCalculateRemaining(`${priestSpellPoints}-total`, `${priestSpellPoints}-sum`, `${priestSpellPoints}-remaining`);
setupCalculateRemaining(wind, `${wind}-sum`, `${wind}-remaining`);
let PRIEST_SPELL_POINTS_WIS = 'spell-points-priest-wis';
on('change:spell-points-priest-wis-enabled change:wisdom change:level-priest', function (eventInfo) {
getAttrs(['spell-points-priest-wis-enabled', 'wisdom', 'level-priest'], async function (values) {
await keepContextRoll();
let newValue = {};
newValue[PRIEST_SPELL_POINTS_WIS] = 0;
if (values['spell-points-priest-wis-enabled'] !== '1') {
return setAttrs(newValue);
}
let wisdom = getLookupValue(values['wisdom'], 0);
if (wisdom < 13) {
return setAttrs(newValue);
}
if (wisdom === 13) {
newValue[PRIEST_SPELL_POINTS_WIS] = 4;
return setAttrs(newValue);
}
if (wisdom === 14) {
newValue[PRIEST_SPELL_POINTS_WIS] = 8;
return setAttrs(newValue);
}
let level = await extractRollResult(values['level-priest']);
if (isNaN(level) || level < 0) {
level = 1;
}
let spellPoints = 0;
if (wisdom === 15) {
spellPoints = level < 3 ? 8 : 15;
} else if (wisdom === 16) {
spellPoints = level < 3 ? 8 : 20;
} else if (wisdom === 17) {
if (1 <= level && level <= 2) {
spellPoints = 8;
} else if (3 <= level && level <= 4) {
spellPoints = 20;
} else {
spellPoints = 30;
}
} else if (wisdom === 18) {
if (1 <= level && level <= 2) {
spellPoints = 8;
} else if (3 <= level && level <= 4) {
spellPoints = 20;
} else if (5 <= level && level <= 6) {
spellPoints = 30;
} else {
spellPoints = 45;
}
} else if (wisdom >= 19) {
if (1 <= level && level <= 2) {
spellPoints = 12;
} else if (3 <= level && level <= 4) {
spellPoints = 25;
} else if (5 <= level && level <= 6) {
spellPoints = 45;
} else {
spellPoints = 60;
}
}
newValue[PRIEST_SPELL_POINTS_WIS] = spellPoints;
setAttrs(newValue);
});
});
// --- End setup Spell Points, Arc, and Wind --- //
// --- Start setup reset buttons --- //