From: terencehill Date: Thu, 27 May 2021 15:53:39 +0000 (+0200) Subject: Make vampire buff and vampire PlayerDamage_SplitHealthArmor code style similar X-Git-Tag: xonotic-v0.8.5~405^2~28 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=287de7c2d29d39f6d14698c08a324230d4978175;p=xonotic%2Fxonotic-data.pk3dir.git Make vampire buff and vampire PlayerDamage_SplitHealthArmor code style similar --- diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 6fa6e8d05..3433aad9d 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -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); } } diff --git a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc index 77b95d4c5..5b4c33e7b 100644 --- a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc +++ b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc @@ -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); } }