Skip to content

Trim the shared logic from Scene_Battle #2279

@mateofio

Description

@mateofio

The battle scene code is very difficult to follow, by extension difficult to extend, and nearly impossible to reason about it's correctness. It's also very easy to fix a bug in one battle system and break the other.

A good example is this PR, which is a simple feature addition but exceedingly complex in it's implementation:
#2151

The cause of all this is the shared logic in Scene_Battle and how it interacts with the 2k and 2k3 battle systems. The code is constantly calling back and forth between the child and parent classes, and carefully trying to juggle the needs of both battle systems.

This needs a refactor, Scene_Battle should only be for the very few required shared facilities for setting up the battle stack. I would rather have code duplication in 2k and 2k3 if it means I can reason about and understand the code.

Likely development sequence:

  • Separate true battle stack fundamentals into Scene_Battle, and make a Scene_BattleBase with the rest of the current shared logic.
  • Copy Scene_BattleBase stuff into 2k battle system and refactor the 2k battle system state machine.
  • Rename to Scene_BattleBase2k3 and leave the rest for 2k3 battle system refactor...

Once this is done, it will also make it possible to reconcile the 2k battle system against RPG_RT using RE tools and fix for good wierd interactions like #2153 and #2154

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions