From 80e9e7a972adfe64a5ba483dcdb966ce69a2b143 Mon Sep 17 00:00:00 2001 From: kuangthree Date: Sat, 3 Feb 2024 13:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAchooseButton=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=B8=8A=E4=B8=8B=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/ai/basic.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/noname/ai/basic.js b/noname/ai/basic.js index 760175368..0d03bb8c1 100644 --- a/noname/ai/basic.js +++ b/noname/ai/basic.js @@ -24,15 +24,21 @@ export class Basic extends Uninstantable { if (ui.selected.buttons.length >= range[0]) { ok = true; } + CacheContext.setCacheContext(new CacheContext()); + CacheContext.setInCacheEnvironment(true); if (range[1] <= -1) { j = 0; for (i = 0; i < ui.selected.buttons.length; i++) { j += check(ui.selected.buttons[i]); } + CacheContext.setInCacheEnvironment(false); + CacheContext.removeCacheContext(); return (j > 0); } buttons = get.selectableButtons(); if (buttons.length == 0) { + CacheContext.setInCacheEnvironment(false); + CacheContext.removeCacheContext(); return ok; } buttons2 = buttons.slice(0); @@ -50,9 +56,13 @@ export class Basic extends Uninstantable { // }); if (check(buttons[ix]) <= 0) { if (!forced || ok) { + CacheContext.setInCacheEnvironment(false); + CacheContext.removeCacheContext(); return ok; } } + CacheContext.setInCacheEnvironment(false); + CacheContext.removeCacheContext(); buttons[ix].classList.add('selected'); ui.selected.buttons.add(buttons[ix]); game.check();