multiple fixes
Fixed skillmax calculation on career change Added overmax check on career change Fixed wrong attribute call in normal Defend roll mutliple fixes fixed crit double-template getting split by avatar in chat fixed un-empropered skill names in some templates
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
<!--
|
||||
ROLL20 CHARACTER SHEET FOR WARLOCK! OSR BY OOSHP
|
||||
V 0.3.0
|
||||
-->
|
||||
<div class="war-outer">
|
||||
<div class="war-header">
|
||||
<div class="header-charname">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- ATTACK & SKILL ROLL TEMPLATE -->
|
||||
<rolltemplate class="sheet-rolltemplate-wart-roll">
|
||||
<div class="sheet-wart-outer" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<div class="sheet-wart-outer{{#class}} sheet-{{class}}{{/class}}" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<!-- NON-REACT HEADER/BODY -->
|
||||
{{^react}}
|
||||
<div class="sheet-wart-header">
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
<!-- DAMAGE TEMPLATE -->
|
||||
<rolltemplate class="sheet-rolltemplate-wart-damage">
|
||||
<div class="sheet-wart-outer" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<div class="sheet-wart-outer{{#class}} sheet-{{class}}{{/class}}" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<div class="sheet-wart-header">
|
||||
<div class="sheet-wart-title" style="background-color:{{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}}">
|
||||
{{title}}
|
||||
@@ -315,7 +315,7 @@
|
||||
<!-- DESCRIPTION TEMPLATE -->
|
||||
<rolltemplate class="sheet-rolltemplate-wart-description">
|
||||
{{#title}}<div class="sheet-wart-spacer sheet-header"></div>{{/title}}
|
||||
<div class="sheet-wart-outer" style="border-color: {{#color}}{{color}}{{/color}}{{^color}}#363905{{/color}};">
|
||||
<div class="sheet-wart-outer{{#class}} sheet-{{class}}{{/class}}" style="border-color: {{#color}}{{color}}{{/color}}{{^color}}#363905{{/color}};">
|
||||
{{#title}}
|
||||
<div class="sheet-wart-header">
|
||||
<div class="sheet-wart-title" style="background-color:{{#color}}{{color}}{{/color}}{{^color}}#121101{{/color}}">
|
||||
@@ -375,12 +375,12 @@
|
||||
</div>
|
||||
{{/description}}
|
||||
<div class="sheet-wart-allprops">
|
||||
{{#allprops() optionroll subheader title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
{{#allprops() optionroll subheader class title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
<div class="sheet-wart-row sheet-allprops">
|
||||
<div class="sheet-allprop sheet-key">{{key}}</div>
|
||||
<div class="sheet-allprop sheet-value">{{value}}</div>
|
||||
</div>
|
||||
{{/allprops() optionroll subheader title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
{{/allprops() optionroll subheader class title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
</div>
|
||||
</div>
|
||||
{{#charname}}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
**/
|
||||
const version = {
|
||||
M: 0,
|
||||
m: 3,
|
||||
p: 0,
|
||||
m: 4,
|
||||
p: 2,
|
||||
current() {return `${this.M}.${this.m}.${this.p}`},
|
||||
integer() {return parseInt(`${this.M}${this.m}${this.p}`)}
|
||||
};
|
||||
@@ -239,10 +239,7 @@ const versionControl = async (gotVersion) => {
|
||||
if (latestVersion === gotVersion) return h.log(`Sheet is up to date`, 'info', `versionControl`);
|
||||
let currentVersion = /\d+\.\d+\.\d+/.test(gotVersion) ? parseInt(gotVersion.replace(/\D/g, '')) : 0;
|
||||
|
||||
if (currentVersion < 20) {
|
||||
// NO ATTR CHANGES
|
||||
}
|
||||
if (currentVersion < 30) {
|
||||
if (currentVersion < 42) {
|
||||
//NO ATTR CHANGES
|
||||
}
|
||||
|
||||
@@ -504,10 +501,12 @@ const warSheet = (() => {
|
||||
h.log(`${sk}: ${attrs[sk]}, parse ${parseInt(attrs[sk])}`)
|
||||
let nonBoostedMax = Math.min(parseInt(attrs[sk])??0, 6),
|
||||
careerMax = parseInt(careerSkills[sk])||0,
|
||||
current = parseInt(attrs[sk]),
|
||||
currentMax = parseInt(attrs[`${sk}_max`])||0,
|
||||
isProf = (careerSkillNames.includes(sk)) ? true : false;
|
||||
output[`${sk}_max`] = (attrs[`${sk}_boosted`] == 1) ? Math.max(currentMax, careerMax) : (isProf) ? careerMax : nonBoostedMax;
|
||||
output[`${sk}_max`] = isProf ? careerMax : (attrs[`${sk}_boosted`] == 1) ? Math.min(currentMax, current) : nonBoostedMax;
|
||||
output[`${sk}_prof`] = (isProf) ? 1 : 0;
|
||||
if (output[`${sk}_max`] < current) output[`${sk}_overmax`] = 1;
|
||||
h.log(`${sk} max set to: ${output[`${sk}_max`]}, nbm: ${nonBoostedMax}`);
|
||||
});
|
||||
h.log(output, 'info', `Career switch completed`);
|
||||
@@ -1177,8 +1176,8 @@ const roll = (() => {
|
||||
// Standard Defence roll
|
||||
const defendRoll = async (rowId) => {
|
||||
let wp = await prop.getWeaponAttrs(rowId),
|
||||
rollExpression = h.combineRollParts(wp.damage, null, wp.globalDamage);
|
||||
let rollBase = `${t.roll}${prop.name}${color.defend}{{title=Defend Roll}}{{subheader=${h.emproper(wp.name)}}} {{roll1name=+${rollExpression}}} {{roll1=[[${rollExpression}]]}}`;
|
||||
rollExpression = h.combineRollParts(wp.skill, wp.skillBonus, null, {base: h.emproper(wp.skillName)||'Skill'});
|
||||
let rollBase = `${t.roll}${prop.name}${color.defend}{{title=Defend Roll}}{{subheader=${h.emproper(wp.name)}}} {{roll1name=+${rollExpression}}} {{roll1=[[${prop.coreDie} + ${rollExpression}]]}}`;
|
||||
let defendRoll = await startRoll(rollBase);
|
||||
finishRoll(defendRoll.rollId);
|
||||
}
|
||||
@@ -1204,7 +1203,7 @@ const roll = (() => {
|
||||
let critRollTop = await startRoll(critTop);
|
||||
let critResult = Math.min(10, Math.max(critRollTop.results.subtitle.result, 2));
|
||||
let critString = warlockData.critTables[damageType][critResult];
|
||||
let critBottom = `${t.desc}${prop.name}{{description=${critString}}}`;
|
||||
let critBottom = `${t.desc}${prop.name}{{class=bottom}}{{description=${critString}}}`;
|
||||
let critRollBottom = await startRoll(critBottom);
|
||||
await finishRoll(critRollTop.rollId);
|
||||
finishRoll(critRollBottom.rollId);
|
||||
|
||||
@@ -1359,7 +1359,7 @@ input[name*="options-flag"][value="1"] ~ .foldable {
|
||||
}
|
||||
|
||||
/* ROLL TEMPLATES */
|
||||
/* WART-ROLL */
|
||||
/* WART-ROLL && COMMON */
|
||||
.sheet-rolltemplate-wart-roll .sheet-wart-outer,
|
||||
.sheet-rolltemplate-wart-damage .sheet-wart-outer,
|
||||
.sheet-rolltemplate-wart-description .sheet-wart-outer {
|
||||
@@ -1736,6 +1736,15 @@ input[name*="options-flag"][value="1"] ~ .foldable {
|
||||
}
|
||||
|
||||
/* DESCRIPTION TEMPLATE */
|
||||
|
||||
/* Trick to stop the double-template getting cut by the avatar on 6th/7th post */
|
||||
.sheet-rolltemplate-wart-description:not(:first-child) {
|
||||
position: relative;
|
||||
}
|
||||
.sheet-rolltemplate-wart-description:not(:first-child) .sheet-wart-outer.sheet-sheet-bottom {
|
||||
position: relative;
|
||||
margin-top: -28px;
|
||||
}
|
||||
.sheet-rolltemplate-wart-description {
|
||||
text-align: center;
|
||||
margin: -2px 5% -7px -10%;
|
||||
|
||||
+22
-23
@@ -1,8 +1,9 @@
|
||||
<!-- START OF CHARACTER SHEET -->
|
||||
<!--
|
||||
ROLL20 CHARACTER SHEET FOR WARLOCK! OSR BY OOSHP
|
||||
V 0.3.0
|
||||
V 0.4.2
|
||||
-->
|
||||
|
||||
<!-- START OF CHARACTER SHEET -->
|
||||
<div class="war-outer">
|
||||
<div class="war-header">
|
||||
<div class="header-charname">
|
||||
@@ -620,9 +621,10 @@ V 0.3.0
|
||||
<option value="days">Days</option>
|
||||
<option value="weeks">Weeks</option>
|
||||
</select>
|
||||
<!-- NOT YET IMPLEMENTED
|
||||
<div class="sub-sub-option">
|
||||
<label title="Display an alert when the character takes an action - only works for 'Rounds' duration type">Alert: <input type="checkbox" name="alert" value="0"/></label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="repeating option">
|
||||
@@ -766,9 +768,10 @@ V 0.3.0
|
||||
<option value="days">Days</option>
|
||||
<option value="weeks">Weeks</option>
|
||||
</select>
|
||||
<!-- NOT YET IMPLEMENTED
|
||||
<div class="sub-sub-option">
|
||||
<label title="Display an alert when the character takes an action - only works for 'Rounds' duration type">Alert: <input type="checkbox" name="alert" value="0"/></label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="repeating option">
|
||||
@@ -1259,7 +1262,7 @@ V 0.3.0
|
||||
<!-- ROLL TEMPLATES -->
|
||||
<!-- ATTACK & SKILL ROLL TEMPLATE -->
|
||||
<rolltemplate class="sheet-rolltemplate-wart-roll">
|
||||
<div class="sheet-wart-outer" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<div class="sheet-wart-outer{{#class}} sheet-{{class}}{{/class}}" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<!-- NON-REACT HEADER/BODY -->
|
||||
{{^react}}
|
||||
<div class="sheet-wart-header">
|
||||
@@ -1433,7 +1436,7 @@ V 0.3.0
|
||||
|
||||
<!-- DAMAGE TEMPLATE -->
|
||||
<rolltemplate class="sheet-rolltemplate-wart-damage">
|
||||
<div class="sheet-wart-outer" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<div class="sheet-wart-outer{{#class}} sheet-{{class}}{{/class}}" style="border: 5px solid {{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}};">
|
||||
<div class="sheet-wart-header">
|
||||
<div class="sheet-wart-title" style="background-color:{{#color}}{{color}}{{/color}}{{^color}}#14197e{{/color}}">
|
||||
{{title}}
|
||||
@@ -1463,7 +1466,7 @@ V 0.3.0
|
||||
<div class="sheet-wart-rolls sheet-react">
|
||||
<div class="sheet-wart-damageroll sheet-react">
|
||||
<div class="sheet-wart-damagename sheet-react">{{damageroll1name}}</div>
|
||||
<div class="sheet-wart-damageresult">{{#mighty}}<span class="sheet-mighty-three">3</span>x{{/mighty}}{{damageroll1}}{{damagetype}}</div>
|
||||
<div class="sheet-wart-damageresult">{{#mighty}}<span class="sheet-mighty-three">2</span>x{{/mighty}}{{damageroll1}}{{damagetype}}</div>
|
||||
</div>
|
||||
<div class="sheet-wart-defence sheet-react">
|
||||
<div class="sheet-wart-defencename">{{defencename}}</div>
|
||||
@@ -1574,7 +1577,7 @@ V 0.3.0
|
||||
<!-- DESCRIPTION TEMPLATE -->
|
||||
<rolltemplate class="sheet-rolltemplate-wart-description">
|
||||
{{#title}}<div class="sheet-wart-spacer sheet-header"></div>{{/title}}
|
||||
<div class="sheet-wart-outer" style="border-color: {{#color}}{{color}}{{/color}}{{^color}}#363905{{/color}};">
|
||||
<div class="sheet-wart-outer{{#class}} sheet-{{class}}{{/class}}" style="border-color: {{#color}}{{color}}{{/color}}{{^color}}#363905{{/color}};">
|
||||
{{#title}}
|
||||
<div class="sheet-wart-header">
|
||||
<div class="sheet-wart-title" style="background-color:{{#color}}{{color}}{{/color}}{{^color}}#121101{{/color}}">
|
||||
@@ -1634,12 +1637,12 @@ V 0.3.0
|
||||
</div>
|
||||
{{/description}}
|
||||
<div class="sheet-wart-allprops">
|
||||
{{#allprops() optionroll subheader title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
{{#allprops() optionroll subheader class title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
<div class="sheet-wart-row sheet-allprops">
|
||||
<div class="sheet-allprop sheet-key">{{key}}</div>
|
||||
<div class="sheet-allprop sheet-value">{{value}}</div>
|
||||
</div>
|
||||
{{/allprops() optionroll subheader title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
{{/allprops() optionroll subheader class title reactbutton1name reactbutton1label reactdata optionsubtitle classdesc description reactdescription subtitle charname color option1 option2 option3 option4 option5 option6 option7 option8 option9 option10 option11 option12 option13 option14 option15 option16 option17 option18 option19 option20}}
|
||||
</div>
|
||||
</div>
|
||||
{{#charname}}
|
||||
@@ -1711,8 +1714,8 @@ V 0.3.0
|
||||
**/
|
||||
const version = {
|
||||
M: 0,
|
||||
m: 3,
|
||||
p: 0,
|
||||
m: 4,
|
||||
p: 2,
|
||||
current() {return `${this.M}.${this.m}.${this.p}`},
|
||||
integer() {return parseInt(`${this.M}${this.m}${this.p}`)}
|
||||
};
|
||||
@@ -1929,10 +1932,7 @@ V 0.3.0
|
||||
if (latestVersion === gotVersion) return h.log(`Sheet is up to date`, 'info', `versionControl`);
|
||||
let currentVersion = /\d+\.\d+\.\d+/.test(gotVersion) ? parseInt(gotVersion.replace(/\D/g, '')) : 0;
|
||||
|
||||
if (currentVersion < 20) {
|
||||
// NO ATTR CHANGES
|
||||
}
|
||||
if (currentVersion < 30) {
|
||||
if (currentVersion < 42) {
|
||||
//NO ATTR CHANGES
|
||||
}
|
||||
|
||||
@@ -2194,10 +2194,12 @@ V 0.3.0
|
||||
h.log(`${sk}: ${attrs[sk]}, parse ${parseInt(attrs[sk])}`)
|
||||
let nonBoostedMax = Math.min(parseInt(attrs[sk])??0, 6),
|
||||
careerMax = parseInt(careerSkills[sk])||0,
|
||||
current = parseInt(attrs[sk]),
|
||||
currentMax = parseInt(attrs[`${sk}_max`])||0,
|
||||
isProf = (careerSkillNames.includes(sk)) ? true : false;
|
||||
output[`${sk}_max`] = (attrs[`${sk}_boosted`] == 1) ? Math.max(currentMax, careerMax) : (isProf) ? careerMax : nonBoostedMax;
|
||||
output[`${sk}_max`] = isProf ? careerMax : (attrs[`${sk}_boosted`] == 1) ? Math.min(currentMax, current) : nonBoostedMax;
|
||||
output[`${sk}_prof`] = (isProf) ? 1 : 0;
|
||||
if (output[`${sk}_max`] < current) output[`${sk}_overmax`] = 1;
|
||||
h.log(`${sk} max set to: ${output[`${sk}_max`]}, nbm: ${nonBoostedMax}`);
|
||||
});
|
||||
h.log(output, 'info', `Career switch completed`);
|
||||
@@ -2867,8 +2869,8 @@ V 0.3.0
|
||||
// Standard Defence roll
|
||||
const defendRoll = async (rowId) => {
|
||||
let wp = await prop.getWeaponAttrs(rowId),
|
||||
rollExpression = h.combineRollParts(wp.damage, null, wp.globalDamage);
|
||||
let rollBase = `${t.roll}${prop.name}${color.defend}{{title=Defend Roll}}{{subheader=${h.emproper(wp.name)}}} {{roll1name=+${rollExpression}}} {{roll1=[[${rollExpression}]]}}`;
|
||||
rollExpression = h.combineRollParts(wp.skill, wp.skillBonus, null, {base: h.emproper(wp.skillName)||'Skill'});
|
||||
let rollBase = `${t.roll}${prop.name}${color.defend}{{title=Defend Roll}}{{subheader=${h.emproper(wp.name)}}} {{roll1name=+${rollExpression}}} {{roll1=[[${prop.coreDie} + ${rollExpression}]]}}`;
|
||||
let defendRoll = await startRoll(rollBase);
|
||||
finishRoll(defendRoll.rollId);
|
||||
}
|
||||
@@ -2894,7 +2896,7 @@ V 0.3.0
|
||||
let critRollTop = await startRoll(critTop);
|
||||
let critResult = Math.min(10, Math.max(critRollTop.results.subtitle.result, 2));
|
||||
let critString = warlockData.critTables[damageType][critResult];
|
||||
let critBottom = `${t.desc}${prop.name}{{description=${critString}}}`;
|
||||
let critBottom = `${t.desc}${prop.name}{{class=bottom}}{{description=${critString}}}`;
|
||||
let critRollBottom = await startRoll(critBottom);
|
||||
await finishRoll(critRollTop.rollId);
|
||||
finishRoll(critRollBottom.rollId);
|
||||
@@ -3178,11 +3180,8 @@ V 0.3.0
|
||||
loser = attackResult[attackResult.result.loser];
|
||||
if (!winner || !loser) return h.log(attackResult, 'error', `react-damage: Couldn't determine winner from attack`);
|
||||
if (!await checkSheetPermission(winner.charname)) return h.log(`Failed action button permission check`, 'error', `react-apply-damage`);
|
||||
let rowId = winner.weaponId;
|
||||
let mightyBlow = attackResult.result.mighty ? `{{mighty=1}}` : '';
|
||||
let spellAttack = (winner.spellAttack) ? true : false;
|
||||
as.setActiveCharacterId(winner.id);
|
||||
let att = spellAttack ? await prop.getSpellAttrs(rowId) : await prop.getWeaponAttrs(rowId);
|
||||
as.setActiveCharacterId(loser.id);
|
||||
let def = await as.getAttrs(['armour_value', 'armour_items', 'stamina']);
|
||||
//h.log(d, 'info', `loser defence`);
|
||||
|
||||
Reference in New Issue
Block a user