include force amplifier, attack frequency and hit bonus in portal details

This commit is contained in:
fkloft
2015-01-19 21:13:57 +01:00
parent 2d674e904a
commit 0bdaa2f5c3
4 changed files with 81 additions and 26 deletions

View File

@ -69,26 +69,22 @@ window.getPortalRange = function(d) {
window.getLinkAmpRangeBoost = function(d) {
// additional range boost calculation
// (at the time of writing, only rare link amps have been seen in the wild, so there's a little guesswork at how
// the stats work and combine - jon 2013-06-26)
// link amps scale: first is full, second a quarter, the last two an eighth
var scale = [1.0, 0.25, 0.125, 0.125];
var boost = 0.0; // initial boost is 0.0 (i.e. no boost over standard range)
var count = 0;
var linkAmps = getPortalModsByType(d, 'LINK_AMPLIFIER');
$.each(linkAmps, function(ind, mod) {
linkAmps.forEach(function(mod, i) {
// link amp stat LINK_RANGE_MULTIPLIER is 2000 for rare, and gives 2x boost to the range
// and very-rare is 7000 and gives 7x the range
var baseMultiplier = mod.stats.LINK_RANGE_MULTIPLIER/1000;
boost += baseMultiplier*scale[count];
count++;
boost += baseMultiplier*scale[i];
});
return (count > 0) ? boost : 1.0;
return (linkAmps.length > 0) ? boost : 1.0;
}
@ -316,3 +312,42 @@ window.getPortalSummaryData = function(d) {
type: 'portal'
};
}
window.getPortalAttackValues = function(d) {
var forceamps = getPortalModsByType(d, 'FORCE_AMP');
var turrets = getPortalModsByType(d, 'TURRET');
// at the time of writing, only rare force amps and turrets have been seen in the wild, so there's a little guesswork
// at how the stats work and combine
// algorithm has been compied from getLinkAmpRangeBoost
// FIXME: only extract stats and put the calculation in a method to be used for link range, force amplifier and attack
// frequency
// note: scanner shows rounded values (adding a second FA shows: 2.5x+0.2x=2.8x, which should be 2.5x+0.25x=2.75x)
// amplifier scale: first is full, second a quarter, the last two an eighth
var scale = [1.0, 0.25, 0.125, 0.125];
var attackValues = {
hit_bonus: 0,
force_amplifier: 0,
attack_frequency: 0,
};
forceamps.forEach(function(mod, i) {
// force amp stat FORCE_AMPLIFIER is 2000 for rare, and gives 2x boost to the range
var baseMultiplier = mod.stats.FORCE_AMPLIFIER / 1000;
attackValues.force_amplifier += baseMultiplier * scale[i];
});
turrets.forEach(function(mod, i) {
// turret stat ATTACK_FREQUENCY is 2000 for rare, and gives 2x boost to the range
var baseMultiplier = mod.stats.ATTACK_FREQUENCY / 1000;
attackValues.attack_frequency += baseMultiplier * scale[i];
attackValues.hit_bonus += mod.stats.HIT_BONUS / 10000;
});
return attackValues;
}