Here's my new design.
Looks something like this: http://dl.dropbox.com/u/23043573/RPG%20Maker/RMVXA%20Scripts/PluginBattleSystem.txt
The idea is to abstract away the BattleManager and let it decide which battle manager to actually use.
Because you should *always* setup the battle manager before you actually use it, I decided to put it there
Code:
Now I will introduce a battle manager interface. It's more like an abstract classmodule BattleManager
def self.setup_battle_manager
bs = Tsuki::PBS::Battle_Managers[$game_system.battle_system]
@battleManager = Object.const_get(bs).new
end
def self.setup(troop_id, can_escape = true, can_lose = false)
setup_battle_manager
@battleManager.setup(troop_id, can_escape, can_lose)
end
endCode:
This class will define all of the default BattleManager methods, and will be treated as your default battle system.class IBattleManager
def setup(...)
# the actual setup
end
endYou can inherit from this class to define your own battle managers,
Code:
Then, everytime you sayclass MyBattleManager < IBattleManager
def setup(...)
super
#now do some more things
end
endCode:
It will in theory take your method call and your arguments, and pass them down to the appropriate battle manager. But I'm not sure how that would work.BattleManager.do_something(arg1, arg2, ...)Scene_Battle will still be the same thing, except you can define new battle scenes that inherit from Scene_Battle if needed.
Code:
Each battle system will come with their own scene and their own set of windows, all inheriting from the default windows. There will be no aliasing or overriding.class My_Scene_Battle < Scene_Battle
endRather than saying
Code:
I decided to change it toSceneManager.call(Scene_Battle)Code:
Which would choose the actual scene battle to use, and then let the engine do the rest of the work.SceneManager.call_battle_sceneAny thoughts on the design?
Note that this should in theory support any battle system, because all the battle manager does is determine which battle system to use. If you're using an ABS system, well, it just has to initialize the ABS battle manager and then off it goes.
Sprites and windows are handled by the battle scene, so that is isolated to their own systems.
You shouldn't really have any conflicting attributes in the Game_ objects because your system shouldn't depend on the actors' values; instead, they should be deciding what to do based on the values.
The only real problem I see is that most people prefer to alias and override, which does not work with this plugin battle system. All battle systems will need to be re-written to use subclassing, so if you need your own Spriteset_Battle, just inherit from the default, if you need a new window, just inherit it. If you need a new scene, just make one.
There are only two calls required to make the system work properly
Code:
And the first one is already provided.BattleManager.setup(...)
SceneManager.call_battle_scene