Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battle events refresh and update logic is wrong #1652

Closed
fmatthew5876 opened this issue Mar 1, 2019 · 1 comment

Comments

@fmatthew5876
Copy link
Contributor

commented Mar 1, 2019

Create a 2k battle with 2 enemies. Give each enemy an action which enables switch 1.

Now create 2 copies of a battle event enabled by switch 1 with this code:

Msg: Hello
Switch 1 off

In RPG_RT, we get: Enemy attacks, "Hello", Other enemy attacks, "Hello"
In Player, we get: Enemy attacks, "Hello", "Hello", Other enemy attacks

This happens because in Game_Battle::RefreshEvents() we mark both pages as runnable and then later in Game_Battle::UpdateEvents() we run both.

Instead we need to have a single iteration which checks the page conditions and runs each page at the same time, so that we don't enable both events.

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

commented Mar 31, 2019

This bug is also present in 2k3 battles.

Page1, Enabled by SW1, Msg A, Sw1 Off
Page1, Enabled by SW1, Msg B, Sw1 Off

Use a skill that enabled SW1

RPG_RT: "A"
Player: "A", "B"

fmatthew5876 added a commit to fmatthew5876/Player that referenced this issue Mar 31, 2019

Battle2k: Refactor battle events execution
Simplify battle events execution for 2k battles.
* UpdateEvents() - checks all page conditions everytime
    * This fixes the 2k part of EasyRPG#1652
    * Fixes the steal 3 times issue from EasyRPG#985
* ResetEvents() - clears the run flag, allowing all event pages to run again
    * After start messages are done
    * Before each battle turn starts running

Duplicated functions for now to not break 2k3.

fmatthew5876 added a commit to fmatthew5876/Player that referenced this issue Mar 31, 2019

Battle2k: Refactor battle events execution
Simplify battle events execution for 2k battles.
* UpdateEvents() - checks all page conditions everytime
    * This fixes the 2k part of EasyRPG#1652
    * Fixes the steal 3 times issue from EasyRPG#985
* ResetEvents() - clears the run flag, allowing all event pages to run again
    * After start messages are done
    * Before each battle turn starts running

Duplicated functions for now to not break 2k3.
@fmatthew5876 fmatthew5876 referenced this issue Mar 31, 2019
2 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.