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

Refactor visibility checks #606

Open
tmewett opened this issue Sep 26, 2023 · 2 comments
Open

Refactor visibility checks #606

tmewett opened this issue Sep 26, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@tmewett
Copy link
Owner

tmewett commented Sep 26, 2023

The whole cluster of revealed, hidden, and seen is very confusing. Practically all relevant parts of the code us a confusing combination which maps to an easily-describable meaning like "location known". We should refactor them around those relevant combinations.

Also, canSeeMonster is misnamed. No guarantee you can actually see it - not hidden and out-of-sight returns true.

@tmewett tmewett added the enhancement New feature or request label Sep 26, 2023
@tmewett
Copy link
Owner Author

tmewett commented Sep 26, 2023

This is a contributor to the kinds of inconsistencies fixed by #540.

@brturn
Copy link
Contributor

brturn commented May 13, 2024

So I ended up analyzing and rewriting the vision/aggression/attack logic from scratch. It's actually pretty clean!

WIP fork on my repo here

The WIP only includes the fixes for whip/pike/flail/axe.

I have the entire rewrite working locally with no issues (all monster behavior and player vision). There's 51 code points in the full rewrite, the WIP version only has the 6 needed to fix the player's weapons.

For the full rewrite, I'm not confident that I parsed the logic correctly for each case. However, it did bring up a LOT of questions that may need to be addressed before applying the entire rewrite:

  • Q: Can the player have inanimate allies?
  • Q: Should phantoms be visible in deep water?
  • Q: Should player attack entranced creature when bumping it?
  • Q: Should an entranced creature attack the player when bumping?
  • Q: Should confused player hit allies when stepping by them with a flail?
  • Q: Should confused player accidentally lunge-attack allies?
  • Q: Should confused player with armor of mutuality damage allies when triggered?
  • Q: Should confused monsters blink toward allies to attack them?
  • Q: Should confused monsters swarm at friends?
  • Q: Should confused monsters negate friends?
  • Q: Should confused casters target their enemies with buffs (heal, shield, etc)?
  • Q: Should confused casters target their friends with damaging spells?
  • Q: Should monsters avoid swarming futile enemies?
  • Q: Ally casters only cast when the player can see them - should they?
  • Q: Should non-teammate monsters who are not enemies cast spells to help each other?
  • Q: Should ally salamander light revenants on fire when attacking?
  • Q: Monsters ignore line-of-sight - should they?
  • Q: Apparently, cornered creatures can see invisible creatures?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants