2021-08-21 19:53:43 -05:00
|
|
|
/// <reference path="./Infrastructure.ts" />
|
|
|
|
|
|
|
|
class Compound extends Infrastructure {
|
2021-09-12 13:58:57 -05:00
|
|
|
public readonly resourceKey = ResourceKey.compounds;
|
|
|
|
|
2021-09-06 12:02:38 -05:00
|
|
|
constructor(config: GameConfig) {
|
2021-09-06 00:12:05 -05:00
|
|
|
super(
|
2021-09-06 08:51:41 -05:00
|
|
|
'Compounds',
|
2021-09-06 00:12:05 -05:00
|
|
|
'compound',
|
|
|
|
'compounds',
|
2021-09-06 20:37:23 -05:00
|
|
|
'Provides space for tents, houses, and churches and a place to hide more money.',
|
|
|
|
true
|
2021-09-06 12:02:38 -05:00
|
|
|
);
|
2021-09-05 20:43:11 -05:00
|
|
|
this.cost.money = config.cfgInitialCost.compounds;
|
|
|
|
this._costMultiplier.money = config.cfgCostMultiplier.compounds;
|
2021-08-21 19:53:43 -05:00
|
|
|
}
|
|
|
|
|
2021-09-12 13:58:57 -05:00
|
|
|
public isUnlocked = (state: GameState): boolean => {
|
2021-08-21 19:53:43 -05:00
|
|
|
if (this._isUnlocked) return true;
|
2021-09-05 18:39:08 -05:00
|
|
|
const tents = state.resource.tents;
|
2021-09-06 12:02:38 -05:00
|
|
|
if (
|
|
|
|
tents !== undefined &&
|
|
|
|
tents.value >= (state.config.cfgInitialMax.tents ?? 0)
|
|
|
|
) {
|
2021-08-21 19:53:43 -05:00
|
|
|
this._isUnlocked = true;
|
|
|
|
}
|
|
|
|
return this._isUnlocked;
|
2021-09-12 13:58:57 -05:00
|
|
|
};
|
2021-08-21 19:53:43 -05:00
|
|
|
}
|