]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Tweak resistance buff to reduce damage after most other calculations (and to also...
authorMario <mario@smbclan.net>
Fri, 19 May 2017 22:35:35 +0000 (08:35 +1000)
committerMario <mario@smbclan.net>
Fri, 19 May 2017 22:35:51 +0000 (08:35 +1000)
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc

index 461fb35afce438ed7bec3b3e590338a1c50c1437..032ecff0a0d78b844d0f195f379916ddd441e520 100644 (file)
@@ -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;