Skip to content

Commit

Permalink
Merge pull request #12995 from clevett/pendragonv2.41
Browse files Browse the repository at this point in the history
Pendragon 6th Editoin v 2.41
  • Loading branch information
NorWhal authored Jun 11, 2024
2 parents 3860310 + cf51b33 commit fc7cb2d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Pendragon6thEdition/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pendragon6thedition",
"version": "2.4.0",
"version": "2.4.1",
"description": "You need to run npm start to get the compilers going.",
"dependencies": {
"20": "^3.1.9",
Expand Down
60 changes: 25 additions & 35 deletions Pendragon6thEdition/pendragon.html

Large diffs are not rendered by default.

26 changes: 16 additions & 10 deletions Pendragon6thEdition/src/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,23 @@ const round = (sum) => (sum % 1 >= 0.5 ? Math.ceil(sum) : Math.floor(sum));
const total = (v) =>
Object.values(v).reduce((partialSum, a) => partialSum + parseFloat(a), 0);

characteristics.brawlDamage.forEach((attr) => {
on(`change:${attr}`, () => {
getAttrs(characteristics.brawlDamage, (values) => {
//Brawl Damage = (STR+SIZ)/6
const damage = round(total(values) / 6);
setAttrs({
brawling_damage: `${damage}d6`,
brawling_damage_open: `${round(damage / 2)}d6`,
});
});
const updateBrawling = () => {
const brawlingDamage = (values) => {
//Brawl Damage = (STR+SIZ)/6
const damage = round(total(values) / 6);
return {
brawling_damage: `${damage}`,
brawling_damage_open: `${round(damage / 2)}`,
};
};

getAttrs(characteristics.brawlDamage, (values) => {
setAttrs(brawlingDamage(values));
});
};

characteristics.brawlDamage.forEach((attr) => {
on(`change:${attr}`, () => updateBrawling());
});

characteristics.movement.forEach((attr) => {
Expand Down
26 changes: 7 additions & 19 deletions Pendragon6thEdition/src/js/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ const versionTwoFour = () => {
});
};

const versionTwoThree = () => {
getAttrs(characteristics.brawlDamage, (values) => {
//Brawl Damage = (STR+SIZ)/6
const damage = round(total(values) / 6);
setAttrs({
brawling_damage: `${damage}d6`,
brawling_damage_open: `${round(damage / 2)}d6`,
});
});
};

const versioning = async (version) => {
const updateMessage = (v) =>
console.log(
Expand All @@ -37,19 +26,18 @@ const versioning = async (version) => {
switch (true) {
case version < 1:
versioning(1);
console.log(updateMessage(1));
break;
case version < 2.3:
console.log(updateMessage(2.3));
versionTwoThree();
versioning(2.3);
updateMessage(1);
break;
case version < 2.4:
console.log(updateMessage(2.4));
versionTwoThree();
updateMessage(2.4);
versionTwoFour();
versioning(2.4);
break;
case version < 2.41:
updateMessage(2.41);
updateBrawling();
versioning(2.41);
break;
default:
console.log(
`%c Pendragon 6th Edition is update to date.`,
Expand Down
4 changes: 2 additions & 2 deletions Pendragon6thEdition/src/pendragon.pug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//- Semantic Versioning MAJOR.MINORPATCH
input(name='attr_version' type='hidden' value='2.4')
input(name='attr_version' type='hidden' value='2.41')

//- Do not manually change this. Hidden attribute used by versioning script
input(name='attr_latest_versioning_upgrade' type='hidden' value='1')
Expand Down Expand Up @@ -56,7 +56,7 @@ div
.footer
.div
span.mr © 2023 Chaosium Inc.
span Version
span.mr Version
span(name='attr_version')

//-ROLL TEMPLATE
Expand Down

0 comments on commit fc7cb2d

Please sign in to comment.