Talk:Armor class

From NetHackWiki
Revision as of 02:59, 25 January 2007 by Djao (talk | contribs)
Jump to navigation Jump to search

The section discussing how armor class works is well intentioned, but wrong. For armor class values between 0 and 10, the game mechanics are as described in the text. However, for armor class values below 0, the mechanics are different. If your armor class is -N, then each time you are attacked, the game randomly chooses a value x between 0 and N, and your armor class for the purposes of that attack is set to -x. For example, if your armor class is -20, then each time you are attacked by a monster, the game randomly chooses a number out of the interval 0, -1, -2, -3, -4, ..., -20 and sets your armor class equal to that number. This is done independently for each attack. The other omission in the text is that an armor class of -x for that attack not only reduces the monster's to-hit value by x, but it also reduces the amount of damage that the attack inflicts by x.

Disclaimer: My knowledge of the mechanics of armor class is not from reading the source code, but rather from playing the game way too much. Djao 05:55, 24 January 2007 (UTC)

The game randomly changing your armor class is exactly the same as the game randomly changing the monter's to-hit roll. I don't know the exact mechanics, but either way it is the same thing. I don't know how AC factors into damage taken, which is why that was left out. I was just basing the information on how it was done in Dungeons & Dragons, which is the easiest way to program it in the game. Randomly changing armor class for any negative value just seems too clunky for me. --MadDawg2552 02:28, 25 January 2007 (UTC)
Randomly changing the to-hit roll is not the same thing as randomly changing the armor class, because the game changes the monster's to-hit roll by the amount of your randomly altered armor class, not by the amount of your original armor class. An easy way to see the difference is to set your armor class to -127. Going by your method, no monster would ever hit your character at all (since no monster in the game has to-hit bonus large enough to overcome -127 AC). But, if you test in wizard mode, you will find that an armor class of -127 does NOT in fact make you completely invulnerable to every monster in the game. Monsters do sometimes hit you, because one out of every 127 attacks, your armor class is effectively 0 for the purposes of that attack. Djao 02:59, 25 January 2007 (UTC)
After looking at the source code (starting at line mhitu.c#line1560) it does seem that negative AC reduces damage done. I can't, however, find where it determines if the monster hits or not. It's got to be in there somewhere, but I can't find it. --MadDawg2552 02:54, 25 January 2007 (UTC)