Fix resistance diminishing return calculations

This commit is contained in:
Cmdr McDonald
2017-01-11 21:33:31 +00:00
parent ce980cf091
commit 80656a7a78
6 changed files with 53 additions and 25 deletions

View File

@@ -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 #2.2.6
* Add pitch/roll/yaw information * Add pitch/roll/yaw information
* Use combination of pitch, roll and yaw to provide a more useful agility metric * Use combination of pitch, roll and yaw to provide a more useful agility metric

View File

@@ -285,10 +285,10 @@
"totalThermSDps": 53.82, "totalThermSDps": 53.82,
"baseShieldStrength": 350, "baseShieldStrength": 350,
"baseArmour": 945, "baseArmour": 945,
"hullExplRes": 0.78, "hullExplRes": 0.22,
"hullKinRes": 0.73, "hullKinRes": 0.27,
"hullMass": 400, "hullMass": 400,
"hullThermRes": 1.37, "hullThermRes": -0.36,
"masslock": 23, "masslock": 23,
"pipSpeed": 0.14, "pipSpeed": 0.14,
"pitch": 25, "pitch": 25,
@@ -316,7 +316,7 @@
"shield": 833, "shield": 833,
"shieldCells": 1840, "shieldCells": 1840,
"shieldExplRes": 0.5, "shieldExplRes": 0.5,
"shieldKinRes": 0.6, "shieldKinRes": 0.4,
"shieldThermRes": 1.2 "shieldThermRes": -0.2
} }
} }

View File

@@ -31,6 +31,7 @@ export default class DefenceSummary extends TranslatedComponent {
const shieldGenerator = ship.findShieldGenerator(); const shieldGenerator = ship.findShieldGenerator();
// Damage values are 1 - resistance values
return ( return (
<span> <span>
<h1>{translate('defence summary')}</h1> <h1>{translate('defence summary')}</h1>
@@ -52,15 +53,15 @@ export default class DefenceSummary extends TranslatedComponent {
<td className='le'>{translate('damage from')}</td> <td className='le'>{translate('damage from')}</td>
<td className='ri'> <td className='ri'>
<span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span>&nbsp; <span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span>&nbsp;
<span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - shieldGenerator.explres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(ship.shieldExplRes || 1)}</span> <span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - shieldGenerator.explres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(1 - ship.shieldExplRes)}</span>
</td> </td>
<td className='ri'> <td className='ri'>
<span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span>&nbsp; <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span>&nbsp;
<span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - shieldGenerator.kinres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(ship.shieldKinRes || 1)}</span> <span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - shieldGenerator.kinres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(1 - ship.shieldKinRes)}</span>
</td> </td>
<td className='ri'> <td className='ri'>
<span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span>&nbsp; <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span>&nbsp;
<span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - shieldGenerator.thermres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(ship.shieldThermRes || 1)}</span> <span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - shieldGenerator.thermres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(1 - ship.shieldThermRes)}</span>
</td> </td>
</tr> : null } </tr> : null }
@@ -76,14 +77,14 @@ export default class DefenceSummary extends TranslatedComponent {
<td className='le'>{translate('damage from')}</td> <td className='le'>{translate('damage from')}</td>
<td className='ri'> <td className='ri'>
<span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span>&nbsp; <span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span>&nbsp;
<span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - ship.bulkheads.m.explres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(ship.hullExplRes || 1)}</span></td> <span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - ship.bulkheads.m.explres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(1 - ship.hullExplRes)}</span></td>
<td className='ri'> <td className='ri'>
<span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span>&nbsp; <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span>&nbsp;
<span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - ship.bulkheads.m.kinres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(ship.hullKinRes || 1)}</span> <span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - ship.bulkheads.m.kinres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(1 - ship.hullKinRes)}</span>
</td> </td>
<td className='ri'> <td className='ri'>
<span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span>&nbsp; <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span>&nbsp;
<span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - ship.bulkheads.m.thermres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(ship.hullThermRes || 1)}</span> <span onMouseOver={termtip.bind(null, translate('base') + ' ' + formats.pct1(1 - ship.bulkheads.m.thermres))} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(1 - ship.hullThermRes)}</span>
</td> </td>
</tr> </tr>

View File

@@ -42,9 +42,9 @@ export default class Modification extends TranslatedComponent {
scaledValue = 100000; scaledValue = 100000;
value = 1000; value = 1000;
} }
if (scaledValue < -10000) { if (scaledValue < -9999) {
scaledValue = -10000; scaledValue = -9999;
value = -100; value = -99.99;
} }
let m = this.props.m; let m = this.props.m;

View File

