'use strict';

const BaseEmbed = require('./BaseEmbed.js');

/**
 * Generates enemy embeds
 */
class EnemyEmbed extends BaseEmbed {
  /**
   * @param {Genesis} bot - An instance of Genesis
   * @param {Array.<PersistentEnemy>} enemies - The persistentEnemies to be included in the embed
   */
  constructor(bot, enemies) {
    super();

    this.thumbnail = {
      url: 'http://i.imgur.com/KDMV660.png',
    };
    this.title = 'Worldstate - Enemies';
    this.description = 'Currently discovered enemies:';
    if (enemies.length > 1) {
      this.color = enemies.length > 2 ? 0x00ff00 : 0xff0000;
      this.fields = enemies.map(e => ({
        name: e.agentType,
        value: `Last discovered at ${e.lastDiscoveredAt}.\nIt has ${e.healthPercent}% health remaining and is currently ${e.isDiscovered ? 'discovered' : 'not discovered'}`,
      }));
    } else if (enemies.length === 1) {
      const e = enemies[0];
      this.title = e.agentType;
      this.description = 'Enemy Discovered!';
      this.color = 0xaf5b4b;
      this.fields = [{ name: '_ _', value: `**Discovered At:** ${e.lastDiscoveredAt}` },
      { name: '_ _', value: `**Health Remaining:** ${(100*Number(e.healthPercent)).toFixed(2)}%` },
      { name: '_ _', value: `**Discovered At:** ${e.lastDiscoveredAt}` }];
    } else {
      this.color = 0xaf5b4b;
      this.fields = [{ name: 'There are currently no enemies to combat', value: '_ _' }];
    }
  }
}

module.exports = EnemyEmbed;

@@ -1241,50 +1241,79 @@
 e: %60
-**Discovered At:** $%7Be.lastDiscoveredAt%7D%60 
+Will flee after $%7Be.fleeDamage%7D damage.%5CnGet after the Acolyte, Tenno!%60
 %7D%5D;%0A

Update EnemyEmbed.js