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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | 2x 8x 2x 1x 1x 1x 1x 1x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 2x 2x 2x 2x 2x 2x 5x 5x 5x 5x 3x 2x 1x 1x 1x 1x 3x 1x 2x 2x 2x 2x 2x | /**
* Auto Tutorial System - チュートリアルを完全自動でクリア
*/
const autoTutorial = {
/**
* チュートリアル検出
*/
isTutorial: function () {
// Tutorialモード検出
return Game.tutorial && Game.tutorial.currentStep !== undefined;
},
/**
* メイン自動実行
*/
run: function () {
if (!this.isTutorial()) {
return false;
}
const step = Game.tutorial.currentStep;
console.log('🎮 Auto Tutorial - Step: ' + step);
// ステップ別処理
switch (step) {
case 1:
this.step1_createHarvester();
break;
case 2:
this.step2_harvestEnergy();
break;
case 3:
this.step3_upgradeController();
break;
case 4:
this.step4_buildExtension();
break;
case 5:
this.step5_defendRoom();
break;
default:
this.autoStep();
}
return true;
},
/**
* Step 1: Create harvester
*/
step1_createHarvester: function () {
const spawn = Game.spawns['Spawn1'];
if (!spawn) {
return;
}
// Harvesterがいなければ作成
const harvesters = _.filter(Game.creeps, (c) => c.memory.role === 'harvester');
Iif (harvesters.length === 0 && !spawn.spawning) {
spawn.spawnCreep([WORK, CARRY, MOVE], 'Harvester1', {
memory: { role: 'harvester' },
});
console.log('✅ Created Harvester');
}
},
/**
* Step 2: Harvest energy
*/
step2_harvestEnergy: function () {
for (const name in Game.creeps) {
const creep = Game.creeps[name];
if (creep.store.getFreeCapacity() > 0) {
const sources = creep.room.find(FIND_SOURCES);
Eif (sources.length > 0) {
Iif (creep.harvest(sources[0]) === ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0]);
}
}
} else E{
const spawn = Game.spawns['Spawn1'];
if (spawn && creep.transfer(spawn, RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) {
creep.moveTo(spawn);
}
}
}
},
/**
* Step 3: Upgrade controller
*/
step3_upgradeController: function () {
for (const name in Game.creeps) {
const creep = Game.creeps[name];
Iif (creep.store[RESOURCE_ENERGY] === 0) {
const sources = creep.room.find(FIND_SOURCES);
if (sources.length > 0) {
if (creep.harvest(sources[0]) === ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0]);
}
}
} else {
Eif (creep.room.controller) {
Iif (creep.upgradeController(creep.room.controller) === ERR_NOT_IN_RANGE) {
creep.moveTo(creep.room.controller);
}
}
}
}
},
/**
* Step 4: Build extension
*/
step4_buildExtension: function () {
for (const name in Game.creeps) {
const creep = Game.creeps[name];
const targets = creep.room.find(FIND_CONSTRUCTION_SITES);
Eif (targets.length > 0) {
Iif (creep.store[RESOURCE_ENERGY] === 0) {
const sources = creep.room.find(FIND_SOURCES);
if (sources.length > 0) {
if (creep.harvest(sources[0]) === ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0]);
}
}
} else {
Iif (creep.build(targets[0]) === ERR_NOT_IN_RANGE) {
creep.moveTo(targets[0]);
}
}
}
}
},
/**
* Step 5: Defend room
*/
step5_defendRoom: function () {
const towers = _.filter(Game.structures, (s) => s.structureType === STRUCTURE_TOWER);
Iif (towers.length > 0) {
const tower = towers[0];
const hostiles = tower.room.find(FIND_HOSTILE_CREEPS);
if (hostiles.length > 0) {
tower.attack(hostiles[0]);
console.log('💥 Attacking hostile!');
}
}
},
/**
* 汎用自動ステップ
*/
autoStep: function () {
// 基本的なCreep動作
for (const name in Game.creeps) {
const creep = Game.creeps[name];
// エネルギーが空
Iif (creep.store[RESOURCE_ENERGY] === 0) {
const sources = creep.room.find(FIND_SOURCES);
if (sources.length > 0) {
if (creep.harvest(sources[0]) === ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0]);
}
}
} else {
// 建設サイト優先
const targets = creep.room.find(FIND_CONSTRUCTION_SITES);
Iif (targets.length > 0) {
if (creep.build(targets[0]) === ERR_NOT_IN_RANGE) {
creep.moveTo(targets[0]);
}
} else if (creep.room.controller) {
// 次にControllerアップグレード
Iif (creep.upgradeController(creep.room.controller) === ERR_NOT_IN_RANGE) {
creep.moveTo(creep.room.controller);
}
} else E{
// Spawnに配達
const spawn = Game.spawns['Spawn1'];
if (spawn && creep.transfer(spawn, RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) {
creep.moveTo(spawn);
}
}
}
}
// Tower防衛
const towers = _.filter(Game.structures, (s) => s.structureType === STRUCTURE_TOWER);
for (const tower of towers) {
const hostiles = tower.room.find(FIND_HOSTILE_CREEPS);
if (hostiles.length > 0) {
tower.attack(hostiles[0]);
}
}
// 自動Spawn
const spawn = Game.spawns['Spawn1'];
if (spawn && !spawn.spawning && Object.keys(Game.creeps).length < 3) {
spawn.spawnCreep([WORK, CARRY, MOVE], 'Worker' + Game.time, {
memory: { role: 'worker' },
});
}
},
/**
* チュートリアルスキップ(可能な場合)
*/
skipIfPossible: function () {
if (Game.tutorial && Game.tutorial.skip) {
Game.tutorial.skip();
console.log('⏩ Tutorial skipped!');
return true;
}
return false;
},
/**
* チュートリアル進捗表示
*/
showProgress: function () {
if (!this.isTutorial()) {
return;
}
console.log('🎮 Tutorial Progress:');
console.log(' Current Step: ' + Game.tutorial.currentStep);
console.log(' Creeps: ' + Object.keys(Game.creeps).length);
console.log(
' Energy: ' +
(Game.spawns['Spawn1'] ? Game.spawns['Spawn1'].store[RESOURCE_ENERGY] : 0)
);
},
};
module.exports = autoTutorial;
|