@@ -918,11 +918,10 @@ export default class Ship {
* @return {this} The ship instance (for chaining operations) * @return {this} The ship instance (for chaining operations)
*/ */
diminishingReturns(val, drll, drul) { diminishingReturns(val, drll, drul) {
if (val > drll) { if (val < drll) {
val = drll + (val - drll) / 2; val = drll;
} } else if (val < drul) {
if (val > drul) { val = drul - (drul - val) / 2;
val = drul;
} }
return val; return val;
} }
@@ -1143,14 +1142,26 @@ export default class Ship {
let shieldExplRes = null; let shieldExplRes = null;
let shieldKinRes = null; let shieldKinRes = null;
let shieldThermRes = 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'); const sgSlot = this.findInternalByGroup('sg');
if (sgSlot && sgSlot.enabled) { if (sgSlot && sgSlot.enabled) {
// Shield from generator // Shield from generator
shield = Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sgSlot.m, 1); shield = Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sgSlot.m, 1);
shieldExplRes = 1 - sgSlot.m.getExplosiveResistance(); shieldExplRes = 1 - sgSlot.m.getExplosiveResistance();
shieldExplDRStart = shieldExplRes * 0.7;
shieldExplDREnd = shieldExplRes * 0; // Currently don't know where this is
shieldKinRes = 1 - sgSlot.m.getKineticResistance(); shieldKinRes = 1 - sgSlot.m.getKineticResistance();
shieldKinDRStart = shieldKinRes * 0.7;
shieldKinDREnd = shieldKinRes * 0; // Currently don't know where this is
shieldThermRes = 1 - sgSlot.m.getThermalResistance(); shieldThermRes = 1 - sgSlot.m.getThermalResistance();
shieldThermDRStart = shieldThermRes * 0.7;
shieldThermDREnd = shieldThermRes * 0; // Currently don't know where this is
// Shield from boosters // Shield from boosters
for (let slot of this.hardpoints) { for (let slot of this.hardpoints) {
@@ -1170,9 +1181,9 @@ export default class Ship {
shield = shield * shieldBoost; shield = shield * shieldBoost;
this.shield = shield; this.shield = shield;
this.shieldExplRes = shieldExplRes ? 1 - this.diminishingReturns(1 - shieldExplRes, 0.5, 0.75) : null; this.shieldExplRes = shieldExplRes ? 1 - this.diminishingReturns(shieldExplRes, shieldExplDREnd, shieldExplDRStart) : null;
this.shieldKinRes = shieldKinRes ? 1 - this.diminishingReturns(1 - shieldKinRes, 0.5, 0.75) : null; this.shieldKinRes = shieldKinRes ? 1 - this.diminishingReturns(shieldKinRes, shieldKinDREnd, shieldKinDRStart) : null;
this.shieldThermRes = shieldThermRes ? 1 - this.diminishingReturns(1 - shieldThermRes, 0.5, 0.75) : null; this.shieldThermRes = shieldThermRes ? 1 - this.diminishingReturns(shieldThermRes, shieldThermDREnd, shieldThermDRStart) : null;
return this; return this;
} }
@@ -1206,8 +1217,14 @@ export default class Ship {
let modulearmour = 0; let modulearmour = 0;
let moduleprotection = 1; let moduleprotection = 1;
let hullExplRes = 1 - bulkhead.getExplosiveResistance(); 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(); 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(); 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 // Armour from HRPs and module armour from MRPs
for (let slot of this.internal) { for (let slot of this.internal) {
@@ -1230,9 +1247,9 @@ export default class Ship {
this.armour = armour; this.armour = armour;
this.modulearmour = modulearmour; this.modulearmour = modulearmour;
this.moduleprotection = moduleprotection; this.moduleprotection = moduleprotection;
this.hullExplRes = 1 - this.diminishingReturns(1 - hullExplRes, 0.5, 0.75); this.hullExplRes = 1 - this.diminishingReturns(hullExplRes, hullExplResDREnd, hullExplResDRStart);
this.hullKinRes = 1 - this.diminishingReturns(1 - hullKinRes, 0.5, 0.75); this.hullKinRes = 1 - this.diminishingReturns(hullKinRes, hullKinResDREnd, hullKinResDRStart);
this.hullThermRes = 1 - this.diminishingReturns(1 - hullThermRes, 0.5, 0.75); this.hullThermRes = 1 - this.diminishingReturns(hullThermRes, hullThermResDREnd, hullThermResDRStart);
return this; return this;
} }

View File

@@ -1,6 +1,12 @@
import request from 'superagent'; 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) { export default function shorternUrl(url, success, error) {
shortenUrlEddp(url, success, error); shortenUrlEddp(url, success, error);
} }