damage: physical & magic, as/def , int/mr, formulae, discuss

Moderator: EUO Moderators

Post Reply
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

damage: physical & magic, as/def , int/mr, formulae, discuss

Post by eggmceye »

preface
* physical combat is based of adnd v3 (originally it was v2) but has been altered many times over the years and adnd combat doesn't scale well
* there used to even be a d20 die roll but I was suprised just now to see that has been removed!
* dunno if this is still true but high def makes pvp for the attacker hard since they can't match it with AS


physical damage
Loosely speaking it goes like this
i) work out the base damage inflicted, let's call that base_d - this is primarly from stats, plus +, mats, etc
ii) work out the difference of the defender def and attacker AS, call that diff
iii) work out how much to scale (mostly down) the damage: scale = 1.1 - diff / 20
iv) adjust scale such that it is min 0.25 or max 1.1
v) actual damage is scale * base_d

so studying iii) and doing some math, the takehome points are:
If def - as >= 17 then the damage is Minimised. Ie, if the defender has 17 more def than the attacker has As, then the damage is minimised
If def<=as, then the damage is maximised. ie, if the attacker has at least as much as as the defender has def, then the damage is maxised


The main design problem is this: there is only 17 pts difference (of def-as) between Min damage and max Damge

appendix

Code: Select all

   damage = int((bdamage + slay_damage + stat_bonus)*mat_mult) + critical_bonus;
   if(damage_multiplier>0) damage*=damage_multiplier;
   
   // now scale the damage down according to def-as
   float defAC=defender->get_ac();
   if(attacker->id<100 && get_material(plyr[attacker->id].weapon)==MAT_DIAMOND) defAC=0; // mat diamond cuts thru any defence

   float diff=defAC-attacker->get_thaco();
   float scale=1.1-diff/20.0f;
   if(scale>1.1) scale=1.1f;
   else if(scale<0.25) scale=0.25f; // 20% min

   damage=ROUND(damage*scale);
   if(damage==0) damage=1;

magic damage
some spells have their own formula, but generally speaking most spells' base damage scale to caster's int and most spells damage is reduced by high MR-int, and surprisingly the maths is almost the same for physical !

i) work out the base damage base_d
ii) work out the diff of defender MR and attacker int ... diff=MR-int
iii) work out how much to scale base dmg by (watch carefully) : scale=1.1- diff / (MR/4) !!!
iv) adjust scale such that it is min 0.25 or max 1.1
v) actual damage is scale * base_d

this is the same as for combat except point iii) - the 17 range is now a variable scale, that is higher the tougher the mob is (leaving more room for the attacker's int to do more than the minimised damage

code:

Code: Select all


int scale_magic_damage(int caster_int, int defender_mr, int base_damage, bool enchantment) {

   if (defender_mr>=FULL_MAGIC_RESISTANCE) return 0; // 10k immunity rule
   if (enchantment) return base_damage; // no scaling

   float diff=defender_mr - caster_int;
   float scale=1.1-diff/(defender_mr/4.0f);
   if(scale>1.1) scale=1.1f;
   else if(scale<0.25) scale=0.25f; // 20% always gets thru (was 5%)
   
   int damage=ROUND(base_damage*scale);
   if(damage==0) damage=1;

   return damage;
}

case study i)
red dragon, 800 INT vs player with 1000 MR
scale=1.1-(1000-800)/(1000/4)
scale=1.1-200/250
scale=0.3

so if drag VF you for say 50 (whether it does or not i don't know) then the delivered damage would be 50 * 0.3 = 15 and that would be mostly resisted

case study ii)
heroic red dragon INT 2400 vs player with 1000 MR
you should be able to see that this will be full damage
scale=1.1-(1000-2400)/(1000/4)
scale=1.1--1400/250
scale=6.7 (which is capped to 1.1)

so to work out the MR you need to minimise damage vs a heroic red dragon:
0.25=1.1-(MR-2400)/(MR/4)
juggle
MR=3047

check:
0.25=1.1-(3047-2400)/(MR/4)

as a ratio: 3047/2500 = 1.21x - as an exercise you can check to see if this ratio holds for all MR/INT combos ! (I just did it on paper and it does)

similarly to work out the MR you need to start reducing the damage vs a heroic red dragon:
1.1=1.1-(MR-2400)/(MR/4)
MR=2400

take home: you need the same MR as the attacker's INT to start resisting, and you need 1.21x MR to best resist

notice the scale from 2400->3047 is much larger than that for physical (which is locked at 17) - however the ranges of int & mr go from 0 to 1000s, while as/def go from 0 to about 100 (?) - so it's debatable whether physical needs changing
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by eggmceye »

