This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
irreligious/src/model/resource/Tent.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-08-21 19:53:43 -05:00
/// <reference path="./Infrastructure.ts" />
class Tent extends Infrastructure {
public readonly resourceKey = ResourceKey.tents;
constructor(config: GameConfig) {
super(
2021-09-06 08:51:41 -05:00
'Tents',
'tent',
'tents',
`Provides room to house ${formatNumber(
config.cfgCapacity.tents?.followers ?? 0
)} followers.`,
true
);
this._baseCost.money = config.cfgInitialCost.tents;
2021-09-05 20:43:11 -05:00
this._costMultiplier.money = config.cfgCostMultiplier.tents;
2021-08-21 19:53:43 -05:00
}
public max = (state: GameState): number => {
2021-08-22 13:48:48 -05:00
// ten extra tents per compound
2021-09-05 20:43:11 -05:00
let max = state.config.cfgInitialMax.tents ?? 0;
max +=
(state.resource.compounds?.value ?? 0) *
(state.config.cfgCapacity.compounds?.tents ?? 0);
return max;
2021-09-05 14:45:37 -05:00
};
public inc = (state: GameState): ResourceNumber => {
const inc: ResourceNumber = {};
const compoundManagers =
(state.resource.compoundManagers?.value ?? 0) *
(state.config.cfgBuySpeed.compoundManagers?.tents ?? 0);
if (compoundManagers > 0) {
inc.compoundManagers = compoundManagers;
}
return inc;
};
2021-08-21 19:53:43 -05:00
}