import React from 'react';

import Analyzer from 'Parser/Core/Analyzer';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import { formatPercentage } from 'common/format';

import StatisticBox from 'Main/StatisticBox';

import Garothi from 'Raids/AntorusTheBurningThrone/GarothiWorldbreaker';
import Felhounds from 'Raids/AntorusTheBurningThrone/FelhoundsOfSargeras';
import Council from 'Raids/AntorusTheBurningThrone/AntoranHighCommand';
import Eonar from 'Raids/AntorusTheBurningThrone/EonarLifebinder';
import PKeeper from 'Raids/AntorusTheBurningThrone/PortalKeeperHasabel';
import Imonar from 'Raids/AntorusTheBurningThrone/ImonarTheSoulhunter';
import KG from 'Raids/AntorusTheBurningThrone/Kingaroth';
import Vari from 'Raids/AntorusTheBurningThrone/Varimathras';
import Coven from 'Raids/AntorusTheBurningThrone/TheCovenOfShivarra';
import Agg from 'Raids/AntorusTheBurningThrone/Aggramar';
import Argus from 'Raids/AntorusTheBurningThrone/ArgusTheUnmaker';

const mitigationBuffs = {'Paladin' : [SPELLS.SHIELD_OF_THE_RIGHTEOUS_BUFF.id,
                                      SPELLS.ARDENT_DEFENDER.id,
                                      SPELLS.GUARDIAN_OF_ANCIENT_KINGS.id]};

const mitigationChecks = new Map([
  [Garothi.id, Object.values(Garothi.fight.softMitigationChecks)],
  [Felhounds.id, Object.values(Felhounds.fight.softMitigationChecks)],
  [Council.id, Object.values(Council.fight.softMitigationChecks)],
  [Eonar.id, Object.values(Eonar.fight.softMitigationChecks)],
  [PKeeper.id, Object.values(PKeeper.fight.softMitigationChecks)],
  [Imonar.id, Object.values(Imonar.fight.softMitigationChecks)],
  [KG.id, Object.values(KG.fight.softMitigationChecks)],
  [Vari.id, Object.values(Vari.fight.softMitigationChecks)],
  [Coven.id, Object.values(Coven.fight.softMitigationChecks)],
  [Agg.id, Object.values(Agg.fight.softMitigationChecks)],
  [Argus.id, Object.values(Argus.fight.softMitigationChecks)],
]);


class MitigationCheck extends Analyzer{
  static checks;
  static buffCheck;
  static checksPassed = 0;
  static checksFailed = 0;


  constructor(...args) {
    super(...args);
    const boss = this.owner.boss;
    this.checks = mitigationChecks.get(boss.id);
    if(typeof this.checks === "undefined"){
      this.checks = [];
    }
    this.buffCheck = mitigationBuffs[this.owner.player.type];
    this.checksPassed = 0;
    this.checksFailed = 0;
  }


  on_toPlayer_damage(event){
    if(this.checks.includes(event.ability.guid)){
      if(this.buffCheck.some((e) => this.selectedCombatant.hasBuff(e))){
        this.checksPassed += 1;
      } else {
        this.checksFailed += 1;
      }
    }
  }


  statistic(){
    if(this.checksPassed + this.checksFailed === 0){
      return null;
    }
    return (
      <StatisticBox icon={<SpellIcon id={this.buffCheck[0]} />}
        value={`${formatPercentage(this.checksPassed/(this.checksPassed+this.checksFailed))} %`}
        label={`Soft mitigation checks passed.`}
        tooltip={`${this.checksPassed}/${this.checksPassed+this.checksFailed} of tank-targeted abilities were mitigated.`} />
    );
  }

}


export default MitigationCheck;

@@ -253,1710 +253,256 @@
 ort 
