Skip to content

Commit

Permalink
update gurps
Browse files Browse the repository at this point in the history
add rule of 16
  • Loading branch information
MadCoder253 committed Oct 16, 2023
1 parent e90f673 commit 6a78fd8
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 15 deletions.
167 changes: 152 additions & 15 deletions GURPS/gurps.html
Original file line number Diff line number Diff line change
Expand Up @@ -4333,6 +4333,11 @@ <h4>
<li>
<b>ENHANCEMENT:</b> Subdivided the <b>Bio\Misc</b> into sub-tabs for Bio, Reactions, Training, and Campaign, which is a placeholder for future fields.
</li>
<li>
<b>ENHANCEMENT:</b> Grimoire tab, repeating spells table. Added a new option named <b>Rule of 16</b>, checked by default,
found by clicking the Gear icon on the nav menu, then the Sheet Options sub-tab. It is under the section labeled <b>Spell Options.</b>
If checked, the effective skill of a spell that requires a resistance will use the Rule of 16. B349.
</li>
</ul>

<label class="check"><input type="checkbox" name="attr_announcements_hide" value="1">&nbsp;<b><span data-i18n="hide-until-next-update">Hide until next update</span></b></label>
Expand Down Expand Up @@ -15200,11 +15205,11 @@ <h4 class="spacer">&nbsp;</h4>

<div class="cell">
<div class="popup label">
<span data-i18n="custom-macro-label">Custom Macro</span>
<span data-i18n="custom-macro-spells-label">Custom Macro for Spells</span>
</div>
<span class="tooltip">
<span data-i18n="skills-custom-macro-tooltip">
Enter a custom macro to apply to all skill rolls.
<span data-i18n="custom-macro-spells-tooltip">
Enter a custom macro to apply to all spell rolls.
</span>
</span>
</div>
Expand Down Expand Up @@ -15355,17 +15360,20 @@ <h4 class="spacer">&nbsp;</h4>
<textarea class="reason-textarea" name="attr_spell_custom_roll_modifier_reason"></textarea>
</div>

<div class="modifier-cell">
<input type="checkbox" name="attr_spell_roll_max_nine" value="1" title="Macro: @{NAME|spell_roll_max_nine}" />
<input type="hidden" name="attr_spell_roll_max_nine_value" value="100" />
</div>

<div class="modifier-cell modifier-align-top">
<div class="popup">
<b><span data-i18n="max-skill-9-label">Max skill of 9</span></b>
<div>
<input type="number" min="0" step="1" name="attr_spell_rule_of_16_target_resistance" value="10" />
</div>
<div class="tooltip max-skill-9">
<span data-i18n="max-skill-9-tooltip">The effective skill cannot exceed 9.</span>
</div>

<div class="modifier-cell modifier-align-top">
<div>
<div class="popup">
<b><span data-i18n="target-resistance-label">Target Resistance</span></b>
</div>
<div class="tooltip max-skill-9">
<span data-i18n="rule-of-16-target-resistance-tooltip">Enter target's resistance level to use with Rule of 16 B349.<br />To use Rule of 16, the option needs to be turned on and the spell must have a value for the resistance column.</span>
</div>
</div>
</div>

Expand Down Expand Up @@ -15394,7 +15402,7 @@ <h4 class="spacer">&nbsp;</h4>
<button type="action" name="act_spell_roll_reset" class="btn tool-modifier-reset modifier-line-height-fix" title="Reset Skill Modifiers"><span data-i18n="reset-label">Reset</span></button>
</div>

<div class="modifier-cell modifier-fill-cell-20">&nbsp;</div>
<div class="modifier-cell modifier-fill-cell-15">&nbsp;</div>

</div><!-- end row -->

