Closed 69sinisterblade69 closed 1 year ago
example to using damagelib
local damagelib = module.internal('damagelib')
-- target is practice_tool_dummy
local g_target = nil
for i=0, objManager.enemies_n-1 do
g_target = objManager.enemies[i]
break
end
print('AA damage', damagelib.calc_aa_damage(player, g_target, true))
print('Q damage', damagelib.get_spell_damage('XerathArcanopulseChargeUp', 0, player, g_target, false, 0))
print('W1 damage', damagelib.get_spell_damage('XerathArcaneBarrage2', 1, player, g_target, false, 0))
print('W2 damage', damagelib.get_spell_damage('XerathArcaneBarrage2', 1, player, g_target, false, 1))
damage calculation for Shadowflame/FirstStrike will be fixed soon
[Not visible in screenshots and not present in code but I also tested player:spellSlot():getDamage() and damagelib.get_spell_damage("XerathArcanopulseChargeUp", 0, player, resQ.object, false, 0) and was getting the same result as damagelib.calc_magical_damage(), so all points against it also stand against those]
Relevant pieces of code.
In q.damage() damagelib.get_spell_damage() i'm using player as both source and target as a workaround to get raw damage, because I'm not sure what's the correct way to do that and I can't just pass nil as a target (I think it may be spell_slot:calculate(spellNameHash, calculationHash), but I didn't want to deal with hashes, and the output is still correct [or it's +-1 damage off, not sure how rounding should work in this case, which is insignificant in this example])
Target dummy has 200 magic resist
As you can see q.damage() * common.MagicReduction() calculates damage correctly (61) but damagelib.calc_magical_damage() doesn't (57).
I understand if you don't want to add items damage like Luden or Night harvester to damagelib.calc_magical_damage() or player:spellSlot():getDamage() or any other damage calc function but I think maybe exception should be made for items like Shadowflame as it only changes magic penetration and doesn't have cooldown or horizon focus (Im not expecting it to tell me if that skill will activate it but at least take it into account once target has its buff as it is active for 6 seconds)