Skip to content

Commit

Permalink
Hotfix for an issue with learning rolls and tax
Browse files Browse the repository at this point in the history
Fixed an issue where attributes that don't have a tax property where
rolling NaN dice (defaulting to 1) when skills rooted in those
attributes were being tested via beginner's luck

Also, fixes a UI issue where the forte tax cap was incorrectly being
calculated in the spells section of the sheet.

Updates version to 0.3.2
  • Loading branch information
StasTserk committed Aug 30, 2020
1 parent 0e7ab25 commit b873a81
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
13 changes: 13 additions & 0 deletions module/burningwheel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ function registerHelpers() {
Handlebars.registerHelper("slugify", (value: string) => {
return slugify(value.toLowerCase());
});

Handlebars.registerHelper("add", (...args): number => {
return (Array.prototype.slice.call(args, 0, -1) as (string|number)[]).reduce<number>((acc: number, val) => {
if (typeof val === "number") {
return acc + val as number;
}
return acc + parseInt(val as string);
}, 0);
});

Handlebars.registerHelper("sub", (a: string, b: string): number => {
return parseInt(a) - parseInt(b);
});
}


Expand Down
2 changes: 1 addition & 1 deletion module/rolls/rollLearning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function buildLearningDialog({ skill, statName, sheet, extraInfo, dataPres
const actor = sheet.actor as BWActor;
const stat = getProperty(actor.data.data, statName);

let tax;
let tax = 0;
if (statName.toLowerCase() === "will") {
tax = sheet.actor.data.data.willTax;
} else if (statName.toLowerCase() === "forte") {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "burningwheel",
"version": "0.3.1",
"version": "0.3.2",
"description": "Foundry VTT Implementation for The Burning Wheel",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "burningwheel",
"title": "The Burning Wheel",
"description": "Community Foundry implementation of The Burning Wheel",
"version": "0.3.1",
"version": "0.3.2",
"templateVersion": 10,
"author": "Stas Tserkovny",
"esmodules": [
Expand All @@ -24,5 +24,5 @@
"gridUnits": "ft",
"url": "https://github.com/StasTserk/foundry-burningwheel",
"manifest": "https://raw.githubusercontent.com/StasTserk/foundry-burningwheel/master/system.json",
"download": "https://github.com/StasTserk/foundry-burningwheel/releases/download/0.3.1/release0.3.1.zip"
"download": "https://github.com/StasTserk/foundry-burningwheel/releases/download/0.3.2/release0.3.2.zip"
}
2 changes: 1 addition & 1 deletion templates/character-sheet.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
<div>
Forte Tax
</div>
<div><input type="number" name="data.forteTax" value="{{data.forteTax}}" data-dtype="Number" class="exponent"> / {{plusone data.maxObSustained}}</div>
<div><input type="number" name="data.forteTax" value="{{data.forteTax}}" data-dtype="Number" class="exponent"> / {{sub data.forte.exp data.ptgs.woundDice}}</div>

<div>
Maximum Sustainable Obstacle
Expand Down

0 comments on commit b873a81

Please sign in to comment.