From 137033f8ba90e1aa41b5b489da133ed8a3c48427 Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Sat, 21 Aug 2021 19:53:43 -0500 Subject: [PATCH] added tents, houses, and compounds --- src/model/GameConfig.ts | 6 ++++++ src/model/resource/Compound.ts | 19 +++++++++++++++++++ src/model/resource/Credibility.ts | 2 +- src/model/resource/CryptoCurrency.ts | 4 ++-- src/model/resource/House.ts | 25 +++++++++++++++++++++++++ src/model/resource/Infrastructure.ts | 5 +++++ src/model/resource/Money.ts | 2 +- src/model/resource/PlayerOrg.ts | 5 ++++- src/model/resource/Purchasable.ts | 2 +- src/model/resource/Tent.ts | 17 +++++++++++++++++ 10 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 src/model/resource/Compound.ts create mode 100644 src/model/resource/House.ts create mode 100644 src/model/resource/Infrastructure.ts create mode 100644 src/model/resource/Tent.ts diff --git a/src/model/GameConfig.ts b/src/model/GameConfig.ts index a60cab2..4a1932c 100644 --- a/src/model/GameConfig.ts +++ b/src/model/GameConfig.ts @@ -4,6 +4,9 @@ /// /// /// +/// +/// +/// class GameConfig { public worldPopulation: number = 790000000; @@ -63,6 +66,9 @@ class GameConfig { // add resources state.addResource('money', new Money(3.50)); state.addResource('crpto', new CryptoCurrency()); + state.addResource('tents', new Tent()); + state.addResource('house', new House()); + state.addResource('cmpnd', new Compound()); return state; } diff --git a/src/model/resource/Compound.ts b/src/model/resource/Compound.ts new file mode 100644 index 0000000..083100e --- /dev/null +++ b/src/model/resource/Compound.ts @@ -0,0 +1,19 @@ +/// + +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; + } +} diff --git a/src/model/resource/Credibility.ts b/src/model/resource/Credibility.ts index f424437..6095ad2 100644 --- a/src/model/resource/Credibility.ts +++ b/src/model/resource/Credibility.ts @@ -6,7 +6,7 @@ class Credibility extends Passive { constructor () { super( '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); } diff --git a/src/model/resource/CryptoCurrency.ts b/src/model/resource/CryptoCurrency.ts index 31f7a0d..9586e66 100644 --- a/src/model/resource/CryptoCurrency.ts +++ b/src/model/resource/CryptoCurrency.ts @@ -2,8 +2,8 @@ class CryptoCurrency extends Purchasable { constructor () { - super('CryptoCurrency', - "Can't be spent directly, but provides a steady stream of passive income."); + super('Faithcoin', + "A crypto coin that can't be spent directly, but provides a steady stream of passive income."); this.cost.money = 100; this._costMultiplier.money = 1.1; this._baseMax = 1000; diff --git a/src/model/resource/House.ts b/src/model/resource/House.ts new file mode 100644 index 0000000..3892781 --- /dev/null +++ b/src/model/resource/House.ts @@ -0,0 +1,25 @@ +/// + +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; + } +} diff --git a/src/model/resource/Infrastructure.ts b/src/model/resource/Infrastructure.ts new file mode 100644 index 0000000..9daec6a --- /dev/null +++ b/src/model/resource/Infrastructure.ts @@ -0,0 +1,5 @@ +/// + +abstract class Infrastructure extends Purchasable { + public readonly resourceType: ResourceType = ResourceType.Infrastructure; +} diff --git a/src/model/resource/Money.ts b/src/model/resource/Money.ts index ae6ff6d..41e54e9 100644 --- a/src/model/resource/Money.ts +++ b/src/model/resource/Money.ts @@ -12,7 +12,7 @@ class Money extends Purchasable { super('Money', 'Used to purchase goods and services.'); this.clickText = 'Collect Tithes'; this.clickDescription = 'Voluntary contributions from followers.'; - this._baseMax = 10000; + this._baseMax = 999999; } public isUnlocked (state: GameState): boolean { diff --git a/src/model/resource/PlayerOrg.ts b/src/model/resource/PlayerOrg.ts index 7cd6c8b..fd309da 100644 --- a/src/model/resource/PlayerOrg.ts +++ b/src/model/resource/PlayerOrg.ts @@ -21,7 +21,10 @@ class PlayerOrg implements IResource { } 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 { diff --git a/src/model/resource/Purchasable.ts b/src/model/resource/Purchasable.ts index 2e0b0d3..4479497 100644 --- a/src/model/resource/Purchasable.ts +++ b/src/model/resource/Purchasable.ts @@ -1,7 +1,7 @@ /// abstract class Purchasable implements IResource { - public readonly resourceType: ResourceType = ResourceType.Infrastructure; + public readonly resourceType: ResourceType = ResourceType.Consumable; public value: number = 0; public clickText: string = 'Purchase'; diff --git a/src/model/resource/Tent.ts b/src/model/resource/Tent.ts new file mode 100644 index 0000000..6434146 --- /dev/null +++ b/src/model/resource/Tent.ts @@ -0,0 +1,17 @@ +/// + +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; + } +}