From 0340413a658e18c8240b19b5e7e105b1473a1c40 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Tue, 29 Aug 2017 01:22:43 +0300 Subject: [PATCH] URS: Ported Buffs mutator to URS. --- .../common/mutators/mutator/buffs/sv_buffs.qc | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 925525f39..7038f01ff 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -424,12 +424,17 @@ void buff_Medic_Heal(entity this) { FOREACH_CLIENT(IS_PLAYER(it) && it != this && vdist(it.origin - this.origin, <=, autocvar_g_buffs_medic_heal_range), { - if(SAME_TEAM(it, this)) - if(it.health < autocvar_g_balance_health_regenstable) + if (!SAME_TEAM(it, this)) { - Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); - it.health = bound(0, it.health + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable); + continue; } + float hp = GetResourceAmount(it, RESOURCE_HEALTH); + if(hp >= autocvar_g_balance_health_regenstable) + { + continue; + } + Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); + SetResourceAmount(it, RESOURCE_HEALTH, bound(0, hp + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable)); }); } @@ -460,11 +465,11 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) frag_damage *= autocvar_g_buffs_speed_damage_take; if(frag_target.buffs & BUFF_MEDIC.m_itemid) - if((frag_target.health - frag_damage) <= 0) + if((GetResourceAmount(frag_target, RESOURCE_HEALTH) - frag_damage) <= 0) if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) if(frag_attacker) if(random() <= autocvar_g_buffs_medic_survive_chance) - frag_damage = max(5, frag_target.health - autocvar_g_buffs_medic_survive_health); + frag_damage = max(5, GetResourceAmount(frag_target, RESOURCE_HEALTH) - autocvar_g_buffs_medic_survive_health); if(frag_target.buffs & BUFF_JUMP.m_itemid) if(frag_deathtype == DEATH_FALL.m_id) @@ -537,7 +542,8 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) if(frag_target.takedamage) if(DIFF_TEAM(frag_attacker, frag_target)) { - frag_attacker.health = bound(0, frag_attacker.health + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.health), g_pickup_healthsmall_max); + float hp = GetResourceAmount(frag_attacker, RESOURCE_HEALTH); + SetResourceAmount(frag_attacker, RESOURCE_HEALTH, bound(0, hp + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, GetResourceAmount(frag_target, RESOURCE_HEALTH)), g_pickup_healthsmall_max)); if(frag_target.armorvalue) frag_attacker.armorvalue = bound(0, frag_attacker.armorvalue + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.armorvalue), g_pickup_armorsmall_max); } -- 2.39.2