Questions:
i) is anything actually broken ? the way I see it is this: you should be able to find a dungeon where you maximise the damage you take without dying: assuming the loot you gain is proportional to the danger faced (the damage taken)
ii) it has been said that some (heroic or otherwise) mobs have simply too high INT + damage and only high HP is the way to survive. One answer to that is: you don't have to fight every mob even when you are at the cap, though it would be nice if more or less all builds have equal survivability, just so everyone doesn't go fighter+priest
iii) pvp: I don't care that much about it but I'm happy to address anything that really needs fixing
User avatar
1[WoWz]
MACRO > me
Posts: 841
Joined: Wed Apr 21, 2004 6:48 pm
Location: Southern California, USA

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by 1[WoWz] »

eggmceye wrote:Questions:
i) is anything actually broken ? the way I see it is this: you should be able to find a dungeon where you maximise the damage you take without dying: assuming the loot you gain is proportional to the danger faced (the damage taken)
ii) it has been said that some (heroic or otherwise) mobs have simply too high INT + damage and only high HP is the way to survive. One answer to that is: you don't have to fight every mob even when you are at the cap, though it would be nice if more or less all builds have equal survivability, just so everyone doesn't go fighter+priest
iii) pvp: I don't care that much about it but I'm happy to address anything that really needs fixing
i) Is anything broken? No not really, it's actually pretty good the way it is. Fighters/priests are tanky/low DPS, rogues/mages/necros/monks are squishy/high DPS. Fighters have the bonus of going tank stance, regular stance or zerk stance.

ii) This is true, heroic balrons, heroic shadow dragons, heroic shadow mages; no one has high enough MR to even start resisting them. High HP builds have the best chance of surviving these monsters, but other classes can get away with cheeses or really creative tactics.

iii) Pvp is pretty even to be honest.
IGN: 1
User avatar
Keighn
Stop posting already --;
Posts: 5509
Joined: Sat Jun 26, 2004 10:13 am
Location: Hey.... pssttt Back in Orgeon

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by Keighn »

I always get the question on statistics of various mobs. How much HP do they have? How high is their int? How many HP? How much damage do they do? What's their XP? So, it made me wonder myself.

We know there is Heroic Instances: x3 (in all ways I assume for HP, Int, Dmg, HP, xp, MR?)
And Epic Instances: x5 (likewise as per heroic but 5 times as nasty)

One mentioned he heard that 2x2 mobs are roughly the same as a Heroic Mob (x3) I recall that also.
Hybrid seems to be a bit of an anomalie (but nasty never the less).
eggmceye wrote:take home: you need the same MR as the attacker's INT to start resisting, and you need 1.21x MR to best resist
Boss Mobs:
MR 1.5x normal
Intelligence 1.25x normal
HP 2x normal
AS/Damage? 2x normal?
xp 2x normal?

So, I naturally I want to chart out mobs in a spreadsheet for the regular version, the boss, a 2x2, a hybrid and then for each of those in heroic and epic instances. I'd assume eventually its just multiplication. Maybe some others can help out on this. Esp egg perhaps.
User avatar
treos
I once posted in TFIOOC!
Posts: 110
Joined: Fri Dec 21, 2012 12:23 am

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by treos »

hey egg, is this line

"if (defender_mr>=FULL_MAGIC_RESISTANCE) return 0; // 10k immunity rule"

specifically for golems or something? cause i know for a fact that my golem on alpha takes magic damage (negligible of course but the numbers still appear) if it has so much as 1 mr under 10k yet nothing short of post-apoc mobs can hurt it once it's over the 10k mark (granted, that's mainly due to MR cleave but...if i switch enough back to int to have 10k regardless of the cleave...).

