Closed CameronJung closed 2 months ago
This could just as easily be a child of the regular unit class. However, I am making a promise to myself that this ranged unit will be the last unit added to the game. As such, there is no need to open the can of worms that would be to refactor the various unit classes into a proper tree.
I am going to try rewriting the code that handles how a unit determines what it can do. Ideally I will be splitting up the functions in such a way that they can be called sequentially to build upon each other. Namely, there will be a function to get the hexes that a unit can move to, A method that given which tiles a unit can move to, which tiles it can attack, and a method that determines which tiles can be attacked at range.
The rewrite previously mentioned has been completed, at least to the extent of currently implemented mechanics. I now need to add the handling for ranged attacks.
It took a while but I managed to implement the functionality of ranged units. I also fixed a few bugs associated with the rewrite. It will be committed to the artillery update branch soon.
The behaviour of ranged units should be handled by a class. This class will be a child of the class "Turreted Unit".