From eb048ebb3df04d1c50b8df918a91b6145271a667 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 16 Jan 2016 00:13:55 +1000 Subject: [PATCH] Replace medic's teamshoot healing ability with a nearby player healing function --- mutators.cfg | 5 ++- qcsrc/common/mutators/mutator/buffs/buffs.qc | 35 +++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/mutators.cfg b/mutators.cfg index 5eaa0ad17f..e06e857245 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -304,8 +304,11 @@ set g_buffs_medic_time 60 "medic buff carry time" set g_buffs_medic_survive_chance 0.6 "multiplier chance of player surviving a fatal hit" set g_buffs_medic_survive_health 5 "amount of health player survives with after taking a fatal hit" set g_buffs_medic_rot 0.2 "health rot rate multiplier" -set g_buffs_medic_max 2.5 "stable health medic limit multiplier" +set g_buffs_medic_max 1.5 "stable health medic limit multiplier" set g_buffs_medic_regen 1.7 "health medic rate multiplier" +set g_buffs_medic_heal_amount 15 "health given to nearby players on a delay" +set g_buffs_medic_heal_range 400 "furthest away players can be from carrier to get healed by medic buff" +set g_buffs_medic_heal_delay 1 "delay between team healing" set g_buffs_vengeance 1 "vengeance buff: attackers also take damage" set g_buffs_vengeance_time 60 "vengeance buff carry time" set g_buffs_vengeance_damage_multiplier 0.6 "amount of damage dealt the attacker takes when hitting a target with vengeance" diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 117d2dbaa5..507041e060 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -19,6 +19,9 @@ float autocvar_g_buffs_medic_survive_health; float autocvar_g_buffs_medic_rot; float autocvar_g_buffs_medic_max; float autocvar_g_buffs_medic_regen; +float autocvar_g_buffs_medic_heal_amount = 15; +float autocvar_g_buffs_medic_heal_delay = 1; +float autocvar_g_buffs_medic_heal_range = 400; float autocvar_g_buffs_vengeance_damage_multiplier; float autocvar_g_buffs_bash_force; float autocvar_g_buffs_bash_force_self; @@ -50,6 +53,8 @@ float autocvar_g_buffs_magnet_range_item; .float buff_invisible_prev_alpha; // flight .float buff_flight_prev_gravity; +// medic +.float buff_medic_healtime; // disability .float buff_disability_time; .float buff_disability_effect_time; @@ -490,6 +495,20 @@ void buff_Vengeance_DelayedDamage() return; } +// note: only really useful in teamplay +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) + { + 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); + } + }); +} + float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base) { return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base); @@ -558,15 +577,6 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate) if(frag_target != frag_attacker) frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime; - if(frag_attacker.buffs & BUFF_MEDIC.m_itemid) - if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC) - if(SAME_TEAM(frag_attacker, frag_target)) - if(frag_attacker != frag_target) - { - frag_target.health = min(g_pickup_healthmega_max, frag_target.health + frag_damage); - frag_damage = 0; - } - if(frag_attacker.buffs & BUFF_INFERNO.m_itemid) if(frag_target != frag_attacker) { float time = buff_Inferno_CalculateTime( @@ -890,6 +900,13 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) if(self.alpha != autocvar_g_buffs_invisible_alpha) self.alpha = autocvar_g_buffs_invisible_alpha; // powerups reset alpha, so we must enforce this (TODO) + if(self.buffs & BUFF_MEDIC.m_itemid) + if(time >= self.buff_medic_healtime) + { + buff_Medic_Heal(self); + self.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay; + } + #define BUFF_ONADD(b) if ( (self.buffs & (b).m_itemid) && !(self.oldbuffs & (b).m_itemid)) #define BUFF_ONREM(b) if (!(self.buffs & (b).m_itemid) && (self.oldbuffs & (b).m_itemid)) -- 2.39.2