Merge pull request #327 from felixlinker/sb-fixes

Fixes for shieldboost mods and special effects on shield booster
This commit is contained in:
William
2018-07-20 07:29:49 +10:00
committed by GitHub
2 changed files with 5 additions and 16 deletions

View File

@@ -145,6 +145,8 @@ export default class Module {
result = result + modValue;
} else if (modification.method === 'overwrite') {
result = modValue;
} else if (name === 'shieldboost') {
result = (1 + result) * (1 + modValue) - 1;
} else {
result = result * (1 + modValue);
}

View File

@@ -294,21 +294,6 @@ export function getBlueprint(name, module) {
return {};
}
const blueprint = JSON.parse(JSON.stringify(found));
if (module) {
if (module.grp === 'sb') {
// Shield boosters are treated internally as straight modifiers, so rather than (for example)
// being a 4% boost they are a 104% multiplier. We need to fix the values here so that they look
// accurate as per the information in Elite
for (const grade in blueprint.grades) {
for (const feature in blueprint.grades[grade].features) {
if (feature === 'shieldboost') {
blueprint.grades[grade].features[feature][0] = ((1 + blueprint.grades[grade].features[feature][0]) * (1 + module.shieldboost) - 1) / module.shieldboost - 1;
blueprint.grades[grade].features[feature][1] = ((1 + blueprint.grades[grade].features[feature][1]) * (1 + module.shieldboost) - 1) / module.shieldboost - 1;
}
}
}
}
}
return blueprint;
}
@@ -387,7 +372,9 @@ export function getPercent(m) {
let value = _getValue(m, featureName);
let mult;
if (Modifications.modifications[featureName].higherbetter) {
if (featureName == 'shieldboost') {
mult = ((1 + value) * (1 + m.shieldboost)) - 1 - m.shieldboost;
} else if (Modifications.modifications[featureName].higherbetter) {
// Higher is better, but is this making it better or worse?
if (features[featureName][0] < 0 || (features[featureName][0] === 0 && features[featureName][1] < 0)) {
mult = Math.round((value - features[featureName][1]) / (features[featureName][0] - features[featureName][1]) * 100);