Skip to content

Scaling update melee

Hachem_Muche requested to merge Hachem_Muche/t-engine4:ScalingUpdateMelee into master

Updated some talents that were missing damage scaling. Renamed "Reshape Armor/Weapon" to "Form and Function" and slightly buffed it's weapon damage bonus. This bonus is added to weapon damage in Combat:combatDamage to prevent it from bypassing scaling functions.

Updated Combat:combatDamage to calculate its bonus from stats through Combat:combatPhysicalPower so that they receive the same scaling as Strength. Weapon damage range is applied BEFORE armor, to give the player an additional way to counteract high armor npc's at low level.

Analysis of Melee Damage Scaling (yay loose math!):

(Here O(n) refers to "big O" notation with respect to character level, assuming the character increases all stats and talent levels as fast as allowed. On this basis, O(1) is desirable, so that damage scales at the same rate (to a constant multiplier) of character level (and hit points, approximately).)

How damage is (before this patch) computed (code highlights):

Each melee attack calls Combat:attackTargetWith(target, weapon, damtype, mult, force_dam)

which calculates dam = Combat:combatDamage(weapon)

dam (after subtracting armor) is applied to the target after multipliers for damrange, crit, and mult are applied in order before being passed to the damage projector.

Key statements:

Combat:combatDamage(weapon):

totstat = sum of stats*dammod
talented_mod = 1 + self:combatTrainingPercentInc(weapon) -- from weapon talent --> O(1/2)
local power = self:combatDamagePower(damage or weapon)
	-- takes base weapon.dam (math.sqrt(power / 10) - 1) * 0.5 + 1

return self:rescaleDamage(0.3*(self:combatPhysicalpower(nil, weapon) + totstat) * power * talented_mod)

talented_mod is O(1/2), totstat is O(1), and the power variable is ~O(0), since, from the character's prespective, it is a near constant depending only on the weapon's object properties. (Once tier 5 gear is obtained it won't change much with level, except for the T_RESHAPE_WEAPON/ARMOUR talent, which is corrected in this patch.)

Combat:combatPhysicalpower(mod, weapon, add):

d = <a number of bonuses to weapon power (including weapon training damage) + str>
return self:rescaleCombatStats(d) * mod --> applies ~O(1/2) to all the bonuses

d is O(1), while mod is of unspecified order, but assumed ~O(0) if the calling talent is careful. rescaleCombatStats is ~O(1/2) with respect to d.

Therefore, the O(character_level) of weapon damage can be resolved as follows:

self:rescaleDamage(0.3*(self:combatPhysicalpower(nil, weapon) + totstat) * power * talented_mod)
						(    O(1/2)on(O(1))     		  +       O(1) ) *  O(0) *  O(1/2)
						(					O(1)					   ) *     O(1/2)

==> O(3/2) which is superlinear.

The solution applied with this patch is to pass totstat in combatDamage through combatPhysicalpower (and thus rescaleCombatStats) to reduce it's order to ~O(1/2).

This makes weapon damage ~O(1), or proportional to character level.

Merge request reports