-- LocGym

LocGym = Location:new("LocGym")

----------------------------------------------------------------------------------------------------
function LocGym_UPDATE()
	return 0
end

----------------------------------------------------------------------------------------------------
function LocGym_INIT()
    LocGym:init()
end

----------------------------------------------------------------------------------------------------
LocGym:setSceneHandler(1,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'photo', 'camera'})
        elseif aEvent == "generic_init" then
            
            aScene:setHidsParams({"camera"}, {inventory = true})
            aScene:setHidsParams({"photo"}, {visible = false, active = false})
            aScene:setWinTerms({"ho_collected", "activate_photo"})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locgym_1')
            aScene:setTask("ids_challenge_locgym_1")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("photo", "camera")

        --elseif aEvent == "found_camera" then
            

        elseif aEvent == "activate_photo" then
            aScene:onChallengeComplete()
            aScene:detachInteract("photo")
            --aScene:setHidParams("photo", {active = false})

            --Inventory:addItem("photo")
            aScene:setHidsParams({"photo"}, {visible = true, active = true})
            ho:click('hid_1_photo')

            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocGym:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'hammer', 'toad'})
        elseif aEvent == "generic_init" then
            
            aScene:setHidsParams({"hammer"}, {inventory = true})
            aScene:setHidsParams({"toad"}, {visible = false, active = false})
            aScene:setWinTerms({"ho_collected", "activate_column"})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locgym_2') 
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("column", "hammer")

            aScene:setTask("ids_challenge_locgym_2")

        elseif aEvent == "activate_column" then
            aScene:setHidsParams({"toad"}, {visible = true, active = true})

            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocGym:setSceneHandler(3,
    function(aScene, aEvent)
    
        -- necklace visible,active (knife -> poster)

        if aEvent == "capture" then
            aScene:captureObjects({'necklace'})
        elseif aEvent == "generic_init" then
            

            aScene:setHidsParams({"knife"}, {inventory = true})
            aScene:setHidsParams({"necklace"}, {visible = false, active = false})
            aScene:setWinTerms({"ho_collected", "activate_poster"})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locgym_3') 
            aScene:setTask("ids_challenge_locgym_3")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("poster", "knife")

        elseif aEvent == "activate_poster" then
            aScene:setHidsParams({"necklace"}, {visible = true, active = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocGym:setSceneHandler(4,
    function (aScene, aEvent)
    
        -- battery_charged visible,click(charger_battery(charger + battery) -> electro)
    
        if aEvent == "capture" then
            aScene:captureObjects({'charger_battery', 'charger', 'battery', 'battery_charged'})
        elseif aEvent == "generic_init" then
            

            aScene:setHidsParams({"battery_charged"}, {visible = false, active = false})
            aScene:setWinTerms({"ho_collected", "activate_electro"})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locgym_4') 
            aScene:setTask("ids_challenge_locgym_4")
            aScene:attachHids(aScene:getHidList({except = {'charger_battery'}}))
            aScene:addItemMix('charger_battery', {'charger', 'battery'})

        elseif aEvent == "found_charger_battery" then
            aScene:attachInteract("electro", "charger_battery")

        elseif aEvent == "activate_electro" then
            aScene:setHidsParams({"battery_charged"}, {visible = true, active = true})
            ho:click('hid_4_battery_charged')
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocGym:setSceneHandler(5,
    function(aScene, aEvent)
        if aEvent == "capture" then
            
        elseif aEvent == "generic_init" then
            aScene:setWinTerms({"ho_collected", "found_cell_phone_card"})
            
        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locgym_5') 
            aScene:setTask("ids_challenge_locgym_5")
            aScene:attachHids(aScene:getHidList({except = {'cell_phone_card'}}))
            aScene:addItemMix('cell_phone_card', {'cell_phone_gym', 'visiting_card'})
            
        elseif aEvent == "found_cell_phone_card" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
        end
    end)
