Talk:Drain strength

From NetHackWiki
Jump to: navigation, search

Can we have an article on stat draining in general? Is it permanent if not cured? I think a unicorn horn and potion of restore ability can heal drained strength but are there other ways? DemonDoll 20:57, 29 May 2009 (UTC)

Feel free to make an article on stat loss. However, strength is the only stat that can be drained by a monster spell. It is "permanent" in that any further changes will start from your current stat, e.g. you can push boulder to exercise your strength back up. Unicorn horn, prayer, restore ability (potion/spell) are the most common ways to heal it, but there are more obscure ways (see food poisoning for a list of pointers where to look). The exception is stat loss due to polymorphing in a new version of yourself, it cannot be healed. -Tjr 15:55, 1 June 2009 (UTC)
I stand corrected, quasits can drain dexterity, energy vortices maximum power etc. See magic cancellation for a list. -Tjr 14:10, 17 June 2009 (UTC)

Sustain ability

So wizmode testing in SLASH'EM seems to suggest a couple things:

  • You start losing max hp at Str 4, not 3 (i.e. strength doesn't drop below 4)
  • It definitely seems that sustain ability blocks the stat drain. But, if you're already at the minimum strength, it doesn't seem to block the HP loss. I'm not sure about marginal cases - i.e., if you have 7 strength, sustain ability, and get drained for 6 - do you lose no max hp, or do you lose 18 (because, without sustain ability, you would have dropped to strength 1)?

I'll try to do some more controlled tests on this later, though if someone wants to try in the mean time, feel free. Admittedly, this is all pretty minor, since you very rarely don't have magic resistance or Elbereth when facing monsters who can cast this spell. -Ion frigate 02:11, 22 December 2011 (UTC)

According to losestr (attrib.c, line 178):
  • A temporary strength integer (ustr) is set to your current strength minus the 'damage' done.
  • If this is less than 3, the 'damage' is carried over to your hitpoints, both current and maximum. ustr is incremented, 'damage' is decreased, and 6 HP are taken away until ustr is at least 3.
    • If you are polymorphed, your polymorphed form loses HP, not your natural form. The HP damage is also done at once; if you have 8 max HP and lose 42 from drainstrength, the excess is wasted
  • Your strength is then reduced by the 'damage', after the reduction takes place.
    • If you have fixed attributes, this does not occur.
I'm not sure why you didn't see strength drop below 4. The source code isn't modified in SLASH'EM as far as I can tell, and I'm pretty sure I'm reading it correctly. Additionally, this max HP loss can occur with poisonous corpses as well, as the same function is used for both the monster spell and poisonous corpses, and anything else that drains str (becoming weak, potions of sickness, poisonous fountains, etc). -- Qazmlpok 04:08, 22 December 2011 (UTC)
Maybe it has something to do with lycanthropes - I was using a lycanthrope ranger (random choice). I just tried it with a human barbarian, and indeed Str was drained to 3. But I tried the lycanthrope ranger again, and Str was only drained to 4, then it started taking from max hp, as usual. And trying with a ring of sustain ability shows you are quite correct: it protects against the strength drain, but not the possible HP drain. So it stops your 18/20 Str valkyrie or barbarian from suffering max HP loss, but not your 7 Str wizard. -Ion frigate 08:32, 22 December 2011 (UTC)
I'm guessing the difference with lycanthropes probably comes from the fact that their natural max strength is 19 - I'm guessing that might throw off the ABASE, and thus ustr, somehow. -Ion frigate 09:07, 22 December 2011 (UTC)
Lycanthropes have a minimum Strength of 4 instead of 3, according to the source code: SLASH'EM_0.0.7E7F2/role.c#line690. --Erica 00:41, 23 December 2011 (UTC)
That explains it. losestr does not account for the minimum value, so it should give a free point of str if you do end up drained that low. -- Qazmlpok 02:05, 23 December 2011 (UTC)

That's really interesting. So, for example, if a Lycanthrope starts with a Strength of 12, and is hit by a spell that would drain 10 points of strength, then, unless I am mistaken:

  • losestr will see that your new Strength would be 2, which is lower than 3, so it will drain 6 HP, 6 max HP, and call adjattrib to lower your strength by 9 points;
  • adjattrib does take into account your minimum Strength of 4, so it will lower your Strength by 8 points to 4, with the 9th point being subtracted from your maximum Strength.
  • So in the end, you will be left with a loss of 6 HP and 6 max HP, and with a Strength of 4 and a max Strength of 11 (which means a unicorn horn will only restore your Strength to 11).

A ring of sustain ability should block both the Strength reduction and the max Strength reduction. Does that look right? --Erica 18:28, 24 December 2011 (UTC)

Yep, looks right. I hadn't known about the max attribute reduction, but the source code is showing that would happen. And yes, the ring would completely block the attribute reduction and not the HP reduction. -- Qazmlpok 21:09, 24 December 2011 (UTC)