Add falloff for weapons

This commit is contained in:
Cmdr McDonald
2017-01-14 09:52:31 +00:00
parent 792eda2572
commit 53137e0ae1
6 changed files with 35 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
#2.2.9 #2.2.9
* Use SSL-enabled server for shortlinks * Use SSL-enabled server for shortlinks
* Add falloff for weapons
#2.2.8 #2.2.8
* Fix issue where filling all internals with cargo racks would include restricted slots * Fix issue where filling all internals with cargo racks would include restricted slots

View File

@@ -104,6 +104,7 @@ export default class DamageDealt extends TranslatedComponent {
for (let i = 0; i < ship.hardpoints.length; i++) { for (let i = 0; i < ship.hardpoints.length; i++) {
if (ship.hardpoints[i].m) { if (ship.hardpoints[i].m) {
const m = ship.hardpoints[i].m; const m = ship.hardpoints[i].m;
if (m.getDamage() && m.grp !== 'po') {
const classRating = `${m.class}${m.rating}${m.missile ? '/' + m.missile : ''}`; const classRating = `${m.class}${m.rating}${m.missile ? '/' + m.missile : ''}`;
const effectiveness = m.getPiercing() >= against.properties.hardness ? 1 : m.getPiercing() / against.properties.hardness; const effectiveness = m.getPiercing() >= against.properties.hardness ? 1 : m.getPiercing() / against.properties.hardness;
const effectiveDps = m.getDps() * effectiveness; const effectiveDps = m.getDps() * effectiveness;
@@ -118,6 +119,7 @@ export default class DamageDealt extends TranslatedComponent {
effectiveness }); effectiveness });
} }
} }
}
return weapons; return weapons;
} }

View File

@@ -74,6 +74,7 @@ export default class HardpointSlot extends Slot {
{ 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 } { 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 }
{ m.getRoF() ? <div className={'l'} onMouseOver={termtip.bind(null, 'rof')} onMouseOut={tooltip.bind(null, null)}>{translate('ROF')}: {formats.f1(m.getRoF())}{u.ps}</div> : null } { m.getRoF() ? <div className={'l'} onMouseOver={termtip.bind(null, 'rof')} onMouseOut={tooltip.bind(null, null)}>{translate('ROF')}: {formats.f1(m.getRoF())}{u.ps}</div> : null }
{ m.getRange() ? <div className={'l'}>{translate('range')} {formats.f1(m.getRange() / 1000)}{u.km}</div> : null } { m.getRange() ? <div className={'l'}>{translate('range')} {formats.f1(m.getRange() / 1000)}{u.km}</div> : null }
{ m.getFalloff() ? <div className={'l'}>{translate('falloff')} {formats.f1(m.getFalloff() / 1000)}{u.km}</div> : null }
{ m.getShieldBoost() ? <div className={'l'}>+{formats.pct1(m.getShieldBoost())}</div> : null } { m.getShieldBoost() ? <div className={'l'}>+{formats.pct1(m.getShieldBoost())}</div> : null }
{ m.getAmmo() ? <div className={'l'}>{translate('ammunition')}: {formats.int(m.getClip())}/{formats.int(m.getAmmo())}</div> : null } { m.getAmmo() ? <div className={'l'}>{translate('ammunition')}: {formats.int(m.getClip())}/{formats.int(m.getAmmo())}</div> : null }
{ m.getPiercing() ? <div className={'l'}>{translate('piercing')}: {formats.int(m.getPiercing())}</div> : null } { m.getPiercing() ? <div className={'l'}>{translate('piercing')}: {formats.int(m.getPiercing())}</div> : null }

View File

@@ -39,8 +39,10 @@ export default class ModificationsMenu extends TranslatedComponent {
let list = []; let list = [];
for (let modName of Modifications.validity[m.grp]) { for (let modName of Modifications.validity[m.grp]) {
if (Modifications.modifications[modName].type != 'hidden') {
list.push(<Modification key={ modName } ship={ ship } m={ m } name={ modName } onChange={ onChange }/>); list.push(<Modification key={ modName } ship={ ship } m={ m } name={ modName } onChange={ onChange }/>);
} }
}
return { list }; return { list };
} }

View File

@@ -286,6 +286,20 @@ export default class Module {
return this._getModifiedValue('range'); return this._getModifiedValue('range');
} }
/**
* Get the falloff for this module, taking in to account modifications
* @return {Number} the falloff of this module
*/
getFalloff() {
if (this.getModValue('fallofffromrange')) {
return this.getRange();
} else {
const falloff = this._getModifiedValue('falloff');
const range = this.getRange();
return (falloff > range ? range : falloff);
}
}
/** /**
* Get the range (in terms of seconds, for FSDI) for this module, taking in to account modifications * Get the range (in terms of seconds, for FSDI) for this module, taking in to account modifications
* @return {Number} the range of this module * @return {Number} the range of this module

View File

@@ -305,6 +305,9 @@ function _addModifications(module, modifiers, blueprint, grade) {
} else if (modifiers.modifiers[i].name === 'mod_weapon_burst_rof') { } else if (modifiers.modifiers[i].name === 'mod_weapon_burst_rof') {
// For some reason this is a non-normalised percentage (i.e. 12.23% is 12.23 value rather than 0.1223 as everywhere else), so fix that here // For some reason this is a non-normalised percentage (i.e. 12.23% is 12.23 value rather than 0.1223 as everywhere else), so fix that here
module.setModValue('burstrof', modifiers.modifiers[i].value * 100); module.setModValue('burstrof', modifiers.modifiers[i].value * 100);
} else if (modifiers.modifiers[i].name === 'mod_weapon_falloffrange_from_range') {
// Obtain the falloff value directly from the range
module.setModValue('fallofffromrange', 1);
} else { } else {
// Look up the modifiers to find what we need to do // Look up the modifiers to find what we need to do
const modifierActions = Modifications.modifierActions[modifiers.modifiers[i].name]; const modifierActions = Modifications.modifierActions[modifiers.modifiers[i].name];