Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency for NPC and PC to "reach attack" at 2√2 range #65266

Open
SurFlurer opened this issue Apr 23, 2023 · 3 comments
Open

Inconsistency for NPC and PC to "reach attack" at 2√2 range #65266

SurFlurer opened this issue Apr 23, 2023 · 3 comments
Labels
<Bug> This needs to be fixed Melee Melee weapons, tactics, techniques, reach attack NPC / Factions NPCs, AI, Speech, Factions, Ownership (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@SurFlurer
Copy link
Contributor

Describe the bug

When "Circular distances" is turned on, NPC can use "reach attack" weapon ( like a steel spear ) to attack enemies standing 2 tiles away at 1,3,7,9 directions, but the player character cannot.

Attach save file

npcneed-trimmed.tar.gz

Steps to reproduce

  1. Load the save.
  2. See that the NPC can attack the debug monster from where he stands.
  3. Teleport to the NPC's position, and try to use Tab or f to attack.
  4. Find out that you cannot attack the debug monster.

Expected behavior

Consistency. I'd like to see NPC losing this ability, being the same as PC.

Screenshots

图片

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.2846 (22H2)
  • Game Version: 0.G-1503-ge8a1eafffb [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Portal Storms Ignore NPCs [personal_portal_storms],
    No Fungal Growth [no_fungal_growth],
    Bionic Professions [package_bionic_professions]
    ]

Additional context

No response

@SurFlurer SurFlurer added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Apr 23, 2023
@RenechCDDA
Copy link
Member

Ok now this is a weird one... I can confirm it happens in the provided save(thank you!) but I can't get it to happen in another test scenario:
image

When on guard he simply pauses. In both this test scenario and the provided save, debug mode reports the range as 2.

I think it may be because the target is being cached and as long as the target is cached it's somehow skipping the option check? (Notice in my image target is none)

} else if( target != nullptr && ai_cache.danger > 0 ) {
action = method_of_attack();

@RenechCDDA RenechCDDA added <Bug> This needs to be fixed NPC / Factions NPCs, AI, Speech, Factions, Ownership (S2 - Confirmed) Bug that's been confirmed to exist Melee Melee weapons, tactics, techniques, reach attack and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Apr 24, 2023
@SurFlurer
Copy link
Contributor Author

SurFlurer commented Apr 27, 2023

@RenechCDDA This line indicates that, for npcs, the distance to that monster is 2.

int dist = rl_dist( pos(), critter.pos() );

And this line uses a different method to calculate distance for character attacking.
bool in_range = std::round( rl_dist_exact( pos(), critter.pos() ) ) <= range;

However, I'm not sure what's happening in your test scenario. Maybe that's a different bug?

@DragonWizard23
Copy link
Contributor

I discovered this inconsistency today, but what's weird is that while the cunning feral can attempt to make diagonal reach attacks, it seems like they can't hit the player. This character has minimal dodge, but was able to avoid many attacks in a row. I've added the save if anyone is curious.
Screenshot (389)
Screenshot (390)
Screenshot (391)
2024-03-31-trimmed.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Melee Melee weapons, tactics, techniques, reach attack NPC / Factions NPCs, AI, Speech, Factions, Ownership (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

3 participants