Now that I think on it, the cancel cost in Trail of the Interloper and Heaven’s Gate was based on a note-tag on the map! I just happen to set that note-tag to be the approximate average level of the possible encounters of the map.
That aside, the map() function of arrays might not have been one I’m familiar with, but, it does seem worth looking into.