also, those town guards have quite the physical bite to them. 135+ defense and they still hit in the 130-140+ range. i suspect that means (assuming i'm understanding this annoying D&D nonsense correctly) their 100 AS would be 1-100d10/hit so at minimum that's around 1-14d10 with 117+ defense.
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by eggmceye »

golems only have 2k MR
and the const FULL_MAGIC_RESISTANCE is 9999
User avatar
Rumper
Post in swahili or SHUT THE FUCK UP!
Posts: 217
Joined: Sun Jan 25, 2015 11:49 pm

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by Rumper »

O.O 9999 MR = 80K MR?

LAUGHING OUT LOUD LIKE A MORON :p
User avatar
treos
I once posted in TFIOOC!
Posts: 110
Joined: Fri Dec 21, 2012 12:23 am

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by treos »

eggmceye wrote:golems only have 2k MR
and the const FULL_MAGIC_RESISTANCE is 9999
um...i was referring to the characters you play as, not the mobs. like, if a skeleton character were to somehow hit 10k MR, would it have that immunity as well?
User avatar
EmoMage
Girls only want boyfriends who have great skills.
Posts: 772
Joined: Tue Aug 06, 2013 10:10 am

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by EmoMage »

yeah
eggmceye wrote:
ParadoxOfChoice wrote: Zombie using bow/sling probably shouldn't give disease.

the zombies are pulling the arrows out of their ass
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by eggmceye »

yeh, but I'm pretty sure if that ever happened I'd change it so the 10k mr rule would only apply to mobs, which is the intention anyway

what is the highest mr a player has got to ?
User avatar
1[WoWz]
MACRO > me
Posts: 841
Joined: Wed Apr 21, 2004 6:48 pm
Location: Southern California, USA

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by 1[WoWz] »

eggmceye wrote:yeh, but I'm pretty sure if that ever happened I'd change it so the 10k mr rule would only apply to mobs, which is the intention anyway

what is the highest mr a player has got to ?
Depends on the class and what server they're on (due to level/stat caps). On regular I'd guess the highest a Fighter/Priest/Monk/Rogue could get to is about 3200ish. A Priest/Necro with full int and MR gear would probably break 4k pretty easy.
IGN: 1
User avatar
Rumper
Post in swahili or SHUT THE FUCK UP!
Posts: 217
Joined: Sun Jan 25, 2015 11:49 pm

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by Rumper »

I think for def and AS, one has to be quite creative. I would suggest a non-static scale depending on stats players can achieve and stats mobs have.
The highest possible defence for players is (if I didn't overlook artifacts and stuff):
- - Mythic adamantium field plate of defence + 7 = (6+7)*1,5+2=21,5
- - Mythic adamantium greaves of defence + 7 = (3+7)*1,5+2=17
- - Mythic adamantium full helm of defence + 7 = (2+7)*1,5+2=15,5
- - Mythic adamantium gauntlets of defence + 7 = (2+7)*1,5+2=15,5
- - Mythic adamantium plate boots of defence + 7 = (2+7)*1,5+2=15,5
- - Mythic adamantium spiked collar of defence + 7 = (1+7)*1,5+2=14
- - Mythic adamantium belt of defence + 7 = 7*1,5+2=12,5
- - Mythic adamantium ring of defence + 7 = 7*1,5+2=12,5
- - Mythic adamantium ring of defence + 7 = 7*1,5+2=12,5
- - Sigil of defence + 7 = 7
- - Sigil of defence + 7 = 7
- - Sigil of defence + 7 = 7
This brings us to a grand total of 157,5 defence.
As with AS I don't know how high a player can go, cause it differs for PD and Reg because str stat contributes alot!
Classes normal (wearing plain class armour) defence is at:
Monk = 20 from unarmoured
Mage/Necromancer = 0 from unarmoured
Rogue = 6 from light armour
Priest/Fighter = 15 from Heavy armour
If one fully mythics all his items (10 items including offhand so not applicable for dualwielders, they get 9 items, thus 18 def) one would get 20 defence more.
This can guide us on determining the ranges.
So for instance, we got the starting defence which is 0 then low range which is from 1 to 20, middle range which is 21 - 50, high range which can be 51 to 100, extreme range of 101 to 157 and then there's ultimate defence which is 157,5.

Suggestion 1:
0 defence resists nothing. All attacks deal 1,1 times the damage.
1 to 20 gives scale = 1,1 - diff/ 10
21 to 50 gives scale = 1,1 - diff / 20
51 to 100 gives scale = 1,1 - diff / 50
101 to 157 gives scale = 1,1 - diff /80
157,5 resists all physical damage.

Case study low range. def - AS = diff
8,5 diff resists all and to start resisting AS = def
Case study middle range
17 diff resists all and start resisting at AS = def
Case study high range
42,5 diff resists all and start resisting at AS = def
Case study extreme range
68 diff resists all and start resisting at AS = def

Suggestion 2:
scale = 1,1 - diff / def/(1+max(log(AS/80),0)) where max(log(AS/80),0) means take the greater of these 2 numbers, cause when AS<80 we get negative number for log(AS/80). This means the higher the AS, more impact defence will have at later levels. Damage will still scale upwards, but much more slowly. I didn't have the time to plot the damage numbers yet.
User avatar
Rumper
Post in swahili or SHUT THE FUCK UP!
Posts: 217
Joined: Sun Jan 25, 2015 11:49 pm

Re: damage: physical & magic, as/def , int/mr, formulae, dis

Post by Rumper »

Oh wait a minute I overlooked monks. They can get the highest possible defence in-game.
Mythic Battleweave Gi (torso) of defence + 7 = 7*1,5+2=12,5
Mythic Battleweave Gi (legs) of defence + 7 = 7*1,5+2=12,5
Mythic Battleweave cap of defence + 7 = 7*1,5+2=12,5
Mythic Battleweave gloves of defence + 7 = 7*1,5+2=12,5
Mythic adamantium dragonscale boots of defence + 7 = (2+7)*1,5+2=15,5
Mythic adamantium belt of defence + 7 = 7*1,5+2=12,5
Mythic adamantium ring of defence + 7 = 7*1,5+2=12,5
Mythic adamantium ring of defence + 7 = 7*1,5+2=12,5
Mythic adamantium spiked collar of defence + 7 = (1+7)*1,5+2=14
Sigil of defence + 7 = 7
Sigil of defence + 7 = 7
Sigil of defence + 7 = 7
In addition to the 20 def the get at 100 Ua skill when wearing UA armour
and the aspect of the turtle (another 20 def)
We get 178 defence!
Post Reply