mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
Add falloff for weapons
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -104,18 +104,20 @@ 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;
|
||||||
const classRating = `${m.class}${m.rating}${m.missile ? '/' + m.missile : ''}`;
|
if (m.getDamage() && m.grp !== 'po') {
|
||||||
const effectiveness = m.getPiercing() >= against.properties.hardness ? 1 : m.getPiercing() / against.properties.hardness;
|
const classRating = `${m.class}${m.rating}${m.missile ? '/' + m.missile : ''}`;
|
||||||
const effectiveDps = m.getDps() * effectiveness;
|
const effectiveness = m.getPiercing() >= against.properties.hardness ? 1 : m.getPiercing() / against.properties.hardness;
|
||||||
const effectiveSDps = m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) * effectiveness : effectiveDps;
|
const effectiveDps = m.getDps() * effectiveness;
|
||||||
|
const effectiveSDps = m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) * effectiveness : effectiveDps;
|
||||||
|
|
||||||
weapons.push({ id: i,
|
weapons.push({ id: i,
|
||||||
mount: m.mount,
|
mount: m.mount,
|
||||||
name: m.name || m.grp,
|
name: m.name || m.grp,
|
||||||
classRating,
|
classRating,
|
||||||
effectiveDps,
|
effectiveDps,
|
||||||
effectiveSDps,
|
effectiveSDps,
|
||||||
effectiveness });
|
effectiveness });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 }
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ 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]) {
|
||||||
list.push(<Modification key={ modName } ship={ ship } m={ m } name={ modName } onChange={ onChange }/>);
|
if (Modifications.modifications[modName].type != 'hidden') {
|
||||||
|
list.push(<Modification key={ modName } ship={ ship } m={ m } name={ modName } onChange={ onChange }/>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { list };
|
return { list };
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|||||||
Reference in New Issue
Block a user