From acf51ab29c0a34bce5af26f21b058fc65423beb0 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 20 May 2017 08:35:35 +1000 Subject: [PATCH] Tweak resistance buff to reduce damage after most other calculations (and to also be separate from regular armor blocking) --- .../common/mutators/mutator/buffs/sv_buffs.qc | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 461fb35af..032ecff0a 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -437,22 +437,6 @@ float buff_Inferno_CalculateTime(float damg, float offset_x, float offset_y, flo } // mutator hooks -MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor) -{ - entity frag_target = M_ARGV(2, entity); - float frag_deathtype = M_ARGV(6, float); - float frag_damage = M_ARGV(7, float); - - if(frag_deathtype == DEATH_BUFF.m_id) { return; } - - if(frag_target.buffs & BUFF_RESISTANCE.m_itemid) - { - vector v = healtharmor_applydamage(50, autocvar_g_buffs_resistance_blockpercent, frag_deathtype, frag_damage); - M_ARGV(4, float) = v.x; // take - M_ARGV(5, float) = v.y; // save - } -} - MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) { entity frag_attacker = M_ARGV(1, entity); @@ -463,6 +447,12 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) if(frag_deathtype == DEATH_BUFF.m_id) { return; } + if(frag_target.buffs & BUFF_RESISTANCE.m_itemid) + { + float reduced = frag_damage * autocvar_g_buffs_resistance_blockpercent; + frag_damage = bound(0, frag_damage - reduced, frag_damage); + } + if(frag_target.buffs & BUFF_SPEED.m_itemid) if(frag_target != frag_attacker) frag_damage *= autocvar_g_buffs_speed_damage_take; -- 2.39.2