Page 1 of 1

Damage and AC

PostPosted: Tuesday, 31st May 2016, 23:20
by joyousshower
I don't know where to post this really, so I apologize if this isn't the right place, but I just had a DeFe with 15ac get hit by Gastronok for 35 damage. From what I can see, Gastronok's attack is 40 and ac reduces damage by 15, so shouldn't he be able to do at most 25 damage. There's probably more to the calculation, but please point me in the right direction. Also, I can post the log later, it's on a different computer, if that's even helpful.

Re: Damage and AC

PostPosted: Tuesday, 31st May 2016, 23:25
by Siegurt
Ac is rolled, so 15 ac means you reduce damage taken by 0 to 15 points on each hit.

Re: Damage and AC

PostPosted: Tuesday, 31st May 2016, 23:38
by joyousshower
Oh, well that's an important piece of information I missed, dang. Anyone know about monster damage as well, would Gastronok just roll a d40, for instance?

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 00:02
by Siegurt
Ahappydouche wrote:Oh, well that's an important piece of information I missed, dang. Anyone know about monster damage as well, would Gastronok just roll a d40, for instance?

In most cases, it's just a direct roll of the monster's damage (for melee attacks anyway) There are cases where the monster rolls more than one time, but it's not the common case.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 03:31
by genericpseudonym
Ahappydouche wrote:Oh, well that's an important piece of information I missed, dang. Anyone know about monster damage as well, would Gastronok just roll a d40, for instance?


Generally yeah. Monsters with weapons add their damage stat to the weapons, so an Orc Warlord with a dagger will still hit for 36 damage, not just 4.

Also, gastronok can hit for up to 70ish damage by casting Airstrike, so if the 35 from a melee hit scares you you probably shouldn't be anywhere near him.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 06:43
by Hurkyl
Player airstrike is a monstrosity that usually rolls low damage and only very rarely rolls high. Is Gastronok's the same?

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 08:23
by seren
Ahappydouche wrote:Oh, well that's an important piece of information I missed, dang. Anyone know about monster damage as well, would Gastronok just roll a d40, for instance?


Additionally Armour have a guaranteed damage reduction that will increase the minimum value the range of your AC roll.

If you have a GDR of 50% and AC20, your AC roll is a value between 10 and 20 instead of 0 and 20 (if you had 0% GDR)

http://crawl.chaosforge.org/index.php?t ... _reduction

But this is more geared towards Heavy armour wearer, as a caster you were probably wearing a lighter armour anyway.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 14:15
by ZoFy
genericpseudonym wrote:Also, gastronok can hit for up to 70ish damage by casting Airstrike, so if the 35 from a melee hit scares you you probably shouldn't be anywhere near him.

His max Airstrike damage is "just" 50 and while he pretty much never rolls that high (and he has four less lethal spells in his arsenal), the entire possibility of that should force you to avoid or kite him.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 15:51
by VeryAngryFelid
seren wrote:If you have a GDR of 50% and AC20, your AC roll is a value between 10 and 20 instead of 0 and 20 (if you had 0% GDR)

http://crawl.chaosforge.org/index.php?t ... _reduction


This is wrong. If you are attacked by unarmed goblin with max damage 4, your AC roll is guaranteed to get at least 1, even if you are Gr in CPA. So you can still get 3 damage from that goblin.

That wiki page is confusing, it provides 2 examples when monster has max damage higher than your AC but no examples when lower.

https://github.com/crawl/crawl/blob/mas ... or.cc#L399

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 16:25
by Siegurt
VeryAngryFelid wrote:
seren wrote:If you have a GDR of 50% and AC20, your AC roll is a value between 10 and 20 instead of 0 and 20 (if you had 0% GDR)

http://crawl.chaosforge.org/index.php?t ... _reduction


This is wrong. If you are attacked by unarmed goblin with max damage 4, your AC roll is guaranteed to get at least 1, even if you are Gr in CPA. So you can still get 3 damage from that goblin.

That wiki page is confusing, it provides 2 examples when monster has max damage higher than your AC but no examples when lower.

https://github.com/crawl/crawl/blob/mas ... or.cc#L399

Yeah there is a reason i didn't mention gdr, it is confusing, weird and should almost never factor into your decisions, throwing it at someone who is new to the game is more likely to lead to bad game play than to be of any help.

If you want a short correct short explanation anyway:

Spoiler: show
Gdr is the minimum percentage of the creature's max damage that armor will reduce an attack by, up to half your ac.

Note that gdr doesn't effect the distibution of the ac roll, you still roll the full range of ac, you just substitute the lower rolls for the guarantee.

So if you have 20% gdr, and a critter does 20 points of damage max, you are guaranteed 4 points of protection as long as your ac is above 8, otherwise, it is half your ac if its below 8. If you had say 15 ac, you would roll between 0 and 15, and if you rolled less than 4 you would use 4 instead of your roll for damage reduction.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 19:58
by TwoLeggedMammal
Ah, I didn't know that it was based on monster damage. That means GDR is still pretty valuable even as a lowish AC character.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 20:06
by Siegurt
TwoLeggedMammal wrote:Ah, I didn't know that it was based on monster damage. That means GDR is still pretty valuable even as a lowish AC character.

