]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace medic's teamshoot healing ability with a nearby player healing function
authorMario <mario@smbclan.net>
Fri, 15 Jan 2016 14:13:55 +0000 (00:13 +1000)
committerMario <mario@smbclan.net>
Fri, 15 Jan 2016 14:13:55 +0000 (00:13 +1000)
mutators.cfg
qcsrc/common/mutators/mutator/buffs/buffs.qc

index 5eaa0ad17f6641181b6df34bdb28229694c97c2e..e06e8572457c12e54586453255ef38bc207154af 100644 (file)
@@ -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"
index 117d2dbaa5d6bfc13cc81867df9f8a643a30e621..507041e0603bd4a784fdc64b1e4cb16634a0b56d 100644 (file)
@@ -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))