diff --git a/CHANGELOG.md b/CHANGELOG.md index 84dc72f..3e5e13d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ☮️ Peace in the world, or the world in pieces. 🕊️ ### Added - New translation strings, Radiation Centre is now fully localised. +- Support for the Soak Bonus modifier in SWADE. The Soak macro tries to exclude edges which are already set up with an Active Effect but that's not a fuzzy search so it will only exclude its own Edge findings if the edges corresponding AE is named *exactly* like the edge itself. Otherwise it will add the bonus twice. There is no real way around it as it could cause false matchings if I were to introduce a fuzzy search. ### Changed - Mighty Summoner will now summon tokens without actor link to prevent changes to the original actor. This means GMs don't have to unlink the prototype tokens manually anymore. - Overhauled the Radiation Centre Macro: @@ -15,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - - Radiation Centre *does* however add an Active Effect if the actor becomes Incapacitated from radiation: As in core this AE represents a chronic disease. A chat message will be created in this case. ### Fixed - Bug in the Radiation Centre which made it non-functional for NPCs. +- Bugs in Ammo Management resulting from the overhaul in SWADE. ### Deprecated - The Irradiated condition was deprecated to suit the new SUCC version better. - Combat setup button as the function behind it is a little buggy and due for an overhaul. Let me know if anyone ever used it, otherwise it won't be a priority. diff --git a/swim/scripts/swim_modules/soak_damage.js b/swim/scripts/swim_modules/soak_damage.js index 3b11371..41d11be 100644 --- a/swim/scripts/swim_modules/soak_damage.js +++ b/swim/scripts/swim_modules/soak_damage.js @@ -1,6 +1,6 @@ /******************************************* * Soak Damage - * v. 5.2.5 + * v. 5.3.0 * Code by SalieriC#8263. *******************************************/ export async function soak_damage_script(effect = false) { @@ -75,9 +75,53 @@ export async function soak_damage_script(effect = false) { }); let rollWithEdge = r.total; let edgeText = ""; + + //Get generic actor unstun bonus and check if it is from an AE: + const soakBonus = token.actor.system.attributes.vigor.soakBonus + let effectName = [] + let effectIcon = [] + let effectValue = [] + let soakBonusFromEffects = 0 + if (token.actor.effects.size > 0) { + for (let effect of token.actor.effects) { + if (effect.disabled === false && !edgeNames.includes(effect.label)) { // only apply changes if effect is enabled and not made by a recognised Edge. + for (let change of effect.changes) { + if (change.key === "system.attributes.vigor.soakBonus") { + //Building array of effect names and icons that affect the unStunBonus + effectName.push(effect.label) + effectIcon.push(effect.icon) + effectValue.push(change.value) + soakBonusFromEffects += change.value + } + } + } + } + for (let i = 0; i < effectName.length; i++) { + // Apply mod using parseFloat() to make it a Number: + rollWithEdge += parseFloat(effectValue[i]); + // Change indicator in case the modifier from AE is negative: + let indicator = "+"; + let effectMod = effectValue[i]; + if (parseFloat(effectValue[i]) < 0) { + indicator = "-"; + effectMod = effectValue[i].replace("-", ""); + } + edgeText += `
${indicator} ${effectMod} ${effectName[i]}`; + } + } if (soakBonus > soakBonusFromEffects) { //Add remaining UnstunBonus if it is bigger than those from AEs: + const remainingBonus = soakBonus - soakBonusFromEffects + rollWithEdge += parseFloat(remainingBonus); + edgeText += `
+ ${remainingBonus} Generic Bonus`; + } + + //Now check for edges but don't include them if they are already covered by AEs: for (let edge of edges) { - rollWithEdge += 2; - edgeText += `
+ 2 ${edge.name}`; + //Only add if the edge name is not included in effect names: + const lowercaseEffectNames = effectName.map(element => element.toLowerCase()) + if (!lowercaseEffectNames.includes(edge.name.toLowerCase())) { //This is deliberately not a fuzzy search as that could cause issues. + rollWithEdge += 2; + edgeText += `
+ 2 ${edge.name}`; + } } // If Holy Warrior or Unholy Warrior is used: Include the amount of PPs used as a bonus to the roll. diff --git a/wiki b/wiki index 6887d4f..9ed27c8 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 6887d4f13407fec13d27e09bda0ad8a99c2e1b24 +Subproject commit 9ed27c8ddd7fd74f9509a9fe343237ea251ebfed