configurable values to make the game go faster while testing
This commit is contained in:
parent
e6b75fdccd
commit
f16fb1fcbf
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Reference in New Issue