Skip to content

Commit

Permalink
Merge pull request #3984 from Karlinator/v2.3.1
Browse files Browse the repository at this point in the history
[SWN: Revised] v2.3.1
  • Loading branch information
Solarswordsman committed Jul 23, 2018
2 parents 31f53b8 + 9ad6f18 commit 1d29661
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
13 changes: 9 additions & 4 deletions Stars_Without_Number_Revised/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

This sheet is created for use in Stars Without Number Revised Edition on Roll20.

### Authors/Maintainers
## Authors/Maintainers

* [Karlinator](https://github.com/Karlinator)
* [Jakob](https://github.com/joesinghaus)
* [Panzer](https://app.roll20.net/users/2223776/panzer)

### Contributors
## Contributors

* [Victor M. Suarez](https://github.com/svmnotn)
* [MankiGames](https://github.com/MankiGames)
Expand All @@ -18,11 +18,11 @@ This sheet is created for use in Stars Without Number Revised Edition on Roll20.
* [CoalPoweredPuppet](https://github.com/CoalPoweredPuppet)
* Original First Edition sheet by [Kevin Searle](https://github.com/kevinsearle)

### QA/Testing
## QA/Testing

* [tipsta](https://github.com/mistatipsta)

### Feedback
## Feedback

Report any problems, suggestions, or features by [creating an issue](https://github.com/Karlinator/roll20-character-sheets/issues) on Github.

Expand All @@ -36,6 +36,11 @@ Report any problems, suggestions, or features by [creating an issue](https://git

## Changelog

### 2.3.1

* Fixed a bug causing the sheet to sometimes display an incorrect attack bonus for weapons.
* Fixed missing base attack bonus for drone attacks.

### 2.3.0

* Added drone tab
Expand Down
31 changes: 22 additions & 9 deletions Stars_Without_Number_Revised/Source/workers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* global getAttrs, setAttrs, getSectionIDs, generateRowID, on ,removeRepeatingRow, _, getTranslationByKey */
/* global getAttrs, setAttrs, getSectionIDs, generateRowID, on, removeRepeatingRow, _, getTranslationByKey */
(function () {
"use strict";
/* Data constants */
const sheetName = "Stars Without Number (revised)";
const sheetVersion = "2.3.0";
const sheetVersion = "2.3.1";
const translate = getTranslationByKey;
const attributes = ["strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma"];
const effortAttributes = ["wisdom_mod", "constitution_mod", "psionics_extra_effort",
Expand Down Expand Up @@ -2054,6 +2054,7 @@
...attributes.map(attr => `${attr}_mod`),
...weaponSkills,
"attack_bonus",
"str_dex_mod",
"macro_weapons"
];
getAttrs(sourceAttrs, v => {
Expand Down Expand Up @@ -2837,15 +2838,17 @@
`${prefix}_drone_weapon3_active`,
`${prefix}_drone_weapon3_attack`,
]);
}, ["intelligence_mod", "skill_pilot", "skill_program"]);
}, ["attack_bonus", "intelligence_mod", "skill_pilot", "skill_program"]);
getAttrs(sourceAttrs, v => {
const skillMod = Math.max(parseInt(v.skill_pilot), parseInt(v.skill_program)) || 0,
intMod = parseInt(v.intelligence_mod) || 0;
intMod = parseInt(v.intelligence_mod) || 0,
attackBonus = parseInt(v.attack_bonus) || 0;

const setting = prefixes.reduce((m, prefix) => {
[1, 2, 3].filter(num => v[`${prefix}_drone_weapon${num}_active`] === "1")
.forEach(num => {
m[`${prefix}_drone_weapon${num}_attack`] = skillMod + intMod +
m[`${prefix}_drone_weapon${num}_attack`] = intMod +
((skillMod === -1) ? -2 : skillMod) + attackBonus +
parseInt(v[[`${prefix}_drone_weapon${num}_ab`]] || 0);
});
return m;
Expand All @@ -2871,7 +2874,7 @@
const upgradeSheet = (version, firstTime = false, finalTime = false) => {
// Any version upgrade code should go here
const performUpgrade = (version) => {
const [major, minor] = version.split(".").map(x => parseInt(x));
const [major, minor, patch] = version.split(".").map(x => parseInt(x));
console.log(`Upgrading from version ${version}.`);

/** v2.1.0
Expand Down Expand Up @@ -2998,6 +3001,15 @@
});
}));
}
/** v2.3.1
* Regenerate drone and weapon ABs
**/
else if (major == 2 && (minor < 3 || (minor == 3 && patch == 0))) {
generateWeaponDisplay();
getSectionIDs("repeating_drones", idArray => {
calculateDroneAttack(idArray.map(id => `repeating_drones_${id}`));
});
}
/** Final upgrade clause, always leave this around */
else upgradeSheet(sheetVersion, false, true);
};
Expand Down Expand Up @@ -3472,9 +3484,10 @@
on(`change:repeating_drones:drone_fitting_${num}_name`, () => fillDroneFitting(num));
});
on("change:repeating_drones:drone_model", fillDroneStats);
on("change:intelligence_mod change:skill_pilot change:skill_program", () => getSectionIDs("repeating_drones", idArray => {
calculateDroneAttack(idArray.map(id => `repeating_drones_${id}`));
}));
on("change:attack_bonus change:intelligence_mod change:skill_pilot change:skill_program",
() => getSectionIDs("repeating_drones", idArray => {
calculateDroneAttack(idArray.map(id => `repeating_drones_${id}`));
}));
on([
...[1, 2, 3].map(n => `change:repeating_drones:drone_weapon${n}_ab`),
...[1, 2, 3].map(n => `change:repeating_drones:drone_weapon${n}_active`)
Expand Down

Large diffs are not rendered by default.

0 comments on commit 1d29661

Please sign in to comment.