diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js
index 42cf0c95..4e082670 100644
--- a/code/portal_detail_display_tools.js
+++ b/code/portal_detail_display_tools.js
@@ -137,19 +137,24 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) {
window.getDestroyAP = function(d) {
console.log('rendering destroy AP');
var res_count = 0;
- var links = 0;
+ var links_count = 0;
+ var fields_count
- $.each(d.resonatorArray.resonators, function(ind, reso)
- {
+ $.each(d.resonatorArray.resonators, function(ind, reso) {
res_count += 1;
});
- if(d.portalV2.linkedEdges) $.each(d.portalV2.linkedEdges, function(ind, link)
- {
- links++;
- });
+ if(d.portalV2.linkedEdges) {
+ $.each(d.portalV2.linkedEdges, function(ind, link) {
+ links_count++;
+ });
+ }
- var ap_count = (res_count * DESTROY_RESONATOR) + (links * DESTROY_LINK);
+ if(d.portalV2.linkedFields) {
+ fields_count = d.portalV2.linkedFields.length;
+ }
+
+ var ap_count = (res_count * DESTROY_RESONATOR) + (links_count * DESTROY_LINK) + (fields_count * DESTROY_FIELD);
- return 'Destroy ' + res_count + 'x res + ' + links + 'x link -> ' + ap_count + 'AP';
+ return 'Destroy ' + res_count + 'x res + ' + links_count + 'x link → ' + ap_count + 'AP';
}
diff --git a/main.js b/main.js
index b99017df..f36b3b70 100644
--- a/main.js
+++ b/main.js
@@ -129,7 +129,8 @@ var HACK_RANGE = 35; // in meters, max. distance from portal to be able to acces
var OCTANTS = ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE'];
var DEFAULT_PORTAL_IMG = 'http://commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
var DESTROY_RESONATOR = 75; //AP for destroying portal
-var DESTROY_LINK = 187; //AP fro destroying link
+var DESTROY_LINK = 187; //AP for destroying link
+var DESTROY_FIELD = 750; //AP for destroying field
// OTHER MORE-OR-LESS CONSTANTS //////////////////////////////////////
var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q=';