cataclysmbnteam / Cataclysm-BN

Cataclysm: Bright Nights, A fork/variant of Cataclysm:DDA by CleverRaven.
https://docs.cataclysmbn.org
Other
662 stars 260 forks source link

Circular distances cuts diagonal reach attacks short #2873

Open chaosvolt opened 1 year ago

chaosvolt commented 1 year ago

Describe the bug

It's the classic, a bug that has been in Cataclysm in general probably for as long as circular distances have existed. When using a reach weapon, trying to aim 2 tiles diagonally won't work if circular distances is on, cutting it off with only 1/2 range. This is of course inintuitive to the player who's expecting their spear to work within what seems to be the correct distance (instead of having to be conscious about whether they're a knight's move away or dead ahead instead), and is inconsistent with behavior when circular distances is off.

Steps To Reproduce

  1. Load up with circular distances turned on.
  2. Spawn in and wield a spear.
  3. Hit f and attempt to aim due diagonally in any direction.
  4. It will stop you at only a range of 1/2.
  5. Turn circular distances off.
  6. Observe you can now attack 2 tiles away in that direction.

Screenshots

image

Versions and configuration

Additional context

I attempted to look through the code to fix this myself but had no such luck.

Empyrean-Heaven commented 1 year ago

Maybe this would help? https://github.com/CleverRaven/Cataclysm-DDA/pull/34749

chaosvolt commented 1 year ago

That was merged before the divergence point Coolthulhu updated BN to before reviving the fork (may 2020), so no.

chaosvolt commented 1 year ago

Just tested DDA (build 2023-05-08-0408) and of course they still have the bug. :V

image

Looks like they've went the route of "actually attacking 2 tiles away is an exploit" as per: https://github.com/CleverRaven/Cataclysm-DDA/issues/16400#issuecomment-214458037

The inability to attack the squares in the corners of the box surrounding the player is intentional.

kholat commented 1 year ago

It is a question of rounding. A 2 tile reach attack means it has a reach of 2 tiles of distance in cardinal directions, but if you attack 2 tiles diagonally, that would mean 2*sqrt(2) which is closer to 3 than 2, I suppose this is why the devs have chosen 1 is the better rounding option and therefore marked "intentional". (from 1.41 to 2 is cca 0.6, from 2.82 to 2 is cca 0.8)