sebulba69 / AscendedZ

Ascended Z Development
0 stars 0 forks source link

Pre-Alpha v4 - Battle Code Refactor #30

Closed sebulba69 closed 1 month ago

sebulba69 commented 1 month ago

The code for the battle system is insanely clunky and should be improved for scalability.

My idea right now is to have an Action Queue that I can periodically add to to sequence attacks better. The problem right now is that I currently double up on spamming events on the Stack. This leads to weird scenarios where some UI updates happen twice, sometimes three times, because they're nested.

Enemy turns are a complete trainwreck codewise. They need to be remade so that they place an action onto the Action Queue and that action needs to be processed independently.

Here is a draft for a potential idea for how this can be implemented:

public class Action
{
         public List<ISkill> Skills {get; set;} = new();
         public List<BattleEntity> Players {get; set;} =new(); // for UI udpates
         public List<BattleEntity> Enemies {get; set;} = new(); // for UI updates
         public PressTurn Turns {get; set;} = null;
}

I'd need some callback feature for when the action completes processing, but this is a good base for now.

sebulba69 commented 1 month ago

Code base is too far gone to refactor at this point.