-Garothi from 'Raids/AntorusTheBurningThrone/GarothiWorldbreaker';%0Aimport Felhounds from 'Raids/AntorusTheBurningThrone/FelhoundsOfSargeras';%0Aimport Council from 'Raids/AntorusTheBurningThrone/AntoranHighCommand';%0Aimport Eonar from 'Raids/AntorusTheBurningThrone/EonarLifebinder';%0Aimport PKeeper from 'Raids/AntorusTheBurningThrone/PortalKeeperHasabel';%0Aimport Imonar from 'Raids/AntorusTheBurningThrone/ImonarTheSoulhunter';%0Aimport KG from 'Raids/AntorusTheBurningThrone/Kingaroth';%0Aimport Vari from 'Raids/AntorusTheBurningThrone/Varimathras';%0Aimport Coven from 'Raids/AntorusTheBurningThrone/TheCovenOfShivarra';%0Aimport Agg from 'Raids/AntorusTheBurningThrone/Aggramar';%0Aimport Argus from 'Raids/AntorusTheBurningThrone/ArgusTheUnmaker';%0A%0Aconst mitigationBuffs = %7B'Paladin' : %5BSPELLS.SHIELD_OF_THE_RIGHTEOUS_BUFF.id,%0A                                      SPELLS.ARDENT_DEFENDER.id,%0A                                      SPELLS.GUARDIAN_OF_ANCIENT_KINGS.id%5D%7D;%0A%0Aconst mitigationChecks = new Map(%5B%0A  %5BGarothi.id, Object.values(Garothi.fight.softMitigationChecks)%5D,%0A  %5BFelhounds.id, Object.values(Felhounds.fight.softMitigationChecks)%5D,%0A  %5BCouncil.id, Object.values(Council.fight.softMitigationChecks)%5D,%0A  %5BEonar.id, Object.values(Eonar.fight.softMitigationChecks)%5D,%0A  %5BPKeeper.id, Object.values(PKeeper.fight.softMitigationChecks)%5D,%0A  %5BImonar.id, Object.values(Imonar.fight.softMitigationChecks)%5D,%0A  %5BKG.id, Object.values(KG.fight.softMitigationChecks)%5D,%0A  %5BVari.id, Object.values(Vari.fight.softMitigationChecks)%5D,%0A  %5BCoven.id, Object.values(Coven.fight.softMitigationChecks)%5D,%0A  %5BAgg.id, Object.values(Agg.fight.softMitigationChecks)%5D,%0A  %5BArgus.id, Object.values(Argus.fight.softMitigationChecks)%5D,%0A%5D)
+%7BfindByBossId%7D from 'Raids';%0A%0Aconst mitigationBuffs = %7B'Paladin' : %5BSPELLS.SHIELD_OF_THE_RIGHTEOUS_BUFF.id,%0A                                      SPELLS.ARDENT_DEFENDER.id,%0A                                      SPELLS.GUARDIAN_OF_ANCIENT_KINGS.id%5D%7D
 ;%0A%0A%0A
@@ -541,16 +541,17 @@
 alyzer%7B%0A
+%0A
   static
@@ -596,28 +596,24 @@
 checksPassed
- = 0
 ;%0A  static c
@@ -623,20 +623,16 @@
 ksFailed
- = 0
 ;%0A%0A%0A  co
@@ -680,21 +680,88 @@
     
-const boss = 
+this.checksPassed = 0;%0A    this.checksFailed = 0;%0A    const boss = findByBossId(
 this
@@ -775,63 +775,164 @@
 boss
+.id)
 ;%0A    
-this.checks = mitigationChecks.get(boss.id
+if(boss !== null && boss.fight.hasOwnProperty('softMitigationChecks'))%7B%0A      this.checks = Object.values(boss.fight.softMitigationChecks
 );%0A    
+ 
+ 
 if(t
@@ -965,32 +965,34 @@
 efined%22)%7B%0A      
+  
 this.checks = %5B%5D
@@ -993,26 +993,30 @@
 s = %5B%5D;%0A    
+ 
+ 
 %7D%0A
+  
     this.buf
@@ -1073,57 +1073,72 @@
     
-this.checksPassed = 0;%0A    this.checksFailed = 0;
+%7Delse%7B%0A      this.checks = %5B%5D;%0A      this.buffCheck = %5B%5D;%0A    %7D%0A
 %0A  %7D

Change to get boss info via findByBossId rather than having to add each boss to MitigationCheck manually.