mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
Fixes
This commit is contained in:
@@ -133,7 +133,7 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
* @param {int} special The name of the selected special
|
* @param {int} special The name of the selected special
|
||||||
*/
|
*/
|
||||||
_specialSelected(special) {
|
_specialSelected(special) {
|
||||||
const { m } = this.props;
|
const { m, ship } = this.props;
|
||||||
|
|
||||||
if (m.blueprint) {
|
if (m.blueprint) {
|
||||||
if (special === null) {
|
if (special === null) {
|
||||||
@@ -141,6 +141,9 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
} else {
|
} else {
|
||||||
m.blueprint.special = Modifications.specials[special];
|
m.blueprint.special = Modifications.specials[special];
|
||||||
}
|
}
|
||||||
|
ship.recalculateDps();
|
||||||
|
ship.recalculateHps();
|
||||||
|
ship.recalculateEps();
|
||||||
}
|
}
|
||||||
|
|
||||||
const specialMenuOpened = false;
|
const specialMenuOpened = false;
|
||||||
@@ -300,8 +303,7 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
onContextMenu={stopCtxPropagation}
|
onContextMenu={stopCtxPropagation}
|
||||||
>
|
>
|
||||||
{ haveBlueprint ?
|
{ haveBlueprint ?
|
||||||
<div className={ cn('section-menu', { selected: blueprintMenuOpened })} style={{ cursor: 'pointer' }} onMouseOver={termtip.bind(null, blueprintTt)} onMouseOut={tooltip.bind(null, null)} onClick={_toggleBlueprintsMenu}>{blueprintLabel}</div>
|
<div className={ cn('section-menu', { selected: blueprintMenuOpened })} style={{ cursor: 'pointer' }} onMouseOver={termtip.bind(null, blueprintTt)} onMouseOut={tooltip.bind(null, null)} onClick={_toggleBlueprintsMenu}>{blueprintLabel}</div> :
|
||||||
:
|
|
||||||
<div className={ cn('section-menu', { selected: blueprintMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleBlueprintsMenu}>{translate('PHRASE_SELECT_BLUEPRINT')}</div> }
|
<div className={ cn('section-menu', { selected: blueprintMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleBlueprintsMenu}>{translate('PHRASE_SELECT_BLUEPRINT')}</div> }
|
||||||
{ showBlueprintsMenu ? this.state.blueprints : null }
|
{ showBlueprintsMenu ? this.state.blueprints : null }
|
||||||
{ showSpecial ? <div className={ cn('section-menu', { selected: specialMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleSpecialsMenu}>{specialLabel}</div> : null }
|
{ showSpecial ? <div className={ cn('section-menu', { selected: specialMenuOpened })} style={{ cursor: 'pointer' }} onClick={_toggleSpecialsMenu}>{specialLabel}</div> : null }
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ export default class OutfittingPage extends Page {
|
|||||||
opponentSys = parseFloat(opponentControl[0]);
|
opponentSys = parseFloat(opponentControl[0]);
|
||||||
opponentEng = parseFloat(opponentControl[1]);
|
opponentEng = parseFloat(opponentControl[1]);
|
||||||
opponentWep = parseFloat(opponentControl[2]);
|
opponentWep = parseFloat(opponentControl[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ship is a stock build
|
// Ship is a stock build
|
||||||
opponent.buildWith(Ships[shipId].defaults);
|
opponent.buildWith(Ships[shipId].defaults);
|
||||||
|
|||||||
@@ -613,9 +613,9 @@ export default class Ship {
|
|||||||
module.blueprint = getBlueprint(blueprints[i + 1].fdname, module);
|
module.blueprint = getBlueprint(blueprints[i + 1].fdname, module);
|
||||||
module.blueprint.grade = blueprints[i + 1].grade;
|
module.blueprint.grade = blueprints[i + 1].grade;
|
||||||
module.blueprint.special = blueprints[i + 1].special;
|
module.blueprint.special = blueprints[i + 1].special;
|
||||||
} else {
|
} else {
|
||||||
module.blueprint = {};
|
module.blueprint = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.use(standard[i], module, true);
|
this.use(standard[i], module, true);
|
||||||
}
|
}
|
||||||
@@ -641,9 +641,9 @@ export default class Ship {
|
|||||||
module.blueprint = getBlueprint(blueprints[cl + i].fdname, module);
|
module.blueprint = getBlueprint(blueprints[cl + i].fdname, module);
|
||||||
module.blueprint.grade = blueprints[cl + i].grade;
|
module.blueprint.grade = blueprints[cl + i].grade;
|
||||||
module.blueprint.special = blueprints[cl + i].special;
|
module.blueprint.special = blueprints[cl + i].special;
|
||||||
} else {
|
} else {
|
||||||
module.blueprint = {};
|
module.blueprint = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.use(hps[i], module, true);
|
this.use(hps[i], module, true);
|
||||||
}
|
}
|
||||||
@@ -667,9 +667,9 @@ export default class Ship {
|
|||||||
module.blueprint = getBlueprint(blueprints[cl + i].fdname, module);
|
module.blueprint = getBlueprint(blueprints[cl + i].fdname, module);
|
||||||
module.blueprint.grade = blueprints[cl + i].grade;
|
module.blueprint.grade = blueprints[cl + i].grade;
|
||||||
module.blueprint.special = blueprints[cl + i].special;
|
module.blueprint.special = blueprints[cl + i].special;
|
||||||
} else {
|
} else {
|
||||||
module.blueprint = {};
|
module.blueprint = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.use(internal[i], module, true);
|
this.use(internal[i], module, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { Modifications } from 'coriolis-data/dist';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a tooltip with details of a blueprint's effects
|
* Generate a tooltip with details of a blueprint's effects
|
||||||
|
* @param {Object} translate The translate object
|
||||||
* @param {Object} features The features of the blueprint
|
* @param {Object} features The features of the blueprint
|
||||||
* @param {Object} m The module to compare with
|
* @param {Object} m The module to compare with
|
||||||
* @returns {Object} The react components
|
* @returns {Object} The react components
|
||||||
*/
|
*/
|
||||||
export function blueprintTooltip(translate, features, m)
|
export function blueprintTooltip(translate, features, m) {
|
||||||
{
|
|
||||||
const results = [];
|
const results = [];
|
||||||
for (const feature in features) {
|
for (const feature in features) {
|
||||||
const featureIsBeneficial = isBeneficial(feature, features[feature]);
|
const featureIsBeneficial = isBeneficial(feature, features[feature]);
|
||||||
@@ -75,7 +75,9 @@ export function blueprintTooltip(translate, features, m)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this blueprint feature beneficial?
|
* Is this blueprint feature beneficial?
|
||||||
*
|
* @param {string} feature The name of the feature
|
||||||
|
* @param {array} values The value of the feature
|
||||||
|
* @returns {boolean} True if this feature is beneficial
|
||||||
*/
|
*/
|
||||||
export function isBeneficial(feature, values) {
|
export function isBeneficial(feature, values) {
|
||||||
const fact = (values[0] < 0 || (values[0] === 0 && values[1] < 0));
|
const fact = (values[0] < 0 || (values[0] === 0 && values[1] < 0));
|
||||||
@@ -88,7 +90,9 @@ export function isBeneficial(feature, values) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this feature value beneficial?
|
* Is this feature value beneficial?
|
||||||
*
|
* @param {string} feature The name of the feature
|
||||||
|
* @param {number} value The value of the feature
|
||||||
|
* @returns {boolean} True if this value is beneficial
|
||||||
*/
|
*/
|
||||||
export function isValueBeneficial(feature, value) {
|
export function isValueBeneficial(feature, value) {
|
||||||
if (Modifications.modifications[feature].higherbetter) {
|
if (Modifications.modifications[feature].higherbetter) {
|
||||||
@@ -134,8 +138,8 @@ export function getBlueprint(name, module) {
|
|||||||
for (const grade in blueprint.grades) {
|
for (const grade in blueprint.grades) {
|
||||||
for (const feature in blueprint.grades[grade].features) {
|
for (const feature in blueprint.grades[grade].features) {
|
||||||
if (feature === 'shieldboost') {
|
if (feature === 'shieldboost') {
|
||||||
blueprint.grades[grade].features[feature][0] = ((1 + blueprint.grades[grade].features[feature][0]) * (1 + module.shieldboost) - 1)/ module.shieldboost - 1;
|
blueprint.grades[grade].features[feature][0] = ((1 + blueprint.grades[grade].features[feature][0]) * (1 + module.shieldboost) - 1) / module.shieldboost - 1;
|
||||||
blueprint.grades[grade].features[feature][1] = ((1 + blueprint.grades[grade].features[feature][1]) * (1 + module.shieldboost) - 1)/ module.shieldboost - 1;
|
blueprint.grades[grade].features[feature][1] = ((1 + blueprint.grades[grade].features[feature][1]) * (1 + module.shieldboost) - 1) / module.shieldboost - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user