add link amp mod range calculation to portal range

(it involves some guessing, as only 'rare' ones have been seen so far)
alternative to #392
part of #374
This commit is contained in:
Jon Atkins 2013-06-26 21:53:02 +01:00
parent ab3bdcef30
commit c552742def
2 changed files with 30 additions and 3 deletions

View File

@ -8,8 +8,8 @@ window.getRangeText = function(d) {
return ['range',
'<a onclick="window.rangeLinkClick()">'
+ (range > 1000
? Math.round(range/1000) + ' km'
: Math.round(range) + ' m')
? Math.floor(range/1000) + ' km'
: Math.floor(range) + ' m')
+ '</a>'];
}

View File

@ -54,9 +54,36 @@ window.getPortalRange = function(d) {
lvl += parseInt(reso.level);
});
if(resoMissing) return 0;
return 160*Math.pow(getPortalLevel(d), 4);
var range = 160*Math.pow(getPortalLevel(d), 4);
var boost = getLinkAmpRangeBoost(d);
return range*boost;
}
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)
var boost = 1.0; // initial boost is 1.0 (i.e. no boost over standard range)
var scale = 1.0; // scale starts at 1 (full effect of boost) - will be halved after each link amp is processed
$.each(d.portalV2.linkedModArray, function(ind, mod) {
if(mod && mod.type === 'LINK_AMPLIFIER' && mod.stats && mod.stats.LINK_RANGE_MULTIPLIER) {
// link amp stat LINK_RANGE_MULTIPLIER is 2000 for rare, and gives 2x boost to the range
var baseMultiplier = mod.stats.LINK_RANGE_MULTIPLIER/1000;
boost += (baseMultiplier-1)*scale;
scale = scale / 2; // each link amp has half the effect of the previous one
}
});
return boost;
}
window.getAvgResoDist = function(d) {
var sum = 0, resos = 0;
$.each(d.resonatorArray.resonators, function(ind, reso) {