Open Isaaq-Khader opened 4 years ago
I am putting this issue into the backlog since this issue requires a little bit more work than I thought. Due to time constraints, I cannot work on this issue since it requires us to refactor the combatant struct we have in place. I spoke to our senior developer about this and I am putting his thoughts on this below for the future:
- this would require some changes to how combatants work, but basically if we had a linked list of all combatants instead of separating them out by friendly or not friendly (and instead, kept that info in a boolean in the combatant struct)
- You could sort the friendly combatants and sort the enemy combatants, and then "merge" the two sorted lists together (basically, since they're sorted, the combatant at the top of the friendly list and the enemy list will be the fastest of their respective lists, so you keep popping off the fastest of either list- see https://www.geeksforgeeks.org/merge-two-sorted-linked-lists/)
In the logic module of battle-systems, there is a function named goes_first that accounts for all enemies, but will return the enemies as faster even if only one of the enemies is faster than the player. To solve this, the function should return a list of the order of who attacks first. This has been made onto a separate branch (https://github.com/uchicago-cs/chiventure/tree/battle/goes-first).