Closed Rakaneth closed 6 years ago
Hm, yeah... I haven't really used Technique much. I do think it has potential to be more actually-useful though, and these are both good things for me to implement. For some reason, I thought Technique stored its min and max range, but that might have been moved into AOE at some point. I'll take a look at ways to simplify the API for part 1. Part 2 should be very quick to fix, and it will probably be done at the same time as the range check code. I'll start on this sometime tomorrow (which in my time zone starts in 43 minutes).
Just to be clear, @Rakaneth , do you want a method that returns all Coord
s within range for a Technique
, together in some collection? Or would a yes/no check be all that's needed? AreaUtils.verifyReach()
doesn't check for obstacles; normally a line of sight check (possibly combined with a check of the length for that line) is the main requirement in many roguelikes to use a ranged attack. SquidLib provides LOS
for this; there's also some extra features in Bresenham
and other classes used to implement LOS
. I think I'll add a method to Technique that calls AreaUtils.verifyReach()
and performs a line of sight check if the reach is verified, and that can satisfy the "is this Coord target-able" check. As for getting a collection of all target-able Coords, I think FOV
can get the general area between the Technique user and the maximum range (that can be seen without obstruction), and then a Technique could process the 2D array produced by FOV to restrict any areas to those that can be targeted with the given minimum range and AimLimit. I hope this helps.
OK, both the yes/no check and the "show all possible targets" approaches are implemented now in Technique. Technique also implements Serializable; if anything isn't working with that (I don't know if the AOE implementations need to implement it as well), feel free to reopen. Thanks for the feedback on this!
Although
Technique
neatly wraps up anAOE
to make it useable, there are two key pieces of functionality missing:1) It is nontrivial to check if a
Coord
is in theTechnique
's range or not (for UI purposes, to share this with the user). Currently, a call toAreaUtils.verifyReach
must be performed; for this to work properly,limit
ofTechnique.aoe
must be set. I think the implementation details could be hidden better in this case.2)
Technique
is notSerializable
. This could be worked around by storing a helper class and reconstructing on load, but I currently don't know how else to store what techniques are known to various entities.