pagefaultgames / pokerogue

A browser based Pokémon fangame heavily inspired by the roguelite genre.
https://pokerogue.net
GNU Affero General Public License v3.0
4.41k stars 1.78k forks source link

[BUG] Metronome calling Beak Blast hardlocks the game #2790

Closed EJS2K closed 1 month ago

EJS2K commented 3 months ago

A pokemon using metronome, calling beak blast, hard locks the game (complete freeze, need to reload page). I tried doing it more than once, seems to happen every time (since the same move keeps getting called).

To Reproduce

  1. Get a pokemon with metronome (i used munchlax).
  2. Use metronome.
  3. Get beak blast.
  4. Crash.

Expected behavior Move working and doing damage

Device This was done on mobile, not tested on PC. Using google chrome.

Additional context To note the exact battle flow: Lead with hydreigon against a donphan on endless mode Swapped to munchlax when given the prompt Chose metronome Donphan went first, used scary face Metronome went off, beak blast got selected. Beak blast "charging" animation goes off, and then it freezes.

schmidtc1 commented 3 months ago

The issue is coming from this line of code which is called from ChargeAttr: https://github.com/pagefaultgames/pokerogue/blob/7847aa1644a732b7002e10660cd342675136e312/src/data/move.ts#L2218

user.moveset.find(m => m.moveId === move.id)

This piece of code searches for the move in the user's moveset, but since it's from Metronome, Beak Blast doesn't exist in the user's moveset.