CPU opponents in Mokepon provide automated challengers that ensure players always have enemies to battle, even when no other human players are online. The server maintains exactly 3 CPU Mokepons at all times when players are active.
CPU opponents are fully automated - they don’t move around the map but are positioned strategically for players to encounter during exploration.
Each Mokepon’s type is automatically assigned based on its name:
function getMokeponType(name) { switch (name) { case "Hipodoge": case "Pydos": return "💧"; case "Capipepo": case "Tucapalma": return "🌱"; case "Ratigueya": case "Langostelvis": return "🔥"; default: return "💧"; }}
CPUs get an extra attack when they have a type advantage over the player:
app.post("/mokepon/:playerId/check-advantage", (req, res, next) => { try { const playerId = req.params.playerId || ""; const { playerMokeponType } = req.body || {}; const cpuPlayer = players.find( (player) => player.id === playerId && player.isCPU ); // Check if CPU has advantage over player const cpuType = cpuPlayer.mokepon.type; const hasAdvantage = combatRules[cpuType] === playerMokeponType; if (hasAdvantage) { // Add an extra attack of the same type as the CPU mokepon if (!cpuPlayer.extraAttackAdded) { cpuPlayer.attacks.push(cpuType); cpuPlayer.availableAttacks.push(cpuType); cpuPlayer.extraAttackAdded = true; } res.json({ success: true, hasAdvantage: true, attacks: cpuPlayer.attacks, availableAttacks: cpuPlayer.availableAttacks, }); } } catch (error) { next(error); }});
Combat Rules:
const combatRules = { "💧": "🔥", // Water beats Fire "🔥": "🌱", // Fire beats Plant "🌱": "💧", // Plant beats Water};
When a CPU has type advantage, their attack pool increases from 5 to 6 attacks, giving them a 4:2 ratio of their strong type vs weak types, making them significantly harder to beat.
CPU opponents persist in the game as long as human players are active:
function areHumanPlayersActive() { return players.some((player) => !player.isCPU);}function checkAndRegenerateCPUs() { if (!areHumanPlayersActive() && cpuMokepons.length > 0) { console.log("No human players left. Regenerating CPU Mokepons."); // Remove existing CPU players const humanPlayers = players.filter((player) => !player.isCPU); players.length = 0; players.push(...humanPlayers); // Generate new CPU Mokepons generateCPUMokepons(); }}
Regeneration Trigger
When the last human player disconnects, all CPU opponents are removed and regenerated. This means each new game session has fresh CPUs with randomized Mokepons and positions.
Scout First: Check the types of all 3 CPU opponents on the map
Choose Wisely: Select a Mokepon that has advantage over at least 2 of the 3 CPUs
Plan Encounters: Battle CPUs in order of advantage (best matchup first)
Attack Selection: Prioritize your super-effective attacks early in the sequence
Expect Patterns: CPUs will likely use their primary type attack 60% of the time
Since CPUs are positioned at different locations, you can choose the order in which you encounter them. Battle the ones you have type advantage against first to build up experience!
Harder than completely random opponents (type-weighted attacks)
Good for learning game mechanics
Excellent practice for understanding type advantages
CPU opponents serve as training encounters that teach players about type matchups and attack sequencing before facing human opponents with strategic planning.