TemplePlus icon indicating copy to clipboard operation
TemplePlus copied to clipboard

Invisibility bugs

Open dolio opened this issue 4 years ago • 3 comments

So, believe it or not, the Invisibility condition is bugged in multiple ways. Here are the ones I know about at the moment.

  1. Being invisible makes you lose your own dexterity bonus to AC, and has no effect on your opponents' bonus. If you can see invisible, you retain your own bonus.
  2. Being able to see invisible negates your own concealment from being invisible, and does nothing to negate your opponents' concealment.

I wouldn't be surprised if there are others.

I'd kind of like to try fixing these. My question is, where do they go? They are callbacks for the "Invisible" condition that need to be replaced. Is it condition.cpp? I wasn't exactly sure, because it seemed like some other condition fixes were in other files.

dolio avatar Aug 16 '21 01:08 dolio

Hmm, are you sure it's not because of the to_hit_processing changes? Sounds too "obvious" to slip by in vanilla.

DudeMcDude avatar Aug 16 '21 03:08 DudeMcDude

Yeah, I'm pretty sure. I've actually known about the concealment thing for a while; before the python to hit. And I found the dex one trying to remember which part was bugged. Also I think I originally found the concealment problem by reading the code to figure out how see invisibility worked, not just from observing the effects.

And I'm not longer surprised by how many obvious bugs seem to be in every function of the original game. :)

dolio avatar Aug 16 '21 04:08 dolio

Here's my analysis of the original code (listing the stuff that's wrong):

ToHitBonus2: 0x100e88d0

  • Target's Blind Fight cancels the bonus, even for ranged attacks

GetACBonus2: 0x100e8a80

  • I think this whole function is just mis-keyed; it's testing a bunch of victim statuses to determine whether the dexterity bonus is retained, but it's called when the victim is invisible; it should be on GetAcModifierFromAttacker (but it's not; the actual in-game behavior matches the wiki)
  • If victim Blind Fight, retain dex bonus (no test for ranged combat again)
  • If victim See Invisible or Uncanny Dodge, retain dex bonus
  • If attacker has glitterdust, faerie fire or invisibility purge, retain dex bonus

GetDefenderConcealmentMissChance: 0x100e8ca0

  • If not victim See Invisible, add bonus; but this runs when the victim is invisible
  • Note that this branch correctly checks if the attacker is an animal/undead

dolio avatar Aug 17 '21 00:08 dolio