added tents, houses, and compounds

This commit is contained in:
Rudis Muiznieks 2021-08-21 19:53:43 -05:00
parent ca9260eb03
commit 137033f8ba
10 changed files with 81 additions and 6 deletions

View File

@ -4,6 +4,9 @@
/// <reference path="./resource/Money.ts" /> /// <reference path="./resource/Money.ts" />
/// <reference path="./resource/PlayerOrg.ts" /> /// <reference path="./resource/PlayerOrg.ts" />
/// <reference path="./resource/Religion.ts" /> /// <reference path="./resource/Religion.ts" />
/// <reference path="./resource/Tent.ts" />
/// <reference path="./resource/House.ts" />
/// <reference path="./resource/Compound.ts" />
class GameConfig { class GameConfig {
public worldPopulation: number = 790000000; public worldPopulation: number = 790000000;
@ -63,6 +66,9 @@ class GameConfig {
// add resources // add resources
state.addResource('money', new Money(3.50)); state.addResource('money', new Money(3.50));
state.addResource('crpto', new CryptoCurrency()); state.addResource('crpto', new CryptoCurrency());
state.addResource('tents', new Tent());
state.addResource('house', new House());
state.addResource('cmpnd', new Compound());
return state; return state;
} }

View File

@ -0,0 +1,19 @@
/// <reference path="./Infrastructure.ts" />
class Compound extends Infrastructure {
constructor () {
super('Compounds',
'Provides space for tents and houses.');
this.cost.money = 15000;
this._costMultiplier.money = 1.5;
}
public isUnlocked (state: GameState): boolean {
if (this._isUnlocked) return true;
const tents: IResource = state.getResource('tents');
if (tents.value === tents.max(state)) {
this._isUnlocked = true;
}
return this._isUnlocked;
}
}

View File

@ -6,7 +6,7 @@ class Credibility extends Passive {
constructor () { constructor () {
super( super(
'Credibility', 'Credibility',
'How trustworthy you are perceived to be. Affects your ability to recruit and retain followers.', 'Affects your ability to recruit and retain followers.',
100, 100, 0.25); 100, 100, 0.25);
} }

View File

@ -2,8 +2,8 @@
class CryptoCurrency extends Purchasable { class CryptoCurrency extends Purchasable {
constructor () { constructor () {
super('CryptoCurrency', super('Faithcoin',
"Can't be spent directly, but provides a steady stream of passive income."); "A crypto coin that can't be spent directly, but provides a steady stream of passive income.");
this.cost.money = 100; this.cost.money = 100;
this._costMultiplier.money = 1.1; this._costMultiplier.money = 1.1;
this._baseMax = 1000; this._baseMax = 1000;

View File

@ -0,0 +1,25 @@
/// <reference path="./Infrastructure.ts" />
class House extends Infrastructure {
constructor () {
super('Houses',
'Provides room to house 10 followers.');
this.cost.money = 150000;
this._costMultiplier.money = 1.1;
}
public max (state: GameState): number {
let max: number = this._baseMax;
max += state.getResource('cmpnd').value * 2;
return max;
}
public isUnlocked (state: GameState): boolean {
if (this._isUnlocked) return true;
const tents: IResource = state.getResource('tents');
if (tents.value === tents.max(state)) {
this._isUnlocked = true;
}
return this._isUnlocked;
}
}

View File

@ -0,0 +1,5 @@
/// <reference path="./Purchasable.ts" />
abstract class Infrastructure extends Purchasable {
public readonly resourceType: ResourceType = ResourceType.Infrastructure;
}

View File

@ -12,7 +12,7 @@ class Money extends Purchasable {
super('Money', 'Used to purchase goods and services.'); super('Money', 'Used to purchase goods and services.');
this.clickText = 'Collect Tithes'; this.clickText = 'Collect Tithes';
this.clickDescription = 'Voluntary contributions from followers.'; this.clickDescription = 'Voluntary contributions from followers.';
this._baseMax = 10000; this._baseMax = 999999;
} }
public isUnlocked (state: GameState): boolean { public isUnlocked (state: GameState): boolean {

View File

@ -21,7 +21,10 @@ class PlayerOrg implements IResource {
} }
public max (state: GameState): number { public max (state: GameState): number {
return this._baseMax; let max: number = this._baseMax;
max += state.getResource('tents').value * 2;
max += state.getResource('house').value * 10;
return max;
} }
public clickAction (state: GameState): void { public clickAction (state: GameState): void {

View File

@ -1,7 +1,7 @@
/// <reference path="./IResource.ts" /> /// <reference path="./IResource.ts" />
abstract class Purchasable implements IResource { abstract class Purchasable implements IResource {
public readonly resourceType: ResourceType = ResourceType.Infrastructure; public readonly resourceType: ResourceType = ResourceType.Consumable;
public value: number = 0; public value: number = 0;
public clickText: string = 'Purchase'; public clickText: string = 'Purchase';

View File

@ -0,0 +1,17 @@
/// <reference path="./Infrastructure.ts" />
class Tent extends Infrastructure {
constructor () {
super('Tents',
'Provides room to house 2 followers.');
this.cost.money = 250;
this._costMultiplier.money = 1.1;
this._baseMax = 5;
}
public max (state: GameState): number {
let max: number = this._baseMax;
max += state.getResource('cmpnd').value * 10;
return max;
}
}