update plugins to use new IITC core mitigation calculations

This commit is contained in:
Jon Atkins
2013-09-19 13:06:06 +01:00
parent 0fb6650ad0
commit 148d1d10b6
2 changed files with 7 additions and 59 deletions

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-defense@gluckies
// @name IITC plugin: portal defense
// @category Layer
// @version 0.2.0.@@DATETIMEVERSION@@
// @version 0.2.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -50,41 +50,17 @@ window.plugin.portalDefense.getDisplay = function() {
return window.plugin.portalDefense.DisplayEnum.OFF;
}
window.plugin.portalDefense.computeDef = function(portal) {
var m = portal.options.details.portalV2.linkedModArray;
var ret = {};
ret.mod = 0;
ret.links = 0;
var display = "";
$.each(m, function(ind, mod) {
if (!mod) return true;
if(!mod.stats.MITIGATION)
return true;
ret.mod += parseInt(mod.stats.MITIGATION);
});
var link = 0;
$(portal.options.details.portalV2.linkedEdges).each(function () {
link++;
});
if (link > 0) {
ret.links = Math.round(400/9*Math.atan(link/Math.E));
}
ret.total = Math.min(95, ret.mod + ret.links);
return ret;
}
window.plugin.portalDefense.renderAttackRegion = function(portal) {
plugin.portalDefense.removeAttackRegion(portal);
if (window.plugin.portalDefense.currentDisplay == window.plugin.portalDefense.DisplayEnum.OFF) return;
plugin.portalDefense.regionLayers[portal.options.guid] = [];
var defense = window.plugin.portalDefense.computeDef(portal);
var defense = window.getPortalMitigationDetails(portal.options.details);
if (defense.total) {
var display = defense.total;
if (window.plugin.portalDefense.currentDisplay == window.plugin.portalDefense.DisplayEnum.DETAIL) {
if (defense.mod) {
display += "<br>"+"\u2297"+defense.mod;
if (defense.shields) {
display += "<br>"+"\u2297"+defense.shields;
}
if(defense.links) {
display += "<br>"+"\u21b1"+defense.links;