Resistance to protect inventory / pack items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Taha
    Adept
    • Jun 2009
    • 128

    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, 14:50.
  • Magnate
    Angband Devteam member
    • May 2007
    • 4916

    #2
    Originally posted by Taha
    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.
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

    Comment

    • Derakon
      Prophet
      • Dec 2009
      • 8820

      #3
      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.

      Comment

      • Magnate
        Angband Devteam member
        • May 2007
        • 4916

        #4
        Originally posted by Derakon
        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.
        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

        Comment

        • Taha
          Adept
          • Jun 2009
          • 128

          #5
          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, 14:51.

          Comment

          • Derakon
            Prophet
            • Dec 2009
            • 8820

            #6
            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.

            Comment

            • Magnate
              Angband Devteam member
              • May 2007
              • 4916

              #7
              Originally posted by Derakon
              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.
              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

              Comment

              • Derakon
                Prophet
                • Dec 2009
                • 8820

                #8
                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

                Comment

                • d_m
                  Angband Devteam member
                  • Aug 2008
                  • 1516

                  #9
                  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

                  Comment

                  • Rizwan
                    Swordsman
                    • Jun 2007
                    • 280

                    #10
                    Originally posted by Derakon
                    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.

                    Comment

                    • Derakon
                      Prophet
                      • Dec 2009
                      • 8820

                      #11
                      Well, the nightlies will now allow resistances to reduce inventory damage rates.

                      Comment

                      • Netbrian
                        Adept
                        • Jun 2009
                        • 141

                        #12
                        Unrelated note -- could we change the rod of probing to be immune to electricity like certain other rods? I was carrying some around to fill out my monster memory, and eventually just gave up due to inventory damage. I rather doubt this will be particularly unbalanced.

                        Comment

                        • Derakon
                          Prophet
                          • Dec 2009
                          • 8820

                          #13
                          I'd rather just shift all rods back to being immune to electricity. I've yet to hear of a good reason why they should be vulnerable.

                          Comment

                          • d_m
                            Angband Devteam member
                            • Aug 2008
                            • 1516

                            #14
                            For what it's worth I have changed the inven_damage() function to use a higher resolution (hundredths of a percent versus percents). The old behavior was:

                            1-29 dmg: 1% chance
                            30-59 dmg: 2%
                            60+: 3%

                            The new formula I am trying out is: MIN(dmg, 60) / 20

                            To compare this formula to the old method:

                            Code:
                            DMG   NEW IS...
                            0     same
                            1-19  easier
                            20    same
                            21-29 harder
                            30-39 easier
                            40    same
                            41-59 harder
                            The deviations are never more than 1% in either direction... given the old stepwise function and its breakpoints (which I am smoothing out) it's inevitable that there will be some differences.

                            This plus the other change may have made inventory damage too weak. To compensate I will probably tweak the formula and/or raise the maximum chance from 3% to something higher.

                            Suggestions welcome.
                            linux->xterm->screen->pmacs

                            Comment

                            • fizzix
                              Prophet
                              • Aug 2009
                              • 2969

                              #15
                              Originally posted by d_m
                              This plus the other change may have made inventory damage too weak. To compensate I will probably tweak the formula and/or raise the maximum chance from 3% to something higher.

                              Suggestions welcome.
                              The *big* problem is for warriors who cannot easily get double resist, and are the class that relies the most on destroyable consumables. I think it might be a good idea to raise the unresisted chance overall and then to give warriors a bonus resistance (it can be gained at clevel 30).

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