function init(hero) {
    hero.setName("Kratos");
    hero.setAliases("God_of_War", "GOW", "Marked_Warrior");
    hero.setVersion("\u00A7c\u00A7lGOW \u00A7f\u00A7l2018\u00A7r");
    hero.setTier(10);
    
    hero.setHelmet("Head");
    hero.setChestplate("Body");
    hero.setLeggings("Legs");
    hero.setBoots("Boots");
    
    hero.addPowers("gowhp:godofwar", "gowhp:leviathanaxe", "gowhp:guardianshield", "gowhp:spartanrage");
    hero.addAttribute("PUNCH_DAMAGE", 10.0, 0);
    hero.addAttribute("KNOCKBACK", 1.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 1.15, 0);
    hero.addAttribute("SPRINT_SPEED", 0.4, 1);
    hero.addAttribute("FALL_RESISTANCE", 100.0, 0);
    
    hero.addKeyBind("LEVIATHANAXE", "Leviathan Axe", 2);
    hero.addKeyBind("SHIELD", "Guardian Shield", 3);
    hero.addKeyBindFunc("LEVIATHANAXE_RUNIC_CYCLE", leviathanaxerunicCycle, "Cycle Ranged/Runic Attacks", 4);
    hero.addKeyBind("LEVIATHANAXERUNICCYCLEUNAVAILABLE", "\u00A7cUnavailable", 4);
    hero.addKeyBind("CHARGED_BEAM", "Throw", 5);
    hero.addKeyBind("BOULDERTHROW", "Boulder Throw", 5);
    hero.addKeyBind("LEVIATHANAXETHROWANIMATION", "Throw Leviathan Axe", 5);
    hero.addKeyBind("WRATHOFTHEFROSTANCIENTANIMATION", "Wrath of the Frost Ancient", 5);
    hero.addKeyBind("BREATHOFTHAMURANIMATION", "Breath of Thamur", 5);
    hero.addKeyBind("SPARTANRAGE", "Spartan Rage", 4);
    hero.addKeyBind("GROUND_SMASH", "Ground Smash", 3);
    
    hero.setDefaultScale(1.1);
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.addAttributeProfile("LEVIATHANAXE", leviathanaxeProfile);
    hero.addAttributeProfile("SHIELD", shieldProfile);
    hero.addAttributeProfile("SPARTANRAGE", spartanrageProfile);
    hero.addAttributeProfile("SPARTANRAGETOGGLE", spartanragetoggleProfile);
    hero.addAttributeProfile("RUNICATTACK", runicattackProfile);
    hero.setAttributeProfile(getAttributeProfile);
    hero.setHasProperty(hasProperty);

    hero.setDamageProfile(entity => entity.getData("gowhp:dyn/leviathanaxe") ? "LEVIATHANAXE_FROST" : null);
    hero.addDamageProfile("LEVIATHANAXE_FROST", {
        "types": {
            "SHARP": 1.0,
            "LEVIATHAN_ICE": 0.6,
            "JORMUNGANDR_VENOM": 0.25
        }
    });

    hero.addSoundEvent("MASK_OPEN", "gowhp:kratos_voice_lines");
    hero.addSoundEvent("MASK_CLOSE", "gowhp:kratos_voice_lines");
    hero.addSoundEvent("STEP", ["gowhp:kratos_walk", "gowhp:kratos_sprint"]);
    hero.addSoundEvent("PUNCH", ["gowhp:kratos_punch", "gowhp:spartanrage_punch", "gowhp:leviathanaxe_hit", "gowhp:bladesofchaos_hit"]);
    hero.addSoundEvent("LAND", "gowhp:spartanrage_land");
}

function hasProperty(entity, property) {
    return property == "BREATHE_SPACE" || property == "MASK_TOGGLE";
}

function leviathanaxerunicCycle(player, manager) {
  manager.setData(player, "gowhp:dyn/leviathanaxe_runic_cycle", player.getData("gowhp:dyn/leviathanaxe_runic_cycle") + 1);
  if (player.getData("gowhp:dyn/leviathanaxe_runic_cycle") > 2) {
    manager.setData(player, "gowhp:dyn/leviathanaxe_runic_cycle", 0);
  }
  return true;
}

function leviathanaxeProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 13.5, 0);
    profile.addAttribute("SPRINT_SPEED", 0.3, 1);
    profile.addAttribute("JUMP_HEIGHT", 1.05, 0);
}

function shieldProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("BASE_SPEED", -0.5, 1);
    profile.addAttribute("JUMP_HEIGHT", -1.0, 0);
}

function spartanrageProfile(profile) {
    profile.addAttribute("PUNCH_DAMAGE", 16.5, 0);
    profile.addAttribute("KNOCKBACK", 4.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 1.8, 0);
    profile.addAttribute("SPRINT_SPEED", 0.8, 1);
    profile.addAttribute("FALL_RESISTANCE", 120.0, 0);
}

function spartanragetoggleProfile(profile) {
    profile.revokeAugments();
    profile.addAttribute("BASE_SPEED", -1, 0);
    profile.addAttribute("JUMP_HEIGHT", -10, 0);
}

