Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 1x 8x 8x 2x 1x 1x 1x 1x 1x 2x 2x 1x 1x 1x 1x | const StatsManager = {
initMemory() {
Eif (!Memory.stats) {
Memory.stats = {
totalEnergyProcessed: 0,
totalEnergyUpgraded: 0,
totalBuildProgress: 0,
totalRepairDone: 0,
roomStats: {},
creepDeaths: 0,
creepsBorn: 0,
startTime: Game.time,
};
}
},
recordHarvest(amount) {
Memory.stats.totalEnergyProcessed += amount;
},
recordUpgrade(amount) {
Memory.stats.totalEnergyUpgraded += amount;
},
recordBuild(progress) {
Memory.stats.totalBuildProgress += progress;
},
recordRepair(progress) {
Memory.stats.totalRepairDone += progress;
},
recordCreepBirth() {
Memory.stats.creepsBorn++;
},
recordCreepDeath() {
Memory.stats.creepDeaths++;
},
getStats() {
const uptime = Game.time - Memory.stats.startTime;
return {
uptime,
energyProcessed: Memory.stats.totalEnergyProcessed,
energyUpgraded: Memory.stats.totalEnergyUpgraded,
buildProgress: Memory.stats.totalBuildProgress,
repairDone: Memory.stats.totalRepairDone,
creepDeaths: Memory.stats.creepDeaths,
creepsBorn: Memory.stats.creepsBorn,
avgEnergyPerTick: (Memory.stats.totalEnergyProcessed / uptime).toFixed(2),
};
},
displayStats() {
const stats = this.getStats();
const lines = [
`📊 Empire Stats (${stats.uptime} ticks)`,
`Energy Processed: ${stats.energyProcessed}`,
`Energy Upgraded: ${stats.energyUpgraded}`,
`Build Progress: ${stats.buildProgress}`,
`Repair Done: ${stats.repairDone}`,
`Creeps Born: ${stats.creepsBorn} | Deaths: ${stats.creepDeaths}`,
`Avg Energy/tick: ${stats.avgEnergyPerTick}`,
];
return lines;
},
};
module.exports = StatsManager;
|