Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old July 25, 2012, 23:53   #1
bron
Swordsman
 
Join Date: May 2008
Location: Saratoga, California (in the midst of Silicon Valley)
Posts: 494
bron is on a distinguished road
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:
Quote:
[...] 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
File Type: zip melee2.zip (21.8 KB, 150 views)
bron is offline   Reply With Quote
Old July 26, 2012, 00:14   #2
bron
Swordsman
 
Join Date: May 2008
Location: Saratoga, California (in the midst of Silicon Valley)
Posts: 494
bron is on a distinguished road
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
File Type: zip melee2.zip (21.7 KB, 193 views)
bron is offline   Reply With Quote
Old July 26, 2012, 21:21   #3
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,060
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by bron View Post
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!
Quote:
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.
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline   Reply With Quote
Old July 26, 2012, 22:14   #4
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
fizzix is on a distinguished road
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.
fizzix is offline   Reply With Quote
Old July 26, 2012, 22:25   #5
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,060
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by fizzix View Post
[*] 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
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline   Reply With Quote
Old July 27, 2012, 01:00   #6
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,024
Derakon is on a distinguished road
This should be self-evident, but just to be explicit: only the physical portion of the damage should be subject to AC damage reduction.
Derakon is offline   Reply With Quote
Old July 27, 2012, 01:12   #7
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
fizzix is on a distinguished road
Quote:
Originally Posted by Magnate View Post
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:

Quote:
Inventory damage is based only on the effect damage, not on the physical hit.
fizzix is offline   Reply With Quote
Old July 27, 2012, 01:52   #8
bron
Swordsman
 
Join Date: May 2008
Location: Saratoga, California (in the midst of Silicon Valley)
Posts: 494
bron is on a distinguished road
Quote:
Originally Posted by Magnate View Post
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.
bron is offline   Reply With Quote
Old July 27, 2012, 02:11   #9
bron
Swordsman
 
Join Date: May 2008
Location: Saratoga, California (in the midst of Silicon Valley)
Posts: 494
bron is on a distinguished road
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
bron is offline   Reply With Quote
Old July 27, 2012, 04:02   #10
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
fizzix is on a distinguished road
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.
fizzix 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
Damage bonuses that don't provide extra damage? Egavactip v4 2 May 27, 2012 01:51
It did how much damage? Raggy Vanilla 27 June 26, 2011 21:12
Why AC instead of physical resistance? pampl Idle chatter 7 February 19, 2011 03:54
Monster susceptibilities and immunities CunningGabe Vanilla 11 February 2, 2011 16:40
Randart immunities TJS Vanilla 4 June 25, 2010 18:06


All times are GMT +1. The time now is 15:20.


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