mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Improved docs
This commit is contained in:
@@ -44,9 +44,9 @@ export function weaponComparator(translate, propComparator, desc) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a tooltip that shows damage by type.
|
* Creates a tooltip that shows damage by type.
|
||||||
* @param {function} translate Translation function
|
* @param {function} translate Translation function
|
||||||
* @param {Object} formats Object that holds format functions
|
* @param {Object} formats Object that holds format functions
|
||||||
* @param {Object} sdpsObject Object that holds sdps split up by type
|
* @param {Calc.SDps} sdpsObject Object that holds sdps split up by type
|
||||||
* @returns {Array} Tooltip
|
* @returns {Array} Tooltip
|
||||||
*/
|
*/
|
||||||
function getSDpsTooltip(translate, formats, sdpsObject) {
|
function getSDpsTooltip(translate, formats, sdpsObject) {
|
||||||
@@ -62,9 +62,9 @@ function getSDpsTooltip(translate, formats, sdpsObject) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a data object used by {@link PieChart} that shows damage by type.
|
* Returns a data object used by {@link PieChart} that shows damage by type.
|
||||||
* @param {function} translate Translation function
|
* @param {function} translate Translation function
|
||||||
* @param {Object} sdpsObject Object that holds sdps split up by type
|
* @param {Calc.SDps} sdpsObject Object that holds sdps split up by type
|
||||||
* @returns {Object} Data object
|
* @returns {Object} Data object
|
||||||
*/
|
*/
|
||||||
function getSDpsData(translate, sdpsObject) {
|
function getSDpsData(translate, sdpsObject) {
|
||||||
return Object.keys(sdpsObject).map(key => {
|
return Object.keys(sdpsObject).map(key => {
|
||||||
@@ -77,8 +77,8 @@ function getSDpsData(translate, sdpsObject) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds all damage of `add` onto `addOn`.
|
* Adds all damage of `add` onto `addOn`.
|
||||||
* @param {Object} addOn Object that holds sdps split up by type (will be mutated)
|
* @param {Calc.SDps} addOn Object that holds sdps split up by type (will be mutated)
|
||||||
* @param {Object} add Object that holds sdps split up by type
|
* @param {Calc.SDps} add Object that holds sdps split up by type
|
||||||
*/
|
*/
|
||||||
function addSDps(addOn, add) {
|
function addSDps(addOn, add) {
|
||||||
Object.keys(addOn).map(k => addOn[k] += (add[k] ? add[k] : 0));
|
Object.keys(addOn).map(k => addOn[k] += (add[k] ? add[k] : 0));
|
||||||
@@ -86,7 +86,7 @@ function addSDps(addOn, add) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the overall sdps of an sdps object.
|
* Calculates the overall sdps of an sdps object.
|
||||||
* @param {Object} sdpsObject Object that holds sdps spluit up by type
|
* @param {Calc.SDps} sdpsObject Object that holds sdps spluit up by type
|
||||||
*/
|
*/
|
||||||
function sumSDps(sdpsObject) {
|
function sumSDps(sdpsObject) {
|
||||||
if (sdpsObject.total) {
|
if (sdpsObject.total) {
|
||||||
@@ -127,7 +127,7 @@ export default class Offence extends TranslatedComponent {
|
|||||||
this._sort = this._sort.bind(this);
|
this._sort = this._sort.bind(this);
|
||||||
|
|
||||||
const damage = Calc.offenceMetrics(props.ship, props.opponent, props.wep, props.opponentSys, props.engagementrange);
|
const damage = Calc.offenceMetrics(props.ship, props.opponent, props.wep, props.opponentSys, props.engagementrange);
|
||||||
this.state = {
|
this.state = {
|
||||||
predicate: 'n',
|
predicate: 'n',
|
||||||
desc: true,
|
desc: true,
|
||||||
damage
|
damage
|
||||||
@@ -247,7 +247,7 @@ export default class Offence extends TranslatedComponent {
|
|||||||
<td className='ri'><span onMouseOver={termtip.bind(null, effectiveArmourSDpsTooltipDetails)} onMouseOut={tooltip.bind(null, null)}>{formats.f1(weapon.sdps.armour.total)}</span></td>
|
<td className='ri'><span onMouseOver={termtip.bind(null, effectiveArmourSDpsTooltipDetails)} onMouseOut={tooltip.bind(null, null)}>{formats.f1(weapon.sdps.armour.total)}</span></td>
|
||||||
<td className='ri'><span onMouseOver={termtip.bind(null, effectivenessArmourTooltipDetails)} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(weapon.effectiveness.armour.total)}</span></td>
|
<td className='ri'><span onMouseOver={termtip.bind(null, effectivenessArmourTooltipDetails)} onMouseOut={tooltip.bind(null, null)}>{formats.pct1(weapon.effectiveness.armour.total)}</span></td>
|
||||||
</tr>);
|
</tr>);
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalSDps = sumSDps(totalSDpsObject);
|
const totalSDps = sumSDps(totalSDpsObject);
|
||||||
const totalSDpsTooltipDetails = getSDpsTooltip(translate, formats, totalSDpsObject);
|
const totalSDpsTooltipDetails = getSDpsTooltip(translate, formats, totalSDpsObject);
|
||||||
|
|||||||
@@ -824,14 +824,42 @@ export function _sustainedDps(ship, opponent, opponentShields, opponentArmour, e
|
|||||||
return { shieldsdps, armoursdps, eps };
|
return { shieldsdps, armoursdps, eps };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores SDPS split up by type.
|
||||||
|
* @typedef {Object} SDps
|
||||||
|
* @property {number} absolute Damage of type absolute
|
||||||
|
* @property {number} explosive Damage of type explosive
|
||||||
|
* @property {number} kinetic Damage of type kinetic
|
||||||
|
* @property {number} thermal Damage of type thermal
|
||||||
|
* @property {number} [total] Sum of all damage types
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object that holds information about SDPS for a given weapon and opponent.
|
||||||
|
* @typedef {Object} WeaponDamage
|
||||||
|
* @property {number} eps Energy per second
|
||||||
|
* @property {Object} damage An object that stores damage inflicted by
|
||||||
|
* the weapon.
|
||||||
|
* @property {Object} effectiveness An object that stores the effectiveness of
|
||||||
|
* the weapon against the opponent given.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores overall SDPS and against a given opponent's shields and armour.
|
||||||
|
* @typedef {Object} WeaponDamage~damage
|
||||||
|
* @property {SDps} base Overall SDPS.
|
||||||
|
* @property {SDps} shields SDPS against the given opponent's shields.
|
||||||
|
* @property {SDps} armour SDPS against the given opponent's armour.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the sustained DPS for a weapon at a given range
|
* Calculate the sustained DPS for a weapon at a given range
|
||||||
* @param {Object} m The weapon
|
* @param {Object} m The weapon
|
||||||
* @param {Object} opponent The opponent ship
|
* @param {Object} opponent The opponent ship
|
||||||
* @param {Object} opponentShields The opponent's shield resistances
|
* @param {Object} opponentShields The opponent's shield resistances
|
||||||
* @param {Object} opponentArmour The opponent's armour resistances
|
* @param {Object} opponentArmour The opponent's armour resistances
|
||||||
* @param {int} engagementrange The range between the ship and opponent
|
* @param {int} engagementrange The range between the ship and opponent
|
||||||
* @returns {Object} Sustained DPS for shield and armour
|
* @returns {WeaponDamage} Sustained DPS for shield and armour
|
||||||
*/
|
*/
|
||||||
export function _weaponSustainedDps(m, opponent, opponentShields, opponentArmour, engagementrange) {
|
export function _weaponSustainedDps(m, opponent, opponentShields, opponentArmour, engagementrange) {
|
||||||
const opponentHasShields = opponentShields.generator ? true : false;
|
const opponentHasShields = opponentShields.generator ? true : false;
|
||||||
|
|||||||
Reference in New Issue
Block a user