]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Derive inferno buff burn time from an increasing exponential decay curve
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 10 Feb 2015 02:23:26 +0000 (13:23 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 10 Feb 2015 02:23:26 +0000 (13:23 +1100)
mutators.cfg
qcsrc/server/autocvars.qh
qcsrc/server/mutators/mutator_buffs.qc
qcsrc/warpzonelib/mathlib.qc
qcsrc/warpzonelib/mathlib.qh

index 4d051f83bc8579b37f205db823207dec100a736f..e99dafa864087804c552ef9074a9dd06b8be2df7 100644 (file)
@@ -318,5 +318,7 @@ set g_buffs_flight_gravity 0.3 "player gravity multiplier while holding flight b
 set g_buffs_invisible 1 "invisible buff: carrier becomes invisible"
 set g_buffs_invisible_alpha 0.4 "player invisibility multiplier while holding invisible buff"
 set g_buffs_inferno 1 "inferno buff: targets damaged by player carrying inferno buff will also receive burning damage"
-set g_buffs_inferno_burntime 1.5 "burning time of damaged target"
 set g_buffs_inferno_damagemultiplier 0.25 "multiplier of damage dealt during burn"
+set g_buffs_inferno_burntime_factor 2 "burn time logarithm base. 0 < x < 1: increasing, x > 1: increasing"
+set g_buffs_inferno_burntime_target_damage 150 "damage required for g_buffs_inferno_burntime_target_time seconds of burn"
+set g_buffs_inferno_burntime_target_time 5 "seconds of burn given g_buffs_inferno_burntime_target_damage damage"
index 673d84dfdc5464edf1a074d43302e709c9680485..77a6b1fe7722d955ca525a1f814a6934b45b4a29 100644 (file)
@@ -882,6 +882,8 @@ float autocvar_g_buffs_vampire_damage_steal;
 float autocvar_g_buffs_invisible_alpha;
 float autocvar_g_buffs_flight_gravity;
 float autocvar_g_buffs_jump_height;
-float autocvar_g_buffs_inferno_burntime;
+float autocvar_g_buffs_inferno_burntime_factor;
+float autocvar_g_buffs_inferno_burntime_target_damage;
+float autocvar_g_buffs_inferno_burntime_target_time;
 float autocvar_g_buffs_inferno_damagemultiplier;
 #endif
index 2171e6ed312bc9b429b93647c181002e31299bbf..73d60335ea1a6e35feba6753e5cbe0e2c6fff441 100644 (file)
@@ -373,6 +373,12 @@ void buff_Vengeance_DelayedDamage()
        return;
 }
 
+float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base)
+{
+       float f = (x - offset_x) / intersect_x;
+       return offset_y + (intersect_y - offset_y) * logn((base - 1) * (f + 1), base);
+}
+
 MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
 {
        if(frag_deathtype == DEATH_BUFF) { return false; }
@@ -429,8 +435,16 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
        }
 
        if(frag_attacker.buffs & BUFF_INFERNO)
-       if(frag_target != frag_attacker)
-               Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier) * autocvar_g_buffs_inferno_burntime, autocvar_g_buffs_inferno_burntime, DEATH_BUFF);
+       if(frag_target != frag_attacker) {
+               float time = buff_Inferno_CalculateTime(
+                       frag_damage,
+                       0, 0,
+                       autocvar_g_buffs_inferno_burntime_target_damage,
+                       autocvar_g_buffs_inferno_burntime_target_time,
+                       autocvar_g_buffs_inferno_burntime_factor
+               );
+               Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier) * time, time, DEATH_BUFF);
+       }
 
        // this... is ridiculous (TODO: fix!)
        if(frag_attacker.buffs & BUFF_VAMPIRE)
index d86af8a00ec786760c15a9440b525a7160d4a0ab..e702756265ad45367dee72293e50b0f3cee90b4e 100644 (file)
@@ -95,6 +95,10 @@ float ldexp(float x, int e)
 {
        return x * pow(2, e);
 }
+float logn(float x, float base)
+{
+       return log(x) / log(base);
+}
 float log10(float x)
 {
        return log(x) * M_LOG10E;
index a37ba63de6c63b87ed3dad63d12ea1ad4637fe52..fb12956d636602b8b9c056342316f5c37e6f835d 100644 (file)
@@ -41,6 +41,7 @@ vector frexp(float x); // returns mantissa as _x, exponent as _y
 int ilogb(float x);
 float ldexp(float x, int e);
 //float log(float x);
+float logn(float x, float base);
 float log10(float x);
 float log1p(float x);
 float log2(float x);