SWN Revised v2.4.7 (#6117)

* Added permanent strain tracking from cyberware.

* Fix typo

* HP roll now behaves correctly with Heroic characters.

* Travel cost macro.

* Add new magic skills, also add option in weapon skill list.

* Fix typo

* Readme

* Number of attacks for NPCs upped to 8

* Add magic effort

* Final tweaks to magic effort

* Space Magic finished

* Changelog

* Add i18n to missing Innate AC

* changelog

* Fix version number

* Build html

* Fix for upgrade code stopping early

* Fix HP roll looking for con_bonus in stead of constitution_mod

* Remove incorrect field title

* Versioning

* Changelog

* Revert "SWN Revised v2.4.0 (#5124)"

This reverts commit caf89367c5.

* Fix cyberware strain sum being horribly broken

* Incorrect title text for permanent strain extra field

* Fix stray space nullifying a on(change) call

* Changelog

* V2.4.4

* Fix inconsistent field name HP_MAX on the NPC sheet - the correct way to write this is HP_max.
* Link the name input on the PC sheet to the character_name attribute.
* Fix misspelling of "Initiative" in translations, which was not propagated from  translation.json

Fixes #62, #65, and #70.

* Fixes #69

* Remove accidental incorrect maths added in last commit.

* Fix @{name} instead of @{character_name}

* Fix initiative another way

* Fix maths in travel cost macro.

* Add space to track attribte boosts. Closes #51

* Add ship autofill price data.

* Ship price multiplier

* Rebuild html/css

* Fix readme and sheet version.

* Make strain and encumbrance count boosts correctly

* Collapse attr base and boosts into attr in display mode.

Move current attr to attr_base, attr becomes attr_base+attr_boosts

* Fix new sheets not treating attr_base properly.

* Changelog

Co-authored-by: Jakob Oesinghaus <deceptive.duality@gmail.com>
This commit is contained in:
Karlinator
2020-04-13 11:06:47 -07:00
committed by GitHub
co-authored by Jakob Oesinghaus
parent e4a6847e09
commit 601a9da5f3
4 changed files with 50 additions and 15 deletions
+5
View File
@@ -42,6 +42,11 @@ on Github.
## Changelog
### 2.4.7
* Fix attribute boosts not being counted correctly for encumbrance and system strain.
* Collapse attribute base and boosts fields into a single field in display mode.
### 2.4.6
* Add a box to keep track of attribute boosts.
@@ -151,8 +151,10 @@ input(type="hidden", name="attr_magic_type", value="arcanist").magic-type
thead
tr
th
th(data-i18n="BASE")
th(data-i18n="BOOSTS")
th(data-i18n="BASE").edit
th(data-i18n="BOOSTS").edit
th(data-i18n="TOTAL").edit
th(data-i18n="ATTRIBUTE").display
th(data-i18n="BONUS")
th(data-i18n="MODIFIER")
tbody
@@ -160,12 +162,15 @@ input(type="hidden", name="attr_magic_type", value="arcanist").magic-type
each attr in attributes
tr
td(data-i18n=attr.toUpperCase(), data-i18n-title=`${attr.toUpperCase()}_DESC`)
td.edit
input(type="number", name=`attr_${attr}_base`, value="10")
//span(name=`attr_${attr}`).display
td.edit
input(type="number", name=`attr_${attr}_boosts`, value="0")
//span(name=`attr_${attr}_boosts`).display
td
input(type="number", name=`attr_${attr}`, value="10").edit
span(name=`attr_${attr}`).display
td
input(type="number", name=`attr_${attr}_boosts`, value="0").edit
span(name=`attr_${attr}_boosts`).display
//input(type="number", name=`attr_${attr}_boosts`, value="0").edit
span(name=`attr_${attr}`)
td
input(type="number", name=`attr_${attr}_bonus`, value="0").edit
span(name=`attr_${attr}_bonus`).display
+31 -6
View File
@@ -3,7 +3,7 @@
"use strict";
/* Data constants */
const sheetName = "Stars Without Number (revised)";
const sheetVersion = "2.4.6";
const sheetVersion = "2.4.7";
const translate = getTranslationByKey;
const attributes = ["strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma"];
const effortAttributes = ["wisdom_mod", "constitution_mod", "psionics_extra_effort",
@@ -2012,7 +2012,7 @@
const calculateMaxStrain = () => {
getAttrs(["constitution", "strain_max"], v => {
mySetAttrs({
strain_max: v.constitution
strain_max: parseInt(v.constitution)
}, v);
});
};
@@ -2045,15 +2045,26 @@
});
};
const calculateAttr = (attr) => {
getAttrs([attr, `${attr}_base`, `${attr}_boosts`], v => {
const setting = {
[`${attr}`]: `${(parseInt(v[`${attr}_base`]) || 10) + (parseInt(v[`${attr}_boosts`]) || 0)}`
};
mySetAttrs(setting, v, null, () => {
calculateMod(attr);
});
});
}
const calculateMod = (attr) => {
getAttrs([attr, `${attr}_bonus`, `${attr}_boosts`, `${attr}_mod`], v => {
getAttrs([attr, `${attr}_bonus`, `${attr}_mod`], v => {
const mod = (value => {
if (value >= 18) return 2;
else if (value >= 14) return 1;
else if (value >= 8) return 0;
else if (value >= 4) return -1;
else return -2;
})((parseInt(v[attr]) || 10) + parseInt(v[`${attr}_boosts`]) || 0);
})(parseInt(v[attr]) || 10);
const setting = {
[`${attr}_mod`]: `${mod + (parseInt(v[`${attr}_bonus`]) || 0)}`
@@ -2137,7 +2148,7 @@
...armorIDs.filter(id => v[`repeating_armor_${id}_armor_status`] === "READIED")
.map(id => parseInt(v[`repeating_armor_${id}_armor_encumbrance_bonus`]) || 0)
);
const gear_stowed_max = (parseInt(v.strength) || 0) + armor_encumbrance_bonus;
const gear_stowed_max = parseInt(v.strength) + armor_encumbrance_bonus;
const gear_readied_max = Math.floor(gear_stowed_max / 2);
const setting = {
gear_readied,
@@ -3153,6 +3164,19 @@
calculateCyberwareStrain();
upgradeSheet("2.4.3");
}
/** v2.4.7
* Move attr to attr_base, and recalculate attr
**/
else if (major == 2 && minor == 4 && patch < 7) {
attributes.forEach(attr => {
getAttrs([attr, `${attr}_base`], v => {
mySetAttrs({[`${attr}_base`]: parseInt(v[`${attr}`] || 10)}, v, null, () => {
calculateAttr(attr);
});
});
});
upgradeSheet("2.4.7");
}
/** Final upgrade clause, always leave this around */
else upgradeSheet(sheetVersion, false, true);
};
@@ -3563,7 +3587,8 @@
/* Character sheet */
on("change:class", fillClassStats);
attributes.forEach(attr => on(`change:${attr} change:${attr}_boosts change:${attr}_bonus`, () => calculateMod(attr)));
attributes.forEach(attr => on(`change:${attr}_base change:${attr}_boosts`, () => calculateAttr(attr)));
attributes.forEach(attr => on(`change:${attr} change:${attr}_bonus`, () => calculateMod(attr)));
on(weaponDisplayEvent, generateWeaponDisplay);
File diff suppressed because one or more lines are too long