Merge pull request #546 from EDCD/fix/bugs

Various bug fixes
This commit is contained in:
William
2019-09-18 05:59:58 +10:00
committed by GitHub
8 changed files with 45 additions and 38 deletions

View File

@@ -104,10 +104,10 @@ export default class HardpointSlot extends Slot {
onMouseOut={tooltip.bind(null, null)}>{translate('shotdmg')}: {formats.round1(m.getDamage())}</div> : null} onMouseOut={tooltip.bind(null, null)}>{translate('shotdmg')}: {formats.round1(m.getDamage())}</div> : null}
{m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'epsseps' : 'eps')} {m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'epsseps' : 'eps')}
onMouseOut={tooltip.bind(null, null)}>{translate('EPS')}: {formats.round1(m.getEps())}{u.MW} {m.getClip() ? onMouseOut={tooltip.bind(null, null)}>{translate('EPS')}: {formats.round1(m.getEps())}{u.MW} {m.getClip() ?
<span>({formats.round1(m.getEps() / m.getDps() * m.getSDps())}{u.MW})</span> : null}</div> : null} <span>({formats.round1(m.getEps() * m.getSustainedFactor())}{u.MW})</span> : null}</div> : null}
{m.getHps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'hpsshps' : 'hps')} {m.getHps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'hpsshps' : 'hps')}
onMouseOut={tooltip.bind(null, null)}>{translate('HPS')}: {formats.round1(m.getHps())} {m.getClip() ? onMouseOut={tooltip.bind(null, null)}>{translate('HPS')}: {formats.round1(m.getHps())} {m.getClip() ?
<span>({formats.round1(m.getHps() / m.getDps() * m.getSDps())})</span> : null}</div> : null} <span>({formats.round1(m.getHps() * m.getSustainedFactor())})</span> : null}</div> : null}
{m.getDps() && m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, 'dpe')} {m.getDps() && m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, 'dpe')}
onMouseOut={tooltip.bind(null, null)}>{translate('DPE')}: {formats.f1(m.getDps() / m.getEps())}</div> : null} onMouseOut={tooltip.bind(null, null)}>{translate('DPE')}: {formats.f1(m.getDps() / m.getEps())}</div> : null}
{m.getRoF() ? <div className={'l'} onMouseOver={termtip.bind(null, 'rof')} {m.getRoF() ? <div className={'l'} onMouseOver={termtip.bind(null, 'rof')}

View File

@@ -78,7 +78,6 @@ export default class InternalSlot extends Slot {
{ m.rangeLS ? <div className={'l'}>{translate('range')}: {m.rangeLS}{u.Ls}</div> : null } { m.rangeLS ? <div className={'l'}>{translate('range')}: {m.rangeLS}{u.Ls}</div> : null }
{ m.rangeLS === null ? <div className={'l'}>{u.Ls}</div> : null } { m.rangeLS === null ? <div className={'l'}>{u.Ls}</div> : null }
{ m.rangeRating ? <div className={'l'}>{translate('range')}: {m.rangeRating}</div> : null } { m.rangeRating ? <div className={'l'}>{translate('range')}: {m.rangeRating}</div> : null }
{ m.maximum ? <div className={'l'}>{translate('max')}: {(m.maximum)}</div> : null }
{ m.passengers ? <div className={'l'}>{translate('passengers')}: {m.passengers}</div> : null } { m.passengers ? <div className={'l'}>{translate('passengers')}: {m.passengers}</div> : null }
{ m.getRegenerationRate() ? <div className='l'>{translate('regen')}: {formats.round1(m.getRegenerationRate())}{u.ps}</div> : null } { m.getRegenerationRate() ? <div className='l'>{translate('regen')}: {formats.round1(m.getRegenerationRate())}{u.ps}</div> : null }
{ m.getBrokenRegenerationRate() ? <div className='l'>{translate('brokenregen')}: {formats.round1(m.getBrokenRegenerationRate())}{u.ps}</div> : null } { m.getBrokenRegenerationRate() ? <div className='l'>{translate('brokenregen')}: {formats.round1(m.getBrokenRegenerationRate())}{u.ps}</div> : null }

View File

@@ -86,7 +86,7 @@ export default class ShipSummaryTable extends TranslatedComponent {
<th onMouseEnter={termtip.bind(null, 'hull hardness', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('hrd')}</th> <th onMouseEnter={termtip.bind(null, 'hull hardness', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('hrd')}</th>
<th rowSpan={2}>{translate('crew')}</th> <th rowSpan={2}>{translate('crew')}</th>
<th onMouseEnter={termtip.bind(null, 'mass lock factor', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('MLF')}</th> <th onMouseEnter={termtip.bind(null, 'mass lock factor', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('MLF')}</th>
<th onMouseEnter={termtip.bind(null, 'TT_SUMMARY_BOOST_TIME', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('boost time')}</th> <th onMouseEnter={termtip.bind(null, 'TT_SUMMARY_BOOST_INTERVAL', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('boost interval')}</th>
<th rowSpan={2}>{translate('resting heat (Beta)')}</th> <th rowSpan={2}>{translate('resting heat (Beta)')}</th>
</tr> </tr>
<tr> <tr>
@@ -160,10 +160,10 @@ export default class ShipSummaryTable extends TranslatedComponent {
<td>{formats.pct1(ship.shieldThermRes)}</td> <td>{formats.pct1(ship.shieldThermRes)}</td>
<td></td> <td></td>
<td>{int(ship && ship.shield > 0 ? ship.shield : 0)}{u.MJ}</td> <td>{int(ship && sgMetrics.summary > 0 ? sgMetrics.summary : 0)}{u.MJ}</td>
<td>{int(ship && ship.shield > 0 ? ship.shield * ((1 / (1 - (ship.shieldExplRes)))) : 0)}{u.MJ}</td> <td>{int(ship && sgMetrics.summary > 0 ? sgMetrics.summary / sgMetrics.explosive.base : 0)}{u.MJ}</td>
<td>{int(ship && ship.shield > 0 ? ship.shield * ((1 / (1 - (ship.shieldKinRes)))) : 0)}{u.MJ}</td> <td>{int(ship && sgMetrics.summary ? sgMetrics.summary / sgMetrics.kinetic.base : 0)}{u.MJ}</td>
<td>{int(ship && ship.shield > 0 ? ship.shield * ((1 / (1 - (ship.shieldThermRes)))) : 0)}{u.MJ}</td> <td>{int(ship && sgMetrics.summary ? sgMetrics.summary / sgMetrics.thermal.base : 0)}{u.MJ}</td>
<td></td> <td></td>
<td>{sgMetrics && sgMetrics.recover === Math.Inf ? translate('Never') : formats.time(sgMetrics.recover)}</td> <td>{sgMetrics && sgMetrics.recover === Math.Inf ? translate('Never') : formats.time(sgMetrics.recover)}</td>
<td>{sgMetrics && sgMetrics.recharge === Math.Inf ? translate('Never') : formats.time(sgMetrics.recharge)}</td> <td>{sgMetrics && sgMetrics.recharge === Math.Inf ? translate('Never') : formats.time(sgMetrics.recharge)}</td>
@@ -198,11 +198,11 @@ export default class ShipSummaryTable extends TranslatedComponent {
<td>{formats.pct1(ship.hullKinRes)}</td> <td>{formats.pct1(ship.hullKinRes)}</td>
<td>{formats.pct1(ship.hullThermRes)}</td> <td>{formats.pct1(ship.hullThermRes)}</td>
<td>{formats.pct1(ship.hullCausRes)}</td> <td>{formats.pct1(ship.hullCausRes)}</td>
<td>{int(ship.armour)}</td> <td>{int(armourMetrics.total)}</td>
<td>{int(ship.armour * ((1 / (1 - (ship.hullExplRes)))))}</td> <td>{int(armourMetrics.total / armourMetrics.explosive.total)}</td>
<td>{int(ship.armour * ((1 / (1 - (ship.hullKinRes)))))}</td> <td>{int(armourMetrics.total/ armourMetrics.kinetic.total)}</td>
<td>{int(ship.armour * ((1 / (1 - (ship.hullThermRes)))))}</td> <td>{int(armourMetrics.total / armourMetrics.thermal.total)}</td>
<td>{int(ship.armour * ((1 / (1 - (ship.hullCausRes)))))}</td> <td>{int(armourMetrics.total/ armourMetrics.caustic.total)}</td>
<td>{int(armourMetrics.modulearmour)}</td> <td>{int(armourMetrics.modulearmour)}</td>
<td>{int(armourMetrics.moduleprotection * 100) + '%'}</td> <td>{int(armourMetrics.moduleprotection * 100) + '%'}</td>

View File

@@ -61,7 +61,7 @@
"TT_SUMMARY_SPEED": "给推进器分配4格能量值且满燃料", "TT_SUMMARY_SPEED": "给推进器分配4格能量值且满燃料",
"TT_SUMMARY_SPEED_NONFUNCTIONAL": "推进器被关闭或者飞船满燃料满载时的总质量超出推进器最大可推进质量", "TT_SUMMARY_SPEED_NONFUNCTIONAL": "推进器被关闭或者飞船满燃料满载时的总质量超出推进器最大可推进质量",
"TT_SUMMARY_BOOST": "给推进器分配4格能量值且满燃料", "TT_SUMMARY_BOOST": "给推进器分配4格能量值且满燃料",
"TT_SUMMARY_BOOST_TIME": "给推进器分配4格能量值时每次助推间隔时间", "TT_SUMMARY_BOOST_INTERVAL": "给推进器分配4格能量值时每次助推间隔时间",
"TT_SUMMARY_BOOST_NONFUNCTIONAL": "配电器无法提供足够的能量以供助推", "TT_SUMMARY_BOOST_NONFUNCTIONAL": "配电器无法提供足够的能量以供助推",
"TT_SUMMARY_SHIELDS": "护盾的绝对值,包含增幅装置", "TT_SUMMARY_SHIELDS": "护盾的绝对值,包含增幅装置",
"TT_SUMMARY_SHIELDS_SCB": "护盾的绝对值,包含增幅装置和护盾电池", "TT_SUMMARY_SHIELDS_SCB": "护盾的绝对值,包含增幅装置和护盾电池",
@@ -157,7 +157,7 @@
"shield": "护盾", "shield": "护盾",
"integrity": "强度", "integrity": "强度",
"mass": "质量", "mass": "质量",
"boost time": "推进时间", "boost interval": "推进时间",
"resting heat (Beta)": "待机热量(测试)", "resting heat (Beta)": "待机热量(测试)",
"No Shield": "无护盾", "No Shield": "无护盾",
"resistance": "抗性", "resistance": "抗性",

View File

@@ -63,7 +63,7 @@
"TT_SUMMARY_SPEED": "With full fuel tank and 4 pips to ENG", "TT_SUMMARY_SPEED": "With full fuel tank and 4 pips to ENG",
"TT_SUMMARY_SPEED_NONFUNCTIONAL": "Thrusters powered off or over maximum mass with full fuel and cargo loads", "TT_SUMMARY_SPEED_NONFUNCTIONAL": "Thrusters powered off or over maximum mass with full fuel and cargo loads",
"TT_SUMMARY_BOOST": "With full fuel tank and 4 pips to ENG", "TT_SUMMARY_BOOST": "With full fuel tank and 4 pips to ENG",
"TT_SUMMARY_BOOST_TIME": "Time between each boost with 4 pips to ENG", "TT_SUMMARY_BOOST_INTERVAL": "Time between each boost with 4 pips to ENG",
"TT_SUMMARY_BOOST_NONFUNCTIONAL": "Power distributor not able to supply enough power to boost", "TT_SUMMARY_BOOST_NONFUNCTIONAL": "Power distributor not able to supply enough power to boost",
"TT_SUMMARY_SHIELDS": "Raw shield strength, including boosters", "TT_SUMMARY_SHIELDS": "Raw shield strength, including boosters",
"TT_SUMMARY_SHIELDS_SCB": "Raw shield strength, including boosters and SCBs", "TT_SUMMARY_SHIELDS_SCB": "Raw shield strength, including boosters and SCBs",
@@ -205,7 +205,7 @@
"internal protection": "Internal protection", "internal protection": "Internal protection",
"external protection": "External protection", "external protection": "External protection",
"engagement range": "Engagement range", "engagement range": "Engagement range",
"boost time": "Boost time", "boost interval": "Boost intervall",
"total": "Total", "total": "Total",
"ammo": "Ammunition maximum", "ammo": "Ammunition maximum",
"boot": "Boot time", "boot": "Boot time",

View File

@@ -400,7 +400,7 @@ export function shieldMetrics(ship, sys) {
let shieldAddition = 0; let shieldAddition = 0;
if (ship) { if (ship) {
for (const module of ship.internal) { for (const module of ship.internal) {
if (module && module.m && module.m.grp === 'gsrp') { if (module && module.m && module.m.grp === 'gsrp' && module.enabled) {
shieldAddition += module.m.getShieldAddition(); shieldAddition += module.m.getShieldAddition();
} }
} }
@@ -465,6 +465,7 @@ export function shieldMetrics(ship, sys) {
boosters: boostersStrength, boosters: boostersStrength,
addition: shieldAddition, addition: shieldAddition,
cells: ship.shieldCells, cells: ship.shieldCells,
summary: generatorStrength + boostersStrength + shieldAddition,
total: generatorStrength + boostersStrength + ship.shieldCells + shieldAddition, total: generatorStrength + boostersStrength + ship.shieldCells + shieldAddition,
recover, recover,
recharge, recharge,
@@ -573,7 +574,7 @@ export function armourMetrics(ship) {
// }; // };
// Armour from HRPs and module armour from MRPs // Armour from HRPs and module armour from MRPs
for (let slot of ship.internal) { for (let slot of ship.internal) {
if (slot.m && (slot.m.grp === 'hr' || slot.m.grp === 'ghrp' || slot.m.grp == 'mahr')) { if (slot.m && slot.enabled && (slot.m.grp === 'hr' || slot.m.grp === 'ghrp' || slot.m.grp == 'mahr')) {
armourReinforcement += slot.m.getHullReinforcement(); armourReinforcement += slot.m.getHullReinforcement();
// Hull boost for HRPs is applied against the ship's base armour // Hull boost for HRPs is applied against the ship's base armour
armourReinforcement += ship.baseArmour * slot.m.getModValue('hullboost') / 10000; armourReinforcement += ship.baseArmour * slot.m.getModValue('hullboost') / 10000;
@@ -585,7 +586,7 @@ export function armourMetrics(ship) {
hullThermDmg = hullThermDmg * (1 - slot.m.getThermalResistance()); hullThermDmg = hullThermDmg * (1 - slot.m.getThermalResistance());
hullCausDmg = hullCausDmg * (1 - slot.m.getCausticResistance()); hullCausDmg = hullCausDmg * (1 - slot.m.getCausticResistance());
} }
if (slot.m && (slot.m.grp == 'mrp' || slot.m.grp == 'gmrp')) { if (slot.m && slot.enabled && (slot.m.grp == 'mrp' || slot.m.grp == 'gmrp')) {
moduleArmour += slot.m.getIntegrity(); moduleArmour += slot.m.getIntegrity();
moduleProtection = moduleProtection * (1 - slot.m.getProtection()); moduleProtection = moduleProtection * (1 - slot.m.getProtection());
} }

View File

@@ -583,20 +583,9 @@ export default class Module {
* @return {Number} the falloff of this module * @return {Number} the falloff of this module
*/ */
getFalloff(modified = true) { getFalloff(modified = true) {
if (!modified) {
const range = this.getRange(false);
const falloff = this.get('falloff', false);
return (falloff > range ? range : falloff);
}
// Falloff from range is mapped to range // Falloff from range is mapped to range
if (this.mods && this.mods['fallofffromrange']) { if (modified && this.mods && this.mods['fallofffromrange']) {
return this.getRange(); return this.getRange();
// Need to find out if we have a focused modification, in which case our
// falloff is scaled to range
} else if (this.blueprint && this.blueprint.name === 'Focused') {
const rangeMod = this.getModValue('range') / 10000;
return this.falloff * (1 + rangeMod);
// Standard falloff calculation // Standard falloff calculation
} else { } else {
const range = this.getRange(); const range = this.getRange();
@@ -818,12 +807,11 @@ export default class Module {
} }
/** /**
* Get the SDPS for this module * Return the factor that gets applied when calculating certain "sustained"
* values, e.g. `SDPS = this.getSustainedFactor() * DPS`.
* @param {Boolean} [modified=true] Whether to take modifications into account * @param {Boolean} [modified=true] Whether to take modifications into account
* @return {Number} The SDPS of this module
*/ */
getSDps(modified = true) { getSustainedFactor(modified = true) {
let dps = this.getDps(modified);
let clipSize = this.getClip(modified); let clipSize = this.getClip(modified);
if (clipSize) { if (clipSize) {
// If auto-loader is applied, effective clip size will be nearly doubled // If auto-loader is applied, effective clip size will be nearly doubled
@@ -838,12 +826,21 @@ export default class Module {
// rof we need to take another burst without pause into account // rof we need to take another burst without pause into account
let burstOverhead = (burstSize - 1) / (this.get('burstrof', modified) || 1); let burstOverhead = (burstSize - 1) / (this.get('burstrof', modified) || 1);
let srof = clipSize / ((clipSize - burstSize) / rof + burstOverhead + this.getReload(modified)); let srof = clipSize / ((clipSize - burstSize) / rof + burstOverhead + this.getReload(modified));
return dps * srof / rof; return srof / rof;
} else { } else {
return dps; return 1;
} }
} }
/**
* Get the SDPS for this module
* @param {Boolean} [modified=true] Whether to take modifications into account
* @return {Number} The SDPS of this module
*/
getSDps(modified = true) {
return this.getDps(modified) * this.getSustainedFactor(modified);
}
/** /**
* Get the EPS for this module * Get the EPS for this module
* @param {Boolean} [modified=true] Whether to take modifications into account * @param {Boolean} [modified=true] Whether to take modifications into account

View File

@@ -249,6 +249,13 @@ function _addModifications(module, modifiers, blueprint, grade, specialModificat
if (!modifiers) return; if (!modifiers) return;
let special; let special;
if (specialModifications) { if (specialModifications) {
if (specialModifications == 'special_plasma_slug') {
if (module.symbol.match(/PlasmaAccelerator/i)) {
specialModifications = 'special_plasma_slug_pa';
} else {
specialModifications = 'special_plasma_slug_cooled';
}
}
special = Modifications.specials[specialModifications]; special = Modifications.specials[specialModifications];
} }
// Add the blueprint definition, grade and special // Add the blueprint definition, grade and special
@@ -274,6 +281,9 @@ function _addModifications(module, modifiers, blueprint, grade, specialModificat
if (value === Infinity) { if (value === Infinity) {
value = modifiers[i].Value * 100; value = modifiers[i].Value * 100;
} }
if (modifiers[i].Label.search('DamageFalloffRange') >= 0) {
value = (modifiers[i].Value / module.range - 1) * 100;
}
if (modifiers[i].Label.search('Resistance') >= 0) { if (modifiers[i].Label.search('Resistance') >= 0) {
value = (modifiers[i].Value * 100) - (modifiers[i].OriginalValue * 100); value = (modifiers[i].Value * 100) - (modifiers[i].OriginalValue * 100);
} }