local function playSprite(sprite)
    player.DummyAutoAnimate = false
    player.Sprite:Play("idleB", false, false)
end

function onBegin()
  local golden_have = getFlag("VivHelper/PlayerHasExactGoldenBerry")

  if not golden_have then
     waitUntilOnGround()
     disableMovement()
     say("fificrisis")
     playSprite()
     wait(3.0)
     player.DummyAutoAnimate = true
     player.Facing = luanet.enum(luanet.import_type("Celeste.Facings"), "Left")
     walkTo(-442, false, 1.0, false)
     wait(1.0)
     walk(15, true, 0.1)
     say("fificrisis2")
     if choice("fificrisis_conv01_ask", "fificrisis_conv02_ask") == 1 then
           say("fificrisis_conv01_say")

     else
           say("fificrisis_conv02_say")
           instantTeleportTo(760, -9928)

           player.Facing = luanet.enum(luanet.import_type("Celeste.Facings"), "Right")
     end
  else
     makeUnskippable()
     waitUntilOnGround()
     disableRetry()
     disableMovement()
     say("fificrisisgolden")
     if choice("fificrisisg_conv01_ask", "fificrisisg_conv02_ask") == 1 then
           say("fificrisisg_conv01_say")
           instantTeleportTo(760, -9928)
           say("fificrisisg_convtp1")
           player.Facing = luanet.enum(luanet.import_type("Celeste.Facings"), "Right")
           enableRetry()

     else
           say("fificrisisg_conv02_say")
           instantTeleportTo(760, -9928)
           say("fificrisisg_convtp2")
           player.Facing = luanet.enum(luanet.import_type("Celeste.Facings"), "Right")
           enableRetry()
     end
end
end

function onEnd(room, wasSkipped)
    if wasSkipped then
        setFlag("fifiskip", true)
        setFlag("fifiskipd", true)
    end
  enableMovement()
end