From 8988852eb8bbd57cc52aa40ec19f02c41fd11367 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 1 Dec 2013 20:04:32 +0000 Subject: [PATCH] correct maths in updated portal weakness - oops --- plugins/show-portal-weakness.user.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/show-portal-weakness.user.js b/plugins/show-portal-weakness.user.js index 72c4c99b..a469a741 100644 --- a/plugins/show-portal-weakness.user.js +++ b/plugins/show-portal-weakness.user.js @@ -25,14 +25,13 @@ window.plugin.portalWeakness.highlightWeakness = function(data) { if(data.portal.options.team != TEAM_NONE) { var res_count = data.portal.options.data.resCount; - var portal_health = data.portal.options.data.health/100; + var portal_health = data.portal.options.data.health; - var weakness = (res_count/8) * (portal_health/100); + var strength = (res_count/8) * (portal_health/100); - if(weakness < 1) { - var fill_opacity = weakness*.85 + .15; + if(strength < 1) { + var fill_opacity = (1-strength)*.85 + .15; var color = 'red'; - fill_opacity = Math.round(fill_opacity*100)/100; var params = {fillColor: color, fillOpacity: fill_opacity}; // Hole per missing resonator