mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Merge branch 'release/2.2.18' into develop
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
* Clean up breakpoints for modules in available modules list; stops 7- or 8- module long lines
|
||||
* Add damager/range graphs to damage dealt
|
||||
* Reorder panels
|
||||
* Use coriolis-data 2.2.18:
|
||||
* Correct lower efficiency value to be better, not worse
|
||||
|
||||
#2.2.17
|
||||
* Use in-game terminology for shield generator optmul and optmass items
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "coriolis_shipyard",
|
||||
"version": "2.2.18b",
|
||||
"version": "2.2.18",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/EDCD/coriolis"
|
||||
|
||||
@@ -61,6 +61,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
/**
|
||||
* Constructor
|
||||
* @param {Object} props React Component properties
|
||||
* @param {Object} context React Component context
|
||||
*/
|
||||
constructor(props, context) {
|
||||
super(props);
|
||||
@@ -73,7 +74,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
const against = DamageDealt.DEFAULT_AGAINST;
|
||||
const maxRange = this._calcMaxRange(ship);
|
||||
const range = 1000 / maxRange;
|
||||
const maxDps = this._calcMaxSDps(ship, against)
|
||||
const maxDps = this._calcMaxSDps(ship, against);
|
||||
const weaponNames = this._weaponNames(ship, context);
|
||||
|
||||
this.state = {
|
||||
@@ -109,7 +110,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
const data = this._calcWeaponsDps(nextProps.ship, this.state.against, this.state.range * this.state.maxRange, this.props.hull);
|
||||
const weaponNames = this._weaponNames(nextProps.ship, nextContext);
|
||||
const maxRange = this._calcMaxRange(nextProps.ship);
|
||||
const maxDps = this._calcMaxSDps(nextProps.ship, this.state.against)
|
||||
const maxDps = this._calcMaxSDps(nextProps.ship, this.state.against);
|
||||
this.setState({ weapons: data.weapons,
|
||||
totals: data.totals,
|
||||
weaponNames,
|
||||
@@ -129,11 +130,10 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
*/
|
||||
_calcMaxSDps(ship, against) {
|
||||
let maxSDps = 0;
|
||||
for (let i =0; i < ship.hardpoints.length; i++) {
|
||||
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||
if (ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||
const m = ship.hardpoints[i].m;
|
||||
const thisSDps = m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) : m.getDps();
|
||||
//const thisDps = m.getDps();// * (m.getPiercing() >= against.properties.hardness ? 1 : m.getPiercing() / against.properties.hardness);
|
||||
if (thisSDps > maxSDps) {
|
||||
maxSDps = thisSDps;
|
||||
}
|
||||
@@ -144,13 +144,16 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
|
||||
/**
|
||||
* Calculate the per-weapon DPS for this ship against another ship at a given range
|
||||
* @param {Object} ship The ship
|
||||
* @param {Object} against The target
|
||||
* @param {Object} range The engagement range
|
||||
* @return {array} The array of weapon DPS
|
||||
* @param {Object} context The context
|
||||
* @param {Object} ship The ship
|
||||
* @param {Object} weaponNames The names of the weapons for which to calculate DPS
|
||||
* @param {Object} against The target
|
||||
* @param {bool} hull true if to calculate against hull, false if to calculate against shields
|
||||
* @param {Object} range The engagement range
|
||||
* @return {array} The array of weapon DPS
|
||||
*/
|
||||
_calcDps(context, ship, weaponNames, against, hull, range) {
|
||||
let results = {}
|
||||
let results = {};
|
||||
let weaponNum = 0;
|
||||
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||
if (ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||
@@ -162,16 +165,18 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Calculate the maximum range of a ship's weapons
|
||||
* @param {Object} ship The ship
|
||||
* @returns {int} The maximum range, in metres
|
||||
*/
|
||||
_calcMaxRange(ship) {
|
||||
let maxRange = 1000;
|
||||
for (let i =0; i < ship.hardpoints.length; i++) {
|
||||
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||
if (ship.hardpoints[i].maxClass > 0 && ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||
const thisRange = ship.hardpoints[i].m.getRange();
|
||||
if (thisRange > maxRange) {
|
||||
maxRange = thisRange;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,14 +185,15 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
|
||||
/**
|
||||
* Obtain the weapon names for this ship
|
||||
* @param {Object} ship The ship
|
||||
* @return {array} The weapon names
|
||||
* @param {Object} ship The ship
|
||||
* @param {Object} context The context
|
||||
* @return {array} The weapon names
|
||||
*/
|
||||
_weaponNames(ship, context) {
|
||||
const translate = context.language.translate
|
||||
const translate = context.language.translate;
|
||||
let names = [];
|
||||
let num = 1;
|
||||
for (let i =0; i < ship.hardpoints.length; i++) {
|
||||
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||
if (ship.hardpoints[i].maxClass > 0 && ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||
const m = ship.hardpoints[i].m;
|
||||
let name = '' + num++ + ': ' + m.class + m.rating + (m.missile ? '/' + m.missile : '') + ' ' + translate(m.name || m.grp);
|
||||
@@ -201,15 +207,24 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
if (engineering) {
|
||||
name = name + ' (' + engineering + ')';
|
||||
}
|
||||
names.push(name)
|
||||
names.push(name);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate a specific weapon DPS for this ship against another ship at a given range
|
||||
* @param {Object} context The context
|
||||
* @param {Object} m The weapon
|
||||
* @param {Object} against The target
|
||||
* @param {bool} hull true if to calculate against hull, false if to calculate against shields
|
||||
* @param {Object} range The engagement range
|
||||
* @return {number} The weapon DPS
|
||||
*/
|
||||
_calcWeaponDps(context, m, against, hull, range) {
|
||||
const translate = context.language.translate
|
||||
const translate = context.language.translate;
|
||||
let dropoff = 1;
|
||||
if (m.getFalloff()) {
|
||||
// Calculate the dropoff % due to range
|
||||
@@ -315,7 +330,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
const effectiveSDpsShields = (m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) * effectivenessShields : effectiveDpsShields);
|
||||
|
||||
// Alter effectiveness as per standard hull
|
||||
const bulkheads = new Module({template: against.bulkheads});
|
||||
const bulkheads = new Module({ template: against.bulkheads });
|
||||
let effectivenessHull = 0;
|
||||
if (m.getDamageDist().E) {
|
||||
effectivenessHull += m.getDamageDist().E * (1 - bulkheads.getExplosiveResistance());
|
||||
@@ -473,19 +488,19 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
render() {
|
||||
const { language, onWindowResize, sizeRatio, tooltip, termtip } = this.context;
|
||||
const { formats, translate, units } = language;
|
||||
const { expanded, maxRange, range, totals } = this.state;
|
||||
const { against, expanded, maxRange, range, totals } = this.state;
|
||||
const { ship } = this.props;
|
||||
|
||||
const sortOrder = this._sortOrder;
|
||||
const onCollapseExpand = this._onCollapseExpand;
|
||||
|
||||
const hStr = ship.getHardpointsString() + '.' + ship.getModificationsString();
|
||||
const code = ship.getHardpointsString() + '.' + ship.getModificationsString() + '.' + against.properties.name;
|
||||
|
||||
return (
|
||||
<span>
|
||||
<h1>{translate('damage dealt to')} {expanded ? <span onClick={onCollapseExpand}><CollapseSection className='summary'/></span> : <span onClick={onCollapseExpand}><ExpandSection className='summary'/></span>}</h1>
|
||||
{expanded ? <span>
|
||||
<ShipSelector initial={this.state.against} currentMenu={this.props.currentMenu} onChange={this._onShipChange} />
|
||||
<ShipSelector initial={against} currentMenu={this.props.currentMenu} onChange={this._onShipChange} />
|
||||
<table className='summary' style={{ width: '100%' }}>
|
||||
<thead>
|
||||
<tr className='main'>
|
||||
@@ -551,7 +566,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
colors={DAMAGE_DEALT_COLORS}
|
||||
func={this.state.calcShieldsDpsFunc}
|
||||
points={200}
|
||||
code={hStr}
|
||||
code={code}
|
||||
/>
|
||||
</div>
|
||||
<div className='group half'>
|
||||
@@ -567,7 +582,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
colors={DAMAGE_DEALT_COLORS}
|
||||
func={this.state.calcHullDpsFunc}
|
||||
points={200}
|
||||
code={hStr}
|
||||
code={code}
|
||||
/>
|
||||
</div>
|
||||
</span> : null }
|
||||
|
||||
@@ -43,14 +43,12 @@ export default class LineChart extends TranslatedComponent {
|
||||
super(props);
|
||||
|
||||
this._updateDimensions = this._updateDimensions.bind(this);
|
||||
this._updateSeriesData = this._updateSeriesData.bind(this);
|
||||
this._updateSeries = this._updateSeries.bind(this);
|
||||
this._tooltip = this._tooltip.bind(this);
|
||||
this._showTip = this._showTip.bind(this);
|
||||
this._hideTip = this._hideTip.bind(this);
|
||||
this._moveTip = this._moveTip.bind(this);
|
||||
|
||||
//const data = _updateSeries(this.props);
|
||||
const series = props.series;
|
||||
|
||||
let xScale = d3.scaleLinear();
|
||||
@@ -64,9 +62,6 @@ export default class LineChart extends TranslatedComponent {
|
||||
xScale,
|
||||
xAxisScale,
|
||||
yScale,
|
||||
//seriesLines: data.seriesLines,
|
||||
//detailElems: data.detailElems,
|
||||
//markerElems: data.markerElems,
|
||||
tipHeight: 2 + (1.2 * (series ? series.length : 0.8))
|
||||
};
|
||||
}
|
||||
@@ -161,7 +156,8 @@ export default class LineChart extends TranslatedComponent {
|
||||
|
||||
/**
|
||||
* Update series generated from props
|
||||
* @param {Object} props React Component properties
|
||||
* @param {Object} props React Component properties
|
||||
* @param {Object} state React Component state
|
||||
*/
|
||||
_updateSeries(props, state) {
|
||||
let { func, xMin, xMax, series, points } = props;
|
||||
@@ -192,31 +188,6 @@ export default class LineChart extends TranslatedComponent {
|
||||
}
|
||||
|
||||
this.setState({ markerElems, detailElems, seriesLines, seriesData });
|
||||
return { seriesData };
|
||||
}
|
||||
|
||||
/**
|
||||
* Update series and data generated from props
|
||||
* @param {Object} props React Component properties
|
||||
*/
|
||||
_updateSeriesData(props) {
|
||||
let { func, xMin, xMax, series, points } = props;
|
||||
let delta = (xMax - xMin) / points;
|
||||
let seriesData = new Array(points);
|
||||
|
||||
if (delta) {
|
||||
seriesData = new Array(points);
|
||||
for (let i = 0, x = xMin; i < points; i++) {
|
||||
seriesData[i] = [x, func(x)];
|
||||
x += delta;
|
||||
}
|
||||
seriesData[points - 1] = [xMax, func(xMax)];
|
||||
} else {
|
||||
let yVal = func(xMin);
|
||||
seriesData = [[0, yVal], [1, yVal]];
|
||||
}
|
||||
|
||||
this.setState({ seriesData });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,11 +214,8 @@ export default class LineChart extends TranslatedComponent {
|
||||
}
|
||||
|
||||
if (props.code != nextProps.code) {
|
||||
console.log('Code changed');
|
||||
}
|
||||
// if (domainChanged) {
|
||||
this._updateSeries(nextProps, this.state);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ export function getLanguage(langCode) {
|
||||
let currentTerms = lang.terms;
|
||||
let d3Locale = d3.formatLocale(lang.formats);
|
||||
let gen = d3Locale.format('');
|
||||
const round = function(x, n) { var ten_n = Math.pow(10,n); return Math.round(x * ten_n) / ten_n; }
|
||||
const round = function(x, n) { const ten_n = Math.pow(10,n); return Math.round(x * ten_n) / ten_n; };
|
||||
|
||||
if(lang === EN) {
|
||||
translate = (t, x) => { return currentTerms[t + '_' + x] || currentTerms[t] || t; };
|
||||
|
||||
Reference in New Issue
Block a user