creature.adjacentHexes
returns counter-clockwise hexes when clockwise=true
#2470
Labels
Projects
Milestone
I came across this 8-year-old
TODO
in the code:https://github.com/FreezingMoon/AncientBeast/blame/ba65fa35bb4cf78b8c5807fd9e158d3511401d94/src/creature.ts#L1034C6-L1034C10
I happen to have been adding code that does that.
However, the function
Creature.adjacentHexes
takes a "clockwise" argument. When I compared my implementation, it didn't match the order of the original implementation's returned value.It turns out that the old implementation was returning a counter-clockwise result – at least in terms of the game coordinate system and
HexGrid
coordinate system, where0, 0
is top, left.There's only one caller that passes
clockwise=true
. Is it necessary to keep this functionality? Should it be renamedcounterClockwise
?Fwiw, if
clockwise=true
isn't passed then the default order for theHex[]
result is sorted by row, then by column, so neither counter-clockwise, not clockwise.I think this should probably just be removed as an option. The only caller that passes a "clockwise" value (Impaler), doesn't rely on it exclusively, and to do so would be weird:
shock
stat.Hex[]
order matters is when it break ties, in instances where the top candidates have the sameshock
stat.... But that doesn't really make sense in a game where opposing players face opposing directions. Both a right-facing player and a left-facing player will break ties in the same direction: A left-facing character will attack a creature behind it before a creature in front of it.
The text was updated successfully, but these errors were encountered: