diff --git a/ChangeLog.md b/ChangeLog.md index 48bad6ab..cd0122af 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +#2.2.7 + * Fix resistance diminishing return calculations + * Do not allow -100% to be entered as a modification value + #2.2.6 * Add pitch/roll/yaw information * Use combination of pitch, roll and yaw to provide a more useful agility metric diff --git a/__tests__/fixtures/anaconda-test-detailed-export-v4.json b/__tests__/fixtures/anaconda-test-detailed-export-v4.json index fbe1dcfa..12327c14 100644 --- a/__tests__/fixtures/anaconda-test-detailed-export-v4.json +++ b/__tests__/fixtures/anaconda-test-detailed-export-v4.json @@ -285,10 +285,10 @@ "totalThermSDps": 53.82, "baseShieldStrength": 350, "baseArmour": 945, - "hullExplRes": 0.78, - "hullKinRes": 0.73, + "hullExplRes": 0.22, + "hullKinRes": 0.27, "hullMass": 400, - "hullThermRes": 1.37, + "hullThermRes": -0.36, "masslock": 23, "pipSpeed": 0.14, "pitch": 25, @@ -316,7 +316,7 @@ "shield": 833, "shieldCells": 1840, "shieldExplRes": 0.5, - "shieldKinRes": 0.6, - "shieldThermRes": 1.2 + "shieldKinRes": 0.4, + "shieldThermRes": -0.2 } } diff --git a/src/app/components/DefenceSummary.jsx b/src/app/components/DefenceSummary.jsx index a20b1bb5..21896b90 100644 --- a/src/app/components/DefenceSummary.jsx +++ b/src/app/components/DefenceSummary.jsx @@ -31,6 +31,7 @@ export default class DefenceSummary extends TranslatedComponent { const shieldGenerator = ship.findShieldGenerator(); + // Damage values are 1 - resistance values return (

{translate('defence summary')}

@@ -52,15 +53,15 @@ export default class DefenceSummary extends TranslatedComponent { {translate('damage from')}   - {formats.pct1(ship.shieldExplRes || 1)} + {formats.pct1(1 - ship.shieldExplRes)}   - {formats.pct1(ship.shieldKinRes || 1)} + {formats.pct1(1 - ship.shieldKinRes)}   - {formats.pct1(ship.shieldThermRes || 1)} + {formats.pct1(1 - ship.shieldThermRes)} : null } @@ -76,14 +77,14 @@ export default class DefenceSummary extends TranslatedComponent { {translate('damage from')}   - {formats.pct1(ship.hullExplRes || 1)} + {formats.pct1(1 - ship.hullExplRes)}   - {formats.pct1(ship.hullKinRes || 1)} + {formats.pct1(1 - ship.hullKinRes)}   - {formats.pct1(ship.hullThermRes || 1)} + {formats.pct1(1 - ship.hullThermRes)} diff --git a/src/app/components/Modification.jsx b/src/app/components/Modification.jsx index 8c3c6062..3813681e 100644 --- a/src/app/components/Modification.jsx +++ b/src/app/components/Modification.jsx @@ -42,9 +42,9 @@ export default class Modification extends TranslatedComponent { scaledValue = 100000; value = 1000; } - if (scaledValue < -10000) { - scaledValue = -10000; - value = -100; + if (scaledValue < -9999) { + scaledValue = -9999; + value = -99.99; } let m = this.props.m; diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 0c016384..7a5313a5 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -918,11 +918,10 @@ export default class Ship { * @return {this} The ship instance (for chaining operations) */ diminishingReturns(val, drll, drul) { - if (val > drll) { - val = drll + (val - drll) / 2; - } - if (val > drul) { - val = drul; + if (val < drll) { + val = drll; + } else if (val < drul) { + val = drul - (drul - val) / 2; } return val; } @@ -1143,14 +1142,26 @@ export default class Ship { let shieldExplRes = null; let shieldKinRes = null; let shieldThermRes = null; + let shieldExplDRStart = null; + let shieldExplDREnd = null; + let shieldKinDRStart = null; + let shieldKinDREnd = null; + let shieldThermDRStart = null; + let shieldThermDREnd = null; const sgSlot = this.findInternalByGroup('sg'); if (sgSlot && sgSlot.enabled) { // Shield from generator shield = Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sgSlot.m, 1); shieldExplRes = 1 - sgSlot.m.getExplosiveResistance(); + shieldExplDRStart = shieldExplRes * 0.7; + shieldExplDREnd = shieldExplRes * 0; // Currently don't know where this is shieldKinRes = 1 - sgSlot.m.getKineticResistance(); + shieldKinDRStart = shieldKinRes * 0.7; + shieldKinDREnd = shieldKinRes * 0; // Currently don't know where this is shieldThermRes = 1 - sgSlot.m.getThermalResistance(); + shieldThermDRStart = shieldThermRes * 0.7; + shieldThermDREnd = shieldThermRes * 0; // Currently don't know where this is // Shield from boosters for (let slot of this.hardpoints) { @@ -1170,9 +1181,9 @@ export default class Ship { shield = shield * shieldBoost; this.shield = shield; - this.shieldExplRes = shieldExplRes ? 1 - this.diminishingReturns(1 - shieldExplRes, 0.5, 0.75) : null; - this.shieldKinRes = shieldKinRes ? 1 - this.diminishingReturns(1 - shieldKinRes, 0.5, 0.75) : null; - this.shieldThermRes = shieldThermRes ? 1 - this.diminishingReturns(1 - shieldThermRes, 0.5, 0.75) : null; + this.shieldExplRes = shieldExplRes ? 1 - this.diminishingReturns(shieldExplRes, shieldExplDREnd, shieldExplDRStart) : null; + this.shieldKinRes = shieldKinRes ? 1 - this.diminishingReturns(shieldKinRes, shieldKinDREnd, shieldKinDRStart) : null; + this.shieldThermRes = shieldThermRes ? 1 - this.diminishingReturns(shieldThermRes, shieldThermDREnd, shieldThermDRStart) : null; return this; } @@ -1206,8 +1217,14 @@ export default class Ship { let modulearmour = 0; let moduleprotection = 1; let hullExplRes = 1 - bulkhead.getExplosiveResistance(); + const hullExplResDRStart = hullExplRes * 0.7; + const hullExplResDREnd = hullExplRes * 0; // Currently don't know where this is let hullKinRes = 1 - bulkhead.getKineticResistance(); + const hullKinResDRStart = hullKinRes * 0.7; + const hullKinResDREnd = hullKinRes * 0; // Currently don't know where this is let hullThermRes = 1 - bulkhead.getThermalResistance(); + const hullThermResDRStart = hullThermRes * 0.7; + const hullThermResDREnd = hullThermRes * 0; // Currently don't know where this is // Armour from HRPs and module armour from MRPs for (let slot of this.internal) { @@ -1230,9 +1247,9 @@ export default class Ship { this.armour = armour; this.modulearmour = modulearmour; this.moduleprotection = moduleprotection; - this.hullExplRes = 1 - this.diminishingReturns(1 - hullExplRes, 0.5, 0.75); - this.hullKinRes = 1 - this.diminishingReturns(1 - hullKinRes, 0.5, 0.75); - this.hullThermRes = 1 - this.diminishingReturns(1 - hullThermRes, 0.5, 0.75); + this.hullExplRes = 1 - this.diminishingReturns(hullExplRes, hullExplResDREnd, hullExplResDRStart); + this.hullKinRes = 1 - this.diminishingReturns(hullKinRes, hullKinResDREnd, hullKinResDRStart); + this.hullThermRes = 1 - this.diminishingReturns(hullThermRes, hullThermResDREnd, hullThermResDRStart); return this; } diff --git a/src/app/utils/ShortenUrl.js b/src/app/utils/ShortenUrl.js index f11efaa8..ca7f05b4 100644 --- a/src/app/utils/ShortenUrl.js +++ b/src/app/utils/ShortenUrl.js @@ -1,6 +1,12 @@ import request from 'superagent'; +/** + * Shorten a URL + * @param {string} url The URL to shorten + * @param {function} success Success callback + * @param {function} error Failure/Error callback + */ export default function shorternUrl(url, success, error) { shortenUrlEddp(url, success, error); }