Expand Down Expand Up @@ -15515,7 +15523,8 @@ <h4 class="spacer">&nbsp;</h4>
<input type="hidden" name="attr_idkey" />
</div>
<div class="cell col1">
<button type="roll" value="@{roll}&{template:skillRoll} {{sheetStyle=@{sheetstyle}}} {{type=Spell Skill Roll}} {{activeDefense=[[0]]}} {{isSkillRoll=[[1]]}} {{showSuccessLabel=[[1]]}} {{characterName=@{character_name}}} {{skillName=@{name}}} {{rollResult=[[3d6cs<1cf>6]]}} {{effectiveSkill=[[{@{level} + @{modifier} + @{spell_roll_modifier}, @{spell_roll_max_nine_value} }kl1]]}} {{useModTool=[[1]]}} {{maxNine=[[@{spell_roll_max_nine}]]}} {{rollModifier=[[@{spell_roll_modifier}]]}} {{rollModifierSummary=@{spell_roll_modifier_summary}}} {{rollTraitSummary=@{spell_roll_trait_summary}}} {{notes=@{notes}}} {{showNotes=[[@{show_notes}]]}} {{castingTime=@{casttime}}} {{castingDuration=@{duration}}} {{castingCost=@{cost}}} {{castingMaintain=@{maintain}}} {{castingResist=@{spell_resisted_by}}} {{castingClass=@{spell_class}}} {{bookReference=@{ref}}} {{useCriticalPlusTen=[[@{use_critical_plus_10}]]}} {{customSuccessNote=@{spell_success_note}}} {{customCriticalSuccessNote=@{spell_critical_success_note}}} {{customFailNote=@{spell_fail_note}}} {{customCriticalFailNote=@{spell_critical_fail_note}}} {{spellRoll=true}} {{spellCriticalSuccessNote=@{spell_critical_success_notes}}} {{spellFailNote=@{spell_fail_notes}}} {{spellCriticalFailureNote=@{spell_critical_failure_notes}}} {{showCastingDetails=[[@{show_casting_details}]]}} {{showSpellNotes=[[@{show_spell_notes}]]}} {{spellNotes=@{spell_notes}}} {{popupModifier=@{popup_modifier}}} {{displayRollModifierSummary=[[@{display_roll_modifier_summary}]]}} {{customMacro=@{spell_custom_macro}}}" name="roll_vsSL" />
<input type="hidden" name="attr_rule_of_16_value" value="100" />
<button type="roll" value="@{roll}&{template:skillRoll} {{sheetStyle=@{sheetstyle}}} {{type=Spell Skill Roll}} {{activeDefense=[[0]]}} {{isSkillRoll=[[1]]}} {{showSuccessLabel=[[1]]}} {{characterName=@{character_name}}} {{skillName=@{name}}} {{rollResult=[[3d6cs<1cf>6]]}} {{effectiveSkill=[[{@{level} + @{modifier} + @{spell_roll_modifier}, @{rule_of_16_value} }kl1]]}} {{useModTool=[[1]]}} {{maxNine=[[@{spell_roll_max_nine}]]}} {{rollModifier=[[@{spell_roll_modifier}]]}} {{rollModifierSummary=@{spell_roll_modifier_summary}}} {{rollTraitSummary=@{spell_roll_trait_summary}}} {{notes=@{notes}}} {{showNotes=[[@{show_notes}]]}} {{castingTime=@{casttime}}} {{castingDuration=@{duration}}} {{castingCost=@{cost}}} {{castingMaintain=@{maintain}}} {{castingResist=@{spell_resisted_by}}} {{rule16Value=[[@{rule_of_16_value}]]}}} {{castingClass=@{spell_class}}} {{bookReference=@{ref}}} {{useCriticalPlusTen=[[@{use_critical_plus_10}]]}} {{customSuccessNote=@{spell_success_note}}} {{customCriticalSuccessNote=@{spell_critical_success_note}}} {{customFailNote=@{spell_fail_note}}} {{customCriticalFailNote=@{spell_critical_fail_note}}} {{spellRoll=true}} {{spellCriticalSuccessNote=@{spell_critical_success_notes}}} {{spellFailNote=@{spell_fail_notes}}} {{spellCriticalFailureNote=@{spell_critical_failure_notes}}} {{showCastingDetails=[[@{show_casting_details}]]}} {{showSpellNotes=[[@{show_spell_notes}]]}} {{spellNotes=@{spell_notes}}} {{popupModifier=@{popup_modifier}}} {{displayRollModifierSummary=[[@{display_roll_modifier_summary}]]}} {{customMacro=@{spell_custom_macro}}}" name="roll_vsSL" />
</div>
<div class="cell col2">
<input type="text" name="attr_level" title="Macro: @{NAME|repeating_spells_$[row #]_level}" readonly="readonly" value="10"/>
Expand Down Expand Up @@ -15745,6 +15754,11 @@ <h4>Version: <span name="attr_announcement_version"></span></h4>
<li>
<b>ENHANCEMENT:</b> Subdivided the <b>Bio\Misc</b> into sub-tabs for Bio, Reactions, Training, and Campaign, which is a placeholder for future fields.
</li>
<li>
<b>ENHANCEMENT:</b> Grimoire tab, repeating spells table. Added a new option named <b>Rule of 16</b>, checked by default,
found by clicking the Gear icon on the nav menu, then the Sheet Options sub-tab. It is under the section labeled <b>Spell Options.</b>
If checked, the effective skill of a spell that requires a resistance will use the Rule of 16. B349.
</li>
</ul>

