Interface for an upgrade that is cached. We need a cache to reduce redundant calculations.

We store the level, and the level +/- 1, or times/divided by 1 + 1e-3 if the level is larger than ~2e3. and the cost of the upgrade at those levels.

This approach might be useful for lower levels of upgrades, but it's not very useful for higher levels.

interface UpgradeCached {
    el: boolean;
    end: UpgradeCachedLevel;
    endLower: UpgradeCachedLevel;
    endUpper: UpgradeCachedLevel;
    id: string;
}

Hierarchy

Properties

el: boolean

Endless / Everlasting: Flag to exclude the sum calculation and only perform binary search. Note: A function value is also allowed, and will be evaluated when the upgrade is bought or calculated. (but you should use a getter function instead)

end: UpgradeCachedLevel
endLower: UpgradeCachedLevel
endUpper: UpgradeCachedLevel
id: string

The ID of the upgrade. Used to retrieve the upgrade later.