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.53k stars 1.81k forks source link

[Bug] Game freezes after attack lowering stats (e.g Bulldoze) when Mist has been used before #4737

Open herbyliciouss opened 3 weeks ago

herbyliciouss commented 3 weeks ago

Describe the bug

Game freezed multiple times every time my Pokemons where being hit by a lowering stat attack after having Volcanion using Mist. It freezes after the attack dealt its normal damage and before the lowering stat message appears

Reproduction

In my scenario here's what happened:

  1. Have Volcanion use Mist to prevent stats being lowered
  2. Volcanion dies the turn after
  3. Sent Mega Gyarados to then take a Bulldoze
  4. Games freezes on message saying Foe Wailord uses Bulldoze

Expected behavior

Game should not freeze and stat should not be lowered. Maybe skip the lowering stat message or have a message saying something like Mist protects [your pokemon name] from having its stat lowered

Screenshots / Videos

No response

Session export file

sessionData_jaugeobese.txt

User data export file

data_jaugeobese.txt

Additional context

No response

Snailman11 commented 3 weeks ago

ah

Mist

Growl

https://github.com/user-attachments/assets/8a05281f-b7d6-45be-9722-d96d42f8048d

Icy Wind

https://github.com/user-attachments/assets/f639733f-2047-4e68-86a6-5e360704eb49

Occurs whenever Mist would block a stat drop

Snailman11 commented 3 weeks ago

This code from Infiltrator's implementation

   * Cancels the lowering of stats
   * @param arena the {@linkcode Arena} containing this effect
   * @param simulated `true` if the effect should be applied quietly
   * @param cancelled a {@linkcode BooleanHolder} whose value is set to `true`
   * to flag the stat reduction as cancelled
   * @returns `true` if a stat reduction was cancelled; `false` otherwise
   */
  override apply(arena: Arena, simulated: boolean, attacker: Pokemon, cancelled: BooleanHolder): boolean {
    // `StatStageChangePhase` currently doesn't have a reference to the source of stat drops,
    // so this code currently has no effect on gameplay.
    if (attacker) {
      const bypassed = new BooleanHolder(false);
      // TODO: Allow this to be simulated
      applyAbAttrs(InfiltratorAbAttr, attacker, null, false, bypassed);
      if (bypassed.value) {
        return false;
      }
    }

@innerthunder