diff --git a/src/model/GameConfig.ts b/src/model/GameConfig.ts index d461872..6999f14 100644 --- a/src/model/GameConfig.ts +++ b/src/model/GameConfig.ts @@ -1,5 +1,6 @@ /// -/// +/// +/// /// class GameConfig { @@ -18,6 +19,9 @@ class GameConfig { public generateState(): GameState { const state = new GameState(); + // create player organization + state.addResource('plorg', new PlayerOrganization()); + // create world religions state.addResource('xtian', new Religion( 'Christianity', 'God, Jesus, Bible, churches.', @@ -51,6 +55,9 @@ class GameConfig { 'Non-Religious', 'Atheists and agnostics.', this.relNoneShare * this.worldPopulation)); + // add crafting resources + state.addResource('money', new Money(0, 1000)); + return state; } } diff --git a/src/model/IResource.ts b/src/model/IResource.ts index 8523fbe..6710231 100644 --- a/src/model/IResource.ts +++ b/src/model/IResource.ts @@ -1,12 +1,14 @@ enum ResourceType { - Religion + Religion, + Consumable } interface IResource { - name: string, - description: string, - resourceType: ResourceType, - value: number, - max?: number, - unlocked: boolean + name: string; + description: string; + + resourceType: ResourceType; + value: number; + max?: number; + unlocked: boolean; } diff --git a/src/model/resource/Consumable.ts b/src/model/resource/Consumable.ts new file mode 100644 index 0000000..23c8f9e --- /dev/null +++ b/src/model/resource/Consumable.ts @@ -0,0 +1,14 @@ +/// + +class Consumable implements IResource { + public readonly resourceType = ResourceType.Consumable; + + constructor ( + public readonly name: string, + public readonly description: string, + public value: number, + public unlocked: boolean, + public max?: number, + ) { + } +} diff --git a/src/model/resource/Money.ts b/src/model/resource/Money.ts new file mode 100644 index 0000000..6497169 --- /dev/null +++ b/src/model/resource/Money.ts @@ -0,0 +1,11 @@ +/// + +class Money extends Consumable { + constructor ( + public value: number, + public max: number + ) { + super('Money', 'Used to purchase goods and services.', + value, true, max); + } +} diff --git a/src/model/resource/PlayerOrganization.ts b/src/model/resource/PlayerOrganization.ts new file mode 100644 index 0000000..d5b738e --- /dev/null +++ b/src/model/resource/PlayerOrganization.ts @@ -0,0 +1,11 @@ +/// + +class PlayerOrganization implements IResource { + public readonly name = 'Player'; + public readonly description = 'In you they trust.'; + public readonly resourceType = ResourceType.Religion; + public readonly max?: number = null; + public readonly unlocked = true; + + public value = 0; +} diff --git a/src/model/resource/Religion.ts b/src/model/resource/Religion.ts index 6fb32b5..aa9b3e7 100644 --- a/src/model/resource/Religion.ts +++ b/src/model/resource/Religion.ts @@ -8,7 +8,7 @@ class Religion implements IResource { constructor ( public readonly name: string, public readonly description: string, - public readonly value: number, + public value: number, ) { } }