correct maths in updated portal weakness - oops

This commit is contained in:
Jon Atkins 2013-12-01 20:04:32 +00:00
parent 1452a1c534
commit 8988852eb8

View File

@ -25,14 +25,13 @@ window.plugin.portalWeakness.highlightWeakness = function(data) {
if(data.portal.options.team != TEAM_NONE) { if(data.portal.options.team != TEAM_NONE) {
var res_count = data.portal.options.data.resCount; 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) { if(strength < 1) {
var fill_opacity = weakness*.85 + .15; var fill_opacity = (1-strength)*.85 + .15;
var color = 'red'; var color = 'red';
fill_opacity = Math.round(fill_opacity*100)/100;
var params = {fillColor: color, fillOpacity: fill_opacity}; var params = {fillColor: color, fillOpacity: fill_opacity};
// Hole per missing resonator // Hole per missing resonator