From e87ae9d1601bd7d92d85789f4e8e3f465f3880a5 Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Sat, 4 Sep 2021 23:16:32 -0500 Subject: [PATCH] megachurches --- public/css/debugger.css | 3 +++ src/model/GameConfig.ts | 4 ++++ src/model/resource/BuildingPermit.ts | 18 ++++++++++++++++++ src/model/resource/IResource.ts | 1 + src/model/resource/MegaChurch.ts | 20 ++++++++++++++++++++ src/model/resource/Pastor.ts | 4 +++- src/model/resource/Research.ts | 16 ++++++++++++++++ 7 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/model/resource/BuildingPermit.ts create mode 100644 src/model/resource/MegaChurch.ts create mode 100644 src/model/resource/Research.ts diff --git a/public/css/debugger.css b/public/css/debugger.css index 0ef73ce..8713844 100644 --- a/public/css/debugger.css +++ b/public/css/debugger.css @@ -61,3 +61,6 @@ body, html { #resource-container-passive .resource { background-color: #ffc; } +#resource-container-research .resource { + background-color: #cff; +} diff --git a/src/model/GameConfig.ts b/src/model/GameConfig.ts index de4d84c..e5ee99d 100644 --- a/src/model/GameConfig.ts +++ b/src/model/GameConfig.ts @@ -1,9 +1,11 @@ /// +/// /// /// /// /// /// +/// /// /// /// @@ -79,6 +81,8 @@ class GameConfig { state.addResource('house', new House()); state.addResource('chrch', new Church()); state.addResource('cmpnd', new Compound()); + state.addResource('blpmt', new BuildingPermit()); + state.addResource('mchch', new MegaChurch()); // add passive resources state.addResource('creds', new Credibility()); diff --git a/src/model/resource/BuildingPermit.ts b/src/model/resource/BuildingPermit.ts new file mode 100644 index 0000000..9ef6cba --- /dev/null +++ b/src/model/resource/BuildingPermit.ts @@ -0,0 +1,18 @@ +/// + +class BuildingPermit extends Research { + constructor () { + super('Building Permit', + 'Unlocks several new buildings you can build outside of your compounds.'); + this.cost.money = 250000; + } + + public isUnlocked (state: GameState): boolean { + if (this._isUnlocked) return true; + const compounds: IResource = state.getResource('cmpnd'); + if (compounds.value > 0) { + this._isUnlocked = true; + } + return this._isUnlocked; + } +} diff --git a/src/model/resource/IResource.ts b/src/model/resource/IResource.ts index 2bb0eb0..b0b255a 100644 --- a/src/model/resource/IResource.ts +++ b/src/model/resource/IResource.ts @@ -3,6 +3,7 @@ enum ResourceType { Job = 'job', Consumable = 'consumable', Infrastructure = 'infrastructure', + Research = 'research', Passive = 'passive' } diff --git a/src/model/resource/MegaChurch.ts b/src/model/resource/MegaChurch.ts new file mode 100644 index 0000000..0a18437 --- /dev/null +++ b/src/model/resource/MegaChurch.ts @@ -0,0 +1,20 @@ +/// + +class MegaChurch extends Infrastructure { + constructor () { + super('MegaChurches', + 'Room for 5 pastors'); + this.cost.money = 7500000; + this._costMultiplier.money = 1.01; + this._baseMax = 2; + } + + public isUnlocked (state: GameState): boolean { + if (this._isUnlocked) return true; + const permit: IResource = state.getResource('blpmt'); + if (permit.value > 0) { + this._isUnlocked = true; + } + return this._isUnlocked; + } +} diff --git a/src/model/resource/Pastor.ts b/src/model/resource/Pastor.ts index c758aa7..88bd2ec 100644 --- a/src/model/resource/Pastor.ts +++ b/src/model/resource/Pastor.ts @@ -9,7 +9,9 @@ class Pastor extends Job { } public max (state: GameState): number { - return state.getResource('chrch').value * 2; + let max: number = state.getResource('chrch').value * 2; + max += state.getResource('mchch').value * 5; + return max; } public isUnlocked (state: GameState): boolean { diff --git a/src/model/resource/Research.ts b/src/model/resource/Research.ts new file mode 100644 index 0000000..a822a59 --- /dev/null +++ b/src/model/resource/Research.ts @@ -0,0 +1,16 @@ +/// + +abstract class Research extends Purchasable { + public readonly resourceType: ResourceType = ResourceType.Research; + + constructor ( + public readonly name: string, + public readonly description: string + ) { + super(name, description); + this.value = 0; + this._baseMax = 1; + this.clickText = 'Learn'; + this.clickDescription = 'Complete this research.' + } +}