Physical Damage despite Immunities

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bron
    Knight
    • May 2008
    • 515

    Physical Damage despite Immunities

    In a different thread, there was commentary on the idea that a physical attack by a monster, where that attack had e.g. a FIRE effect, should still do normal physical damage, even when the player has immunity to the effect. I said:
    [...] when I looked at the code, it seemed like one would only need to make changes to make_attack_normal in monster/melee2.c to get physical damage in the face of immunities to work.
    I decided to put my money where my mouth is. Attached (I hope) is a new version of melee2.c which implements one possible method of doing this.

    The basic idea is that if you have immunity to the effect, you execute the RBE_HURT branch of the switch statement instead. If you are not immune, then we change
    Code:
        damage = adjust_dam(..., damage, ...)
    into
    Code:
        extra = adjust_dam(..., damage, ...);
        damage -= armor_reduction(damage, ac);
        take_hit(..., damage + extra, ...);
        inven_damage(..., extra, ...);
    so the attack has both a physical part, and an effect part. The physical part is reduced by armor, the effect part is reduced by resistance. Inventory damage is based only on the effect damage, not on the physical hit.

    Note that this means that a monster attack with e.g. an RBE_FIRE effect against an unarmored player with no resists will do twice as much damage as a straight RBE_HURT attack of the same strength but without the FIRE effect (once for the physical attack, once for the effect). Note that this is also twice as much damage as such an attack currently does. One might also think that the extra damage should be calculated after the armor reduction, rather than before (I don't think so myself, but it is not an unreasonable position). Of course, one might just throw out the whole thing.
    Attached Files
  • bron
    Knight
    • May 2008
    • 515

    #2
    Here is a slightly better version of the same thing.

    I've tested this some, and it seems to do the right thing, but I certainly did not subject it anything like a thorough QA process.
    Attached Files

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #3
      Originally posted by bron
      In a different thread, there was commentary on the idea that a physical attack by a monster, where that attack had e.g. a FIRE effect, should still do normal physical damage, even when the player has immunity to the effect. I said:

      I decided to put my money where my mouth is. Attached (I hope) is a new version of melee2.c which implements one possible method of doing this.
      First, just wanted to say thanks so much for having a go at this - this is how development ought to work!
      The basic idea is that if you have immunity to the effect, you execute the RBE_HURT branch of the switch statement instead. If you are not immune, then we change
      Code:
          damage = adjust_dam(..., damage, ...)
      into
      Code:
          extra = adjust_dam(..., damage, ...);
          damage -= armor_reduction(damage, ac);
          take_hit(..., damage + extra, ...);
          inven_damage(..., extra, ...);
      so the attack has both a physical part, and an effect part. The physical part is reduced by armor, the effect part is reduced by resistance. Inventory damage is based only on the effect damage, not on the physical hit.

      Note that this means that a monster attack with e.g. an RBE_FIRE effect against an unarmored player with no resists will do twice as much damage as a straight RBE_HURT attack of the same strength but without the FIRE effect (once for the physical attack, once for the effect). Note that this is also twice as much damage as such an attack currently does. One might also think that the extra damage should be calculated after the armor reduction, rather than before (I don't think so myself, but it is not an unreasonable position). Of course, one might just throw out the whole thing.
      Well, there are two things I don't like about it (but other devs and commentators may disagree).

      First, I think increasing early game damage output is a big problem. Fire hounds and cold hounds will do twice as much damage. Ugh!

      Second, and less importantly, I don't like the idea that an attack can do physical damage to your hp and yet to elemental damage to your equipment.

      Neither is hard to fix though, so you may well have given us the basics of the fix - thanks again.
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • fizzix
        Prophet
        • Aug 2009
        • 3025

        #4
        So between bron's and magnate's comments I was able to dredge up some old memories from the last time I thought about this problem. As I remember, the difficulty was how to exactly handle the attacks. So we should take some time to try to agree on what the ideal behavior is. Here are my thoughts.
        • 1) Elemental breaths and spells should give no damage with immunity.
        • 2) Melee attacks should be made up of N% physical and (100 - N)% elemental
        • 3) Only the elemental portion of the attack is subject to resistance/immunity reduction.
        • 4) Only the elemental portion of the attack should cause inventory damage.
        • 5) Monster damage may need some minor rebalancing (but probably not, elemental melee damage is less important than breaths usually)
        • 6) Inventory damage thresholds will need to be multiplied by N/100 to best reproduce current behavior.


        Note that If we set N to 0, we should regain current behavior.

        From what I gather, bron's changes correctly do 1-4 with N being 50 (and the odd change of damage being doubled). They do not attempt to address 5, and there's no change with regard to 6 because of the damage doubling.

        I'm not sure that I'm remembering correctly how melee works, so please point out any errors.

        Lastly, N = 50 is an obvious choice, but I'm not sure it's really the best choice. In this case, single resist will allow 2/3, double will allow 5/9 and immunity will allow 1/2 danage. I can very easily see something like N = 20 being reasonable, then single resist will allow 7/15, double will allow 13/45, and immunity will allow 1/5.

        Comment

        • Magnate
          Angband Devteam member
          • May 2007
          • 5110

          #5
          Originally posted by fizzix
          [*] 4) Only the elemental portion of the attack should cause inventory damage.

          From what I gather, bron's changes correctly do 1-4 with N being 50 (and the odd change of damage being doubled). They do not attempt to address 5, and there's no change with regard to 6 because of the damage doubling.
          One of us has not understood bron's code then - quite possibly me. The way I read it, an elemental attack when you are immune to the element will both do physical damage and inventory damage ... the latter conflicts with your #1
          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

          Comment

          • Derakon
            Prophet
            • Dec 2009
            • 9022

            #6
            This should be self-evident, but just to be explicit: only the physical portion of the damage should be subject to AC damage reduction.

            Comment

            • fizzix
              Prophet
              • Aug 2009
              • 3025

              #7
              Originally posted by Magnate
              One of us has not understood bron's code then - quite possibly me. The way I read it, an elemental attack when you are immune to the element will both do physical damage and inventory damage ... the latter conflicts with your #1
              If that's the case it's not what bron intended, since he explicitly said:

              Inventory damage is based only on the effect damage, not on the physical hit.

              Comment

              • bron
                Knight
                • May 2008
                • 515

                #8
                Originally posted by Magnate
                The way I read it, an elemental attack when you are immune to the element will both do physical damage and inventory damage ... the latter conflicts with your #1
                First of all, let's agree that we are talking about version2 of the change so we can all be talking about the same thing. If Magnate is looking at version1, it's a bit less clear. But the inventory damage is based only on the elemental damage.

                In the 3.4RC version, you started with "damage", which was modified by the resists. In my version, I start with the same "damage", and modify it two ways. I compute a value "extra" which is damage modified by resists: this is the same as the original code's modified "damage" value. This is the value used in the "inven_damage" call. I then also compute "damage" modifed by ac, which is the same calcualtion as is done by a normal (RBE_HURT) attack.

                In my proposed code, the "take_hit" damage is the sum of the two modified values. This seemed like the right thing to me at the time, although as Magnate points out it makes low-level elemental monsters more dangerous, since you are more likely to encounter them without the appropriate resists. In a test-game I'm playing right now, things like Chimera are certainly more dangerous, but not unduly so, since for most low level things, only one of their attacks is of the elemental variety. However, doombats become fearsomely hard without rFire.

                I think the simple way out of this with the least change would be to say that the "take_hit" damage should be the *max* (not the sum) of the resist-modified and of the armor-modified damage. Although inven_damage should still use the resist-modified value regardless. That should give the originally desired outcome (i.e. do the physical damage amount even with immunity), but should not alter the damage amount in other cases by so much as to be unbalancing.

                Comment

                • bron
                  Knight
                  • May 2008
                  • 515

                  #9
                  Just to be concrete, I'm proposing change the 3.4RC code from the existing:
                  Code:
                  damage = adjust_dam(p, GF_ACID, damage, RANDOMISE, 
                                    check_for_resist(p, GF_ACID, p->state.flags, TRUE));
                  if (damage) {
                          take_hit(p, damage, ddesc);
                          inven_damage(p, GF_ACID, MIN(damage * 5, 300));
                  }
                  to
                  Code:
                  elemental = adjust_dam(p, GF_ACID, damage, RANDOMISE, 
                                     check_for_resist(p, GF_ACID, p->state.flags, TRUE));
                  physical = damage - armor_reduction(damage, ac);
                  
                  damage = max(elemental, physical)
                  
                  if (damage > 0) take_hit(p, damage, ddesc);
                  if (elemental > 0) inven_damage(p, GF_ACID, MIN(elemental * 5, 300));
                  and similarly for the other elemental types.

                  With this code, the amount of inventory damage is exactly the same as now. The only time the take_hit damage will be more than it is now is if the player has resists to the element

                  Comment

                  • fizzix
                    Prophet
                    • Aug 2009
                    • 3025

                    #10
                    I like using max(physical, elemental). It's a pretty nice solution to some of the problems.

                    I'm also fine with lowering the melee damage from some elemental monsters so they're not too deadly. Specifically in the dlevel 1-25 range. If there's consensus and bron's suggestions are accepted, and someone puts these changes in, I'll run the numbers on the appropriate monsters and select changes. If we put it in 3.4, we will probably need monster damage in these levels to align with 3.3 for minimal gameplay effect.

                    I probably won't be able to work on the code in the next two weeks due to traveling without my usual angband computer. However, I should be able to do work on monster rebalancing calcs with googledocs excel.

                    Comment

                    • bron
                      Knight
                      • May 2008
                      • 515

                      #11
                      fizzix makes some good points regarding game balance, especially at the low level. I did a quick survey of monsters with an eye to game balance. Under the proposal, the "elemental" part of the damage would be exactly the same as the current damage. So no monster would do less damage than currently. There is only a change when the physical damage is higher than the elemental damage. Also, if the monster has several melee attacks, but only one of them is elemental, that didn't seem to be enough of a change to really matter much (yes, the monster gets a little tougher, but not a lot). I also chose to ignore uniques. And most high-level monsters have much more damaging attacks than the physical melee attacks anyway, and while this probably shouldn't be ignored, I don't think it would prove to be a problem.

                      This leaves us with a small handful of problematic monsters. These mostly fall into two camps: (1) low-level monsters with acid attacks, where right now the player could reasonably expect their armor to stop half the acid damage, but their AC isn't yet high enough to stop half the physical damage, and (2) mid-level monsters that have many multiple elemental melee attacks, that right now could possibly be easily engaged with single or double resists, but that become a lot tougher with the physical damage. These two camps are especially a problem if the monster is fast. Conversely, it's not a problem if the monster is slow (e.g. Spotted Jelly).

                      camp (1):
                      green naga
                      green icky thing
                      gelatinous cube
                      water hound
                      ochre jelly (fast)

                      camp (2):
                      doombat (fast)
                      hellhound (fast)
                      black pudding
                      acidic cytoplasm (fast)
                      colbran
                      frost giant
                      fire giant
                      cloud giant
                      storm giant (fast)

                      After some thought, my personal opinion is that most of these just aren't a big enough problem that anything need be done. The only ones that IMHO become a problem are:
                      ochre jelly
                      doombat
                      hellhound
                      black pudding
                      acidic cytoplasm

                      I think that the proposed change makes these 5 a lot tougher than they are now, and so they might need to be adjusted (e.g. delete one of their melee attacks).

                      Comment

                      • Timo Pietilä
                        Prophet
                        • Apr 2007
                        • 4096

                        #12
                        Originally posted by bron
                        After some thought, my personal opinion is that most of these just aren't a big enough problem that anything need be done. The only ones that IMHO become a problem are:
                        ochre jelly
                        doombat
                        hellhound
                        black pudding
                        acidic cytoplasm

                        I think that the proposed change makes these 5 a lot tougher than they are now, and so they might need to be adjusted (e.g. delete one of their melee attacks).
                        Hellhound and Doombat do not need to hit with elemental damage with all of their attacks, but IMO mobile jellies do. You can always just avoid those if you don't want to get your inventory damaged. I usually do that even now until I can kill them really fast.

                        Also mobile jelly attacks are not hits but touch, which should eliminate physical portion of the attack leaving only elemental. Immunity should them make you completely immune to melee against those.

                        Comment

                        • bron
                          Knight
                          • May 2008
                          • 515

                          #13
                          Attached is version 3. This implements the "max" idea. It also factors out the 4 elemental attacks into a seperate procedure for easy modification. I made a routine "adjust_dam_armor" that does the damage reduction for armor; the counter-part of the "adjust_dam" routine which does that for resists. Personally, I think "adjust_dam" should be renamed "adjust_dam_resist", but that changes more than just the one file, so I didn't do it.
                          Attached Files

                          Comment

                          • Magnate
                            Angband Devteam member
                            • May 2007
                            • 5110

                            #14
                            Originally posted by Timo Pietilä
                            Hellhound and Doombat do not need to hit with elemental damage with all of their attacks, but IMO mobile jellies do. You can always just avoid those if you don't want to get your inventory damaged. I usually do that even now until I can kill them really fast.

                            Also mobile jelly attacks are not hits but touch, which should eliminate physical portion of the attack leaving only elemental. Immunity should them make you completely immune to melee against those.
                            Yes, I like this idea a lot - touch attacks are purely elemental and thus not subject to the new handling.

                            Thanks to both fizzix and bron for clarifying - I'm fine with this now. Sorry for the misunderstanding.
                            "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                            Comment

                            • fizzix
                              Prophet
                              • Aug 2009
                              • 3025

                              #15
                              Is it worth it defining different multipliers for the different attack types to calculate physical damage. Something like.
                              • Hit: 1
                                Touch: 0
                                Bite: 0.8
                                Claw: 0.8

                              etc.

                              Or is it sufficient to make touch 0 and everything else 1, and go ahead with some slight rebalancing if needed?

                              Comment

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