Created RIgidel mode #694

This commit is contained in:
Daniël van Noord
2021-03-19 17:39:27 +01:00
parent 51c89bdc88
commit 823d12fa70
8 changed files with 36 additions and 23 deletions

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-unused-vars */
/** Functions related to the Dragon */
@@ -52,28 +51,27 @@ export default function CacheDragonCost() {
} else {
let cost = 0;
CopyData();
for (const j of Object.keys(Game.Objects)) {
Object.keys(Game.Objects).forEach((j) => {
target = j;
if (Game.Objects[target].amount < amount) {
CacheCostDragonUpgrade = 'Not enough buildings to sell';
break;
} else {
for (let i = 0; i < amount; i++) {
let price =
SimObjects[target].basePrice *
Game.priceIncrease **
Math.max(
0,
SimObjects[target].amount - 1 - SimObjects[target].free,
);
price = Game.modifyBuildingPrice(SimObjects[target], price);
price = Math.ceil(price);
cost += price;
SimObjects[target].amount -= 1;
}
return;
}
for (let i = 0; i < amount; i++) {
let price =
SimObjects[target].basePrice *
Game.priceIncrease **
Math.max(
0,
SimObjects[target].amount - 1 - SimObjects[target].free,
);
price = Game.modifyBuildingPrice(SimObjects[target], price);
price = Math.ceil(price);
cost += price;
SimObjects[target].amount -= 1;
}
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
}
});
}
}
CacheLastDragonLevel = Game.dragonLevel;

View File

@@ -19,6 +19,10 @@ import ColourOfPP from './ColourOfPP';
*/
function CacheColor(target, amount) {
Object.keys(target).forEach((i) => {
if (CMOptions.PPRigidelMode && amount === 1) {
target.color = ColorGray;
return;
}
target[i].color = ColourOfPP(
target[i],
Game.Objects[i].getSumPrice(amount),
@@ -39,7 +43,8 @@ function CachePP(target, amount) {
Game.cookiesPs +
price / target[i].bonus;
} else target[i].pp = price / target[i].bonus;
CachePPArray.push([target[i].pp, amount]);
if (!(CMOptions.PPRigidelMode && amount === 1))
CachePPArray.push([target[i].pp, amount]);
});
}