From: Mario Date: Fri, 19 May 2017 22:35:35 +0000 (+1000) Subject: Tweak resistance buff to reduce damage after most other calculations (and to also... X-Git-Tag: xonotic-v0.8.5~2773 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=acf51ab29c0a34bce5af26f21b058fc65423beb0;p=xonotic%2Fxonotic-data.pk3dir.git Tweak resistance buff to reduce damage after most other calculations (and to also be separate from regular armor blocking) --- 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;