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.
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
into
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.
[...] 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.
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, ...)
Code:
extra = adjust_dam(..., damage, ...); damage -= armor_reduction(damage, ac); take_hit(..., damage + extra, ...); inven_damage(..., extra, ...);
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.
Comment