Bonus DPS mod (MOD_DPS_ADD) calculation not consistent with original YouTD
Closed this issue · 6 comments
DPS mod uses current attack speed which is inconsistent with original YouTD that used base attack speed. It is also annoying when playing knowing that your attack speed bonuses 'work against' your damage per hit (after I've discovered that).
Lines 1113 to 1118 in 48ce267
Another layer of inconsistency is that resulting bonus damage from DPS * base_attack_speed calculation was added to "damage add" originally so it was affected by "damage add %" bonuses, while here it is not affected.
Here's example of DPS mod and damage add % on a tower: 450 dps add * 1.6 base attack speed = 720 damage add. And +5% from damage add % also applied on top of it which is confirmed by calculating ((1076*0.91) + 720) * 1.05 ~= 1784.
In order to replicate original functionality that code could look like:
var dps_bonus: float = get_dps_bonus()
var attack_speed: float = get_base_attack_speed()
var dps_mod: float = dps_bonus * attack_speed
var overall_base_damage: float = (base_damage + base_bonus) * base_bonus_percent
var overall_damage: float = (overall_base_damage + damage_add + dps_mod) * damage_add_percent
I'm not aware of other places in the code that would need to be modified. All this is relevant unless that change is intentional. If it is intentional - it feels sort of wrong for someone who played YouTD for years.
Thanks for your time!
This is not intentional, it's a mistake. The goal is to have same combat logic as original YouTD so these issues should be fixed.
DPS mod uses current attack speed which is inconsistent with original YouTD that used base attack speed.
Confirmed that behavior in original game is as described. Check JASS code from original game below.
function Xcv takes integer D0,integer P6,real k5 returns nothing
...
if(P6==5)then
// k5 is value of MOD_DPS_ADD
// dC[cL[D0]] is base attack cooldown
set P6=3
set k5=k5*dC[cL[D0]]
endif
Another layer of inconsistency is that resulting bonus damage from DPS * base_attack_speed calculation was added to "damage add" originally so it was affected by "damage add %" bonuses, while here it is not affected.
Confirmed that behavior in original game is as described.
// km = base damage and MOD_DAMAGE_BASE and MOD_DAMAGE_BASE_PERC
// sL[SL[D0]+3] = MOD_DAMAGE_ADD and "dmg bonus from MOD_DPS_ADD"
// sL[SL[D0]+4] = MOD_DAMAGE_ADD_PERC
set Km=R2I((km+sL[SL[D0]+3])*(1+sL[SL[D0]+4])-km)
call vLv(bL[D0],0,vm[xm[D0]+3],Km)
set vm[xm[D0]+3]=Km
Thank you for such quick fix!
One more point to look for (idk how current build works): the multiboard for tower could show damage add (flat) coming from DPS increases aswell - as it is the case in original game (the screenshot with Skilled Witch that I provided) and I suspect that it will not be the case given the scope of those updates (I assume it will use only "damage_add" property from tower and not "damage add" + "DPS add * base attack speed").
I just thought about it and maybe even this part could be removed from damage calculation:
Lines 1113 to 1115 in b879e2e
and become a part of this function (it would combine "static" damage add and DPS damage add without the need to include DPS bonuses in the formula):
Line 1771 in b879e2e
or a similar function i.e. "get_total_damage_add".
It then could possibly correctly display in the multiboard too I assume (without code duplication for calculation of DPS related bonus).
That's just a suggestion - I'm not aware of all consequences of such modifications, thanks again for your time!
Thank you for such quick fix!
One more point to look for (idk how current build works): the multiboard for tower could show damage add (flat) coming from DPS increases aswell - as it is the case in original game (the screenshot with Skilled Witch that I provided) and I suspect that it will not be the case given the scope of those updates (I assume it will use only "damage_add" property from tower and not "damage add" + "DPS add * base attack speed").
Oh yeah, you're right. Original game does display "Damage add" stat as "damage add" + "bonus from MOD_DPS". Will fix that.
Addressed here: 3d51efd