function runicattackProfile(profile) {
    profile.revokeAugments();
    profile.addAttribute("BASE_SPEED", -1, 0);
    profile.addAttribute("JUMP_HEIGHT", -10, 0);
}

function getAttributeProfile(entity) {
    if (entity.getData("gowhp:dyn/leviathanaxe") && entity.getData("fiskheroes:beam_charging") && (entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 1 || entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 2)) {
        return "RUNICATTACK";
    }
    if (entity.getData("fiskheroes:shield_blocking")) {
        return "SHIELD";
    }
    if (entity.getData("gowhp:dyn/leviathanaxe")) {
        return "LEVIATHANAXE";
    }
    if (entity.getData("gowhp:dyn/spartanrage") && entity.getInterpolatedData("gowhp:dyn/spartanrage_animation_timer") < 0.5) {
        return "SPARTANRAGETOGGLE";
    }
    if (entity.getData("gowhp:dyn/spartanrage")) {
        return "SPARTANRAGE";
    }
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "gowhp:dyn/leviathanaxe":
        return !entity.getData("gowhp:dyn/spartanrage");
    case "fiskheroes:shield":
        return !entity.getData("gowhp:dyn/spartanrage") && !entity.getData("fiskheroes:beam_charging");
    case "gowhp:dyn/spartanrage":
        return !entity.getData("gowhp:dyn/leviathanaxe");
    case "fiskheroes:arrow_catching":
        return entity.getData("gowhp:dyn/spartanrage") && !entity.getData("gowhp:dyn/leviathanaxe") && !entity.getData("fiskheroes:shield");
    case "fiskheroes:fire_immunity":
        return entity.getData("gowhp:dyn/spartanrage");
    case "fiskheroes:regeneration":
      switch (modifier.id()) {
        case "default":
          return !entity.getData("gowhp:dyn/spartanrage");
        case "spartanrageregen":
          return entity.getData("gowhp:dyn/spartanrage");
      };
    case "fiskheroes:leaping":
      switch (modifier.id()) {
        case "default":
          return !entity.getData("gowhp:dyn/spartanrage");
        case "spartanrageleap":
          return entity.getData("gowhp:dyn/spartanrage");
      };
    case "fiskheroes:charged_beam":
      switch (modifier.id()) {
        case "boulderthrow":
          return entity.getData("gowhp:dyn/spartanrage") && entity.isOnGround();
        case "leviathanaxethrow":
          return entity.getData("gowhp:dyn/leviathanaxe") && entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 0;
        case "wrathofthefrostancient":
          return entity.getData("gowhp:dyn/leviathanaxe") && entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 1;
        case "breathofthamur":
          return entity.getData("gowhp:dyn/leviathanaxe") && entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 2;
      };
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
        case "LEVIATHANAXE":
            return entity.getHeldItem().isEmpty() && !entity.getData("gowhp:dyn/spartanrage") && !entity.getData("fiskheroes:shield_blocking");
        case "SHIELD":
            return !entity.getData("gowhp:dyn/spartanrage") && !entity.getData("fiskheroes:beam_charging");
        case "SPARTANRAGE":
            return !entity.getData("gowhp:dyn/leviathanaxe");
        case "BOULDERTHROW":
            return entity.getData("gowhp:dyn/spartanrage") && entity.isOnGround();
        case "LEVIATHANAXE_RUNIC_CYCLE":
            return entity.getData("gowhp:dyn/leviathanaxe") && !entity.getData("fiskheroes:shield") && !((entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 0 || entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 1 || entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 2) && entity.getData("fiskheroes:beam_charging"));
        case "LEVIATHANAXERUNICCYCLEUNAVAILABLE":
            return ((entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 0 || entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 1 || entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 2) && entity.getData("fiskheroes:beam_charging"));
        case "CHARGED_BEAM":
            return ((entity.getData("gowhp:dyn/spartanrage") && entity.isOnGround()) || entity.getData("gowhp:dyn/leviathanaxe")) && !entity.getData("fiskheroes:shield");
        case "LEVIATHANAXETHROWANIMATION":
            return entity.getData("gowhp:dyn/leviathanaxe") && !entity.getData("fiskheroes:shield") && entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 0 && entity.getData("fiskheroes:beam_charging");
        case "WRATHOFTHEFROSTANCIENTANIMATION":
            return entity.getData("gowhp:dyn/leviathanaxe") && !entity.getData("fiskheroes:shield") && entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 1;
        case "BREATHOFTHAMURANIMATION":
            return entity.getData("gowhp:dyn/leviathanaxe") && !entity.getData("fiskheroes:shield") && entity.getData("gowhp:dyn/leviathanaxe_runic_cycle") == 2;
        case "GROUND_SMASH":
            return entity.getHeldItem().isEmpty() && !entity.getData("fiskheroes:shield") && entity.getData("gowhp:dyn/spartanrage_timer") == 1;
        default:
            return true;
    }
}