@jeremyckahn/farmhand
Version:
A farming game
17 lines (13 loc) • 404 B
text/typescript
import { KEG_SPOILAGE_RATE_MULTIPLIER } from '../constants.js'
import { cellarService } from '../services/cellar.js'
/**
* @returns number
*/
export const getKegSpoilageRate = (keg: farmhand.keg) => {
if (!cellarService.doesKegSpoil(keg) || keg.daysUntilMature > 0) {
return 0
}
const spoilageRate =
Math.abs(keg.daysUntilMature) * KEG_SPOILAGE_RATE_MULTIPLIER
return spoilageRate
}