Sort of, it maxes out at half your ac, so no matter how good your gdr, low ac chars aren't going to get a lot from it, it is also important to note the a lot of "non regular" attacks simply bypass it entirely, which is another reason that relying on it isn't a very good idea.

Re: Damage and AC

PostPosted: Wednesday, 1st June 2016, 20:14
by ontoclasm
Siegurt wrote:
TwoLeggedMammal wrote:Ah, I didn't know that it was based on monster damage. That means GDR is still pretty valuable even as a lowish AC character.
a lot of "non regular" attacks simply bypass it entirely

Note that "a lot of non-regular attacks" here means "literally every single source of damage that isn't a basic melee strike."

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 04:17
by joyousshower
Glad I asked, I never knew about GDR, good thread, good thread.

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 07:20
by Sprucery
Ahappydouche wrote:Glad I asked, I never knew about GDR, good thread, good thread.

And now that you know abot GDR, you can go ahead and forget it :)

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 07:40
by seren
VeryAngryFelid wrote:That wiki page is confusing, it provides 2 examples when monster has max damage higher than your AC but no examples when lower.

https://github.com/crawl/crawl/blob/mas ... or.cc#L399


Thanks for pointing out the actual source code.

Effectively , gdr is always multiplied to max_damage, and not your AC.

I also wonder why there are different case like AC_PROPORTIONAL, AC_DOUBLED and so on..

I'll try to clarify the wiki.

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 07:47
by infinitevox
ontoclasm wrote:
Siegurt wrote:
TwoLeggedMammal wrote:Ah, I didn't know that it was based on monster damage. That means GDR is still pretty valuable even as a lowish AC character.
a lot of "non regular" attacks simply bypass it entirely

Note that "a lot of non-regular attacks" here means "literally every single source of damage that isn't a basic melee strike."


So.... what about standardizing what is and isn't reduced by armor?
All physical attacks (Melee, Ranged, Reaching) are affected by AC.
All magical attacks (Spells, Wands, Rods) are affected by MR
All types of attacks (the above) can be dodged via EV

Something like that. It's extremely unintuitive what is and isn't affected by a players different mitigaters.

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 09:19
by Magipi
infinitevox wrote:So.... what about standardizing what is and isn't reduced by armor?
All physical attacks (Melee, Ranged, Reaching) are affected by AC.
All magical attacks (Spells, Wands, Rods) are affected by MR
All types of attacks (the above) can be dodged via EV

Something like that. It's extremely unintuitive what is and isn't affected by a players different mitigaters.

I think you misunderstand: Ontoclasm was talking about GDR, not about AC.

Also, you want firestorm to be resisted by EV? And also by MR? How is that making any sense?

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 12:01
by infinitevox
Well, the fire rains down from the sky.
So you dance around and try not to get hit, but when you do, your magic resistance allows you to shrug off some of the damage.
It makes perfect sense.

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 16:50
by ydeve
MR is hex armor, not general magic armor

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 17:04
by VeryAngryFelid
seren wrote:I also wonder why there are different case like AC_PROPORTIONAL, AC_DOUBLED and so on..


AC_NONE is used by attacks that ignore AC like Freeze.
AC_HALF is used by attacks that half AC like Lightning Bolt.
AC_TRIPLE is used by attacks which check AC three times like Sandblast.
AC_PROPORTIONAL is new to me, I have just checked source code and found that it is used by Tornado, Summon forest and rod of lightining.

Edit. For proportional.

  Code:
// Reduce damage by AC.
// In most cases, we want AC to mostly stop weak attacks completely but affect
// strong ones less, but the regular formula is too hard to apply well to cases
// when damage is spread into many small chunks.
//
// Every point of damage is processed independently. Every point of AC has
// an independent 1/81 chance of blocking that damage.
//
// AC 20 stops 22% of damage, AC 40 -- 39%, AC 80 -- 63%.
int apply_chunked_AC(int dam, int ac)
{
    double chance = pow(80.0/81, ac);
    uint64_t cr = chance * (((uint64_t)1) << 32);

    int hurt = 0;
    for (int i = 0; i < dam; i++)
        if (get_uint32() < cr)
            hurt++;

    return hurt;
}

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 21:16
by Rast
I'll bet there is a really close approximation to that which doesn't require calculating (80/81)^AC.

At the very least, it could all be precomputed and put in a lookup table, to save cpu.

EDIT:
  Code:
    double chance = 1 - ac/100;
    if (ac>40) chance+=ac/200.0 - 0.2;


(this would mean AC 160 equals immunity; I'm OK with that)

Re: Damage and AC

PostPosted: Thursday, 2nd June 2016, 22:46
by Sprucery
Rast wrote:(this would mean AC 160 equals immunity; I'm OK with that)

No no it's better that AC over 159 is treated as 159 instead :)