This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

autoclicker costs implemented

parent caa4bce5
......@@ -14,6 +14,22 @@ export class GamePlayService {
private readonly accumulates = new BehaviorSubject<number>(0);
readonly accumulatesVal = this.accumulates.asObservable();
private readonly jars = new BehaviorSubject<number>(0);
readonly jarCount = this.jars.asObservable();
jarCost = 5;
private readonly barrels = new BehaviorSubject<number>(0);
readonly barrelCount = this.jars.asObservable();
barrelCost = 50;
private readonly silos = new BehaviorSubject<number>(0);
readonly siloCount = this.jars.asObservable();
siloCost = 500;
private readonly reservoirs = new BehaviorSubject<number>(0);
readonly reservoirCount = this.jars.asObservable();
reservoirCost = 5000;
constructor() {
console.log('Game service activated');
}
......@@ -23,12 +39,13 @@ export class GamePlayService {
}
checkEnough(price) {
if (this.pickles.value >= price) {
if (this.pickleCount >= price) {
return true;
}
return false;
}
async pickleUpgrade(cost) {
this.incrementsClicks.next(this.incrementsClicks.value * 10);
......@@ -37,31 +54,39 @@ export class GamePlayService {
}
async jarUpgrade() {
if (this.pickles.value >= 5) {
if (this.pickles.value >= (this.jarCost + (this.jars.value*(this.jars.value+1)*5))) {
this.jarCost = (this.jarCost + (this.jars.value*(this.jars.value+1)*5));
this.accumulates.next(this.accumulates.value + 5);
this.pickles.next(this.pickles.value - 5);
this.pickles.next(this.pickles.value - this.jarCost);
this.jars.next(this.jars.value + 1)
}
// need to add else to throw error
}
async barrelUpgrade() {
if (this.pickles.value >= 50) {
if (this.pickles.value >= (this.barrelCost + (this.barrels.value*(this.barrels.value+1)*50))) {
this.barrelCost = (this.barrelCost + (this.barrels.value*(this.barrels.value+1)*50));
this.accumulates.next(this.accumulates.value + 50);
this.pickles.next(this.pickles.value - 50);
this.pickles.next(this.pickles.value - this.barrelCost);
this.barrels.next(this.barrels.value + 1);
}
}
async siloUpgrade() {
if (this.pickles.value >= 500) {
if (this.pickles.value >= (this.siloCost + (this.silos.value*(this.silos.value+1)*500))) {
this.siloCost = (this.siloCost + (this.silos.value*(this.silos.value+1)*500));
this.accumulates.next(this.accumulates.value + 500);
this.pickles.next(this.pickles.value - 500);
this.pickles.next(this.pickles.value - this.siloCost);
this.silos.next(this.silos.value + 1);
}
}
async reservoirUpgrade() {
if (this.pickles.value >= 5000) {
if (this.pickles.value >= (this.reservoirCost + (this.reservoirs.value*(this.reservoirs.value+1)*5000))) {
this.reservoirCost = (this.reservoirCost + (this.reservoirs.value*(this.reservoirs.value+1)*5000));
this.accumulates.next(this.accumulates.value + 5000);
this.pickles.next(this.pickles.value - 5000);
this.pickles.next(this.pickles.value - this.reservoirCost);
this.reservoirs.next(this.reservoirs.value + 1);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment