function init(hero) {
    hero.setName("John Constantine");
    hero.setTier(3);
    
    hero.setChestplate("item.superhero_armor.piece.trenchcoat");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.shoes");

    hero.addPowers("jmctheroes:pyrokinesis", "jmctheroes:illusion_casting", "jmctheroes:eldritch_magic");
    hero.addAttribute("PUNCH_DAMAGE", 2.0, 0);
    hero.addAttribute("WEAPON_DAMAGE", 1.0, 0);

    hero.addKeyBind("BLADE", "Toggle Eldritch Sword", 1);
    hero.addKeyBind("SHIELD", "Toggle Eldritch Shield", 1);
    hero.addKeyBind("SPELL_MENU", "key.spellMenu", 2);
    hero.addKeyBind("TELEPORT", "key.teleport", 3);
    hero.addKeyBind("AIM", "Flame Blast", 4);
    hero.addKeyBind("PYRO", "Toggle Pyromancy", 5);

    hero.addAttributeProfile("SHIELD", shieldProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);
    hero.addAttributeProfile("PYRO", pyroProfile);
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.supplyFunction("canAim", canAim);
    hero.setAttributeProfile(getProfile);
    hero.addDamageProfile("PYRO", {
        "types": {
            "SHARP": 1.0,
            "FIRE": 1.5
        }
    }
  );
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:blade":
        return !(entity.getData("fiskheroes:shield") && entity.getData("fiskheroes:blade"));
    case "fiskheroes:shield":
        return !(entity.getData("fiskheroes:shield") && entity.getData("fiskheroes:blade"));
    case "fiskheroes:flame_blast":
        return (entity.getData("jmctheroes:dyn/pyro"));
    case "fiskheroes:propelled_flight":
        return (entity.getData("jmctheroes:dyn/pyro"));
    case "fiskheroes:damage_weakness":
        return (entity.getData("jmctheroes:dyn/pyro"));
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "SHIELD":
        return entity.getData("fiskheroes:blade_timer") == 0 || entity.isBookPlayer();
    case "BLADE":
        return entity.getData("fiskheroes:shield_timer") > 0 || entity.getData("fiskheroes:blade_timer") > 0 || entity.isBookPlayer();
    case "AIM":
        return entity.getData("jmctheroes:dyn/pyro");
    default:
        return true;
    }
}

function pyroProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 8.0, 0);
    profile.addAttribute("SPRINT_SPEED", 0.45, 1);
}

function bladeProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 8.4, 0);
}

function shieldProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 7.8, 0);

}

function getProfile(entity) {
    if (entity.getData("jmctheroes:dyn/pyro")) {
        return "PYRO";
    }
    else if (entity.getData("fiskheroes:blade")) {
        return "BLADE";
    }
    else if (entity.getData("fiskheroes:shield")) {
        return "SHIELD";
    }
}

function canAim(entity) {
    return entity.getHeldItem().isEmpty() && entity.getData("jmctheroes:dyn/pyro");
}