-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fix for whip/pike attack invisible but revealed enemies #540
Fix for whip/pike attack invisible but revealed enemies #540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thought this was making hitlist inclusion and attack triggering use the same code, but I see that's only for the flail where that logic actually should be the same.
Just a question.
src/brogue/Items.c
Outdated
@@ -3460,15 +3460,13 @@ void getImpactLoc(pos *returnLoc, const pos originLoc, const pos targetLoc, | |||
pos coords[DCOLS + 1]; | |||
short i, n; | |||
creature *monst; | |||
creature *orig = monsterAtLoc(originLoc.x, originLoc.y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps *attacker or *caster instead of *orig ?
@@ -1,2 +1,2 @@ | |||
- | |||
The rapier lunge attack works against invisible enemies when you are telepathic. | |||
The whip, spear, and rapier now work against invisible enemies when you are telepathic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention that whips no longer work against submerged enemies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should name and document canAttack properly before merging
|
||
n = getLineCoordinates(coords, originLoc, targetLoc, theBolt); | ||
n = min(n, maxDistance); | ||
for (i=0; i<n; i++) { | ||
monst = monsterAtLoc(coords[i].x, coords[i].y); | ||
if (monst | ||
&& !monsterIsHidden(monst, monsterAtLoc(originLoc.x, originLoc.y)) | ||
if (canAttack(orig, monst) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong from the POV of getImpactLoc. Bolts do not pass through creatures if the caster is unable to attack them.
// Centralize the logic of whether an attacker can/will attack the defender | ||
boolean canAttack( creature *attacker, creature *defender ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should decide what this means precisely. For example, this check includes that the defender's location is known, but it's obviously possible to attack completely invisible enemies.
It probably means something more like "does the attack know it will attack defender if it moves into its cell?"
The player case was equivalent to `canSee || revealed` because the inner `|| revealed` in `canSee` is made redundant by the outer one.
faa9ad5
to
100f0bc
Compare
Closing in favor of #686, which is much cleaner and can be applied universally. |
As theorized by @slow-burn on brogue discord, the pike, whip, and flail do not work against invisible but revealed enemies (eg. telepathy).