mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Ignore rpshot for eps and hps
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
* Ensure that hull reinforcement modifications take the inherent resistance in to account when calculating modification percentages
|
* Ensure that hull reinforcement modifications take the inherent resistance in to account when calculating modification percentages
|
||||||
* Add tooltip for blueprints providing details of the features they alter
|
* Add tooltip for blueprints providing details of the features they alter
|
||||||
* Use opponent's saved pips if available
|
* Use opponent's saved pips if available
|
||||||
|
* Ignore rounds per shot for EPS and HPS calculations; it's already factored in to the numbers
|
||||||
|
|
||||||
#2.2.19
|
#2.2.19
|
||||||
* Power management panel now displays modules in descending order of power usage by default
|
* Power management panel now displays modules in descending order of power usage by default
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { isEmpty, stopCtxPropagation } from '../utils/UtilityFunctions';
|
|||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
import { Modifications } from 'coriolis-data/dist';
|
import { Modifications } from 'coriolis-data/dist';
|
||||||
import Modification from './Modification';
|
import Modification from './Modification';
|
||||||
import { blueprintTooltip } from '../utils/BlueprintFunctions';
|
import { getBlueprint, blueprintTooltip } from '../utils/BlueprintFunctions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifications menu
|
* Modifications menu
|
||||||
@@ -51,10 +51,11 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
let blueprints = [];
|
let blueprints = [];
|
||||||
for (const blueprintName in Modifications.modules[m.grp].blueprints) {
|
for (const blueprintName in Modifications.modules[m.grp].blueprints) {
|
||||||
for (const grade of Modifications.modules[m.grp].blueprints[blueprintName]) {
|
for (const grade of Modifications.modules[m.grp].blueprints[blueprintName]) {
|
||||||
const close = this._blueprintSelected.bind(this, Modifications.blueprints[blueprintName].id, grade);
|
const close = this._blueprintSelected.bind(this, blueprintName, grade);
|
||||||
const key = blueprintName + ':' + grade;
|
const key = blueprintName + ':' + grade;
|
||||||
const tooltipContent = blueprintTooltip(translate, Modifications.blueprints[blueprintName].grades[grade].features);
|
const blueprint = getBlueprint(blueprintName, m);
|
||||||
blueprints.push(<div style={{ cursor: 'pointer' }} key={ key } onMouseOver={termtip.bind(null, tooltipContent)} onMouseOut={tooltip.bind(null, null)} onClick={ close }>{translate(Modifications.blueprints[blueprintName].name + ' grade ' + grade)}</div>);
|
const tooltipContent = blueprintTooltip(translate, blueprint.grades[grade].features);
|
||||||
|
blueprints.push(<div style={{ cursor: 'pointer' }} key={ key } onMouseOver={termtip.bind(null, tooltipContent)} onMouseOut={tooltip.bind(null, null)} onClick={ close }>{translate(blueprint.name + ' grade ' + grade)}</div>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,12 +106,12 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Activated when a blueprint is selected
|
* Activated when a blueprint is selected
|
||||||
* @param {int} blueprintId The ID of the selected blueprint
|
* @param {int} fdname The Frontier name of the blueprint
|
||||||
* @param {int} grade The grade of the selected blueprint
|
* @param {int} grade The grade of the selected blueprint
|
||||||
*/
|
*/
|
||||||
_blueprintSelected(blueprintId, grade) {
|
_blueprintSelected(fdname, grade) {
|
||||||
const { m } = this.props;
|
const { m } = this.props;
|
||||||
const blueprint = Object.assign({}, _.find(Modifications.blueprints, function(o) { return o.id === blueprintId; }));
|
const blueprint = getBlueprint(fdname, m);
|
||||||
blueprint.grade = grade;
|
blueprint.grade = grade;
|
||||||
m.blueprint = blueprint;
|
m.blueprint = blueprint;
|
||||||
|
|
||||||
@@ -155,13 +156,6 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
* @param {number} value The value of the roll
|
* @param {number} value The value of the roll
|
||||||
*/
|
*/
|
||||||
_setRollResult(ship, m, featureName, value) {
|
_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') {
|
if (Modifications.modifications[featureName].type == 'percentage') {
|
||||||
ship.setModification(m, featureName, value * 10000);
|
ship.setModification(m, featureName, value * 10000);
|
||||||
} else if (Modifications.modifications[featureName].type == 'numeric') {
|
} else if (Modifications.modifications[featureName].type == 'numeric') {
|
||||||
|
|||||||
@@ -554,10 +554,10 @@ export default class Module {
|
|||||||
getEps() {
|
getEps() {
|
||||||
// EPS is a synthetic value
|
// EPS is a synthetic value
|
||||||
let distdraw = this.getDistDraw();
|
let distdraw = this.getDistDraw();
|
||||||
let rpshot = this.roundspershot || 1;
|
// We don't use rpshot here as dist draw is per combined shot
|
||||||
let rof = this.getRoF() || 1;
|
let rof = this.getRoF() || 1;
|
||||||
|
|
||||||
return distdraw * rpshot * rof;
|
return distdraw * rof;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -567,10 +567,10 @@ export default class Module {
|
|||||||
getHps() {
|
getHps() {
|
||||||
// HPS is a synthetic value
|
// HPS is a synthetic value
|
||||||
let heat = this.getThermalLoad();
|
let heat = this.getThermalLoad();
|
||||||
let rpshot = this.roundspershot || 1;
|
// We don't use rpshot here as dist draw is per combined shot
|
||||||
let rof = this.getRoF() || 1;
|
let rof = this.getRoF() || 1;
|
||||||
|
|
||||||
return heat * rpshot * rof;
|
return heat * rof;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as Calc from './Calculations';
|
import * as Calc from './Calculations';
|
||||||
import * as ModuleUtils from './ModuleUtils';
|
import * as ModuleUtils from './ModuleUtils';
|
||||||
import * as Utils from '../utils/UtilityFunctions';
|
import * as Utils from '../utils/UtilityFunctions';
|
||||||
|
import { getBlueprint } from '../utils/BlueprintFunctions';
|
||||||
import Module from './Module';
|
import Module from './Module';
|
||||||
import LZString from 'lz-string';
|
import LZString from 'lz-string';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -588,7 +589,13 @@ export default class Ship {
|
|||||||
this.bulkheads.m = null;
|
this.bulkheads.m = null;
|
||||||
this.useBulkhead(comps && comps.bulkheads ? comps.bulkheads : 0, true);
|
this.useBulkhead(comps && comps.bulkheads ? comps.bulkheads : 0, true);
|
||||||
this.bulkheads.m.mods = mods && mods[0] ? mods[0] : {};
|
this.bulkheads.m.mods = mods && mods[0] ? mods[0] : {};
|
||||||
this.bulkheads.m.blueprint = blueprints && blueprints[0] ? blueprints[0] : {};
|
if (blueprints && blueprints[0]) {
|
||||||
|
this.bulkheads.m.blueprint = getBlueprint(blueprints[0].fdname, this.bulkheads.m);
|
||||||
|
this.bulkheads.m.blueprint.grade = blueprints[0].grade;
|
||||||
|
this.bulkheads.m.blueprint.special = blueprints[0].special;
|
||||||
|
} else {
|
||||||
|
this.bulkheads.m.blueprint = {};
|
||||||
|
}
|
||||||
this.cargoHatch.priority = priorities ? priorities[0] * 1 : 0;
|
this.cargoHatch.priority = priorities ? priorities[0] * 1 : 0;
|
||||||
this.cargoHatch.enabled = enabled ? enabled[0] * 1 : true;
|
this.cargoHatch.enabled = enabled ? enabled[0] * 1 : true;
|
||||||
|
|
||||||
@@ -602,7 +609,13 @@ export default class Ship {
|
|||||||
let module = ModuleUtils.standard(i, comps.standard[i]);
|
let module = ModuleUtils.standard(i, comps.standard[i]);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
module.mods = mods && mods[i + 1] ? mods[i + 1] : {};
|
module.mods = mods && mods[i + 1] ? mods[i + 1] : {};
|
||||||
module.blueprint = blueprints && blueprints[i + 1] ? blueprints[i + 1] : {};
|
if (blueprints && blueprints[i + 1]) {
|
||||||
|
module.blueprint = getBlueprint(blueprints[i + 1].fdname, module);
|
||||||
|
module.blueprint.grade = blueprints[i + 1].grade;
|
||||||
|
module.blueprint.special = blueprints[i + 1].special;
|
||||||
|
} else {
|
||||||
|
module.blueprint = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.use(standard[i], module, true);
|
this.use(standard[i], module, true);
|
||||||
}
|
}
|
||||||
@@ -624,7 +637,13 @@ export default class Ship {
|
|||||||
let module = ModuleUtils.hardpoints(comps.hardpoints[i]);
|
let module = ModuleUtils.hardpoints(comps.hardpoints[i]);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
module.mods = mods && mods[cl + i] ? mods[cl + i] : {};
|
module.mods = mods && mods[cl + i] ? mods[cl + i] : {};
|
||||||
module.blueprint = blueprints && blueprints[cl + i] ? blueprints[cl + i] : {};
|
if (blueprints && blueprints[cl + i]) {
|
||||||
|
module.blueprint = getBlueprint(blueprints[cl + i].fdname, module);
|
||||||
|
module.blueprint.grade = blueprints[cl + i].grade;
|
||||||
|
module.blueprint.special = blueprints[cl + i].special;
|
||||||
|
} else {
|
||||||
|
module.blueprint = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.use(hps[i], module, true);
|
this.use(hps[i], module, true);
|
||||||
}
|
}
|
||||||
@@ -644,7 +663,13 @@ export default class Ship {
|
|||||||
let module = ModuleUtils.internal(comps.internal[i]);
|
let module = ModuleUtils.internal(comps.internal[i]);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
module.mods = mods && mods[cl + i] ? mods[cl + i] : {};
|
module.mods = mods && mods[cl + i] ? mods[cl + i] : {};
|
||||||
module.blueprint = blueprints && blueprints[cl + i] ? blueprints[cl + i] : {};
|
if (blueprints && blueprints[cl + i]) {
|
||||||
|
module.blueprint = getBlueprint(blueprints[cl + i].fdname, module);
|
||||||
|
module.blueprint.grade = blueprints[cl + i].grade;
|
||||||
|
module.blueprint.special = blueprints[cl + i].special;
|
||||||
|
} else {
|
||||||
|
module.blueprint = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.use(internal[i], module, true);
|
this.use(internal[i], module, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,3 +70,49 @@ export function isBeneficial(feature, values) {
|
|||||||
return fact;
|
return fact;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a blueprint with a given name and an optional module
|
||||||
|
* @param {string} name The name of the blueprint
|
||||||
|
* @param {Object} module The module for which to obtain this blueprint
|
||||||
|
* @returns {Object} The matching blueprint
|
||||||
|
*/
|
||||||
|
export function getBlueprint(name, module) {
|
||||||
|
// Start with a copy of the blueprint
|
||||||
|
const blueprint = JSON.parse(JSON.stringify(Modifications.blueprints[name]));
|
||||||
|
if (module) {
|
||||||
|
if (module.grp === 'bh') {
|
||||||
|
// Bulkheads need to have their resistances altered
|
||||||
|
for (const grade in blueprint.grades) {
|
||||||
|
for (const feature in blueprint.grades[grade].features) {
|
||||||
|
if (feature === 'explres') {
|
||||||
|
blueprint.grades[grade].features[feature][0] *= (1 - module.explres);
|
||||||
|
blueprint.grades[grade].features[feature][1] *= (1 - module.explres);
|
||||||
|
}
|
||||||
|
if (feature === 'kinres') {
|
||||||
|
blueprint.grades[grade].features[feature][0] *= (1 - module.kinres);
|
||||||
|
blueprint.grades[grade].features[feature][1] *= (1 - module.kinres);
|
||||||
|
}
|
||||||
|
if (feature === 'thermres') {
|
||||||
|
blueprint.grades[grade].features[feature][0] *= (1 - module.thermres);
|
||||||
|
blueprint.grades[grade].features[feature][1] *= (1 - module.thermres);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (module.grp === 'sb') {
|
||||||
|
// Shield boosters are treated internally as straight modifiers, so rather than (for example)
|
||||||
|
// being a 4% boost they are a 104% multiplier. We need to fix the values here so that they look
|
||||||
|
// accurate as per the information in Elite
|
||||||
|
for (const grade in blueprint.grades) {
|
||||||
|
for (const feature in blueprint.grades[grade].features) {
|
||||||
|
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][1] = ((1 + blueprint.grades[grade].features[feature][1]) * (1 + module.shieldboost) - 1)/ module.shieldboost - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return blueprint;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { Modifications, Modules, Ships } from 'coriolis-data/dist';
|
import { Modifications, Modules, Ships } from 'coriolis-data/dist';
|
||||||
import Module from '../shipyard/Module';
|
import Module from '../shipyard/Module';
|
||||||
import Ship from '../shipyard/Ship';
|
import Ship from '../shipyard/Ship';
|
||||||
|
import { getBlueprint } from '../utils/BlueprintFunctions';
|
||||||
|
|
||||||
// mapping from fd's ship model names to coriolis'
|
// mapping from fd's ship model names to coriolis'
|
||||||
const SHIP_FD_NAME_TO_CORIOLIS_NAME = {
|
const SHIP_FD_NAME_TO_CORIOLIS_NAME = {
|
||||||
@@ -335,9 +336,9 @@ function _addModifications(module, modifiers, blueprint, grade) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the blueprint ID, grade and special
|
// Add the blueprint definition, grade and special
|
||||||
if (blueprint) {
|
if (blueprint) {
|
||||||
module.blueprint = Object.assign({}, Modifications.blueprints[blueprint]);
|
module.blueprint = getBlueprint(blueprint, module);
|
||||||
if (grade) {
|
if (grade) {
|
||||||
module.blueprint.grade = Number(grade);
|
module.blueprint.grade = Number(grade);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user