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 | 1x 3x 2x 1x 1x 1x 3x 2x 2x 1x 1x 2x 1x | const MissionSystem = {
initMemory() {
if (!Memory.missions) {
Memory.missions = {
active: [],
completed: 0,
};
}
},
createMission(type, target, reward) {
const mission = {
id: Math.random().toString(36).substr(2, 9),
type,
target,
reward,
createdAt: Game.time,
status: 'active',
};
Memory.missions.active.push(mission);
return mission;
},
getMissionsForCreep(creep) {
return Memory.missions.active.filter((m) => m.status === 'active');
},
completeMission(missionId) {
const mission = Memory.missions.active.find((m) => m.id === missionId);
if (mission) {
mission.status = 'completed';
Memory.missions.completed++;
}
},
getActiveMissions() {
return Memory.missions.active.filter((m) => m.status === 'active');
},
createRandomMission() {
const types = ['scout', 'harvest_boost', 'defense_patrol', 'build_sprint'];
const type = types[Math.floor(Math.random() * types.length)];
const targets = Object.values(Game.rooms)[0];
const rewards = [100, 250, 500];
const reward = rewards[Math.floor(Math.random() * rewards.length)];
return this.createMission(type, targets ? targets.name : 'sim', reward);
},
};
module.exports = MissionSystem;
|