From c552742def1d414407439b601e4a33e9c049c5ea Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 26 Jun 2013 21:53:02 +0100 Subject: [PATCH] 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 --- code/portal_detail_display_tools.js | 4 ++-- code/portal_info.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index 896dceb0..f0c4d6d3 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -8,8 +8,8 @@ window.getRangeText = function(d) { return ['range', '' + (range > 1000 - ? Math.round(range/1000) + ' km' - : Math.round(range) + ' m') + ? Math.floor(range/1000) + ' km' + : Math.floor(range) + ' m') + '']; } diff --git a/code/portal_info.js b/code/portal_info.js index f414c2c9..77d36c96 100644 --- a/code/portal_info.js +++ b/code/portal_info.js @@ -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) {