function init(hero) {
    hero.setName("Aqualad/Young Justice");
    hero.setTier(5);
    
    hero.setChestplate("item.superhero_armor.piece.chestpiece");
    hero.setLeggings("item.superhero_armor.piece.pants");
    
    hero.addPowers("tmfp:atlantian_magic", "tmfp:water_breathing", "tmfp:stealth_suit");
    hero.addAttribute("PUNCH_DAMAGE", 4.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 6.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.2, 1);
    
    hero.addKeyBind("BLADE", "Water Blade", 1);
    hero.addKeyBind("SHIELD", "Water Shield", 2);
    hero.addKeyBind("MAGIC_TRANSFORM", "Atlantian Magic", 3);
    hero.addKeyBind("STEALTH_MOD", "Stealth Mod", 4);
    
    hero.addAttributeProfile("MAGIC", magicProfile);
    hero.addAttributeProfile("SWORD", swordProfile);
    hero.addAttributeProfile("WATER", waterProfile);
    hero.setAttributeProfile(getProfile);
    hero.setModifierEnabled(isModifierEnabled);
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:flight":
        return entity.isInWater();
    case "fiskheroes:blade":
        return !entity.getData("fiskheroes:shield_timer");
    case "fiskheroes:shield":
        return !entity.getData("fiskheroes:blade_timer");
    default:
        return true;
    }
}

function getProfile(entity) {
    if (entity.getData("fiskheroes:dyn/steeled")) {
        return "MAGIC";
    }
      else if (entity.isInWater()) {
        return "WATER";
    }
    
    return entity.getData("fiskheroes:blade") ? "SWORD" : null;
}

function magicProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("FALL_RESISTANCE", 7.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 3.0, 0);
    profile.addAttribute("PUNCH_DAMAGE", 9.0, 0);
    profile.addAttribute("SPRINT_SPEED", 0.4, 1);
}

function swordProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 15.0, 0);
}

function waterProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 12.0, 0);
    profile.addAttribute("SPRINT_SPEED", 0.8, 1);
}
