Skip to content

Commit

Permalink
Update planning mode logic
Browse files Browse the repository at this point in the history
  • Loading branch information
waicool20 committed Dec 4, 2023
1 parent a9c031b commit 4b6c773
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ import com.waicool20.cvauto.core.util.pipeline
import com.waicool20.wai2k.events.EventBus
import com.waicool20.wai2k.events.RepairEvent
import com.waicool20.wai2k.events.SortieDoneEvent
import com.waicool20.wai2k.game.*
import com.waicool20.wai2k.game.CombatMap
import com.waicool20.wai2k.game.Echelon
import com.waicool20.wai2k.game.GFL
import com.waicool20.wai2k.game.MapRunnerRegions
import com.waicool20.wai2k.game.location.LocationId
import com.waicool20.wai2k.script.ScriptComponent
import com.waicool20.wai2k.script.ScriptTimeOutException
Expand Down Expand Up @@ -755,18 +758,13 @@ abstract class MapRunner(
*/
protected suspend fun enterPlanningMode() {
while (coroutineContext.isActive) {
val pmColor = region.pickColor(125, 890)
when {
pmColor.isSimilar(Color.WHITE) -> {
logger.info("Entering planning mode")
mapRunnerRegions.planningMode.click()
delay((3000 * gameState.delayCoefficient).roundToLong())
}
// Dunno why but the delta varies a lot, compression artifacts maybe?
pmColor.isSimilar(Color(254, 195, 26), maxDelta = 6.0) -> {
logger.info("In planning mode")
break
}
if (region.pickColor(125, 890).isSimilar(Color.WHITE)) {
logger.info("Entering planning mode")
mapRunnerRegions.planningMode.click()
delay((3000 * gameState.delayCoefficient).roundToLong())
} else {
logger.info("In planning mode")
break
}
delay(500)
}
Expand Down

0 comments on commit 4b6c773

Please sign in to comment.