var utils = implement("fiskheroes:external/utils");

function init(hero) {
    hero.setName("Miss Martian");
    hero.setVersion("item.superhero_armor.version.comics");
    hero.setTier(8);

    hero.setHelmet("item.superhero_armor.piece.head");
    hero.setChestplate("item.superhero_armor.piece.torso");
    hero.setLeggings("item.superhero_armor.piece.leggings");
    hero.setBoots("item.superhero_armor.piece.boots");
    
    hero.addPowers("skarlet:white_martian_physiology");
    hero.addAttribute("PUNCH_DAMAGE", 9.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.1, 1);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 1.0, 1);
    
    hero.addKeyBind("TELEKINESIS", "key.telekinesis", 2);
    hero.addKeyBind("INTANGIBILITY", "key.intangibility", 3);
    hero.addKeyBind("INVISIBILITY", "key.invisibility", 4);
    hero.addKeyBind("HEAT_VISION", "key.heatVision", 5);
    
    hero.setDefaultScale(1.0);
    hero.setHasProperty((entity, property) => property == "BREATHE_SPACE");
    hero.setKeyBindEnabled(isKeyBindEnabled);

    hero.setTickHandler((entity, manager) => {
        utils.flightOnIntangibility(entity, manager);
    });
}

function isKeyBindEnabled(entity, keyBind) {
	switch (keyBind) {
		case "TELEKINESIS":
			return !entity.getData("fiskheroes:invisible");
		default:
			return true;
	}
}
