]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make vampire buff and vampire PlayerDamage_SplitHealthArmor code style similar
authorterencehill <piuntn@gmail.com>
Thu, 27 May 2021 15:53:39 +0000 (17:53 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 27 May 2021 15:53:39 +0000 (17:53 +0200)
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/vampire/sv_vampire.qc

index 6fa6e8d054c50785a5971e02e685d6e98bacabcc..3433aad9db634f0e4513d860e519ac807b7c480b 100644 (file)
@@ -532,19 +532,17 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor)
 {
+       // NOTE: vampire PlayerDamage_SplitHealthArmor code is similar
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
        if(!(STAT(BUFFS, frag_attacker) & BUFF_VAMPIRE.m_itemid))
                return;
        float health_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
 
-       if(time >= frag_target.spawnshieldtime &&
-               frag_target != frag_attacker &&
-               IS_PLAYER(frag_attacker) &&
-               !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
+       if (time >= frag_target.spawnshieldtime && frag_target != frag_attacker
+               && IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
        {
-               GiveResource(frag_attacker, RES_HEALTH,
-                       autocvar_g_buffs_vampire_damage_steal * health_take);
+               GiveResource(frag_attacker, RES_HEALTH, autocvar_g_buffs_vampire_damage_steal * health_take);
        }
 }
 
index 77b95d4c5e34a5ebeae3fc043595f511585f432d..5b4c33e7bf02052fb48e66e99a4afdbd6f9e6a45 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_MUTATOR(vampire, expr_evaluate(autocvar_g_vampire) && !MUTATOR_IS_ENABL
 
 MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
 {
+       // NOTE: vampire buff PlayerDamage_SplitHealthArmor code is similar
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
        float health_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
@@ -17,8 +18,7 @@ MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
        if (time >= frag_target.spawnshieldtime && frag_target != frag_attacker
                && IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target))
        {
-               GiveResource(frag_attacker, RES_HEALTH,
-                       autocvar_g_vampire_factor * damage_take);
+               GiveResource(frag_attacker, RES_HEALTH, autocvar_g_vampire_factor * damage_take);
        }
 }