import * as general from "./general";

const skill = [
  "[skill1]",
  "[skill2]",
  "[skill3]"
];

const special_skill = [
  "[special_skill1]",
  "[special_skill2]"
];

const alien_hologram = [
  "[]",
  "[swampfire_holo]",
  "[humungousaur_holo]",
  "[bigchill_holo]",
  "[echo_holo]",
  "[alien_x_holo]",
  "[error_holo]",
  "[error_holo]",
  "[error_holo]",
  "[error_holo]",
  "[error_holo]"
];


general.tick1((player) => {
  if (player.hasTag(`swampfire`) || player.hasTag(`swampfire_ultimate`) || player.hasTag(`humungousaur`) || player.hasTag(`humungousaur_full`) || player.hasTag(`humungousaur_ultimate`) || player.hasTag(`bigchill`) || player.hasTag(`bigchill_ultimate`) || player.hasTag(`echo`) || player.hasTag(`echo_ultimate`) || player.hasTag(`alien_x`)) {
    player.runCommandAsync(`hud @s hide health`);
    player.runCommandAsync(`hud @s hide armor`);
    player.runCommandAsync(`hud @s hide paperdoll`);
    player.runCommandAsync(`hud @s hide item_text`);
  } else {
    player.runCommandAsync(`hud @s reset all`);
  }

  const alienSkills = general.getScore("skills", player);
  const currentSkill = skill[alienSkills] || "";
  const alienSpecialSkills = general.getScore("special_skills", player);
  const currentSpecialSkill = special_skill[alienSpecialSkills] || "";
  const alienHolograms = general.getScore("select", player);
  const currentAlienHolograms = alien_hologram[alienHolograms] || "";
  const isUltimatrix = player.hasTag("ultimatrix") ? "[is_ultimatrix]" : "";
  const isAlienForm = player.hasTag("swampfire") ? "[is_alien]" : player.hasTag("swampfire_ultimate") ? "[is_alien]" : player.hasTag("humungousaur") ? "[is_alien]" : player.hasTag("humungousaur_full") ? "[is_alien]" : player.hasTag("humungousaur_ultimate") ? "[is_alien]" : player.hasTag("bigchill") ? "[is_alien]" : player.hasTag("bigchill_ultimate") ? "[is_alien]" : player.hasTag("echo") ? "[is_alien]" : player.hasTag("echo_ultimate") ? "[is_alien]" : player.hasTag("alien_x") ? "[is_alien]" : "";
  const currentAlien = player.hasTag("swampfire") ? "[swampfire_alien]" : player.hasTag("swampfire_ultimate") ? "[swampfire_ultimate_alien]" : player.hasTag("humungousaur") ? "[humungousaur_alien]" : player.hasTag("humungousaur_full") ? "[humungousaur_alien]" : player.hasTag("humungousaur_ultimate") ? "[humungousaur_ultimate_alien]" : player.hasTag("bigchill") ? "[bigchill_alien]" : player.hasTag("bigchill_ultimate") ? "[bigchill_ultimate_alien]" : player.hasTag("echo") ? "[echo_alien]" : player.hasTag("echo_ultimate") ? "[echo_ultimate_alien]" : player.hasTag("alien_x") ? "[alien_x_alien]" : "";

  player.onScreenDisplay.setTitle(
    `\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ${isUltimatrix}${currentAlienHolograms}${isAlienForm}${currentAlien}${currentSkill}${currentSpecialSkill}[health${Math.round(player.getComponent("health")?.currentValue * 10 / player.getComponent("health")?.defaultValue)}][battery${Math.ceil(general.getScore("batteryCur", player) * 16 / general.getScore("batteryMax", player))}]`
  );
});
