Weapon damage

Any discussions regarding the spoilers present in ToME 4.x.x should be restricted to this forum

Moderator: Moderator

Post Reply
Message
Author
PowerWyrm
Sher'Tul
Posts: 1106
Joined: Thu Nov 21, 2002 9:53 pm

Weapon damage

#1 Post by PowerWyrm »

What is the actual formula? I'm a little lost here...
Using a sword with power x (y min - z max) usually leads to damage ranging from y to z as expected. Using a dagger with the same power leads to really low damage (probably 1/3rd of the expected damage). So I guess it's not really a random value between min and max power. I suppose Str and Dex are factored in the formula, but I cannot figure how...

Zaive
Archmage
Posts: 313
Joined: Mon May 24, 2010 1:33 pm

Re: Weapon damage

#2 Post by Zaive »

I think the stats used is written in the weapons description. Swords use 100% Str and daggers use 45% Str and 45% Dex, or something like that. Did you have a high str and low dex?
Burb Lulls wrote:"FLURRYFLURRYFLURRYFLURRYFLURRYFLURRY"

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Weapon damage

#3 Post by darkgod »

Code: Select all

	local talented_mod = math.sqrt(self:combatCheckTraining(weapon) / 10) + 1
	local power = math.max(self.combat_dam + (weapon.dam or 1) + add, 1)
	power = (math.sqrt(power / 10) - 1) * 0.8 + 1
	return (totstat / 1.5 * power * talented_mod) * 0.75
Tada!

Ok maybe I'll explain a bit ;)
The first line just grabs the %multiplier granted by your weapon mastery talent.

The second&third lines are where the weapon power is turned into a stat modifier.
The fourth merges all.
"totstat" is the final value of your stat(s)-influencing the weapon; if your weapon says it uses 110% of your strength and you have 45 STR then totstat is 49.5
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Marcotte
Wyrmic
Posts: 203
Joined: Sat Jan 26, 2008 1:12 am

Re: Weapon damage

#4 Post by Marcotte »

Wait a minute. This means that STR have a multiplicative effect on damage? And I always believed (from the weapon descriptions) that STR was a straight additive bonus (with the given multiplier) to the base weapon damage...

That explain why high level material weapons are always much better than low level material weapons, even without any ego...

greycat
Sher'Tul
Posts: 1396
Joined: Tue May 11, 2010 11:51 pm

Re: Weapon damage

#5 Post by greycat »

Reading class/interface/Combat.lua and trying to figure it out....

First thing it does is calculate your stat-based multiplier. E.g. if your weapon is (Str 60% Dex 40%) then it adds together your Str*0.6 + Dex*0.4. It makes substitutions based on talents (Lethality -> substitute Cun for Str) and Psi combat (substitute Wil for Str, Cun for Dex). If you're using psi combat (whatever that actually means), it nerfs this by another hard-coded 0.6. The final result is called "totstat".

