megachurches

This commit is contained in:
Rudis Muiznieks 2021-09-04 23:16:32 -05:00
parent 0df44e3e87
commit e87ae9d160
7 changed files with 65 additions and 1 deletions

View file

@ -61,3 +61,6 @@ body, html {
#resource-container-passive .resource {
background-color: #ffc;
}
#resource-container-research .resource {
background-color: #cff;
}

View file

@ -1,9 +1,11 @@
/// <reference path="./GameState.ts" />
/// <reference path="./resource/BuildingPermit.ts" />
/// <reference path="./resource/Church.ts" />
/// <reference path="./resource/Compound.ts" />
/// <reference path="./resource/Credibility.ts" />
/// <reference path="./resource/CryptoCurrency.ts" />
/// <reference path="./resource/House.ts" />
/// <reference path="./resource/MegaChurch.ts" />
/// <reference path="./resource/Money.ts" />
/// <reference path="./resource/Pastor.ts" />
/// <reference path="./resource/PlayerOrg.ts" />
@ -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());

View file

@ -0,0 +1,18 @@
/// <reference path="./Research.ts" />
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;
}
}

View file

@ -3,6 +3,7 @@ enum ResourceType {
Job = 'job',
Consumable = 'consumable',
Infrastructure = 'infrastructure',
Research = 'research',
Passive = 'passive'
}

View file

@ -0,0 +1,20 @@
/// <reference path="./Infrastructure.ts" />
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;
}
}

View file

@ -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 {

View file

@ -0,0 +1,16 @@
/// <reference path="./Purchasable.ts" />
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.'
}
}