function init(hero) {
    hero.setName("Venom");
    hero.setTier(7);
    
    hero.setChestplate("Symbiote");
    
    hero.addPowers("dlheroes:symbiote_physiology", "dlheroes:symbiote_web");
    hero.addAttribute("FALL_RESISTANCE", 12.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 2.5, 0);
    hero.addAttribute("PUNCH_DAMAGE", 8.5, 0);
    hero.addAttribute("SPRINT_SPEED", 0.45, 1);
    hero.addAttribute("STEP_HEIGHT", 0.5, 0);
    hero.addAttribute("IMPACT_DAMAGE", 0.5, 1);
    
    hero.addKeyBind("UTILITY_BELT", "key.webShooters", 1);
    hero.addKeyBind("WEB_ZIP", "key.webZip", 2);
    hero.addKeyBindFunc("func_WEB_SWINGING", webSwingingKey, "key.webSwinging", 3);
    hero.addKeyBind("BLADE", "Blade", 4);
	hero.addKeyBindFunc("func_GIANT_MODE", giantModeKey, "Symbiote Transformation", 5);

    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
	hero.setTierOverride(getTierOverride);
    hero.addAttributeProfile("INACTIVE", inactiveProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);
    hero.setAttributeProfile(getProfile);
    hero.setDamageProfile(getProfile);
    hero.addDamageProfile("BLADE", {"types": {"SHARP": 1.0}});
    hero.setHasProperty(hasProperty);

    hero.addSoundEvent("MASK_OPEN", "dlheroes:venommask");
    hero.addSoundEvent("MASK_CLOSE", "dlheroes:venom");
}

function giantModeKey(player, manager) {
    var flag = player.getData("fiskheroes:dyn/giant_mode");
    manager.setData(player, "fiskheroes:dyn/giant_mode", !flag);
    manager.setData(player, "fiskheroes:size_state", flag ? -1 : 1);
    return true;
}

function webSwingingKey(player, manager) {
    var flag = player.getData("fiskheroes:web_swinging");
    
    if (!flag) {
        manager.setDataWithNotify(player, "fiskheroes:prev_utility_belt_type", player.getData("fiskheroes:utility_belt_type"));
        manager.setDataWithNotify(player, "fiskheroes:utility_belt_type", -1);
    }
    
    manager.setDataWithNotify(player, "fiskheroes:web_swinging", !flag);
    return true;
}

function hasProperty(entity, property) {
    switch (property) {
    case "MASK_TOGGLE":
        return entity.getData("fiskheroes:dyn/giant_mode_timer") == 1;
    case "BREATHE_SPACE":
        return !entity.getData("fiskheroes:mask_open") && entity.getData("fiskheroes:dyn/giant_mode");
    default:
        return false;
    }
}

function inactiveProfile(profile) {
    profile.addAttribute("FALL_RESISTANCE", 6.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 0.5, 0);
    profile.addAttribute("PUNCH_DAMAGE", 5.5, 0);
}

function getProfile(entity) {
	if (entity.getData("fiskheroes:dyn/giant_mode_timer") < 1 ) {
        return "INACTIVE";
    }
    else if (entity.getData("fiskheroes:blade") ) {
        return "BLADE";
    }
    return null;
}

function getTierOverride(entity) {
    return entity.getData("fiskheroes:dyn/giant_mode") ? 7 : 0;
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:web_swinging":
        return entity.getHeldItem().isEmpty() && entity.getData("fiskheroes:utility_belt_type") == -1 && entity.getData("fiskheroes:dyn/giant_mode");
    case "fiskheroes:leaping":
        return modifier.id() == "springboard" == (entity.getData("fiskheroes:ticks_since_swinging") < 5) && entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:water_breathing":
        return entity.getData("fiskheroes:dyn/giant_mode") && !entity.getData("fiskheroes:mask_open");
	case "fiskheroes:wall_crawling":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:potion_immunity":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:arrow_catching":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:equipment":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:blade":
        return entity.getData("fiskheroes:dyn/giant_mode");
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "func_GIANT_MODE":
        var timer = entity.getData("fiskheroes:dyn/giant_mode_timer");
        return timer == 0 || timer == 1;
	case "WEB_ZIP":
        return entity.getHeldItem().isEmpty() && entity.getData("fiskheroes:scale") > 1.0 && entity.getData("fiskheroes:size_state") == 0;
	case "UTILITY_BELT":
        return entity.getHeldItem().isEmpty() && entity.getData("fiskheroes:scale") > 1.0 && entity.getData("fiskheroes:size_state") == 0;
    case "func_WEB_SWINGING":
        return entity.getHeldItem().isEmpty() && entity.getData("fiskheroes:scale") > 1.0 && entity.getData("fiskheroes:size_state") == 0;
    case "BLADE":
        return entity.getHeldItem().isEmpty() && entity.getData("fiskheroes:scale") > 1.0 && entity.getData("fiskheroes:size_state") == 0;
    default:
        return true;
    }
}

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