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

Spellcasting Monsters Misjudge Circular Distances #71699

Closed
worm-girl opened this issue Feb 11, 2024 · 1 comment
Closed

Spellcasting Monsters Misjudge Circular Distances #71699

worm-girl opened this issue Feb 11, 2024 · 1 comment
Labels
(S1 - Need confirmation) Report waiting on confirmation of reproducibility stale Closed for lack of activity, but still valid.

Comments

@worm-girl
Copy link
Contributor

Describe the bug

Monsters who can cast spells do not appear to correctly be judging the distance to the player along diagonals. Spellcasting monsters are sort of rare and most monsters cast spells infrequently (moving up to melee if they flub a cast) so I'm not surprised this didn't get noticed.

Attach save file

N/A

Steps to reproduce

Make a new game with circular distances on.
Give a monster a spell via special_attacks with a fixed range. Set that monster's cooldown to 1, so that it will try to use the spell every turn.
Try standing at certain diagonal angles. The monster will stand just out of reach and try unsuccessfully to cast on you over and over again.
Set the distances to square and see that this does not happen.

Expected behavior

Monsters should not try to cast spells when they're out of range just because they can't do trigonometry.

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.3930 (22H2)
  • Game Version: 0.G-7246-g7af851e7c2-dirty [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth]
    ]

Additional context

I think the relevant code is at line 295 in mattack_actors.cpp

    // Bail out if the target is out of range.
    if( !spell_data.self && rl_dist( mon.pos(), target ) > spell_instance.range( mon ) ) {
        return false;
    }

I discovered this while working on #71584 . I'd fix it myself but I'm not actually sure what's wrong.

@worm-girl worm-girl added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Feb 11, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@github-actions github-actions bot added the stale Closed for lack of activity, but still valid. label Mar 12, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(S1 - Need confirmation) Report waiting on confirmation of reproducibility stale Closed for lack of activity, but still valid.
Projects
None yet
Development

No branches or pull requests

1 participant