var firestorm = implement("fiskheroes:external/firestorm_base");

function init(hero) {
    hero.setName("Ghost Rider");
    hero.setTier(6);

    hero.setHelmet("Skull");
    hero.setChestplate("item.superhero_armor.piece.jacket");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.shoes");
    
    hero.addPowers("pkg:ghost_rider_physiology");
    hero.addAttribute("PUNCH_DAMAGE", 5.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 0.5, 0);
    hero.addAttribute("FALL_RESISTANCE", 5.0, 0);

    hero.addKeyBind("SPELL_MENU", "Chain", 2);
    hero.addKeyBind("TELEKINESIS", "Chain", 3);
    hero.addKeyBind("CHARGED_PUNCH", "Soul Burning Punch", 4);
    hero.addKeyBind("CHARGED_BEAM", "Penance Stare", 5);


    hero.setDamageProfile(entity => !entity.getHeldItem().isWeapon() ? "PUNCH" : null);
    hero.addDamageProfile("PUNCH", {
        "types": {
            "BLUNT": 1.0,
            "MAGIC": 0.7
        }
    });

    hero.addAttributeProfile("PENANCESTARE", penanceProfile);
    hero.setAttributeProfile(getAttributeProfile);

    hero.setAttributeProfile(getAttributeProfile);
    hero.addAttributeProfile("PUNCH", punchProfile);
    hero.addAttributeProfile("BLUNT", bluntProfile);

    firestorm.init(hero);
}

function getAttributeProfile(entity) {
    return entity.getData("fiskheroes:beam_charging") || entity.getData("fiskheroes:beam_shooting") ? "SCREAM" : null;

}

function penanceProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("BASE_SPEED", -0.4, 0);

}

function punchProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 25, 0);
    profile.addAttribute("KNOCKBACK", 30.0, 0);
}

function bluntProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 20, 0);
}

function getAttributeProfile(entity) {
    return entity.getData("fiskheroes:punchmode") ? "PUNCH" : "BLUNT";
}
