MediaWiki:Tweeki.js: Difference between revisions

From Wizardia Community Wiki

Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for users using the Tweeki skin */
/* Any JavaScript here will be loaded for users using the Tweeki skin */


console.log("message89");
console.log("message90");


if (document.body.classList.contains("page-Battle_analyzer")) {
if (document.body.classList.contains("page-Battle_analyzer")) {
Line 506: Line 506:
function displayCalculator() {
function displayCalculator() {
var calculatorWrap = document.getElementById("baCalculatorWrap");
var calculatorWrap = document.getElementById("baCalculatorWrap");
calculatorWrap.innerHTML = "<div id='baCalculatorIntro' style='color:red' onclick='damageCalculator()'>Count damage</div>";
calculatorWrap.innerHTML = "<div id='baCalculatorIntro' style='cursor:pointer;margin-left:0.2em' onclick='damageCalculator()'>COUNT DAMAGE</div>";
}
}
function damageCalculator() {
function damageCalculator() {

Revision as of 15:03, 2 December 2022

/* Any JavaScript here will be loaded for users using the Tweeki skin */

console.log("message90");

if (document.body.classList.contains("page-Battle_analyzer")) {
  changeH1name();
  addAttributesToWizardDropdowns();
  displayCalculator();
  showTableLegend();
  if (document.getElementById("wizard-1-health").innerHTML) {
      teamDamage();
  }
}
function changeH1name() {
  document.getElementById("firstHeading").innerHTML = "<span dir='auto' class='noselect'>Battle analyzer</span>";
}
function addAttributesToWizardDropdowns() {
  var inputId1 = document.getElementById("input_1");
  var inputId1rarity = document.getElementById("input_2");
  var inputId2 = document.getElementById("input_3");
  var inputId2rarity = document.getElementById("input_4");
  var inputId3 = document.getElementById("input_5");
  var inputId3rarity = document.getElementById("input_6");
  var inputId4 = document.getElementById("input_7");
  var inputId4rarity = document.getElementById("input_8");
  var inputId5 = document.getElementById("input_9");
  var inputId5rarity = document.getElementById("input_10");
  var inputId6 = document.getElementById("input_11");
  var inputId6rarity = document.getElementById("input_12");
  var inputShowOppTbl = document.getElementById("input_13");

  // replace underscore with empty space for Wizard names in Dropdowns
  const nodeList = document.querySelectorAll("#input_1 > option, #input_3 > option, #input_5 > option, #input_7 > option, #input_9 > option, #input_11 > option");
  for (var i = 0; i < nodeList.length; i++) {
    nodeList[i].innerHTML = nodeList[i].innerHTML.replaceAll('_',' ');
  };

  inputId1.setAttribute("required","");
  inputId1.classList.add(inputId1rarity.value);
  inputId1rarity.setAttribute("onchange","changeRarityClassDropdowns('input_1','input_2');");
  inputId1rarity.classList.add(inputId1rarity.value);
  inputId2.setAttribute("required","");
  inputId2.classList.add(inputId2rarity.value);
  inputId2rarity.setAttribute("onchange","changeRarityClassDropdowns('input_3','input_4');");
  inputId2rarity.classList.add(inputId2rarity.value);
  inputId3.setAttribute("required","");
  inputId3.classList.add(inputId3rarity.value);
  inputId3rarity.setAttribute("onchange","changeRarityClassDropdowns('input_5','input_6');");
  inputId3rarity.classList.add(inputId3rarity.value);
  inputId4.setAttribute("required","");
  inputId4.classList.add(inputId4rarity.value);
  inputId4rarity.setAttribute("onchange","changeRarityClassDropdowns('input_7','input_8');");
  inputId4rarity.classList.add(inputId4rarity.value);
  inputId5.setAttribute("required","");
  inputId5.classList.add(inputId5rarity.value);
  inputId5rarity.setAttribute("onchange","changeRarityClassDropdowns('input_9','input_10');");
  inputId5rarity.classList.add(inputId5rarity.value);
  inputId6.setAttribute("required","");
  inputId6.classList.add(inputId6rarity.value);
  inputId6rarity.setAttribute("onchange","changeRarityClassDropdowns('input_11','input_12');");
  inputId6rarity.classList.add(inputId6rarity.value);
  inputShowOppTbl.classList.add("Rare");
}
function changeRarityClassDropdowns(wizardInputId,wizardRarityId) {
  var wizardInput = document.getElementById(wizardInputId);
  var wizardRarity = document.getElementById(wizardRarityId);

  wizardInput.classList.remove("Rare");
  wizardInput.classList.remove("Epic");
  wizardInput.classList.remove("Legendary");
  wizardRarity.classList.remove("Rare");
  wizardRarity.classList.remove("Epic");
  wizardRarity.classList.remove("Legendary");
  wizardInput.classList.add(wizardRarity.value);
  wizardRarity.classList.add(wizardRarity.value);
}
function teamDamage() {
  var wizard1line1 = document.getElementById("wizard-1-line-1");
  var wizard1line1spell1 = document.getElementById("wizard-1-line-1-spell-1");
  var wizard1line1spell2 = document.getElementById("wizard-1-line-1-spell-2");
  var wizard1line2 = document.getElementById("wizard-1-line-2");
  var wizard1line2spell1 = document.getElementById("wizard-1-line-2-spell-1");
  var wizard1line2spell2 = document.getElementById("wizard-1-line-2-spell-2");
  var wizard1line3 = document.getElementById("wizard-1-line-3");
  var wizard1line3spell1 = document.getElementById("wizard-1-line-3-spell-1");
  var wizard1line3spell2 = document.getElementById("wizard-1-line-3-spell-2");
  var wizard2line1 = document.getElementById("wizard-2-line-1");
  var wizard2line1spell1 = document.getElementById("wizard-2-line-1-spell-1");
  var wizard2line1spell2 = document.getElementById("wizard-2-line-1-spell-2");
  var wizard2line2 = document.getElementById("wizard-2-line-2");
  var wizard2line2spell1 = document.getElementById("wizard-2-line-2-spell-1");
  var wizard2line2spell2 = document.getElementById("wizard-2-line-2-spell-2");
  var wizard2line3 = document.getElementById("wizard-2-line-3");
  var wizard2line3spell1 = document.getElementById("wizard-2-line-3-spell-1");
  var wizard2line3spell2 = document.getElementById("wizard-2-line-3-spell-2");
  var wizard3line1 = document.getElementById("wizard-3-line-1");
  var wizard3line1spell1 = document.getElementById("wizard-3-line-1-spell-1");
  var wizard3line1spell2 = document.getElementById("wizard-3-line-1-spell-2");
  var wizard3line2 = document.getElementById("wizard-3-line-2");
  var wizard3line2spell1 = document.getElementById("wizard-3-line-2-spell-1");
  var wizard3line2spell2 = document.getElementById("wizard-3-line-2-spell-2");
  var wizard3line3 = document.getElementById("wizard-3-line-3");
  var wizard3line3spell1 = document.getElementById("wizard-3-line-3-spell-1");
  var wizard3line3spell2 = document.getElementById("wizard-3-line-3-spell-2");
  var wizard4line1 = document.getElementById("wizard-4-line-1");
  var wizard4line1spell1 = document.getElementById("wizard-4-line-1-spell-1");
  var wizard4line1spell2 = document.getElementById("wizard-4-line-1-spell-2");
  var wizard4line2 = document.getElementById("wizard-4-line-2");
  var wizard4line2spell1 = document.getElementById("wizard-4-line-2-spell-1");
  var wizard4line2spell2 = document.getElementById("wizard-4-line-2-spell-2");
  var wizard4line3 = document.getElementById("wizard-4-line-3");
  var wizard4line3spell1 = document.getElementById("wizard-4-line-3-spell-1");
  var wizard4line3spell2 = document.getElementById("wizard-4-line-3-spell-2");
  var wizard5line1 = document.getElementById("wizard-5-line-1");
  var wizard5line1spell1 = document.getElementById("wizard-5-line-1-spell-1");
  var wizard5line1spell2 = document.getElementById("wizard-5-line-1-spell-2");
  var wizard5line2 = document.getElementById("wizard-5-line-2");
  var wizard5line2spell1 = document.getElementById("wizard-5-line-2-spell-1");
  var wizard5line2spell2 = document.getElementById("wizard-5-line-2-spell-2");
  var wizard5line3 = document.getElementById("wizard-5-line-3");
  var wizard5line3spell1 = document.getElementById("wizard-5-line-3-spell-1");
  var wizard5line3spell2 = document.getElementById("wizard-5-line-3-spell-2");
  var wizard6line1 = document.getElementById("wizard-6-line-1");
  var wizard6line1spell1 = document.getElementById("wizard-6-line-1-spell-1");
  var wizard6line1spell2 = document.getElementById("wizard-6-line-1-spell-2");
  var wizard6line2 = document.getElementById("wizard-6-line-2");
  var wizard6line2spell1 = document.getElementById("wizard-6-line-2-spell-1");
  var wizard6line2spell2 = document.getElementById("wizard-6-line-2-spell-2");
  var wizard6line3 = document.getElementById("wizard-6-line-3");
  var wizard6line3spell1 = document.getElementById("wizard-6-line-3-spell-1");
  var wizard6line3spell2 = document.getElementById("wizard-6-line-3-spell-2");

  var wizard1name = document.getElementById("wizard-1-name").innerHTML;
  var wizard1rarity = document.getElementById("wizard-1-name").className;
  var wizard1affinity = document.getElementById("wizard-1-affinity").innerHTML;
  var wizard1spell1name = document.getElementById("wizard-1-spell-1-name").innerHTML;
  var wizard1spell1type = document.getElementById("wizard-1-spell-1-type").innerHTML;
  var wizard1spell1targets = document.getElementById("wizard-1-spell-1-targets").innerHTML;
  var wizard1spell1cost = document.getElementById("wizard-1-spell-1-cost").innerHTML;
  var wizard1spell1value = document.getElementById("wizard-1-spell-1-value").innerHTML;
  var wizard1spell2name = document.getElementById("wizard-1-spell-2-name").innerHTML;
  var wizard1spell2type = document.getElementById("wizard-1-spell-2-type").innerHTML;
  var wizard1spell2targets = document.getElementById("wizard-1-spell-2-targets").innerHTML;
  var wizard1spell2cost = document.getElementById("wizard-1-spell-2-cost").innerHTML;
  var wizard1spell2value = document.getElementById("wizard-1-spell-2-value").innerHTML;

  var wizard2name = document.getElementById("wizard-2-name").innerHTML;
  var wizard2rarity = document.getElementById("wizard-2-name").className;
  var wizard2affinity = document.getElementById("wizard-2-affinity").innerHTML;
  var wizard2spell1name = document.getElementById("wizard-2-spell-1-name").innerHTML;
  var wizard2spell1type = document.getElementById("wizard-2-spell-1-type").innerHTML;
  var wizard2spell1targets = document.getElementById("wizard-2-spell-1-targets").innerHTML;
  var wizard2spell1cost = document.getElementById("wizard-2-spell-1-cost").innerHTML;
  var wizard2spell1value = document.getElementById("wizard-2-spell-1-value").innerHTML;
  var wizard2spell2name = document.getElementById("wizard-2-spell-2-name").innerHTML;
  var wizard2spell2type = document.getElementById("wizard-2-spell-2-type").innerHTML;
  var wizard2spell2targets = document.getElementById("wizard-2-spell-2-targets").innerHTML;
  var wizard2spell2cost = document.getElementById("wizard-2-spell-2-cost").innerHTML;
  var wizard2spell2value = document.getElementById("wizard-2-spell-2-value").innerHTML;

  var wizard3name = document.getElementById("wizard-3-name").innerHTML;
  var wizard3rarity = document.getElementById("wizard-3-name").className;
  var wizard3affinity = document.getElementById("wizard-3-affinity").innerHTML;
  var wizard3spell1name = document.getElementById("wizard-3-spell-1-name").innerHTML;
  var wizard3spell1type = document.getElementById("wizard-3-spell-1-type").innerHTML;
  var wizard3spell1targets = document.getElementById("wizard-3-spell-1-targets").innerHTML;
  var wizard3spell1cost = document.getElementById("wizard-3-spell-1-cost").innerHTML;
  var wizard3spell1value = document.getElementById("wizard-3-spell-1-value").innerHTML;
  var wizard3spell2name = document.getElementById("wizard-3-spell-2-name").innerHTML;
  var wizard3spell2type = document.getElementById("wizard-3-spell-2-type").innerHTML;
  var wizard3spell2targets = document.getElementById("wizard-3-spell-2-targets").innerHTML;
  var wizard3spell2cost = document.getElementById("wizard-3-spell-2-cost").innerHTML;
  var wizard3spell2value = document.getElementById("wizard-3-spell-2-value").innerHTML;

  var wizard4name = document.getElementById("wizard-4-name").innerHTML;
  var wizard4rarity = document.getElementById("wizard-4-name").className;
  var wizard4affinity = document.getElementById("wizard-4-affinity").innerHTML;
  var wizard4spell1name = document.getElementById("wizard-4-spell-1-name").innerHTML;
  var wizard4spell1type = document.getElementById("wizard-4-spell-1-type").innerHTML;
  var wizard4spell1targets = document.getElementById("wizard-4-spell-1-targets").innerHTML;
  var wizard4spell1cost = document.getElementById("wizard-4-spell-1-cost").innerHTML;
  var wizard4spell1value = document.getElementById("wizard-4-spell-1-value").innerHTML;
  var wizard4spell2name = document.getElementById("wizard-4-spell-2-name").innerHTML;
  var wizard4spell2type = document.getElementById("wizard-4-spell-2-type").innerHTML;
  var wizard4spell2targets = document.getElementById("wizard-4-spell-2-targets").innerHTML;
  var wizard4spell2cost = document.getElementById("wizard-4-spell-2-cost").innerHTML;
  var wizard4spell2value = document.getElementById("wizard-4-spell-2-value").innerHTML;

  var wizard5name = document.getElementById("wizard-5-name").innerHTML;
  var wizard5rarity = document.getElementById("wizard-5-name").className;
  var wizard5affinity = document.getElementById("wizard-5-affinity").innerHTML;
  var wizard5spell1name = document.getElementById("wizard-5-spell-1-name").innerHTML;
  var wizard5spell1type = document.getElementById("wizard-5-spell-1-type").innerHTML;
  var wizard5spell1targets = document.getElementById("wizard-5-spell-1-targets").innerHTML;
  var wizard5spell1cost = document.getElementById("wizard-5-spell-1-cost").innerHTML;
  var wizard5spell1value = document.getElementById("wizard-5-spell-1-value").innerHTML;
  var wizard5spell2name = document.getElementById("wizard-5-spell-2-name").innerHTML;
  var wizard5spell2type = document.getElementById("wizard-5-spell-2-type").innerHTML;
  var wizard5spell2targets = document.getElementById("wizard-5-spell-2-targets").innerHTML;
  var wizard5spell2cost = document.getElementById("wizard-5-spell-2-cost").innerHTML;
  var wizard5spell2value = document.getElementById("wizard-5-spell-2-value").innerHTML;

  var wizard6name = document.getElementById("wizard-6-name").innerHTML;
  var wizard6rarity = document.getElementById("wizard-6-name").className;
  var wizard6affinity = document.getElementById("wizard-6-affinity").innerHTML;
  var wizard6spell1name = document.getElementById("wizard-6-spell-1-name").innerHTML;
  var wizard6spell1type = document.getElementById("wizard-6-spell-1-type").innerHTML;
  var wizard6spell1targets = document.getElementById("wizard-6-spell-1-targets").innerHTML;
  var wizard6spell1cost = document.getElementById("wizard-6-spell-1-cost").innerHTML;
  var wizard6spell1value = document.getElementById("wizard-6-spell-1-value").innerHTML;
  var wizard6spell2name = document.getElementById("wizard-6-spell-2-name").innerHTML;
  var wizard6spell2type = document.getElementById("wizard-6-spell-2-type").innerHTML;
  var wizard6spell2targets = document.getElementById("wizard-6-spell-2-targets").innerHTML;
  var wizard6spell2cost = document.getElementById("wizard-6-spell-2-cost").innerHTML;
  var wizard6spell2value = document.getElementById("wizard-6-spell-2-value").innerHTML;

  var wizard1image = document.getElementById("wizard-1-image");
  var wizard2image = document.getElementById("wizard-2-image");
  var wizard3image = document.getElementById("wizard-3-image");
  var wizard4image = document.getElementById("wizard-4-image");
  var wizard5image = document.getElementById("wizard-5-image");
  var wizard6image = document.getElementById("wizard-6-image");
  wizard1image.innerHTML = wizardImage(wizard1name,wizard1rarity,'','100%','Your');
  wizard2image.innerHTML = wizardImage(wizard2name,wizard2rarity,'','100%','Your');
  wizard3image.innerHTML = wizardImage(wizard3name,wizard3rarity,'','100%','Your');
  wizard4image.innerHTML = wizardImage(wizard4name,wizard4rarity,'','100%','Your');
  wizard5image.innerHTML = wizardImage(wizard5name,wizard5rarity,'','100%','Your');
  wizard6image.innerHTML = wizardImage(wizard6name,wizard6rarity,'','100%','Your');

  var wizard1health = document.getElementById("wizard-1-health").innerHTML;
  var wizard2health = document.getElementById("wizard-2-health").innerHTML;
  var wizard3health = document.getElementById("wizard-3-health").innerHTML;
  var wizard4health = document.getElementById("wizard-4-health").innerHTML;
  var wizard5health = document.getElementById("wizard-5-health").innerHTML;
  var wizard6health = document.getElementById("wizard-6-health").innerHTML;

  var healthIconImage = "<img alt='Health' src='//static.miraheze.org/wizardiawiki/1/1f/Health.svg' decoding='async' width='16' height='16' style='vertical-align: text-top;'> ";
  var wizard1healthIcon = document.getElementById("wizard-1-healthIcon");
  var wizard2healthIcon = document.getElementById("wizard-2-healthIcon");
  var wizard3healthIcon = document.getElementById("wizard-3-healthIcon");
  var wizard4healthIcon = document.getElementById("wizard-4-healthIcon");
  var wizard5healthIcon = document.getElementById("wizard-5-healthIcon");
  var wizard6healthIcon = document.getElementById("wizard-6-healthIcon");
  wizard1healthIcon.innerHTML = healthIconImage;
  wizard2healthIcon.innerHTML = healthIconImage;
  wizard3healthIcon.innerHTML = healthIconImage;
  wizard4healthIcon.innerHTML = healthIconImage;
  wizard5healthIcon.innerHTML = healthIconImage;
  wizard6healthIcon.innerHTML = healthIconImage;

  var wizard1speciality = document.getElementById("wizard-1-speciality");
  var wizard2speciality = document.getElementById("wizard-2-speciality");
  var wizard3speciality = document.getElementById("wizard-3-speciality");
  var wizard4speciality = document.getElementById("wizard-4-speciality");
  var wizard5speciality = document.getElementById("wizard-5-speciality");
  var wizard6speciality = document.getElementById("wizard-6-speciality");
  wizard1speciality.innerHTML = whatSpeciality(wizard1spell1type,wizard1spell1targets,wizard1spell2type,wizard1spell2targets);
  wizard2speciality.innerHTML = whatSpeciality(wizard2spell1type,wizard2spell1targets,wizard2spell2type,wizard2spell2targets);
  wizard3speciality.innerHTML = whatSpeciality(wizard3spell1type,wizard3spell1targets,wizard3spell2type,wizard3spell2targets);
  wizard4speciality.innerHTML = whatSpeciality(wizard4spell1type,wizard4spell1targets,wizard4spell2type,wizard4spell2targets);
  wizard5speciality.innerHTML = whatSpeciality(wizard5spell1type,wizard5spell1targets,wizard5spell2type,wizard5spell2targets);
  wizard6speciality.innerHTML = whatSpeciality(wizard6spell1type,wizard6spell1targets,wizard6spell2type,wizard6spell2targets);

  var tooltipTargetsIcon = "<img alt=&quot;Targets&quot; src=&quot;//static.miraheze.org/wizardiawiki/b/ba/Targets.svg&quot; decoding=&quot;async&quot; width=&quot;12&quot; height=&quot;13&quot; style=&quot;vertical-align: text-top&quot;>";
  var tooltipManaIcon = "<img alt=&quot;Mana&quot; src=&quot;//static.miraheze.org/wizardiawiki/f/f3/Mana.svg&quot; decoding=&quot;async&quot; width=&quot;14&quot; height=&quot;13&quot; style=&quot;vertical-align: text-top&quot;>";
  var tooltipDamageIcon = "<img alt=&quot;Damage&quot; src=&quot;//static.miraheze.org/wizardiawiki/f/f3/Damage.svg&quot; decoding=&quot;async&quot; width=&quot;15&quot; height=&quot;13&quot; style=&quot;vertical-align: text-top&quot;>";

  wizard1line1.innerHTML = wizardImage(wizard4name,wizard4rarity,'60px','','Opponent') + wizard4name + " <span class='baOppTblHealth'>(" + wizard4health + ")</span> <div class='baOppTblSpeciality'>" + wizard4speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard4spell1name + "<br />" + tooltipTargetsIcon + " " + wizard4spell1targets + " " + tooltipManaIcon + " " + wizard4spell1cost + " " + tooltipDamageIcon + " " + wizard4spell1value + "</p>'>" + displayDamage(wizard4affinity,wizard1affinity,wizard4spell1type,wizard4spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard4spell2name + "<br />" + tooltipTargetsIcon + " " + wizard4spell2targets + " " + tooltipManaIcon + " " + wizard4spell2cost + " " + tooltipDamageIcon + " " + wizard4spell2value + "</p>'>" + displayDamage(wizard4affinity,wizard1affinity,wizard4spell2type,wizard4spell2value) + "</div></div>";
  wizard1line1.classList.add(wizard4rarity);
  wizard1line1spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell1name + "<br />" + tooltipTargetsIcon + " " + wizard1spell1targets + " " + tooltipManaIcon + " " + wizard1spell1cost + " " + tooltipDamageIcon + " " + wizard1spell1value + "</p>'>" + displayDamage(wizard1affinity,wizard4affinity,wizard1spell1type,wizard1spell1value) + "</div>";
  wizard1line1spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell2name + "<br />" + tooltipTargetsIcon + " " + wizard1spell2targets + " " + tooltipManaIcon + " " + wizard1spell2cost + " " + tooltipDamageIcon + " " + wizard1spell2value + "</p>'>" + displayDamage(wizard1affinity,wizard4affinity,wizard1spell2type,wizard1spell2value) + "</div>";

  wizard1line2.innerHTML = wizardImage(wizard5name,wizard5rarity,'60px','','Opponent') + wizard5name + " <span class='baOppTblHealth'>(" + wizard5health + ")</span> <div class='baOppTblSpeciality'>" + wizard5speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard5spell1name + "<br />" + tooltipTargetsIcon + " " + wizard5spell1targets + " " + tooltipManaIcon + " " + wizard5spell1cost + " " + tooltipDamageIcon + " " + wizard5spell1value + "</p>'>" + displayDamage(wizard5affinity,wizard1affinity,wizard5spell1type,wizard5spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard5spell2name + "<br />" + tooltipTargetsIcon + " " + wizard5spell2targets + " " + tooltipManaIcon + " " + wizard5spell2cost + " " + tooltipDamageIcon + " " + wizard5spell2value + "</p>'>" + displayDamage(wizard5affinity,wizard1affinity,wizard5spell2type,wizard5spell2value) + "</div></div>";
  wizard1line2.classList.add(wizard5rarity);
  wizard1line2spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell1name + "<br />" + tooltipTargetsIcon + " " + wizard1spell1targets + " " + tooltipManaIcon + " " + wizard1spell1cost + " " + tooltipDamageIcon + " " + wizard1spell1value + "</p>'>" + displayDamage(wizard1affinity,wizard5affinity,wizard1spell1type,wizard1spell1value) + "</div>";
  wizard1line2spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell2name + "<br />" + tooltipTargetsIcon + " " + wizard1spell2targets + " " + tooltipManaIcon + " " + wizard1spell2cost + " " + tooltipDamageIcon + " " + wizard1spell2value + "</p>'>" + displayDamage(wizard1affinity,wizard5affinity,wizard1spell2type,wizard1spell2value) + "</div>";

  wizard1line3.innerHTML = wizardImage(wizard6name,wizard6rarity,'60px','','Opponent') + wizard6name + " <span class='baOppTblHealth'>(" + wizard6health + ")</span> <div class='baOppTblSpeciality'>" + wizard6speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard6spell1name + "<br />" + tooltipTargetsIcon + " " + wizard6spell1targets + " " + tooltipManaIcon + " " + wizard6spell1cost + " " + tooltipDamageIcon + " " + wizard6spell1value + "</p>'>" + displayDamage(wizard6affinity,wizard1affinity,wizard6spell1type,wizard6spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard6spell2name + "<br />" + tooltipTargetsIcon + " " + wizard6spell2targets + " " + tooltipManaIcon + " " + wizard6spell2cost + " " + tooltipDamageIcon + " " + wizard6spell2value + "</p>'>" + displayDamage(wizard6affinity,wizard1affinity,wizard6spell2type,wizard6spell2value) + "</div></div>";
  wizard1line3.classList.add(wizard6rarity);
  wizard1line3spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell1name + "<br />" + tooltipTargetsIcon + " " + wizard1spell1targets + " " + tooltipManaIcon + " " + wizard1spell1cost + " " + tooltipDamageIcon + " " + wizard1spell1value + "</p>'>" + displayDamage(wizard1affinity,wizard6affinity,wizard1spell1type,wizard1spell1value) + "</div>";
  wizard1line3spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell2name + "<br />" + tooltipTargetsIcon + " " + wizard1spell2targets + " " + tooltipManaIcon + " " + wizard1spell2cost + " " + tooltipDamageIcon + " " + wizard1spell2value + "</p>'>" + displayDamage(wizard1affinity,wizard6affinity,wizard1spell2type,wizard1spell2value) + "</div>";

  wizard2line1.innerHTML = wizardImage(wizard4name,wizard4rarity,'60px','','Opponent') + wizard4name + " <span class='baOppTblHealth'>(" + wizard4health + ")</span> <div class='baOppTblSpeciality'>" + wizard4speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard4spell1name + "<br />" + tooltipTargetsIcon + " " + wizard4spell1targets + " " + tooltipManaIcon + " " + wizard4spell1cost + " " + tooltipDamageIcon + " " + wizard4spell1value + "</p>'>" + displayDamage(wizard4affinity,wizard2affinity,wizard4spell1type,wizard4spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard4spell2name + "<br />" + tooltipTargetsIcon + " " + wizard4spell2targets + " " + tooltipManaIcon + " " + wizard4spell2cost + " " + tooltipDamageIcon + " " + wizard4spell2value + "</p>'>" + displayDamage(wizard4affinity,wizard2affinity,wizard4spell2type,wizard4spell2value) + "</div></div>";
  wizard2line1.classList.add(wizard4rarity);
  wizard2line1spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell1name + "<br />" + tooltipTargetsIcon + " " + wizard2spell1targets + " " + tooltipManaIcon + " " + wizard2spell1cost + " " + tooltipDamageIcon + " " + wizard2spell1value + "</p>'>" + displayDamage(wizard2affinity,wizard4affinity,wizard2spell1type,wizard2spell1value) + "</div>";
  wizard2line1spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell2name + "<br />" + tooltipTargetsIcon + " " + wizard2spell2targets + " " + tooltipManaIcon + " " + wizard2spell2cost + " " + tooltipDamageIcon + " " + wizard2spell2value + "</p>'>" + displayDamage(wizard2affinity,wizard4affinity,wizard2spell2type,wizard2spell2value) + "</div>";

  wizard2line2.innerHTML = wizardImage(wizard5name,wizard5rarity,'60px','','Opponent') + wizard5name + " <span class='baOppTblHealth'>(" + wizard5health + ")</span> <div class='baOppTblSpeciality'>" + wizard5speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard5spell1name + "<br />" + tooltipTargetsIcon + " " + wizard5spell1targets + " " + tooltipManaIcon + " " + wizard5spell1cost + " " + tooltipDamageIcon + " " + wizard5spell1value + "</p>'>" + displayDamage(wizard5affinity,wizard2affinity,wizard5spell1type,wizard5spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard5spell2name + "<br />" + tooltipTargetsIcon + " " + wizard5spell2targets + " " + tooltipManaIcon + " " + wizard5spell2cost + " " + tooltipDamageIcon + " " + wizard5spell2value + "</p>'>" + displayDamage(wizard5affinity,wizard2affinity,wizard5spell2type,wizard5spell2value) + "</div></div>";
  wizard2line2.classList.add(wizard5rarity);
  wizard2line2spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell1name + "<br />" + tooltipTargetsIcon + " " + wizard2spell1targets + " " + tooltipManaIcon + " " + wizard2spell1cost + " " + tooltipDamageIcon + " " + wizard2spell1value + "</p>'>" + displayDamage(wizard2affinity,wizard5affinity,wizard2spell1type,wizard2spell1value) + "</div>";
  wizard2line2spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell2name + "<br />" + tooltipTargetsIcon + " " + wizard2spell2targets + " " + tooltipManaIcon + " " + wizard2spell2cost + " " + tooltipDamageIcon + " " + wizard2spell2value + "</p>'>" + displayDamage(wizard2affinity,wizard5affinity,wizard2spell2type,wizard2spell2value) + "</div>";

  wizard2line3.innerHTML = wizardImage(wizard6name,wizard6rarity,'60px','','Opponent') + wizard6name + " <span class='baOppTblHealth'>(" + wizard6health + ")</span> <div class='baOppTblSpeciality'>" + wizard6speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard6spell1name + "<br />" + tooltipTargetsIcon + " " + wizard6spell1targets + " " + tooltipManaIcon + " " + wizard6spell1cost + " " + tooltipDamageIcon + " " + wizard6spell1value + "</p>'>" + displayDamage(wizard6affinity,wizard2affinity,wizard6spell1type,wizard6spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard6spell2name + "<br />" + tooltipTargetsIcon + " " + wizard6spell2targets + " " + tooltipManaIcon + " " + wizard6spell2cost + " " + tooltipDamageIcon + " " + wizard6spell2value + "</p>'>" + displayDamage(wizard6affinity,wizard2affinity,wizard6spell2type,wizard6spell2value) + "</div></div>";
  wizard2line3.classList.add(wizard6rarity);
  wizard2line3spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell1name + "<br />" + tooltipTargetsIcon + " " + wizard2spell1targets + " " + tooltipManaIcon + " " + wizard2spell1cost + " " + tooltipDamageIcon + " " + wizard2spell1value + "</p>'>" + displayDamage(wizard2affinity,wizard6affinity,wizard2spell1type,wizard2spell1value) + "</div>";
  wizard2line3spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell2name + "<br />" + tooltipTargetsIcon + " " + wizard2spell2targets + " " + tooltipManaIcon + " " + wizard2spell2cost + " " + tooltipDamageIcon + " " + wizard2spell2value + "</p>'>" + displayDamage(wizard2affinity,wizard6affinity,wizard2spell2type,wizard2spell2value) + "</div>";

  wizard3line1.innerHTML = wizardImage(wizard4name,wizard4rarity,'60px','','Opponent') + wizard4name + " <span class='baOppTblHealth'>(" + wizard4health + ")</span> <div class='baOppTblSpeciality'>" + wizard4speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard4spell1name + "<br />" + tooltipTargetsIcon + " " + wizard4spell1targets + " " + tooltipManaIcon + " " + wizard4spell1cost + " " + tooltipDamageIcon + " " + wizard4spell1value + "</p>'>" + displayDamage(wizard4affinity,wizard3affinity,wizard4spell1type,wizard4spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard4spell2name + "<br />" + tooltipTargetsIcon + " " + wizard4spell2targets + " " + tooltipManaIcon + " " + wizard4spell2cost + " " + tooltipDamageIcon + " " + wizard4spell2value + "</p>'>" + displayDamage(wizard4affinity,wizard3affinity,wizard4spell2type,wizard4spell2value) + "</div></div>";
  wizard3line1.classList.add(wizard4rarity);
  wizard3line1spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell1name + "<br />" + tooltipTargetsIcon + " " + wizard3spell1targets + " " + tooltipManaIcon + " " + wizard3spell1cost + " " + tooltipDamageIcon + " " + wizard3spell1value + "</p>'>" + displayDamage(wizard3affinity,wizard4affinity,wizard3spell1type,wizard3spell1value) + "</div>";
  wizard3line1spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell2name + "<br />" + tooltipTargetsIcon + " " + wizard3spell2targets + " " + tooltipManaIcon + " " + wizard3spell2cost + " " + tooltipDamageIcon + " " + wizard3spell2value + "</p>'>" + displayDamage(wizard3affinity,wizard4affinity,wizard3spell2type,wizard3spell2value) + "</div>";

  wizard3line2.innerHTML = wizardImage(wizard5name,wizard5rarity,'60px','','Opponent') + wizard5name + " <span class='baOppTblHealth'>(" + wizard5health + ")</span> <div class='baOppTblSpeciality'>" + wizard5speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard5spell1name + "<br />" + tooltipTargetsIcon + " " + wizard5spell1targets + " " + tooltipManaIcon + " " + wizard5spell1cost + " " + tooltipDamageIcon + " " + wizard5spell1value + "</p>'>" + displayDamage(wizard5affinity,wizard3affinity,wizard5spell1type,wizard5spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard5spell2name + "<br />" + tooltipTargetsIcon + " " + wizard5spell2targets + " " + tooltipManaIcon + " " + wizard5spell2cost + " " + tooltipDamageIcon + " " + wizard5spell2value + "</p>'>" + displayDamage(wizard5affinity,wizard3affinity,wizard5spell2type,wizard5spell2value) + "</div></div>";
  wizard3line2.classList.add(wizard5rarity);
  wizard3line2spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell1name + "<br />" + tooltipTargetsIcon + " " + wizard3spell1targets + " " + tooltipManaIcon + " " + wizard3spell1cost + " " + tooltipDamageIcon + " " + wizard3spell1value + "</p>'>" + displayDamage(wizard3affinity,wizard5affinity,wizard3spell1type,wizard3spell1value) + "</div>";
  wizard3line2spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell2name + "<br />" + tooltipTargetsIcon + " " + wizard3spell2targets + " " + tooltipManaIcon + " " + wizard3spell2cost + " " + tooltipDamageIcon + " " + wizard3spell2value + "</p>'>" + displayDamage(wizard3affinity,wizard5affinity,wizard3spell2type,wizard3spell2value) + "</div>";

  wizard3line3.innerHTML = wizardImage(wizard6name,wizard6rarity,'60px','','Opponent') + wizard6name + " <span class='baOppTblHealth'>(" + wizard6health + ")</span> <div class='baOppTblSpeciality'>" + wizard6speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard6spell1name + "<br />" + tooltipTargetsIcon + " " + wizard6spell1targets + " " + tooltipManaIcon + " " + wizard6spell1cost + " " + tooltipDamageIcon + " " + wizard6spell1value + "</p>'>" + displayDamage(wizard6affinity,wizard3affinity,wizard6spell1type,wizard6spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard6spell2name + "<br />" + tooltipTargetsIcon + " " + wizard6spell2targets + " " + tooltipManaIcon + " " + wizard6spell2cost + " " + tooltipDamageIcon + " " + wizard6spell2value + "</p>'>" + displayDamage(wizard6affinity,wizard3affinity,wizard6spell2type,wizard6spell2value) + "</div></div>";
  wizard3line3.classList.add(wizard6rarity);
  wizard3line3spell1.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell1name + "<br />" + tooltipTargetsIcon + " " + wizard3spell1targets + " " + tooltipManaIcon + " " + wizard3spell1cost + " " + tooltipDamageIcon + " " + wizard3spell1value + "</p>'>" + displayDamage(wizard3affinity,wizard6affinity,wizard3spell1type,wizard3spell1value) + "</div>";
  wizard3line3spell2.innerHTML = "<div class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell2name + "<br />" + tooltipTargetsIcon + " " + wizard3spell2targets + " " + tooltipManaIcon + " " + wizard3spell2cost + " " + tooltipDamageIcon + " " + wizard3spell2value + "</p>'>" + displayDamage(wizard3affinity,wizard6affinity,wizard3spell2type,wizard3spell2value) + "</div>";

  wizard4line1.innerHTML = wizardImage(wizard1name,wizard1rarity,'60px','','Opponent') + wizard1name + " <span class='baOppTblHealth'>(" + wizard1health + ")</span> <div class='baOppTblSpeciality'>" + wizard1speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell1name + "<br />" + tooltipTargetsIcon + " " + wizard1spell1targets + " " + tooltipManaIcon + " " + wizard1spell1cost + " " + tooltipDamageIcon + " " + wizard1spell1value + "</p>'>" + displayDamage(wizard1affinity,wizard4affinity,wizard1spell1type,wizard1spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell2name + "<br />" + tooltipTargetsIcon + " " + wizard1spell2targets + " " + tooltipManaIcon + " " + wizard1spell2cost + " " + tooltipDamageIcon + " " + wizard1spell2value + "</p>'>" + displayDamage(wizard1affinity,wizard4affinity,wizard1spell2type,wizard1spell2value) + "</div></div>";
  wizard4line1.classList.add(wizard1rarity);
  wizard4line1spell1.innerHTML = displayDamage(wizard4affinity,wizard1affinity,wizard4spell1type,wizard4spell1value);
  wizard4line1spell2.innerHTML = displayDamage(wizard4affinity,wizard1affinity,wizard4spell2type,wizard4spell2value);

  wizard4line2.innerHTML = wizardImage(wizard2name,wizard2rarity,'60px','','Opponent') + wizard2name + " <span class='baOppTblHealth'>(" + wizard2health + ")</span> <div class='baOppTblSpeciality'>" + wizard2speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell1name + "<br />" + tooltipTargetsIcon + " " + wizard2spell1targets + " " + tooltipManaIcon + " " + wizard2spell1cost + " " + tooltipDamageIcon + " " + wizard2spell1value + "</p>'>" + displayDamage(wizard2affinity,wizard4affinity,wizard2spell1type,wizard2spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell2name + "<br />" + tooltipTargetsIcon + " " + wizard2spell2targets + " " + tooltipManaIcon + " " + wizard2spell2cost + " " + tooltipDamageIcon + " " + wizard2spell2value + "</p>'>" + displayDamage(wizard2affinity,wizard4affinity,wizard2spell2type,wizard2spell2value) + "</div></div>";
  wizard4line2.classList.add(wizard2rarity);
  wizard4line2spell1.innerHTML = displayDamage(wizard4affinity,wizard2affinity,wizard4spell1type,wizard4spell1value);
  wizard4line2spell2.innerHTML = displayDamage(wizard4affinity,wizard2affinity,wizard4spell2type,wizard4spell2value);

  wizard4line3.innerHTML = wizardImage(wizard3name,wizard3rarity,'60px','','Opponent') + wizard3name + " <span class='baOppTblHealth'>(" + wizard3health + ")</span> <div class='baOppTblSpeciality'>" + wizard3speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell1name + "<br />" + tooltipTargetsIcon + " " + wizard3spell1targets + " " + tooltipManaIcon + " " + wizard3spell1cost + " " + tooltipDamageIcon + " " + wizard3spell1value + "</p>'>" + displayDamage(wizard3affinity,wizard4affinity,wizard3spell1type,wizard3spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell2name + "<br />" + tooltipTargetsIcon + " " + wizard3spell2targets + " " + tooltipManaIcon + " " + wizard3spell2cost + " " + tooltipDamageIcon + " " + wizard3spell2value + "</p>'>" + displayDamage(wizard3affinity,wizard4affinity,wizard3spell2type,wizard3spell2value) + "</div></div>";
  wizard4line3.classList.add(wizard3rarity);
  wizard4line3spell1.innerHTML = displayDamage(wizard4affinity,wizard3affinity,wizard4spell1type,wizard4spell1value);
  wizard4line3spell2.innerHTML = displayDamage(wizard4affinity,wizard3affinity,wizard4spell2type,wizard4spell2value);

  wizard5line1.innerHTML = wizardImage(wizard1name,wizard1rarity,'60px','','Opponent') + wizard1name + " <span class='baOppTblHealth'>(" + wizard1health + ")</span> <div class='baOppTblSpeciality'>" + wizard1speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell1name + "<br />" + tooltipTargetsIcon + " " + wizard1spell1targets + " " + tooltipManaIcon + " " + wizard1spell1cost + " " + tooltipDamageIcon + " " + wizard1spell1value + "</p>'>" + displayDamage(wizard1affinity,wizard5affinity,wizard1spell1type,wizard1spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell2name + "<br />" + tooltipTargetsIcon + " " + wizard1spell2targets + " " + tooltipManaIcon + " " + wizard1spell2cost + " " + tooltipDamageIcon + " " + wizard1spell2value + "</p>'>" + displayDamage(wizard1affinity,wizard5affinity,wizard1spell2type,wizard1spell2value) + "</div></div>";
  wizard5line1.classList.add(wizard1rarity);
  wizard5line1spell1.innerHTML = displayDamage(wizard5affinity,wizard1affinity,wizard5spell1type,wizard5spell1value);
  wizard5line1spell2.innerHTML = displayDamage(wizard5affinity,wizard1affinity,wizard5spell2type,wizard5spell2value);

  wizard5line2.innerHTML = wizardImage(wizard2name,wizard2rarity,'60px','','Opponent') + wizard2name + " <span class='baOppTblHealth'>(" + wizard2health + ")</span> <div class='baOppTblSpeciality'>" + wizard2speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell1name + "<br />" + tooltipTargetsIcon + " " + wizard2spell1targets + " " + tooltipManaIcon + " " + wizard2spell1cost + " " + tooltipDamageIcon + " " + wizard2spell1value + "</p>'>" + displayDamage(wizard2affinity,wizard5affinity,wizard2spell1type,wizard2spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell2name + "<br />" + tooltipTargetsIcon + " " + wizard2spell2targets + " " + tooltipManaIcon + " " + wizard2spell2cost + " " + tooltipDamageIcon + " " + wizard2spell2value + "</p>'>" + displayDamage(wizard2affinity,wizard5affinity,wizard2spell2type,wizard2spell2value) + "</div></div>";
  wizard5line2.classList.add(wizard2rarity);
  wizard5line2spell1.innerHTML = displayDamage(wizard5affinity,wizard2affinity,wizard5spell1type,wizard5spell1value);
  wizard5line2spell2.innerHTML = displayDamage(wizard5affinity,wizard2affinity,wizard5spell2type,wizard5spell2value);

  wizard5line3.innerHTML = wizardImage(wizard3name,wizard3rarity,'60px','','Opponent') + wizard3name + " <span class='baOppTblHealth'>(" + wizard3health + ")</span> <div class='baOppTblSpeciality'>" + wizard3speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell1name + "<br />" + tooltipTargetsIcon + " " + wizard3spell1targets + " " + tooltipManaIcon + " " + wizard3spell1cost + " " + tooltipDamageIcon + " " + wizard3spell1value + "</p>'>" + displayDamage(wizard3affinity,wizard5affinity,wizard3spell1type,wizard3spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell2name + "<br />" + tooltipTargetsIcon + " " + wizard3spell2targets + " " + tooltipManaIcon + " " + wizard3spell2cost + " " + tooltipDamageIcon + " " + wizard3spell2value + "</p>'>" + displayDamage(wizard3affinity,wizard5affinity,wizard3spell2type,wizard3spell2value) + "</div></div>";
  wizard5line3.classList.add(wizard3rarity);
  wizard5line3spell1.innerHTML = displayDamage(wizard5affinity,wizard3affinity,wizard5spell1type,wizard5spell1value);
  wizard5line3spell2.innerHTML = displayDamage(wizard5affinity,wizard3affinity,wizard5spell2type,wizard5spell2value);

  wizard6line1.innerHTML = wizardImage(wizard1name,wizard1rarity,'60px','','Opponent') + wizard1name + " <span class='baOppTblHealth'>(" + wizard1health + ")</span> <div class='baOppTblSpeciality'>" + wizard1speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell1name + "<br />" + tooltipTargetsIcon + " " + wizard1spell1targets + " " + tooltipManaIcon + " " + wizard1spell1cost + " " + tooltipDamageIcon + " " + wizard1spell1value + "</p>'>" + displayDamage(wizard1affinity,wizard6affinity,wizard1spell1type,wizard1spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard1spell2name + "<br />" + tooltipTargetsIcon + " " + wizard1spell2targets + " " + tooltipManaIcon + " " + wizard1spell2cost + " " + tooltipDamageIcon + " " + wizard1spell2value + "</p>'>" + displayDamage(wizard1affinity,wizard6affinity,wizard1spell2type,wizard1spell2value) + "</div></div>";
  wizard6line1.classList.add(wizard1rarity);
  wizard6line1spell1.innerHTML = displayDamage(wizard6affinity,wizard1affinity,wizard6spell1type,wizard6spell1value);
  wizard6line1spell2.innerHTML = displayDamage(wizard6affinity,wizard1affinity,wizard6spell2type,wizard6spell2value);

  wizard6line2.innerHTML = wizardImage(wizard2name,wizard2rarity,'60px','','Opponent') + wizard2name + " <span class='baOppTblHealth'>(" + wizard2health + ")</span> <div class='baOppTblSpeciality'>" + wizard2speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell1name + "<br />" + tooltipTargetsIcon + " " + wizard2spell1targets + " " + tooltipManaIcon + " " + wizard2spell1cost + " " + tooltipDamageIcon + " " + wizard2spell1value + "</p>'>" + displayDamage(wizard2affinity,wizard6affinity,wizard2spell1type,wizard2spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard2spell2name + "<br />" + tooltipTargetsIcon + " " + wizard2spell2targets + " " + tooltipManaIcon + " " + wizard2spell2cost + " " + tooltipDamageIcon + " " + wizard2spell2value + "</p>'>" + displayDamage(wizard2affinity,wizard6affinity,wizard2spell2type,wizard2spell2value) + "</div></div>";
  wizard6line2.classList.add(wizard2rarity);
  wizard6line2spell1.innerHTML = displayDamage(wizard6affinity,wizard2affinity,wizard6spell1type,wizard6spell1value);
  wizard6line2spell2.innerHTML = displayDamage(wizard6affinity,wizard2affinity,wizard6spell2type,wizard6spell2value);

  wizard6line3.innerHTML = wizardImage(wizard3name,wizard3rarity,'60px','','Opponent') + wizard3name + " <span class='baOppTblHealth'>(" + wizard3health + ")</span> <div class='baOppTblSpeciality'>" + wizard3speciality.innerHTML + "</div> <div class='baOppTblSpellWrap'><div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell1name + "<br />" + tooltipTargetsIcon + " " + wizard3spell1targets + " " + tooltipManaIcon + " " + wizard3spell1cost + " " + tooltipDamageIcon + " " + wizard3spell1value + "</p>'>" + displayDamage(wizard3affinity,wizard6affinity,wizard3spell1type,wizard3spell1value) + "</div> <div class='baOppTblSpell simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<p>" + wizard3spell2name + "<br />" + tooltipTargetsIcon + " " + wizard3spell2targets + " " + tooltipManaIcon + " " + wizard3spell2cost + " " + tooltipDamageIcon + " " + wizard3spell2value + "</p>'>" + displayDamage(wizard3affinity,wizard6affinity,wizard3spell2type,wizard3spell2value) + "</div></div>";
  wizard6line3.classList.add(wizard3rarity);
  wizard6line3spell1.innerHTML = displayDamage(wizard6affinity,wizard3affinity,wizard6spell1type,wizard6spell1value);
  wizard6line3spell2.innerHTML = displayDamage(wizard6affinity,wizard3affinity,wizard6spell2type,wizard6spell2value);
}

function displayDamage(attAffin,defAffin,type,damage) {
  if (type === "Healing") {
    return "<div style='color:#fff;background-color:rgba(255, 255, 255, 0.1);border-radius:10px;padding:0.1em 0.2em;border:1px solid rgba(255, 255, 255, 0.2);font-weight:400;'><img alt='Healing' src='//static.miraheze.org/wizardiawiki/2/22/Healing.svg' decoding='async' width='13' height='13' /> <div style='display:inline;vertical-align:middle'>" + damage + "</div></div>";
  } else {
    if (attAffin === defAffin) {
      return "<div style='background-color: #e9e9e9; font-weight:500; border-radius:10px;padding:0.1em 0.2em;border:1px solid rgba(255, 255, 255, 0.2);'>" + damage + "</div>";
    } else if ((attAffin === "Body" && defAffin === "Soul") || (attAffin === "Mind" && defAffin === "Body") || (attAffin === "Soul" && defAffin === "Mind")) {
      return "<div style='background-color: rgb(200 245 200); font-weight:500; border-radius:10px;padding:0.1em;border:1px solid rgba(255, 255, 255, 0.2);'>" + countDamage(attAffin,defAffin,type,damage) + "</div>";
    } else {
      return "<div style='background-color: rgb(245 200 200); font-weight:500; border-radius:10px;padding:0.1em 0.2em;border:1px solid rgba(255, 255, 255, 0.2);'>" + countDamage(attAffin,defAffin,type,damage) + "</div>";
    }
  }
}

function wizardImageAffinity(affinity,team) {
  var soulAffinityDisplay = " class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<div style=&quot;text-align:center&quot;><div><img alt=&quot;Soul Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/5/5a/Soul.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div><div><div style=&quot;color: rgb(183 245 196);display:inline;margin:0.5em;&quot;>Stronger than</div><div style=&quot;color: rgb(171 129 129);display:inline;margin:0.5em;&quot;>Weaker than</div></div><div><div style=&quot;display:inline-block;width:50%;&quot;><img alt=&quot;Mind Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/9/96/Mind.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div><div style=&quot;display:inline-block;width:50%;&quot;><img alt=&quot;Body Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/0/0b/Body.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div></div></div>'";
  var bodyAffinityDisplay = " class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<div style=&quot;text-align:center&quot;><div><img alt=&quot;Body Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/0/0b/Body.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div><div><div style=&quot;color: rgb(183 245 196);display:inline;margin:0.5em;&quot;>Stronger than</div><div style=&quot;color: rgb(171 129 129);display:inline;margin:0.5em;&quot;>Weaker than</div></div><div><div style=&quot;display:inline-block;width:50%;&quot;><img alt=&quot;Soul Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/5/5a/Soul.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div><div style=&quot;display:inline-block;width:50%;&quot;><img alt=&quot;Mind Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/9/96/Mind.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div></div></div>'";
  var mindAffinityDisplay = " class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<div style=&quot;text-align:center&quot;><div><img alt=&quot;Mind Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/9/96/Mind.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div><div><div style=&quot;color: rgb(183 245 196);display:inline;margin:0.5em;&quot;>Stronger than</div><div style=&quot;color: rgb(171 129 129);display:inline;margin:0.5em;&quot;>Weaker than</div></div><div><div style=&quot;display:inline-block;width:50%;&quot;><img alt=&quot;Body Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/0/0b/Body.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div><div style=&quot;display:inline-block;width:50%;&quot;><img alt=&quot;Soul Affinity&quot; src=&quot;//static.miraheze.org/wizardiawiki/5/5a/Soul.svg&quot; decoding=&quot;async&quot; width=&quot;40&quot; height=&quot;40&quot;></div></div></div>'";
  var soulImage = "<img alt='Soul Affinity' src='//static.miraheze.org/wizardiawiki/5/5a/Soul.svg' decoding='async' width='40' height='40' style='position:absolute;left:0%;top:-3%'" + soulAffinityDisplay + ">";
  var bodyImage = "<img alt='Body Affinity' src='//static.miraheze.org/wizardiawiki/0/0b/Body.svg' decoding='async' width='40' height='40' style='position:absolute;left:0%;top:-3%'" + bodyAffinityDisplay + ">";
  var mindImage = "<img alt='Mind Affinity' src='//static.miraheze.org/wizardiawiki/9/96/Mind.svg' decoding='async' width='40' height='40' style='position:absolute;left:0%;top:-3%'" + mindAffinityDisplay + ">";
  if (team === "Opponent") {
    return "";
  }
  else {
    if (affinity === "Soul") {
      return soulImage;
    }
    else if (affinity === "Body") {
      return bodyImage;
    }
    else {
      return mindImage;
    }
  }
}
function wizardImage(wizardName,wizardRarity,height,width,team) {
  var returnHeight = height ? " height='" + height + "'" : "";
  var returnWidth = width ? " width='" + width + "'" : "";

  switch (wizardName) {
    case 'Amin, the Deceived':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/0/06/Amin-epic-650.png/300px-Amin-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/0/06/Amin-epic-650.png/600px-Amin-epic-650.png 2x'>" + wizardImageAffinity("Body",team);
    break;
    case 'Chikara, the Tower':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/1/13/Chikara-epic-650.png/300px-Chikara-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/1/13/Chikara-epic-650.png/600px-Chikara-epic-650.png 2x'>" + wizardImageAffinity("Mind",team);
    break;
    case 'Crizal, the Alluring':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/c/cf/Crizal-epic-650.png/300px-Crizal-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/c/cf/Crizal-epic-650.png/600px-Crizal-epic-650.png 2x'>" + wizardImageAffinity("Mind",team);
    break;
    case 'Hinata, the Detached':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/c/c0/Hinata-epic-650.png/300px-Hinata-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/c/c0/Hinata-epic-650.png/600px-Hinata-epic-650.png 2x'>" + wizardImageAffinity("Soul",team);
    break;
    case 'Olek, the Reflective':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/f/f1/Olek-epic-650.png/300px-Olek-epic-650.png' decoding='async' " + returnHeight + returnWidth + "  srcset='//static.miraheze.org/wizardiawiki/thumb/f/f1/Olek-epic-650.png/600px-Olek-epic-650.png 2x'>" + wizardImageAffinity("Soul",team);
    break;
    case 'Petro, the 1':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/f/f0/Petro-epic-650.png/300px-Petro-epic-650.png' decoding='async' " + returnHeight + returnWidth + "  srcset='//static.miraheze.org/wizardiawiki/thumb/f/f0/Petro-epic-650.png/600px-Petro-epic-650.png 2x'>" + wizardImageAffinity("Mind",team)
    break;
    case 'S, the Unrestrained':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/6/65/S-epic-650.png/300px-S-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/6/65/S-epic-650.png/600px-S-epic-650.png 2x'>" + wizardImageAffinity("Soul",team);
    break;
    case 'Tah Mut Tah, the Indulging':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/e/ef/Tah-epic-650.png/300px-Tah-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/e/ef/Tah-epic-650.png/600px-Tah-epic-650.png 2x'>" + wizardImageAffinity("Body",team);
    break;
    case 'Tsering, the Impatient':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/7/79/Tsering-epic-650.png/300px-Tsering-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/7/79/Tsering-epic-650.png/600px-Tsering-epic-650.png 2x'>" + wizardImageAffinity("Body",team);
    break;
    case 'Elzevir, the Scribe':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/0/01/Elzevir-epic-650.png/300px-Elzevir-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/0/01/Elzevir-epic-650.png/600px-Elzevir-epic-650.png 2x'>" + wizardImageAffinity("Mind",team);
    break;
    case 'Seven, the Torn':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/9/97/Seven-epic-650.png/300px-Seven-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/9/97/Seven-epic-650.png/600px-Seven-epic-650.png 2x'>" + wizardImageAffinity("Body",team);
    break;
    case 'Rose, the Unbreakable':
    return "<img alt='" + wizardName + "' src='//static.miraheze.org/wizardiawiki/thumb/b/b2/Rose-epic-650.png/300px-Rose-epic-650.png' decoding='async' " + returnHeight + returnWidth + " srcset='//static.miraheze.org/wizardiawiki/thumb/b/b2/Rose-epic-650.png/600px-Rose-epic-650.png 2x'>" + wizardImageAffinity("Soul",team);
    break;
    default: '';
  }
}

function showTableLegend() {
  var tableLegend = document.getElementById("baTableLegend");
  var healthIconImage = "<img alt=&quot;Healing&quot; src=&quot;//static.miraheze.org/wizardiawiki/2/22/Healing.svg&quot; decoding=&quot;async&quot; width=&quot;13&quot; height=&quot;13&quot; style=&quot;vertical-align: text-top;&quot;> ";
  var tableLegendHtml = "<span class='simple-tooltip simple-tooltip-inline tooltipstered' data-simple-tooltip='<div><span style=&quot;color:black;background-color:rgb(200,245,200);font-weight: 500;border-radius: 10px;padding: 0.1em;border: 1px solid rgba(255, 255, 255, 0.2);&quot;>more damage</span> - stronger affinity</div><div><span style=&quot;color:black;background-color:rgb(245,200,200);font-weight: 500;border-radius: 10px;padding: 0.1em;border: 1px solid rgba(255, 255, 255, 0.2);&quot;>less damage</span> - weaker affinity</div><div><span style=&quot;color:black;background-color:#e9e9e9;font-weight: 500;border-radius: 10px;padding: 0.1em;border: 1px solid rgba(255, 255, 255, 0.2);&quot;>exact damage</span> - same affinity</div><div><span style=&quot;color:#fff;background-color:rgb(255,255,255,0.1);font-weight: 500;border-radius: 10px;padding: 0.05em 0.1em;border: 1px solid rgba(255, 255, 255, 0.2);&quot;>" + healthIconImage + "restores health</span> - healing</div>'>Table legend</span>";
  if (tableLegend != null) {
    tableLegend.innerHTML = tableLegendHtml;
  }
}

function countDamage(attAffin,defAffin,type,damage) {
  var lowMin = 0.66;
  var lowMax = 0.76;
  var highMin = 1.248;
  var highMax = 1.30;
  if (type === "Healing") {
    return "0";
  } else {
    if (damage.includes("-")) {
      var damageArray = damage.split("-");
      var damageMin = damageArray[0];
      var damageMax = damageArray[1];
      if (attAffin === defAffin) {
        return "" + damage;
      } else if ((attAffin === "Body" && defAffin === "Soul") || (attAffin === "Mind" && defAffin === "Body") || (attAffin === "Soul" && defAffin === "Mind")) {
        return Math.round(damageMin*highMin) + "-" + Math.round(damageMax*highMax);
      } else {
        return Math.round(damageMin*lowMin) + "-" + Math.round(damageMax*lowMax);
      }
    } else {
      if (attAffin === defAffin) {
        return "" + damage;
      } else if ((attAffin === "Body" && defAffin === "Soul") || (attAffin === "Mind" && defAffin === "Body") || (attAffin === "Soul" && defAffin === "Mind")) {
        return Math.round(damage*highMin) + "-" + Math.round(damage*highMax);
      } else {
        return Math.round(damage*lowMin) + "-" + Math.round(damage*lowMax);
      }
    }
  }
}
function whatSpeciality(spell1type,spell1targets,spell2type,spell2targets) {
  if (spell1type === "Healing" || spell2type === "Healing") {
    if (spell1targets > 1 || spell2targets > 1) {
      return "<div style='color: #fff; background-color: rgba(255, 255, 255, 0.2); border-radius:10px;padding:0.2em; margin:0.1em;display:inline;border:1px solid rgba(255, 255, 255, 0.2);'><img alt='Healing' src='//static.miraheze.org/wizardiawiki/2/22/Healing.svg' decoding='async' width='16' height='16' style='vertical-align:text-top'> 3</div>";
    } else {
      return "<div style='color: #fff; background-color: rgba(255, 255, 255, 0.2); border-radius:10px;padding:0.2em; margin:0.1em;display:inline;border:1px solid rgba(255, 255, 255, 0.2);'><img alt='Healing' src='//static.miraheze.org/wizardiawiki/2/22/Healing.svg' decoding='async' width='16' height='16' style='vertical-align:text-top'> 1</div>";
    }
  } else if (spell1targets > 1 || spell2targets > 1) {
    return "<div style='color: #fff; background-color: rgba(255, 255, 255, 0.2); border-radius:10px;padding:0.2em; margin:0.1em;display:inline;border:1px solid rgba(255, 255, 255, 0.2);'><img alt='Targets' src='//static.miraheze.org/wizardiawiki/b/ba/Targets.svg' decoding='async' width='15' height='16' style='vertical-align:text-top'> 3</div>";
  } else {
    return "<div style='color: #fff; background-color: rgba(255, 255, 255, 0.2); border-radius:10px;padding:0.2em; margin:0.1em;display:inline;border:1px solid rgba(255, 255, 255, 0.2);'><img alt='Targets' src='//static.miraheze.org/wizardiawiki/b/ba/Targets.svg' decoding='async' width='15' height='16' style='vertical-align:text-top'> 1</div>";
  }
}

function showTeam() {
  var yourTeam = document.getElementById("ba-your-team");
  var opponentsTeam = document.getElementById("ba-opponents-team");

  if (document.getElementById("whichTeam").value === "Your"){
    yourTeam.classList.remove(noDisplay);
    opponentsTeam.classList.add(noDisplay);
  }     
  else{
    yourTeam.classList.add(noDisplay);
    opponentsTeam.classList.remove(noDisplay);
  }    
}
function displayCalculator() {
  var calculatorWrap = document.getElementById("baCalculatorWrap");
  calculatorWrap.innerHTML = "<div id='baCalculatorIntro' style='cursor:pointer;margin-left:0.2em' onclick='damageCalculator()'>COUNT DAMAGE</div>";
}
function damageCalculator() {
  var calculatorWrap = document.getElementById("baCalculatorWrap");
  var calculatorIntro = document.getElementById("baCalculatorIntro");
  var totalDamage = document.createElement('div');
  totalDamage.style = "min-width:8em";
  var infoField = document.createElement('div');
  infoField.id = "baCalculatorInfoField";
  infoField.style = "cursor:default";
  var closeCalculator = document.createElement('div');
  var wiz1line1spell1 = document.getElementById("wizard-1-line-1-spell-1");
  calculatorIntro.classList.add('noDisplay');
  totalDamage.innerHTML = "Total damage: <div id='baCalculatorTotalDamageSum' style='background-color:rgba(255,255,255,0.2);border:1px solid rgba(255, 255, 255, 0.2);border-radius:10px;margin:0.2em'></div>";
  calculatorWrap.appendChild(totalDamage);
  infoField.innerHTML = "Click on spells to add";
  infoField.classList.add("selectSpells");
  closeCalculator.innerHTML = "<div id='closeCalculator' style='color:red;cursor:pointer;' onclick='closeCalculator()'>[X] Close</div>";
  //calculatorWrap.appendChild(infoField);
  calculatorWrap.appendChild(closeCalculator);
  var nodeList = document.querySelectorAll("[id*='-spell-'].baOppTblRow");
  for (var i = 0; i < nodeList.length; i++) {
    nodeList[i].addEventListener("click", addSpell);
    nodeList[i].classList.add('selectSpells');
  };
}
function addSpell() {
  var calculatorWrap = document.getElementById("baCalculatorWrap");
  var copySpell = document.createElement('div');
  copySpell.classList.add("calculatedSpell");
  copySpell.style.color = "#000";
  copySpell.style.display = "inline-block";
  copySpell.style.margin = "0 0.5em";
  copySpell.innerHTML = this.innerHTML;
  calculatorWrap.appendChild(copySpell);
  calculatorTotalDamageCount();
}
function closeCalculator() {
  var nodeList = document.querySelectorAll("[id*='-spell-'].baOppTblRow");
  for (var i = 0; i < nodeList.length; i++) {
    nodeList[i].removeEventListener("click", addSpell);
    nodeList[i].classList.remove('selectSpells');
    //document.getElementById("baCalculatorInfoField").classList.remove('selectSpells');
  };
  var calculatorWrap = document.getElementById("baCalculatorWrap");
  calculatorWrap.innerHTML = "";
  displayCalculator();
}
function calculatorTotalDamageCount() {
  var damageMin = 0;
  var damageMax = 0;
  var nodeList = document.querySelectorAll(".calculatedSpell");
  for (var i = 0; i < nodeList.length; i++) {
    if (nodeList[i].innerText.includes("-")) {
      var damageArray = nodeList[i].innerText.split("-");
      damageMin = damageMin + parseInt(damageArray[0]);
      damageMax = damageMax + parseInt(damageArray[1]);
    } 
    else if (nodeList[i].innerText.includes(" ")) {
    }
    else {
      damageMin = damageMin + parseInt(nodeList[i].innerText);
      damageMax = damageMax + parseInt(nodeList[i].innerText);
    }
  };
  if (damageMin != damageMax) {
    var totalSum = document.getElementById("baCalculatorTotalDamageSum");
    totalSum.innerHTML = damageMin + "-" + damageMax;
  }
  else {
    var totalSum = document.getElementById("baCalculatorTotalDamageSum");
    totalSum.innerHTML = damageMin;
  }
}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.