mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 14:33:22 +00:00
Merge pull request #627 from jeneg/calculations-fix
Corrected calculations of modification values
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import * as ModuleUtils from './ModuleUtils';
|
||||
import { Modifications } from 'coriolis-data/dist';
|
||||
import React from 'react';
|
||||
import { STATS_FORMATTING, SI_PREFIXES } from './StatsFormatting';
|
||||
import { SI_PREFIXES, STATS_FORMATTING } from './StatsFormatting';
|
||||
import { includes } from 'lodash';
|
||||
|
||||
/**
|
||||
* Module - active module in a ship's buildout
|
||||
@@ -41,8 +42,7 @@ export default class Module {
|
||||
* @return {object} The value of the modification. If it is a numeric value then it is returned as an integer value scaled so that 1.23% == 123
|
||||
*/
|
||||
getModValue(name, raw) {
|
||||
let baseVal = this[name];
|
||||
let result = this.mods && this.mods[name] ? this.mods[name] : null;
|
||||
let result = this.mods && this.mods[name] ? this.mods[name] : null;
|
||||
|
||||
if ((!raw) && this.blueprint && this.blueprint.special) {
|
||||
// This module has a special effect, see if we need to alter our returned value
|
||||
@@ -51,7 +51,8 @@ export default class Module {
|
||||
// this special effect modifies our returned value
|
||||
const modification = Modifications.modifications[name];
|
||||
const multiplier = modification.type === 'percentage' ? 10000 : 100;
|
||||
if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') {
|
||||
|
||||
if (includes(['explres', 'kinres', 'thermres', 'causres'], name)) {
|
||||
// Apply resistance modding mechanisms to special effects subsequently
|
||||
result = result + modifierActions[name] * (1 - (this[name] + result / multiplier)) * 100;
|
||||
} else if (modification.method === 'additive') {
|
||||
@@ -59,7 +60,7 @@ export default class Module {
|
||||
} else if (modification.method === 'overwrite') {
|
||||
result = modifierActions[name];
|
||||
} else {
|
||||
result = (((1 + result / multiplier) * (1 + modifierActions[name])) - 1) * multiplier;
|
||||
result = result + modifierActions[name] * multiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user