Merge branch 'release/2.2.14'

This commit is contained in:
Cmdr McDonald
2017-02-08 09:29:04 +00:00
6 changed files with 51 additions and 72 deletions

View File

@@ -1,3 +1,12 @@
#2.2.14
* Ensure that jitter is shown correctly when the result of a special effect
* Use restyled blueprint information
* Use the ship name (if available) rather than the ship model for the window title
* Use coriolis-data 2.2.14:
* Alter blueprint structure to combine components and features
* Make hidden value of modifications its own attribute
* Fix incorrect ED ID for class 6 passenger cabins
#2.2.13 #2.2.13
* Add 'time to drain' summary value. This is the time to drain the WEP capacitor if firing all enabled weapons * Add 'time to drain' summary value. This is the time to drain the WEP capacitor if firing all enabled weapons
* Do not include utility slot DPS/EPS/HPS in summary information * Do not include utility slot DPS/EPS/HPS in summary information

View File

@@ -1,6 +1,6 @@
{ {
"name": "coriolis_shipyard", "name": "coriolis_shipyard",
"version": "2.2.13", "version": "2.2.14",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/EDCD/coriolis" "url": "https://github.com/EDCD/coriolis"

View File

@@ -87,7 +87,7 @@ export default class ModificationsMenu extends TranslatedComponent {
const { m, onChange, ship } = props; const { m, onChange, ship } = props;
let modifications = []; let modifications = [];
for (const modName of Modifications.modules[m.grp].modifications) { for (const modName of Modifications.modules[m.grp].modifications) {
if (Modifications.modifications[modName].type === 'percentage' || Modifications.modifications[modName].type === 'numeric') { if (!Modifications.modifications[modName].hidden) {
const key = modName + (m.getModValue(modName) / 100 || 0); const key = modName + (m.getModValue(modName) / 100 || 0);
modifications.push(<Modification key={ key } ship={ ship } m={ m } name={ modName } value={ m.getModValue(modName) / 100 || 0 } onChange={ onChange }/>); modifications.push(<Modification key={ key } ship={ ship } m={ m } name={ modName } value={ m.getModValue(modName) / 100 || 0 } onChange={ onChange }/>);
} }
@@ -147,30 +147,40 @@ export default class ModificationsMenu extends TranslatedComponent {
this.props.onChange(); this.props.onChange();
} }
/**
* Set the result of a roll
* @param {object} ship The ship to which the roll applies
* @param {object} m The module to which the roll applies
* @param {string} featureName The modification feature to which the roll applies
* @param {number} value The value of the roll
*/
_setRollResult(ship, m, featureName, value) {
if (Modifications.modifications[featureName].method !== 'overwrite') {
if (m.grp == 'sb' && featureName == 'shieldboost') {
// Shield boosters are a special case. Their boost is dependent on their base so we need to calculate the value here
value = ((1 + m.shieldboost) * (1 + value) - 1) / m.shieldboost - 1;
}
}
if (Modifications.modifications[featureName].type == 'percentage') {
ship.setModification(m, featureName, value * 10000);
} else if (Modifications.modifications[featureName].type == 'numeric') {
ship.setModification(m, featureName, value * 100);
} else {
ship.setModification(m, featureName, value);
}
}
/** /**
* Provide a 'worst' roll within the information we have * Provide a 'worst' roll within the information we have
*/ */
_rollWorst() { _rollWorst() {
const { m, ship } = this.props; const { m, ship } = this.props;
const features = m.blueprint.features[m.blueprint.grade]; const features = m.blueprint.grades[m.blueprint.grade].features;
for (const featureName in features) { for (const featureName in features) {
if (Modifications.modifications[featureName].method == 'overwrite') { let value = features[featureName][0];
ship.setModification(m, featureName, features[featureName][1]); this._setRollResult(ship, m, featureName, value);
} else {
let value = features[featureName][0];
if (m.grp == 'sb' && featureName == 'shieldboost') {
// Shield boosters are a special case. Their boost is dependent on their base so we need to calculate the value here
value = ((1 + m.shieldboost) * (1 + value) - 1) / m.shieldboost - 1;
}
if (Modifications.modifications[featureName].type == 'percentage') {
ship.setModification(m, featureName, value * 10000);
} else if (Modifications.modifications[featureName].type == 'numeric') {
ship.setModification(m, featureName, value * 100);
}
}
} }
this.setState({ modifications: this._setModifications(this.props) }); this.setState({ modifications: this._setModifications(this.props) });
this.props.onChange(); this.props.onChange();
} }
@@ -180,25 +190,11 @@ export default class ModificationsMenu extends TranslatedComponent {
*/ */
_rollAverage() { _rollAverage() {
const { m, ship } = this.props; const { m, ship } = this.props;
const features = m.blueprint.features[m.blueprint.grade]; const features = m.blueprint.grades[m.blueprint.grade].features;
for (const featureName in features) { for (const featureName in features) {
if (Modifications.modifications[featureName].method == 'overwrite') { let value = (features[featureName][0] + features[featureName][1]) / 2;
ship.setModification(m, featureName, (features[featureName][0] + features[featureName][1]) / 2); this._setRollResult(ship, m, featureName, value);
} else {
let value = (features[featureName][0] + features[featureName][1]) / 2;
if (m.grp == 'sb' && featureName == 'shieldboost') {
// Shield boosters are a special case. Their boost is dependent on their base so we need to calculate the value here
value = ((1 + m.shieldboost) * (1 + value) - 1) / m.shieldboost - 1;
}
if (Modifications.modifications[featureName].type == 'percentage') {
ship.setModification(m, featureName, value * 10000);
} else if (Modifications.modifications[featureName].type == 'numeric') {
ship.setModification(m, featureName, value * 100);
}
}
} }
this.setState({ modifications: this._setModifications(this.props) }); this.setState({ modifications: this._setModifications(this.props) });
this.props.onChange(); this.props.onChange();
} }
@@ -208,25 +204,11 @@ export default class ModificationsMenu extends TranslatedComponent {
*/ */
_rollRandom() { _rollRandom() {
const { m, ship } = this.props; const { m, ship } = this.props;
const features = m.blueprint.features[m.blueprint.grade]; const features = m.blueprint.grades[m.blueprint.grade].features;
for (const featureName in features) { for (const featureName in features) {
if (Modifications.modifications[featureName].method == 'overwrite') { let value = features[featureName][0] + (Math.random() * (features[featureName][1] - features[featureName][0]));
ship.setModification(m, featureName, features[featureName][1]); this._setRollResult(ship, m, featureName, value);
} else {
let value = features[featureName][0] + (Math.random() * (features[featureName][1] - features[featureName][0]));
if (m.grp == 'sb' && featureName == 'shieldboost') {
// Shield boosters are a special case. Their boost is dependent on their base so we need to calculate the value here
value = ((1 + m.shieldboost) * (1 + value) - 1) / m.shieldboost - 1;
}
if (Modifications.modifications[featureName].type == 'percentage') {
ship.setModification(m, featureName, value * 10000);
} else if (Modifications.modifications[featureName].type == 'numeric') {
ship.setModification(m, featureName, value * 100);
}
}
} }
this.setState({ modifications: this._setModifications(this.props) }); this.setState({ modifications: this._setModifications(this.props) });
this.props.onChange(); this.props.onChange();
} }
@@ -236,25 +218,11 @@ export default class ModificationsMenu extends TranslatedComponent {
*/ */
_rollBest() { _rollBest() {
const { m, ship } = this.props; const { m, ship } = this.props;
const features = m.blueprint.features[m.blueprint.grade]; const features = m.blueprint.grades[m.blueprint.grade].features;
for (const featureName in features) { for (const featureName in features) {
if (Modifications.modifications[featureName].method == 'overwrite') { let value = features[featureName][1];
ship.setModification(m, featureName, features[featureName][1]); this._setRollResult(ship, m, featureName, value);
} else {
let value = features[featureName][1];
if (m.grp == 'sb' && featureName == 'shieldboost') {
// Shield boosters are a special case. Their boost is dependent on their base so we need to calculate the value here
value = ((1 + m.shieldboost) * (1 + value) - 1) / m.shieldboost - 1;
}
if (Modifications.modifications[featureName].type == 'percentage') {
ship.setModification(m, featureName, value * 10000);
} else if (Modifications.modifications[featureName].type == 'numeric') {
ship.setModification(m, featureName, value * 100);
}
}
} }
this.setState({ modifications: this._setModifications(this.props) }); this.setState({ modifications: this._setModifications(this.props) });
this.props.onChange(); this.props.onChange();
} }

View File

@@ -36,7 +36,7 @@ const SPEED_COLORS = ['#0088d2', '#ff8c0d', '#D26D00', '#c06400'];
* @return {String} Document title * @return {String} Document title
*/ */
function getTitle(shipName, buildName) { function getTitle(shipName, buildName) {
return `${shipName}${buildName ? ` - ${buildName}` : ''}`; return buildName ? buildName : shipName;
} }
/** /**

View File

@@ -60,7 +60,8 @@ export default class Module {
} else { } else {
mod = modifierActions[name]; mod = modifierActions[name];
} }
result = (((1 + result / 10000) * (1 + mod)) - 1) * 10000; const multiplier = modification.type === 'percentage' ? 10000 : 100;
result = (((1 + result / multiplier) * (1 + mod)) - 1) * multiplier;
} }
} }
} }

View File

@@ -897,6 +897,7 @@ export default class Ship {
} }
if (epsChanged) { if (epsChanged) {
this.recalculateEps(); this.recalculateEps();
this.recalculateTtd();
} }
if (hpsChanged) { if (hpsChanged) {
this.recalculateHps(); this.recalculateHps();