writing

MLBB Counter Draft, Shipped on Cloudflare Workers

10 Jul 2026 -- cloudflare-workers, javascript, games

The drafting phase in Mobile Legends: Bang Bang lasts only a few minutes, but it often determines the outcome of the match before gameplay begins. Players must quickly evaluate enemy selections and identify effective counters while considering bans and previous picks. Searching community websites during the draft consumes valuable time and often results in missed opportunities.

To simplify this process, I built a lightweight draft assistant. As enemy heroes are selected, the application immediately recommends available counter picks while automatically excluding heroes that have already been banned or drafted by either team.

How it works

Ban tracking

Users can select up to six banned heroes. Once selected, those heroes are removed from every selection list to prevent invalid recommendations.

Enemy draft analysis

Enemy heroes are selected lane by lane, including Gold, EXP, Mid, Jungle, and Roam. As each selection is made, the application recalculates available counter recommendations. Heroes that have already been picked or banned are automatically excluded.

Hero selection

Users can either choose a hero from the dropdown menu or select one of the recommended counter suggestions directly. A board reset option clears all selections for a new match, while a random enemy team generator creates practice scenarios.

Data collection

Hero matchup data is collected using a Python scraper. Instead of relying on CSS selectors, the scraper identifies information by locating the “Weak Against” section on each hero page. This approach is significantly more resilient because page styling changes more frequently than the underlying content structure.

The collected data is consolidated into a single JSON dataset. A Cloudflare Worker serves both the application and the dataset from the edge, providing low latency and eliminating the need for a traditional application server.

Keeping the data current

Hero balance changes regularly through game updates, making periodic data refreshes essential.

A GitHub Actions workflow executes every Sunday to rerun the scraper, update the mlbb_data.json dataset, commit the changes, and trigger an automatic Cloudflare Pages deployment. As a result, the application remains current without requiring manual intervention.

The scraper supports three operating modes.

  • scrape retrieves the latest data directly from mlcounter.com.
  • builtin uses a bundled offline dataset without making network requests.
  • api queries the Anthropic API with web search when additional validation or fallback data is required.

Lessons learned

One of the primary lessons from this project is that web scrapers should rely on stable content markers instead of presentation details. Anchoring extraction logic to the “Weak Against” heading has proven significantly more reliable than targeting CSS class names, which frequently change during website redesigns.

The project also demonstrates that Cloudflare Workers are an excellent fit for lightweight, read-only applications. Deploying at the edge provides low latency, minimal operational overhead, and a cost-effective hosting model while keeping the application highly responsive.