diff --git a/src/main.ts b/src/main.ts index 47415b5..4b27a49 100644 --- a/src/main.ts +++ b/src/main.ts @@ -22,6 +22,12 @@ function gameLoop (state: GameState, renderer: IRenderer): void { // run with default config at startup ((): void => { const config: GameConfig = new GameConfig(); + + // debug values to make the game play faster while testing + config.baseTitheAmount = 1000; + config.baseCryptoReturnAmount = 100; + config.baseCredibilityRestoreRate = 5; + const renderer: IRenderer = new DebugRenderer(); const state: GameState = config.generateState(); diff --git a/src/model/GameConfig.ts b/src/model/GameConfig.ts index 4a1932c..ff655d5 100644 --- a/src/model/GameConfig.ts +++ b/src/model/GameConfig.ts @@ -21,6 +21,10 @@ class GameConfig { public relOtherShare: number = 0.02; public relNoneShare: number = 0.16; + public baseTitheAmount: number = 10; + public baseCryptoReturnAmount: number = 1; + public baseCredibilityRestoreRate: number = 0.25; + public generateState (): GameState { const state: GameState = new GameState(); @@ -60,16 +64,18 @@ class GameConfig { 'Non-Religious', 'Atheists and agnostics.', this.relNoneShare * this.worldPopulation)); - // add hidden resources - state.addResource('creds', new Credibility()); - // add resources - state.addResource('money', new Money(3.50)); + state.addResource('money', new Money(3.50, + this.baseTitheAmount, this.baseCryptoReturnAmount)); state.addResource('crpto', new CryptoCurrency()); state.addResource('tents', new Tent()); state.addResource('house', new House()); state.addResource('cmpnd', new Compound()); + // add passive resources + state.addResource('creds', new Credibility( + this.baseCredibilityRestoreRate)); + return state; } } diff --git a/src/model/resource/Compound.ts b/src/model/resource/Compound.ts index 083100e..05af056 100644 --- a/src/model/resource/Compound.ts +++ b/src/model/resource/Compound.ts @@ -3,7 +3,7 @@ class Compound extends Infrastructure { constructor () { super('Compounds', - 'Provides space for tents and houses.'); + 'Provides space for tents and houses and a place to hide more money.'); this.cost.money = 15000; this._costMultiplier.money = 1.5; } diff --git a/src/model/resource/Credibility.ts b/src/model/resource/Credibility.ts index 6095ad2..0ac71a4 100644 --- a/src/model/resource/Credibility.ts +++ b/src/model/resource/Credibility.ts @@ -3,7 +3,8 @@ class Credibility extends Passive { private _lastValue: number = 100; - constructor () { + constructor ( + private _baseRestoreRate: number) { super( 'Credibility', 'Affects your ability to recruit and retain followers.', @@ -15,6 +16,6 @@ class Credibility extends Passive { } public inc (state: GameState): number { - return 0.25; + return this._baseRestoreRate; } } diff --git a/src/model/resource/House.ts b/src/model/resource/House.ts index 3892781..d04c919 100644 --- a/src/model/resource/House.ts +++ b/src/model/resource/House.ts @@ -5,6 +5,7 @@ class House extends Infrastructure { super('Houses', 'Provides room to house 10 followers.'); this.cost.money = 150000; + this._baseMax = 0; this._costMultiplier.money = 1.1; } diff --git a/src/model/resource/Money.ts b/src/model/resource/Money.ts index 230168f..cc174e6 100644 --- a/src/model/resource/Money.ts +++ b/src/model/resource/Money.ts @@ -8,11 +8,13 @@ class Money extends Purchasable { constructor ( public value: number, + private readonly _baseTitheAmount: number, + private readonly _baseCryptoReturnAmount: number ) { super('Money', 'Used to purchase goods and services.'); this.clickText = 'Collect Tithes'; this.clickDescription = 'Voluntary contributions from followers.'; - this._baseMax = 1000000; + this._baseMax = 500000; } public isUnlocked (state: GameState): boolean { @@ -21,7 +23,7 @@ class Money extends Purchasable { public inc (state: GameState): number { // crypto currency - return state.getResource('crpto').value * 0.5; + return state.getResource('crpto').value * this._baseCryptoReturnAmount; } protected _purchaseAmount (state: GameState): number { @@ -36,7 +38,7 @@ class Money extends Purchasable { state.getResource('creds').value -= lost; } // each follower gives you $10 - const tithings: number = plorg.value * 10; + const tithings: number = plorg.value * this._baseTitheAmount; this._lastCollectionTime = state.now; return tithings; } @@ -45,4 +47,10 @@ class Money extends Purchasable { const followers: number = state.getResource('plorg').value; return `You collected $${amount} from ${followers} followers.`; } + + public max (state: GameState): number | null { + let max: number = this._baseMax; + max += state.getResource('cmpnd').value * 500000; + return max; + } } diff --git a/src/model/resource/Tent.ts b/src/model/resource/Tent.ts index 6434146..a59e027 100644 --- a/src/model/resource/Tent.ts +++ b/src/model/resource/Tent.ts @@ -5,7 +5,7 @@ class Tent extends Infrastructure { super('Tents', 'Provides room to house 2 followers.'); this.cost.money = 250; - this._costMultiplier.money = 1.1; + this._costMultiplier.money = 1.05; this._baseMax = 5; } diff --git a/src/render/DebugRenderer.ts b/src/render/DebugRenderer.ts index 09295d1..f10458d 100644 --- a/src/render/DebugRenderer.ts +++ b/src/render/DebugRenderer.ts @@ -91,7 +91,8 @@ class DebugRenderer implements IRenderer { el.getElementsByClassName('resource-btn'); if (elB.length > 0) { const enabled: boolean = state.isPurchasable(resource.cost) - && resource.value < resource.max(state); + && (resource.max(state) === null + || resource.value < resource.max(state)); if (enabled) elB[0].removeAttribute('disabled'); else elB[0].setAttribute('disabled', 'disabled'); }