<h4>Version: 2.9.17</h4>
Expand Down Expand Up @@ -17472,8 +17486,25 @@ <h4>
<input type="checkbox" name="attr_show_casting_details" value="1" checked="checked" />
</td>
</tr>

</table>
</span>

<table>
<tr>
<td style="width: 210px;">
<div class="popup">
<b><span data-i18n="rule-of-16-label">Rule of 16</span></b>
</div>
<div class="tooltip max-skill-9">
<span data-i18n="rule-of-16-tooltip">B349. If a supernatural attack (magic spell, psi ability, etc.) offers a resistance roll and the subject is living or sapient, the attacker's effective skill cannot exceed the higher of 16 and the defender's actual resistance. If it does, reduce it to that level.</span>
</div>
</td>
<td>
<input type="checkbox" name="attr_spell_roll_rule_of_16" value="1" checked="checked" title="Macro: @{NAME|spell_roll_rule_of_16}" />
</td>
</tr>
</table>

</div><!-- end option-container -->

Expand Down Expand Up @@ -20045,7 +20076,12 @@ <h3> Your feedback is most welcomed! See link below.</h3>
{{#castingResist}}
<tr>
<td class="label"><span data-i18n="resisted-by-label">Resisted by</span>:</td>
<td>{{castingResist}}</td>
<td>
{{castingResist}}
{{#^rollTotal() rule16Value 100}}
<div><i><span data-i18n="rule-of-16-applied">Rule of 16 Applied</span></i></div>
{{/^rollTotal() rule16Value 100}}
</td>
</tr>
{{/castingResist}}

Expand Down Expand Up @@ -21461,6 +21497,8 @@ <h3> Your feedback is most welcomed! See link below.</h3>
updateLanguagePoints();

upgradeHitLocationPenaltiesToNewVersion();

updateRuleSixteenForSpells();

}

Expand Down Expand Up @@ -22459,6 +22497,105 @@ <h3> Your feedback is most welcomed! See link below.</h3>
});

});

// check for user entering a resistance level
// if entered AND rule of 16 is checked, set the max effective skill level
on("change:repeating_spells:spell_resisted_by", event => {

const hasResistanceValue = Boolean(event.newValue);

getAttrs(["spell_roll_rule_of_16", "spell_rule_of_16_target_resistance"], values => {

let maxEffectiveSkill = 100;

let targetResistance = Number(values.spell_rule_of_16_target_resistance) ?? 10;

if (values.spell_roll_rule_of_16 == "1" && hasResistanceValue) {

if (targetResistance <= 16) {

maxEffectiveSkill = 16;

} else {

maxEffectiveSkill = targetResistance;
}

}

setAttrs({repeating_spells_rule_of_16_value: maxEffectiveSkill});

});

});

// check if target resistance or rule of 16 option checkbox
// update the spells that use rule of 16
on("change:spell_roll_rule_of_16 change:spell_rule_of_16_target_resistance", event => {

updateRuleSixteenForSpells();

});

const updateRuleSixteenForSpells = () => {

const attribs = [
"spell_roll_rule_of_16",
"spell_rule_of_16_target_resistance"
];

getAttrs(attribs, values => {

const useRule16 = values.spell_roll_rule_of_16 == "1";

let targetResistance = Number(values.spell_rule_of_16_target_resistance) ?? 10;

getSectionIDs('repeating_spells', ids => {

const fieldNames = [];

ids.forEach(id => fieldNames.push(`repeating_spells_${id}_spell_resisted_by`));

getAttrs(fieldNames, values => {

let fieldsToUpdate = {};

ids.forEach(id => {

// set the maxEffectiveSkill
let maxEffectiveSkill = 100;

const hasResistanceValue = Boolean(values[`repeating_spells_${id}_spell_resisted_by`]);

if (useRule16 && hasResistanceValue) {

if (targetResistance <= 16) {

maxEffectiveSkill = 16;

} else {

maxEffectiveSkill = targetResistance;

}

}

let fieldName = `repeating_spells_${id}_rule_of_16_value`;

fieldsToUpdate[fieldName] = maxEffectiveSkill;

});

setAttrs(fieldsToUpdate);

});

});

});

}

// Update the skill level and update the total cost of Skills
on('change:repeating_skills:base change:repeating_skills:difficulty change:repeating_skills:bonus change:repeating_skills:points change:repeating_skills:sync', (event) => {
Expand Down
7 changes: 7 additions & 0 deletions GURPS/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"spell-modifiers-tooltip": "These modifiers affect all spell rolls, use the reset button to clear modifiers. These modifiers will be cleared the next time you load your character sheet.",
"max-skill-9-label": "Max skill of 9",
"max-skill-9-tooltip": "The effective skill cannot exceed 9.",
"rule-of-16-label": "Rule of 16",
"rule-of-16-tooltip": "B349. If a supernatural attack (magic spell, psi ability, etc.) offers a resistance roll and the subject is living or sapient, the attacker's effective skill cannot exceed the higher of 16 and the defender's actual resistance. If it does, reduce it to that level.",
"target-resistance-label": "Target Resistance",
"rule-of-16-target-resistance-tooltip": "Enter target's resistance level to use with <b>Rule of 16</b> B349.<br />To use <b>Rule of 16</b>, the option needs to be turned on and the spell must have a value for the resistance column.",
"custom-modifier-label": "Custom Modifier.",
"reason-label": "Reason",
"roll-modifier-reason-tooltip": "Describe the reasons why you entered the custom modifier.",
Expand Down Expand Up @@ -554,6 +558,8 @@
"custom-macro-melee-tooltip": "Enter a custom macro to apply to all melee rolls.",
"custom-macro-ranged-label": "Custom Macro for Ranged",
"custom-macro-ranged-tooltip": "Enter a custom macro to apply to all ranged rolls.",
"custom-macro-spells-label": "Custom Macro for Spells",
"custom-macro-spells-tooltip": "Enter a custom macro to apply to all spell rolls.",
"encumbrance-label": "Encumbrance",
"load-label": "Load",
"encumbrance-move-score-tooltip": "Note: The Move score automatically adjusts for Encumbrance<br>and for HP and/or FP loss below 1/3. (B419, B426).<br><b>STEP:</b> The number in parentheses is the step distance.",
Expand Down Expand Up @@ -1328,6 +1334,7 @@
"minimum-label": "Minimum",
"rolltemplate-minimum-damage-description": "Applied to Target's DR<br>See B378 <b>Damage Roll</b>",
"resisted-by-label": "Resisted by",
"rule-of-16-applied": "Rule of 16 Applied",
"recoil-label": "Recoil",
"abbreviation-malfunction-label": "Malf",
"default-repeating-skill-crit-success-message": "The GM may determine what happens to you. (B347)",
Expand Down

0 comments on commit 6a78fd8

Please sign in to comment.