Then it does something involving Arcane Destruction and Blood Frenzy. I have no idea what those do. It puts some calculated value based on these two talents into "add". ("add" is 0 if you don't have them.)

Then it does the lines that darkgod showed. The "talented_mod" variable is 1 plus the square root of something... no idea what. Darkgod said it's related to the weapon damage talent. Somehow.

The "power" variable is the sum of two things (no idea where they come from) and our friend "add", and it's not allowed to be less than 1.

Then there's a big multiplication of "totstat" and "power" and "talented_mod" and two constant factors. Not sure why there are two constants here, if everything in Lua is floating-point. Dividing by 3/2 is the same as multiplying by 2/3, and we also multiply by 3/4, so in the end we're just multiplying "totstat" * "power" * "talented_mod" * 1/2.

This gives us some number that's presumably used in some other calculation involving the monster's armor, your own armor penetration, and who knows what else.

PowerWyrm
Sher'Tul
Posts: 1106
Joined: Thu Nov 21, 2002 9:53 pm

Re: Weapon damage

#6 Post by PowerWyrm »

Alright, conclusion is:
- talented_mod = 1..2 depending on your Weapon Combat talent (0..10)
- power = weapon power + extra power (innate, from other items, from talents...)
- assuming that you compute the damage of a weapon, power = (math.sqrt(weapon power / 10) - 1) * 0.8 + 1 (jeez...)
- totstat = weapon Str multiplier * Str / 100 + weapon Dex multiplier * Dex / 100
- weapon damage = talented_mod * power * totstat / 2

Need to pull an example here...
* no skills in weapon
* dagger (power = 40, 45% Str, 45% Dex)
* 50 Str 50 Dex
weapon damage = 1 * 1.8 * 45 / 2 = 40.5 (roughly the weapon power!?)

Strange...

Canderel
Sher'Tul
Posts: 1252
Joined: Mon Nov 24, 2003 2:31 pm
Location: South Africa

Re: Weapon damage

#7 Post by Canderel »

Ok... but don't forget armor and armor piercing... Which I *think* is a %reduction (straight reduction?), and armor piercing just effectively reduces the armor rating.

Armor = 10
APR = 6

"total armor for that attack" = 4

Massimiliano Marangio
Sher'Tul
Posts: 1120
Joined: Mon Sep 30, 2002 9:52 pm
Location: Germany

Re: Weapon damage

#8 Post by Massimiliano Marangio »

The stat sum (totstat) is the base damage that is later modified by a bunch of (small) factors.
With a weapon [Str:100%], Strength is the base damage. A mage staff has [Mag:100%], so Magic stat is the base damage.

The factor talented_mod is calculated from the mastery level with the weapon (Weapon/Staff/Knife Mastery):
1.0 (+0%) with a talent level 0,
1.31 (+31%) with a talent level of 1,
1.36 (+36%) with a talent level of 1.3 (e.g. a fighter with a point in Weapon Mastery)
up to
2.0 (+100%) with a talent level of 10 (10x1.0),
2.14 (+114%) with a talent level of 13 (10x1.3) (e.g. a fighter with 10 points in Weapon Mastery),
2.22 (+122%) with a talent level of 15 (10x1.5) (e.g. a fighter with 10 points in Weapon Mastery that also used a category point).

The factor power is calculated from the sum of the power of the weapon (e.g. 30 for Bill's Trunk), the bonus to physical power from equipment (e.g. +5 for Choker of the Dead, or the new bonus of "massacre" weapons), as well as from Arcane Destruction (+Spellpower*talent level/9) and Bloody Frenzy (+2*talent level per foe killed, decreases with time).

The factor power is around
1.0 if the sum is 10,
1.3 if the sum is 20,
1.6 if the sum is 30,
1.8 if the sum is 40,
2.0 if the sum is 50,
2.15 if the sum is 60,
2.3 if the sum is 70, and so on.

Extreme example: http://te4.org/characters/894/tome/282f ... 1cc000edf0

totstat is 126 (Str 105 * 120% for the sword)
talented_mod is 2.05 (based on Weapon Mastery 11 = 10x1.1)
power is 3.45, based on the sum 61 (sword) + 17 (equipment) + 86.7 (Arcane Destruction 120*6.5/9) = 164.7 (this could be even higher if he killed foes while Bloody Frenzy is active)
which gives a base damage of 126*2.05*3.45/2 = 445 as shown in the sheet.

Hirumakai
Thalore
Posts: 192
Joined: Wed Aug 11, 2010 2:39 pm

Re: Weapon damage

#9 Post by Hirumakai »

Highest I had Hiruma Kage's (your extreme example) damage listing was 1070 on the Valley of the Moon quest fighting demons. Pretty much the most useful place for Blood Frenzy. One swing of auto-hit killed a few big U's that fight. :D

Postman
Archmage
Posts: 335
Joined: Fri Dec 03, 2010 5:34 pm

Re: Weapon damage

#10 Post by Postman »

Lethality talent say it replace Str with cunning for knifes. How does it work? Does Strength affect knifes at all with lethality talent?

greycat
Sher'Tul
Posts: 1396
Joined: Tue May 11, 2010 11:51 pm

Re: Weapon damage

#11 Post by greycat »

Cunning is used in place of Strength in the formula if you possess the Lethality talent and are using a knife. Strength is therefore not used at all under those conditions.

I'm still hoping some grand wizard of Lua will come out with a full-blown example showing EVERY number that goes into the black box, and all the results coming out, and how the results got that way.

The inputs that I know of are:
  • Your stats (Str and Dex are most common; Cun is used for Lethality/knives, and slings; Wil/Cun for psi combat).
  • The weapon's base power and variability range.
  • Your Weapon Mastery (or Knife Mastery or Bow/Sling Mastery) talent level. Hopefully effective, not raw....
  • Bonus "physical power" from equipment.
  • Arcane Destruction and Blood Frenzy talent levels or counters or something...?
  • The target's Armour and your APR.
  • For critical hits, your chance of scoring a critical hit, and your critical hit bonus damage.
  • Your +physical% and/or +all% damage boosters (assuming physical damage).
  • The target's physical resistance.
  • Elemental damage bonuses from equipment/talents, and the target's elemental resistances.
And that's just for a regular attack (or Shoot). There would be additional inputs if you're using some sort of talent that affects the damage.

Sirrocco
Sher'Tul
Posts: 1059
Joined: Fri Apr 23, 2010 4:56 am

Re: Weapon damage

#12 Post by Sirrocco »

What would be useful to me is "things going in here, have this effect coming out."

For example, what I *think* is happening, based on what's been written here and as much as I know...

Assuming that your weapon is entirely strength-based.

- doubling your strength will double your effective damage on a 0 armor enemy, regardless of what else is going on.
- the weapon mastery percentage is, effectively, multiplied into your strength for this purpose.
- bonus "physical power" is added to your weapon's physical power to determine total physical power for the swing.
- physical power itself has diminishing returns. doubling your physical power will not, in fact, double your total damage output. I've seen the equations for this, but that doesn't mean I fully understand them. Presumably, variability fits in here somewhere?
- elemental damage bonuses are added on in an entirely separate calculation - you add your extra elemental damage, multiply it by your elemental damage bonus, do something with respect to armor(?) and apply target elemental resistance.

- I have no idea where bonus damage from attack skills comes in
- I have no idea how precisely armor and armor-piercing work.
- I suspect that +% physical damage modifiers from gear are another independent multiplier, and that going from 0% extra physical damage to +100% extra physical damage will double your effective damage on a 0 armor enemy, but I don't know that for sure.
- I don't really know how crits fit into this.
- I believe that physical resistance is a straight multiplier - 50% physical resistance on a 0 armor enemy will cut your damage in half as compared to 0% resistance

...now, this is rather significantly different from how I *thought* it worked, back before this thread started, so I'm not exactly confident that I have it this time, but that's about where I am, personally. Anyone who understands it better and has corrections to offer to this poor, unenlightened soul, would indeed be appreciated.

Hirumakai
Thalore
Posts: 192
Joined: Wed Aug 11, 2010 2:39 pm

Re: Weapon damage

#13 Post by Hirumakai »

Sirrocco wrote: Assuming that your weapon is entirely strength-based.

- doubling your strength will double your effective damage on a 0 armor enemy, regardless of what else is going on.
From the code snippet DG posted earlier, we see that totstat get multiplied in directly into the final damage (no square roots or additions or substractions) so that damage will always scale linearly with the damage stats, which in your example is strength. So yes, doubling strength will double your damage against a 0 armor enemy.
Sirrocco wrote: - the weapon mastery percentage is, effectively, multiplied into your strength for this purpose.
From DG's post, we see talented_mod, which is your weapon mastery percentage is also directly multiplied in the last step, so yes you could consider it simply multiplying your strength.
Sirrocco wrote: - bonus "physical power" is added to your weapon's physical power to determine total physical power for the swing.
- physical power itself has diminishing returns. doubling your physical power will not, in fact, double your total damage output. I've seen the equations for this, but that doesn't mean I fully understand them. Presumably, variability fits in here somewhere?
Physical power, your weapon's base physical power, and so forth (such as from Arcane Destruction or Bloodlust) all get added together then a square root gets taken. So if you double the value, you only get roughly a factor of 1.4 increase, so yes diminishing returns.

Interestingly, the damage range gets multiplied in *after* base damage is calculated and *after* armor have been taken into account.

So the weapon display simply showing min to max damage is very misleading, since the base power has a square root taken, while the damage range gets multiplied on top of the final damage. I'd almost go as far to say the damage listing after a weapons name (61.5-98.4 power or whatever) is simply incorrect. The listing where it goes Power 61 [Range 1.6](+120% Strength) is a more accurate representation, where the various components are separated out. The relevant code can be seen below.

Code: Select all

elseif self:checkHit(atk, def) then
		print("[ATTACK] raw dam", dam, "versus", armor, "with APR", apr)
		dam = math.max(0, dam - math.max(0, armor - apr))
		local damrange = self:combatDamageRange(weapon)
		dam = rng.range(dam, dam * damrange)
		print("[ATTACK] after range", dam)
		dam, crit = self:physicalCrit(dam, weapon, target)
		print("[ATTACK] after crit", dam)
		dam = dam * mult
		print("[ATTACK] after mult", dam)
		if crit then game.logSeen(self, "%s performs a critical strike!", self.name:capitalize()) end
		DamageType:get(damtype).projector(self, target.x, target.y, damtype, math.max(0, dam))
		hitted = true
Sirrocco wrote: - elemental damage bonuses are added on in an entirely separate calculation - you add your extra elemental damage, multiply it by your elemental damage bonus, do something with respect to armor(?) and apply target elemental resistance.
This code snippet comes after the above one (with spread diseases in between). As far as I can tell, this goes through all the "on hit melee" damage effects and applies them. They appear to ignore armor, since there's no armor calculation in it, just a straight up application of damage. The damage type multiplier bonuses (i.e. Physical, Fire, etc) get applied by projector function (as well as handling damage resistance). Damage gets multiplied by bonus (1+damage bonus/100), then by multiplied by (100-resistance)/100.

Code: Select all

-- Melee project
	if hitted and not target.dead and weapon.melee_project then for typ, dam in pairs(weapon.melee_project) do
		if dam > 0 then
			DamageType:get(typ).projector(self, target.x, target.y, typ, dam)
		end
	end end
	if hitted and not target.dead then for typ, dam in pairs(self.melee_project) do
		if dam > 0 then
			DamageType:get(typ).projector(self, target.x, target.y, typ, dam)
		end
	end end
Sirrocco wrote: - I have no idea where bonus damage from attack skills comes in
When a talent gets used, say Death Dance, it calles the attackTargetWith function. At that stage it passes along a damage multiplier, which gets assigned to "mult". In the first code snippet I provided, mult multiplies the final damage just before the crit stage. So it directly increases final damage.
Sirrocco wrote: - I have no idea how precisely armor and armor-piercing work.
Armor directly subtracts from base damage, and armor piercing directly reduces armor, to a minimum of zero. This can be seen on the 3rd line of the 1st code snippet.
Sirrocco wrote: - I suspect that +% physical damage modifiers from gear are another independent multiplier, and that going from 0% extra physical damage to +100% extra physical damage will double your effective damage on a 0 armor enemy, but I don't know that for sure.
This is correct. It gets applied by the projector function, same as elemental damage bonuses.
Sirrocco wrote: - I don't really know how crits fit into this.
There's a bunch of talents and effects that calculate your crit change, then it basically rolls against that to see if it happens (you must have already rolled to hit to get to this point - this a completely separate check after that). The crit damage is then calculated from the following. Basically 50% more damage unless you have special talents.

Code: Select all

if rng.percent(chance) then
		dam = dam * (1.5 + (self.combat_critical_power or 0) / 100)
		crit = true
	end
	return dam, crit
Sirrocco wrote: - I believe that physical resistance is a straight multiplier - 50% physical resistance on a 0 armor enemy will cut your damage in half as compared to 0% resistance
This is correct. The multiplier is (100-resistance)/100.

I may try making a full example going through each line of code later tonight.

Sirrocco
Sher'Tul
Posts: 1059
Joined: Fri Apr 23, 2010 4:56 am

Re: Weapon damage

#14 Post by Sirrocco »

Thank you, Hirumakai, and thanks to all the rest of you as well. This will certainly improve my gear selection.

So (again, as far as I can tell) rider damage is not affected by armor, but if your base damage is of an elemental damage type (say, because you're swinging a staff, or because you happen to be a dragon) then armor gets applied to that. Does the rider damage still kick in if armor reduces the base damage below zero?

Also, just for clarity, by my understanding of what you're saying, you run all of the multipliers except for the variance(stat, skill, mastery, etc), then subtract armor (modified by armor penetration), then check the variance, then apply target resistance at the end. Among other things, this would mean that armor penetration was a bit anemic - the approximate equivalent of added damage. It also means that pretty much any multiplier you have (other than extra attacks) helps get over that armor threshold. Odd that attack power is the only multiplier with diminishing returns.

Does spell damage also double when you double the controlling stat?

HesDeadJim
Wayist
Posts: 20
Joined: Wed Feb 02, 2011 5:51 pm

Re: Weapon damage

#15 Post by HesDeadJim »

Sirrocco wrote:Does the rider damage still kick in if armor reduces the base damage below zero?
This is a definite yes, there have been a number of times I've had to beat a headless physical immune guy to death using the +1 light damage off my belt while my 200+ damage swings were negated.

Post Reply