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/Money.ts

28 lines
822 B
TypeScript
Raw Normal View History

/// <reference path="./Purchasable.ts" />
2021-08-20 17:12:32 -05:00
class Money extends Purchasable {
2021-08-20 17:12:32 -05:00
constructor (
public value: number,
) {
super('Money', 'Used to purchase goods and services.');
2021-08-21 12:45:58 -05:00
this.clickText = 'Collect Tithes';
this.clickDescription = 'Voluntary contributions from followers.';
}
public isUnlocked (state: GameState): boolean {
return true;
2021-08-20 17:12:32 -05:00
}
2021-08-21 12:45:58 -05:00
protected _incrementAmount (state: GameState): number {
const plorg: IResource = state.getResource('plorg');
if (plorg.value === 0) {
state.log('You have no followers to collect from!');
return 0;
}
// each follower gives you $10
const tithings: number = plorg.value * 10;
state.log(`You collected $${state.formatNumber(tithings)} from ${state.formatNumber(plorg.value)} followers.`);
return tithings;
}
2021-08-20 17:12:32 -05:00
}