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] Primordial Sea does not always trigger #1843

Open Terrorforge opened 5 months ago

Terrorforge commented 5 months ago

Describe the bug

While playing Endless primarily using Primal Kyogre, I've noticed that Primordial Sea periodically stops working. The effect is gone from the fly-out and there's no indicator at the end of the turn.

This usually seems to be associated with changing the biome. Just now it happened when I got out of the wave 1750 Eternatus fight, earlier it happened when I entered the Volcano biome, and it's been happening periodically in all sorts of other biomes.

To Reproduce

  1. Play Endless with Primal Kyogre
  2. (optional) get Electro Shot onto it by fusing and unfusing with Archaludon. this helps because if you're using it all the time you really notice when the rain is gone.
  3. Keep playing until the rain randomly(?) disappears

Expected behavior

It's not supposed to be possible to stop Primordial Sea from being active while Kyogre is on the field, except when replaced by Desolate Land or Delta Stream.

Screenshots / Videos image Here I've just defeated Eternatus on wave 1750, and when entering the Beach biome for wave 1751 Primordial Sea has not triggered.

Here's the session data at the above screenshot: sessionData_Terrorforge_PrimordialSea.zip

Device

Chrome on PC

Additional context

This seems like it might be connected to a similar issue I experienced with Hadron Engine, reported in #1688

Terrorforge commented 5 months ago

Just got dropped in the Lake biome on wave 1841. The fly-out listed "heavy rain" as being active, but when I pressed Electro Shot, it had a charge turn. When I regained control, the fly-out no longer listed any weather conditions.

Wondering if this is related to entering a biome that normally has a permanent weather effect. It crapped out on the Graveyard too, which has fog.

Terrorforge commented 5 months ago

Moved to Lake biome on wave 1934. Heavy Rain said to be active by flyout and got the end-of-turn message, but Electro Shot still required a turn to charge.

Terrorforge commented 5 months ago

Happened again exactly the same on wave 1968

c4vv commented 5 months ago

I'm unable to recreate the issue:

I'll try doing my own run with Groudon to look for more clues as to how to recreate the bug

vehumet commented 5 months ago

I'm experiencing same bug for electric field with Miraidon, in infinite mode. (Not sure in classic mode) The bugs are as follows;

  1. When electiric field is active, F5 and reload session. Then electric field is removed.
  2. When biome is changed and Miraidon returns/get out from the ball
    • Select yes when be asked to change Pokemon, then cancel: Electric field is not activated.
    • Select no to the dialogue: Electric field is activated.
vehumet commented 5 months ago

https://github.com/pagefaultgames/pokerogue/assets/7656728/db17b7c4-275c-40f6-9846-611558bd1956

Changed biome, select no to pokemon change dialog. Electric field is activated.

https://github.com/pagefaultgames/pokerogue/assets/7656728/53543958-2af1-4fe1-b634-eafa1e17f34e

Changed biome, select yes to pokemon change dialog then cancel. Electric field is not activated. (Whether it is double battle or not is not related)

https://github.com/pagefaultgames/pokerogue/assets/7656728/867975f7-7c15-48da-b0c1-669b877af1b7

When electric field has duration less than 5, restart session. Electric field is removed. If the duration was 5 (just activated), the terrain remains.

Terrorforge commented 5 months ago

I'm stupid. All those instance where Electro Shot failed to trigger in the Lake biome were because I was up against a Golduck, presumably with Cloud Nine.

Other problems remain, though.

Volbla commented 5 months ago

It doesn't seem like trySetWeather in arena.ts actually checks if the current weather is immutable before overwriting it. Is that the bug or does that check happen somewhere else?

edit: Weather checking abilities do check it, but environmental weathers in phases.ts do not. Maybe it's better to handle that entirely in trySetWeather?

vehumet commented 5 months ago

The bug that terrain was removed after reloading session is fixed a little ago. I'm not sure which commit affected it. The bug related to entering pokemon change page still remains.

Arxalc commented 5 months ago

It seems that the game will look at the last battle to determine whether it is currently a new biome or not. But because you reload, that information isn't available anymore, so it'll always assume you're in the middle of encounters and won't call postSummonPhase (and postSummon abilities) again.

I think you'd need to track isNewBiome in session data and check against that to determine whether to call a postSummonPhase on reload. I can't figure out how it's saving session data to do that though...