diff --git a/src/app/utils/BlueprintFunctions.js b/src/app/utils/BlueprintFunctions.js index dcaf9555..7dcddf04 100644 --- a/src/app/utils/BlueprintFunctions.js +++ b/src/app/utils/BlueprintFunctions.js @@ -26,17 +26,32 @@ export function blueprintTooltip(translate, features, m) lowerBound = Math.round(lowerBound * 1000) / 10; upperBound = Math.round(upperBound * 1000) / 10; } - const range = `${lowerBound}${symbol} - ${upperBound}${symbol}`; + const lowerIsBeneficial = isValueBeneficial(feature, lowerBound); + const upperIsBeneficial = isValueBeneficial(feature, upperBound); if (m) { // We have a module - add in the current value let current = m.getModValue(feature); if (featureDef.type === 'percentage' || featureDef.name === 'burst' || featureDef.name === 'burstrof') { current = Math.round(current / 10) / 10; } - results.push({translate(feature)}{lowerBound}{symbol}{current}{symbol}{upperBound}{symbol}); + const currentIsBeneficial = isValueBeneficial(feature, current); + results.push( + + {translate(feature)} + {lowerBound}{symbol} + {current}{symbol} + {upperBound}{symbol} + + ); } else { // We do not have a module, no value - results.push({translate(feature)}{lowerBound}{symbol}{upperBound}{symbol}); + results.push( + + {translate(feature)} + {lowerBound}{symbol} + {upperBound}{symbol} + + ); } } } @@ -71,6 +86,18 @@ export function isBeneficial(feature, values) { } } +/** + * Is this feature value beneficial? + * + */ +export function isValueBeneficial(feature, value) { + if (Modifications.modifications[feature].higherbetter) { + return value > 0; + } else { + return value < 0; + } +} + /** * Get a blueprint with a given name and an optional module * @param {string} name The name of the blueprint