Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old July 29, 2010, 19:50   #1
Taha
Adept
 
Join Date: Jun 2009
Posts: 128
Taha is on a distinguished road
Resistance to protect inventory / pack items

I know this was discussed recently, but buried deep in an unrelated thread that I can't find any more.

Does elemental (fire, cold, acid, lightning) resist or double resist decrease the chance of damage to your inventory by 1/3 or 2/3? I believe the answer to this was no, but a number of people thought it ought to.

If my understanding is right, has this been recently fixed or will it be fixed soon? I couldn't find a ticket for it in trac, and would happily jump to a nightly that had it. I try to stay out of those fights anyway, but it seems like a lot less of my stuff should burn up while double resisting.
________
butt Webcam

Last edited by Taha; August 14, 2011 at 14:50.
Taha is offline   Reply With Quote
Old July 29, 2010, 19:55   #2
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Taha View Post
I know this was discussed recently, but buried deep in an unrelated thread that I can't find any more.

Does elemental (fire, cold, acid, lightning) resist or double resist decrease the chance of damage to your inventory by 1/3 or 2/3? I believe the answer to this was no, but a number of people thought it ought to.

If my understanding is right, has this been recently fixed or will it be fixed soon? I couldn't find a ticket for it in trac, and would happily jump to a nightly that had it. I try to stay out of those fights anyway, but it seems like a lot less of my stuff should burn up while double resisting.
IIRC the previous thread concluded (after someone looked it up) that resistance is checked for hp damage but not for item damage. (Can't remember whether this was any resistance or just double resistance - and we have an issue with double poison resist being the same as single.)

I don't remember a consensus that this was a bug though, so I didn't open a ticket for it. Immunity protects your pack, but resistance doesn't.
Magnate is offline   Reply With Quote
Old July 29, 2010, 20:05   #3
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,770
Derakon is on a distinguished road
From spells1.c's acid_dam function (elec_dam, fire_dam, and cold_dam appear to be structured identically):
Code:
    int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;

    if (dam <= 0) return;

    /* Resist the damage */
    if (p_ptr->state.immune_acid) n = 3;
    else if (p_ptr->state.resist_acid) n = 1;
    else n = 0;

    if (p_ptr->state.vuln_acid) n--;
    if (p_ptr->timed[TMD_OPP_ACID]) n++;

    /* Notice flags */
    wieldeds_notice_flag(1, TR1_IM_ACID);
    wieldeds_notice_flag(1, TR1_RES_ACID);
    wieldeds_notice_flag(1, TR1_VULN_ACID);

    /* Change damage */
    if (n >= 3) return;
    else if (n >= 2) dam = DBLRES_ACID_ADJ(dam, NOT_USED);
    else if (n == 1) dam = RES_ACID_ADJ(dam, NOT_USED);
    else if (n == -1) dam = VULN_ACID_ADJ(dam, NOT_USED);

    /* If any armor gets hit, defend the player */
    if (minus_ac()) dam = (dam + 1) / 2;

    /* Take damage */
    take_hit(dam, kb_str);

    /* Inventory damage */
    inven_damage(set_acid_destroy, inv);
In particular, note that the variable "inv" is set at the beginning of the function and is not modified thereafter; it is then passed to inven_damage as the percentage chance that an item should be destroyed.

So no, resistances do not protect your equipment.

One interesting thing to note here is that if you are simultaneously immune to and vulnerable to acid, then you're treated as having double resistance -- if you then get a temporary source of acid resistance then you become immune again. Weird.
Derakon is offline   Reply With Quote
Old July 29, 2010, 20:14   #4
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Derakon View Post
One interesting thing to note here is that if you are simultaneously immune to and vulnerable to acid, then you're treated as having double resistance -- if you then get a temporary source of acid resistance then you become immune again. Weird.
It would be very weird - but we don't have any items with the VULN_ flags, do we? I didn't think they were actually in use yet.
Magnate is offline   Reply With Quote
Old July 29, 2010, 22:29   #5
Taha
Adept
 
Join Date: Jun 2009
Posts: 128
Taha is on a distinguished road
I thought there was general consensus on that thread that it was a bug, or at least a change that should be made. The jump from no protection to complete protection seems excessive.

And if we are adding vulnerability flags, it seems like that should have an opposite effect, on goods as well as damge. I don't really see how those would be used, but that's a different topic.
________
Vaporizer shop

Last edited by Taha; August 14, 2011 at 14:51.
Taha is offline   Reply With Quote
Old July 29, 2010, 22:48   #6
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,770
Derakon is on a distinguished road
I will certainly guarantee you that every newbie expects those Amulets of Resist Acid to protect their armor and pack from all those nasty acid monsters they keep running into. So the current behavior is, if nothing else, highly unintuitive.
Derakon is offline   Reply With Quote
Old July 30, 2010, 16:36   #7
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Derakon View Post
I will certainly guarantee you that every newbie expects those Amulets of Resist Acid to protect their armor and pack from all those nasty acid monsters they keep running into. So the current behavior is, if nothing else, highly unintuitive.
Ok, I have opened ticket #1183 for this (I was sure there already was one, but I couldn't find it). It's not something I personally think is a big deal, but it's there if anyone with commit access wants to change it.
Magnate is offline   Reply With Quote
Old July 30, 2010, 17:28   #8
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,770
Derakon is on a distinguished road
Patch made. This one was really simple. All I did was move the setting of the inv variable's value to right before inven_damage is called; thus, it uses the modified damage value instead of the original damage value to determine how likely items are to be destroyed. If resistance takes your damage below 60 (or below 30) then you are less likely to take inventory damage.

Testing done: rolled up a warrior, punted to level 50, take off starting armor, create 99 scrolls, summon a young black dragon (unresisted acid damage: 88, resisted: 29; thus, resisted should destroy 1% of items while unresisted should destroy 3%), let it breathe on me, restore to 99 scrolls, repeat.

Unresisted: 2 destroyed, 1, 7, 2, 5, 2, 1, 2, 3, 5 (average 3 destroyed)
Single resisted: 1, 1, 1, 0, 1, 2, 0, 0, 0, 2 (average .8 destroyed)

I didn't bother testing the other elements, since the code is identical for them.

Note that this doesn't change the fact that acid resistance is useless for protecting your armor from damage, which is the other thing that newbies will be using amulets of acid resistance for. Given that veterans may rely on armor damage as an ad-hoc acid resistance (since it halves the hitpoint damage received), I'm not certain that we want to change that behavior.
Attached Files
File Type: txt diff.txt (1.4 KB, 112 views)
Derakon is offline   Reply With Quote
Old July 30, 2010, 17:42   #9
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 38
Posts: 1,516
d_m is on a distinguished road
Thanks Derakon! Committed as r2019.

EDIT: After some play testing I might increase the chance per point of damage to destroy an item, if elemental attacks seem too wimpy with single resist.
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old July 31, 2010, 18:38   #10
Rizwan
Swordsman
 
Join Date: Jun 2007
Posts: 292
Rizwan is on a distinguished road
Quote:
Originally Posted by Derakon View Post
I will certainly guarantee you that every newbie expects those Amulets of Resist Acid to protect their armor and pack from all those nasty acid monsters they keep running into. So the current behavior is, if nothing else, highly unintuitive.
... and I still do even though I am not a newbie. Thanks for clearing that up, useless amulets.
Rizwan is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
why sort the pack? PowerDiver Development 8 April 16, 2010 01:21
Pickup Items matching inventory option - 3.1.1 Beta Elsairon Vanilla 2 September 11, 2009 05:28
Elemental attacks destroying inventory items - challenging or frustrating? hugorune Vanilla 24 January 28, 2009 08:23
Protect my stuff bpleshek Vanilla 12 October 13, 2008 17:48
What does Resistance do if you already have it? Aldous Vanilla 2 May 23, 2007 02:58


All times are GMT +1. The time now is 18:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.