Skip to content

Commit

Permalink
Merge branch 'release/2.2.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdrmcdonald committed Jan 11, 2017
2 parents a4656e2 + fb5ba6a commit 05e06f3
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 36 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions __tests__/fixtures/anaconda-test-detailed-export-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -316,7 +316,7 @@
"shield": 833,
"shieldCells": 1840,
"shieldExplRes": 0.5,
"shieldKinRes": 0.6,
"shieldThermRes": 1.2
"shieldKinRes": 0.4,
"shieldThermRes": -0.2
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coriolis_shipyard",
"version": "2.2.6",
"version": "2.2.7",
"repository": {
"type": "git",
"url": "https://github.com/EDCD/coriolis"
Expand Down
22 changes: 12 additions & 10 deletions src/app/components/DamageReceived.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,34 +105,36 @@ export default class DamageReceived extends TranslatedComponent {
// Effective DPS taking in to account shield resistance
let effectivenessShields = 0;
if (m.getDamageType().indexOf('E') != -1) {
effectivenessShields += ship.shieldExplRes;
effectivenessShields += (1 - ship.shieldExplRes);
}
if (m.getDamageType().indexOf('K') != -1) {
effectivenessShields += ship.shieldKinRes;
effectivenessShields += (1 - ship.shieldKinRes);
}
if (m.getDamageType().indexOf('T') != -1) {
effectivenessShields += ship.shieldThermRes;
effectivenessShields += (1 - ship.shieldThermRes);
}
if (m.getDamageType().indexOf('A') != -1) {
effectivenessShields += 1;
}
effectivenessShields /= m.getDamageType().length;
// Plasma accelerators deal absolute damage
if (m.grp == 'pa') effectivenessShields = 1;
const effectiveDpsShields = baseDps * effectivenessShields;
const effectiveSDpsShields = baseSDps * effectivenessShields;

// Effective DPS taking in to account hull hardness and resistance
let effectivenessHull = 0;
if (m.getDamageType().indexOf('E') != -1) {
effectivenessHull += ship.hullExplRes;
effectivenessHull += (1 - ship.hullExplRes);
}
if (m.getDamageType().indexOf('K') != -1) {
effectivenessHull += ship.hullKinRes;
effectivenessHull += (1 - ship.hullKinRes);
}
if (m.getDamageType().indexOf('T') != -1) {
effectivenessHull += ship.hullThermRes;
effectivenessHull += (1 - ship.hullThermRes);
}
if (m.getDamageType().indexOf('A') != -1) {
effectivenessHull += 1;
}
effectivenessHull /= m.getDamageType().length;
// Plasma accelerators deal absolute damage (but could be reduced by hardness)
if (m.grp == 'pa') effectivenessHull = 1;
effectivenessHull *= Math.min(m.getPiercing() / ship.hardness, 1);
const effectiveDpsHull = baseDps * effectivenessHull;
const effectiveSDpsHull = baseSDps * effectivenessHull;
Expand Down
13 changes: 7 additions & 6 deletions src/app/components/DefenceSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default class DefenceSummary extends TranslatedComponent {

const shieldGenerator = ship.findShieldGenerator();

// Damage values are 1 - resistance values
return (
<span>
<h1>{translate('defence summary')}</h1>
Expand All @@ -52,15 +53,15 @@ export default class DefenceSummary extends TranslatedComponent {
<td className='le'>{translate('damage from')}</td>
<td className='ri'>
<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 className='ri'>
<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 className='ri'>
<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>
</tr> : null }

Expand All @@ -76,14 +77,14 @@ export default class DefenceSummary extends TranslatedComponent {
<td className='le'>{translate('damage from')}</td>
<td className='ri'>
<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'>
<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 className='ri'>
<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>
</tr>

Expand Down
6 changes: 3 additions & 3 deletions src/app/components/Modification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
39 changes: 28 additions & 11 deletions src/app/shipyard/Ship.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/app/utils/ShortenUrl.js
Original file line number Diff line number Diff line change
@@ -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);
}
Expand Down

0 comments on commit 05e06f3

Please sign in to comment.