Risk attitudes in a changing environment: an evolutionary model of the fourfold pattern of risk preferences