LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
285 stars 158 forks source link

inverse range attack mode for UI #11157

Open ilteroi opened 1 month ago

ilteroi commented 1 month ago

so right now we have the "range attack mode" (shortcut B) which looks like this:

image

it shows which plots the selected ranged unit can attack from it's current position.

would it be possible to have a view (maybe shortcut Ctrl-B?) which shows where the units would need to be in order to attack the plot under the mouse cursor?

it seems the current implementation is mostly lua (RangedStrikeHighlight). this could be optimized by exposing CvMap::GetPlotsAtRangeX(...) which also supports line-of-sight checks in both directions. but it's also possible to do even more on gamecore side since updating on mouse-move might be performance critical.

if some lua whiz wants to tackle this i can provide the c++ part.

ilteroi commented 1 month ago

proposal for new lua api, hopefully simple and self-explanatory

unit:GetPotentialRangeAttackTargetPlots(plot)
unit:GetPotentialRangeAttackOriginPlots(plot)
ilteroi commented 1 month ago

initial implementation ready (cce485397277b61c94f12e5e997b6dadac15768d). should return a list of x,y pairs

v4.13 build here: CvGameCore_Expansion2.zip