mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
Changed loops to be more concise
This commit is contained in:
parent
f8a085af7a
commit
1b57c1f7e0
@ -382,22 +382,16 @@ Bladeburner.prototype.process = function() {
|
|||||||
this.stamina = Math.min(this.maxStamina, this.stamina);
|
this.stamina = Math.min(this.maxStamina, this.stamina);
|
||||||
|
|
||||||
// Count increase for contracts/operations
|
// Count increase for contracts/operations
|
||||||
for (var contractName in this.contracts) {
|
for (let contract of Object.values(this.contracts)) {
|
||||||
if (this.contracts.hasOwnProperty(contractName)) {
|
contract.count += (seconds * contract.countGrowth/BladeburnerConstants.ActionCountGrowthPeriod);
|
||||||
var contract = this.contracts[contractName];
|
|
||||||
contract.count += (seconds * contract.countGrowth/BladeburnerConstants.ActionCountGrowthPeriod);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (var operationName in this.operations) {
|
for (let op of Object.values(this.operations)) {
|
||||||
if (this.operations.hasOwnProperty(operationName)) {
|
op.count += (seconds * op.countGrowth/BladeburnerConstants.ActionCountGrowthPeriod);
|
||||||
var op = this.operations[operationName];
|
|
||||||
op.count += (seconds * op.countGrowth/BladeburnerConstants.ActionCountGrowthPeriod);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chaos goes down very slowly
|
// Chaos goes down very slowly
|
||||||
for (var i = 0; i < BladeburnerConstants.CityNames.length; ++i) {
|
for (let cityName of BladeburnerConstants.CityNames) {
|
||||||
var city = this.cities[BladeburnerConstants.CityNames[i]];
|
var city = this.cities[cityName];
|
||||||
if (!(city instanceof City)) {throw new Error("Invalid City object when processing passive chaos reduction in Bladeburner.process");}
|
if (!(city instanceof City)) {throw new Error("Invalid City object when processing passive chaos reduction in Bladeburner.process");}
|
||||||
city.chaos -= (0.0001 * seconds);
|
city.chaos -= (0.0001 * seconds);
|
||||||
city.chaos = Math.max(0, city.chaos);
|
city.chaos = Math.max(0, city.chaos);
|
||||||
|
Loading…
Reference in New Issue
Block a user