Dolmenwood: update the rolling of skills and attributes to work correctly.

This commit is contained in:
Stuart Harper
2026-06-15 16:02:57 -06:00
parent 6158f2702b
commit 93709ed7e4
2 changed files with 66 additions and 128 deletions
+11 -69
View File
@@ -18,9 +18,7 @@
}
.sheet-rolltemplate-simple h3,
.sheet-rolltemplate-greater h3,
.sheet-rolltemplate-less h3,
.sheet-rolltemplate-skill h3 {
.sheet-rolltemplate-greater h3 {
color: white;
background-color: #333;
line-height: 2.2rem;
@@ -29,9 +27,7 @@
}
.sheet-rolltemplate-simple span,
.sheet-rolltemplate-greater span,
.sheet-rolltemplate-less span,
.sheet-rolltemplate-skill span {
.sheet-rolltemplate-greater span {
background: white;
color: black;
display: inline-block;
@@ -46,9 +42,7 @@
}
.sheet-rolltemplate-simple h3,
.sheet-rolltemplate-greater h3,
.sheet-rolltemplate-less h3,
.sheet-rolltemplate-skill h3 {
.sheet-rolltemplate-greater h3 {
font-family: "Metamorphous", serif;
font-size: 1.6rem;
}
@@ -59,9 +53,7 @@
}
.sheet-rolltemplate-simple .inlinerollresult,
.sheet-rolltemplate-greater .inlinerollresult,
.sheet-rolltemplate-less .inlinerollresult,
.sheet-rolltemplate-skill .inlinerollresult {
.sheet-rolltemplate-greater .inlinerollresult {
background-color: transparent;
border: none;
color: black;
@@ -74,18 +66,14 @@
.sheet-rolltemplate-simple .fullfail,
.sheet-rolltemplate-simple .sheet-fullfail,
.sheet-rolltemplate-greater .sheet-rollfail,
.sheet-rolltemplate-less .sheet-rollfail,
.sheet-rolltemplate-skill .sheet-rollfail {
.sheet-rolltemplate-greater .sheet-rollfail {
color: #990000;
font-weight: bold;
}
.sheet-rolltemplate-simple .fullcrit,
.sheet-rolltemplate-simple .sheet-fullcrit,
.sheet-rolltemplate-greater .sheet-rollsuccess,
.sheet-rolltemplate-less .sheet-rollsuccess,
.sheet-rolltemplate-skill .sheet-rollsuccess {
.sheet-rolltemplate-greater .sheet-rollsuccess {
color: #009900;
font-weight: bold;
}
@@ -932,15 +920,6 @@ div.sheet-custom-spells div.custom-spell-selector label {
width: auto;
}
div.glamour-grid,
div.rune-grid,
div.knack-grid,
div.spells-grid,
div.repcontainer textarea {
font-family: "Metamorphous", serif;
font-size: 12px;
}
.h-line {
width: 100%;
height: 1px;
@@ -981,43 +960,6 @@ div.repcontainer textarea {
width: 210px;
}
div.glamour-grid input[type="text"],
div.knack-grid input[type="text"],
div.rune-grid input[type="text"],
div.spells-grid input[type="text"] {
width: 100%;
}
div.rune-grid textarea,
div.rune-grid textarea,
div.knack-grid textarea,
div.spells-grid textarea {
margin-top: 5px;
height: 70px;
}
.spells-per-level {
display: flex;
align-items: flex-end;
font-family: "Metamorphous", serif;
font-size: 15px;
margin-bottom: 10px;
}
.ui-dialog .charsheet div.spells-per-level span {
margin-left: 16px;
}
.ui-dialog .charsheet div.spells-per-level label {
margin: 0;
padding: 0;
width: auto;
}
.ui-dialog .charsheet div.spells-per-level input[type="number"] {
width: 30px;
}
.monster-row {
display: flex;
font-family: "Metamorphous", serif;
@@ -1041,13 +983,13 @@ div.spells-grid textarea {
color: inherit;
}
input[name="attr_coinsOverloaded"][value="1"] ~ div .sheet-coins span,
input[name="attr_coinsOverloaded"][value="1"] ~ div .sheet-coins input {
input[name="attr_coinsOverloaded"]:checked ~ div .sheet-coins span,
input[name="attr_coinsOverloaded"]:checked ~ div .sheet-coins input {
color: red;
}
.sheet-pouch-full {
display: none;
display: none !important;
}
.sheet-pouch-full input {
@@ -1060,9 +1002,9 @@ span.sheet-pouch-full span {
color: red;
}
input[name="attr_coinsOverloaded"][value="1"] ~ .sheet-pouch-full {
input[name="attr_coinsOverloaded"]:checked ~ .sheet-pouch-full {
color: red;
display: flex;
display: flex !important;
justify-content: center;
align-items: center;
}
+47 -51
View File
@@ -137,7 +137,7 @@
<div class="scores roll flex">
<label class="attribute">
<button type="roll" class="attribute-roll-btn" name="attr_rollSTR"
value="&{template:greater} {{roll=@{character_name} rolls ^{strength}}} {{result=[[ ([[1d6]]+[[@{strMod}]]+[[@{optionalModQuery}]])>=4 ]]}} {{check=[[4-@{optionalModQuery}]]}}"
value="&{template:greater} {{roll=@{character_name} rolls ^{strength}}} {{result=[[1d6+@{strMod}+@{optionalModQuery}]]}} {{check=[[4]]}}"
data-i18n="strength">
Strength
</button>
@@ -148,7 +148,7 @@
</label>
<label class="attribute">
<button type="roll" class="attribute-roll-btn" name="attr_rollINT"
value="&{template:greater} {{roll=@{character_name} rolls ^{intelligence}}} {{result=[[ ([[1d6]]+[[@{intMod}]]+[[@{optionalModQuery}]])>=4 ]]}} {{check=[[4-@{optionalModQuery}]]}}"
value="&{template:greater} {{roll=@{character_name} rolls ^{intelligence}}} {{result=[[1d6+@{intMod}+@{optionalModQuery}]]}} {{check=[[4]]}}"
data-i18n="intelligence">
Inelegance
</button>
@@ -159,7 +159,7 @@
</label>
<label class="attribute">
<button type="roll" class="attribute-roll-btn" name="attr_rollWIS"
value="&{template:greater} {{roll=@{character_name} rolls ^{wisdom}}} {{result=[[ ([[1d6]]+[[@{wisMod}]]+[[@{optionalModQuery}]])>=4 ]]}} {{check=[[4-@{optionalModQuery}]]}}"
value="&{template:greater} {{roll=@{character_name} rolls ^{wisdom}}} {{result=[[1d6+@{wisMod}+@{optionalModQuery}]]}} {{check=[[4]]}}"
data-i18n="wisdom">
Wisdom
</button>
@@ -170,7 +170,7 @@
</label>
<label class="attribute">
<button type="roll" class="attribute-roll-btn" name="attr_rollDEX"
value="&{template:greater} {{roll=@{character_name} rolls ^{dexterity}}} {{result=[[ ([[1d6]]+[[@{dexMod}]]+[[@{optionalModQuery}]])>=4 ]]}} {{check=[[4-@{optionalModQuery}]]}}"
value="&{template:greater} {{roll=@{character_name} rolls ^{dexterity}}} {{result=[[1d6+@{dexMod}+@{optionalModQuery}]]}} {{check=[[4]]}}"
data-i18n="dexterity">
Dexterity
</button>
@@ -181,7 +181,7 @@
</label>
<label class="attribute">
<button type="roll" class="attribute-roll-btn" name="attr_rollCON"
value="&{template:greater} {{roll=@{character_name} rolls ^{constitution}}} {{result=[[ ([[1d6]]+[[@{conMod}]]+[[@{optionalModQuery}]])>=4 ]]}} {{check=[[4-@{optionalModQuery}]]}}"
value="&{template:greater} {{roll=@{character_name} rolls ^{constitution}}} {{result=[[1d6+@{conMod}+@{optionalModQuery}]]}} {{check=[[4]]}}"
data-i18n="constitution">
Constitution
</button>
@@ -192,7 +192,7 @@
</label>
<label class="attribute">
<button type="roll" class="attribute-roll-btn" name="attr_rollCHA"
value="&{template:greater} {{roll=@{character_name} rolls ^{charisma}}} {{result=[[ ([[1d6]]+[[@{chaMod}]]+[[@{optionalModQuery}]])>=4 ]]}} {{check=[[4-@{optionalModQuery}]]}}"
value="&{template:greater} {{roll=@{character_name} rolls ^{charisma}}} {{result=[[1d6+@{chaMod}+@{optionalModQuery}]]}} {{check=[[4]]}}"
data-i18n="charisma">
Charisma
</button>
@@ -424,7 +424,7 @@
type="roll"
name="listenRoll"
data-i18n="roll"
value="/w gm &{template:greater} {{roll=@{character_name} rolls Listen}} {{result=[[ [[1d6+@{optionalModQuery}]]<=@{listenThreshold} ]]}} {{check=[[@{listenThreshold}+@{optionalModQuery}]]}} {{description=@{listenDescription}}}">
value="/w gm &{template:greater} {{roll=@{character_name} rolls Listen}} {{result=[[1d6+@{optionalModQuery}]]}} {{check=[[@{listenThreshold}]]}} {{description=@{listenDescription}}}">
Roll
</button>
<input type="text" name="attr_listenName" readonly value="Listen"/>
@@ -437,7 +437,7 @@
type="roll"
name="searchRoll"
data-i18n="roll"
value="/w gm &{template:greater} {{roll=@{character_name} rolls Search}} {{result=[[ [[1d6+@{optionalModQuery}]]<=@{searchThreshold} ]]}} {{check=[[@{searchThreshold}+@{optionalModQuery}]]}} {{description=@{searchDescription}}}">
value="/w gm &{template:greater} {{roll=@{character_name} rolls Search}} {{result=[[1d6+@{optionalModQuery}]]}} {{check=[[@{searchThreshold}]]}} {{description=@{searchDescription}}}">
Roll
</button>
<input type="text" name="attr_searchName" value="Search" readonly/>
@@ -450,7 +450,7 @@
type="roll"
name="survivalRoll"
data-i18n="roll"
value="/w gm &{template:greater} {{roll=@{character_name} rolls @{survivalName}}} {{result=[[ [[1d6+@{optionalModQuery}]]<=@{survivalThreshold} ]]}} {{check=[[@{survivalThreshold}+@{optionalModQuery}]]}} {{description=@{survivalDescription}}}">
value="/w gm &{template:greater} {{roll=@{character_name} rolls @{survivalName}}} {{result=[[1d6+@{optionalModQuery}]]}} {{check=[[@{survivalThreshold}]]}} {{description=@{survivalDescription}}}">
Roll
</button>
<input type="text" name="attr_survivalName" value="Survival" readonly/>
@@ -463,7 +463,7 @@
type="roll"
name="lightFireRoll"
data-i18n="roll"
value="@{fireToGmOnly}&{template:greater} {{roll=@{character_name} rolls @{lightFireName}}} {{result=[[ [[1d6+@{optionalModQuery}]]<=@{lightFireThreshold} ]]}} {{check=[[@{lightFireThreshold}+@{optionalModQuery}]]}} {{description=@{lightFireDescription}}}">
value="@{fireToGmOnly}&{template:greater} {{roll=@{character_name} rolls @{lightFireName}}} {{result=[[1d6+@{optionalModQuery}]]}} {{check=[[@{lightFireThreshold}]]}} {{description=@{lightFireDescription}}}">
Roll
</button>
<input type="text" name="attr_lightFireName" value="Light Fire under Stress" readonly/>
@@ -477,7 +477,7 @@
type="roll"
name="abilityRoll"
data-i18n="roll"
value="@{toGmOnly}&{template:greater} {{roll=@{character_name} rolls @{abilityName}}} {{result=[[ [[1d6+@{optionalModQuery}]]<=@{abilityThreshold} ]]}} {{check=[[@{abilityThreshold}+@{optionalModQuery}]]}} {{description=@{abilityDescription}}}">
value="@{toGmOnly}&{template:greater} {{roll=@{character_name} rolls @{abilityName}}} {{result=[[1d6+@{optionalModQuery}]]}} {{check=[[@{abilityThreshold}]]}} {{description=@{abilityDescription}}}">
Roll
</button>
<input type="text" name="attr_abilityName" placeholder="Name" data-i18n-placeholder="name-non-head" />
@@ -623,7 +623,7 @@
</div>
</div>
</div>
<input type="hidden" name="attr_coinsOverloaded" value="0"/>
<input type="checkbox" name="attr_coinsOverloaded" value="1" style="display: none;"/>
<div class="notes-and-coins">
<div class="item-notes">
<span data-i18n="item-notes">Item Notes:</span>
@@ -1461,7 +1461,7 @@
<div class="flex roll">
<label class="inline-flex inline-flex-wide-label">
<button type="roll" name="attr_rollNPCReaction"
value="&{template:simple} {{roll=@{character_name} rolls for NPC Reaction}} {{result=[[2d6+@{chaMod}]]}}"
value="/w gm &{template:simple} {{roll=@{character_name} rolls for NPC Reaction}} {{result=[[2d6+@{chaMod}]]}} {{reaction=1}}"
data-i18n="npc-reaction">NPC
Reaction</button>
<input type="number" readOnly name="attr_chaMod" value="0" />
@@ -1718,7 +1718,6 @@
<!-- Settings Sheet -->
<div class="sheet-settings">
<h1 data-i18n="settings">Settings</h1>
<label class="setting">
<span data-i18n="situational-bonus-enabled">Situational Bonus Enabled?</span>
<select name="attr_situationalBonusEnabled">
<option value="enabled" selected data-i18n="enabled">Enabled</option>
@@ -1726,7 +1725,7 @@
</select>
<span data-i18n="coin-pouch-settings">Coin Pouch Max Load: Set to 0 to ignore.</span>
<input type="number" name="attr_coinPouchMaxLoad" value="0" min="0"/>
</label>
<h1 data-i18n="about">About</h1>
<p data-i18n="about-description">
@@ -1738,9 +1737,6 @@
<span data-i18n="submit-issue">Submit a feature request or bug</span>:
https://github.com/Roll20/roll20-character-sheets/issues/new
</li>
<li>
<span>Contact us in the Necrotic Gnome discord with comments or questions and ping arun_ondo</span>:
</li>
</ul>
</div>
</div>
@@ -1801,19 +1797,19 @@
{{#reaction}}
<div class="sheet-template-description">
{{#rollLess() result 3}}
<p data-i18n="reaction-hostile">Hostile, attacks</p>
<p data-i18n="reaction-hostile">Attacks</p>
{{/rollLess() result 3}}
{{#rollBetween() result 3 5}}
<p data-i18n="reaction-unfriendly">Unfriendly, may attack</p>
<p data-i18n="reaction-unfriendly">Hostile, may attack</p>
{{/rollBetween() result 3 5}}
{{#rollBetween() result 6 8}}
<p data-i18n="reaction-neutral">Neutral, uncertain</p>
<p data-i18n="reaction-neutral">Uncertain, wary</p>
{{/rollBetween() result 6 8}}
{{#rollBetween() result 9 11}}
<p data-i18n="reaction-indifferent">Indifferent, uninterested</p>
<p data-i18n="reaction-indifferent">Indifferent, may negotiate</p>
{{/rollBetween() result 9 11}}
{{#rollGreater() result 11}}
<p data-i18n="reaction-friendly">Friendly, helpful</p>
<p data-i18n="reaction-friendly">Eager, friendly</p>
{{/rollGreater() result 11}}
</div>
{{/reaction}}
@@ -1947,34 +1943,18 @@
});
// Attribute Changes
on("sheet:opened change:dex", function () {
updateWeaponBonuses();
const registerAbilityModWatcher = (ability, updatesWeaponBonuses = false) => {
on(`sheet:opened change:${ability}`, function () {
if (updatesWeaponBonuses) updateWeaponBonuses();
getAttrs(["dex"], function (values) {
setAttrs({ dexMod: getModifiers(values.dex) });
getAttrs([ability], function (values) {
setAttrs({ [`${ability}Mod`]: getModifiers(values[ability]) });
});
});
on("sheet:opened change:str", function () {
updateWeaponBonuses();
};
getAttrs(["str"], function (values) {
setAttrs({ strMod: getModifiers(values.str) });
});
});
on("sheet:opened change:con", function () {
getAttrs(["conMod", "con"], function (values) {
setAttrs({ conMod: getModifiers(values.con) });
});
});
on("sheet:opened change:int", function () {
getAttrs(["int"], function (values) {
setAttrs({ intMod: getModifiers(values.int) });
});
});
on("sheet:opened change:wis", function () {
getAttrs(["wis"], function (values) {
setAttrs({ wisMod: getModifiers(values.wis) });
});
["dex", "str", "con", "int", "wis"].forEach((ability) => {
registerAbilityModWatcher(ability, ability === "dex" || ability === "str");
});
on("sheet:opened change:cha change:kindred", function () {
getAttrs(["cha", "kindred"], function (values) {
@@ -2285,8 +2265,9 @@
}
);
// Update weaponAttributeBonus and weaponAttributeBonusDamage when STR or DEX changes
on("change:repeating_weapons:attackType change:str change:dex", function () {
on("change:repeating_weapons:attackType change:str change:dex change:bab change:repeating_weapons add:repeating_weapons remove:repeating_weapons", function () {
updateWeaponBonuses();
getSectionIDs("repeating_weapons", function (idArray) {
idArray.forEach(function (id) {
const attributes = ["attackType"]
@@ -2312,7 +2293,7 @@
// Set saving throws, BAB, HD, Next Level Experience
on(
"change:level change:class change:wis change:monsterHitDice change:monsterSpecialAbilities change:kindred change:customGlamours change:customRunes change:customKnacks change:customArcaneSpells change:customHolySpells",
function () {
function (eventInfo) {
const classData = {
bard: [
@@ -2602,7 +2583,15 @@
function (values) {
const charClass = values.class.toLowerCase();
const charKindred = values.kindred.toLowerCase();
const level = values.sheetTab === "character" ? parseInt(values.level, 10) : Math.ceil(values.monsterHitDice);
const characterLevel = parseInt(values.level, 10) || 0;
const monsterLevel = Math.ceil(parseFloat(values.monsterHitDice)) || 0;
const level = eventInfo.sourceAttribute === "monsterHitDice"
? monsterLevel
: eventInfo.sourceAttribute === "level"
? characterLevel
: values.sheetTab === "character"
? characterLevel
: monsterLevel;
const kindredData = {
breggle: {
@@ -2821,6 +2810,12 @@
}
}
newAttributes = {
...newAttributes,
level,
monsterHitDice: level,
};
setAttrs(newAttributes);
updateWeaponBonuses();
}
@@ -2865,6 +2860,7 @@
const isOverloaded = (type === "slots" && total > maxLoad && maxLoad !== 0) ? "1" : "0";
console.log("Encumbrance Check:", { type, pp, gp, sp, cp, maxLoad, total, isOverloaded });
setAttrs({ coinsOverloaded: isOverloaded });
});
});