]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add damage/force multipliers to keyhunt k9er/implement-2608 1431/head
authorotta8634 <k9wolf@pm.me>
Sun, 9 Mar 2025 11:07:57 +0000 (19:07 +0800)
committerotta8634 <k9wolf@pm.me>
Tue, 1 Apr 2025 10:58:52 +0000 (18:58 +0800)
Implemented the same way as for ka/tka.
Multipliers are 1 by default.

gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc

index 27778c755fe12dfc66a4ba0ee97a3538a3d46820..9f40ccd7ab63292b229bbfcea0cc298c7f7d923d 100644 (file)
@@ -468,6 +468,10 @@ set g_balance_keyhunt_score_capture 100
 set g_balance_keyhunt_score_push 60
 set g_balance_keyhunt_score_destroyed 50
 set g_balance_keyhunt_score_destroyed_ownfactor 1
+set g_balance_keyhunt_carrier_damage   "1 1 1" "damage multiplier of key carriers; to themselves (X), to other carriers (Y), to noncarriers (Z)"
+set g_balance_keyhunt_carrier_force    "1 1 1" "force multiplier of key carriers; to themselves (X), to other carriers (Y), to noncarriers (Z)"
+set g_balance_keyhunt_noncarrier_damage        "1 1 1" "damage multiplier of players who don't have a key; to themselves (X), to carriers (Y), to other noncarriers (Z)"
+set g_balance_keyhunt_noncarrier_force "1 1 1" "force multiplier of players who don't have a key; to themselves (X), to carriers (Y), to other noncarriers (Z)"
 set g_balance_keyhunt_dropvelocity 300
 set g_balance_keyhunt_throwvelocity 400
 set g_balance_keyhunt_protecttime 0.8
index 85814dfecdc21a35b6756e352629c8c8dba635b2..c0bb9aedfc6b3b2592c8f99baad390e60501ae20 100644 (file)
@@ -18,6 +18,11 @@ float autocvar_g_balance_keyhunt_dropvelocity;
 float autocvar_g_balance_keyhunt_maxdist;
 float autocvar_g_balance_keyhunt_protecttime;
 
+vector autocvar_g_balance_keyhunt_carrier_damage;
+vector autocvar_g_balance_keyhunt_carrier_force;
+vector autocvar_g_balance_keyhunt_noncarrier_damage;
+vector autocvar_g_balance_keyhunt_noncarrier_force;
+
 int autocvar_g_balance_keyhunt_score_capture;
 int autocvar_g_balance_keyhunt_score_carrierfrag;
 int autocvar_g_balance_keyhunt_score_collect;
@@ -1226,6 +1231,53 @@ void havocbot_role_kh_freelancer(entity this)
 
 // register this as a mutator
 
+MUTATOR_HOOKFUNCTION(kh, Damage_Calculate) // for changing damage and force values that are applied to players
+{
+       entity frag_attacker = M_ARGV(1, entity);
+       entity frag_target = M_ARGV(2, entity);
+
+       // as a gamemode rule, only apply scaling to player versus player combat
+       if (!IS_PLAYER(frag_attacker) || !IS_PLAYER(frag_target))
+               return;
+
+       if (frag_attacker.kh_next != NULL) // if the attacker is a key carrier
+       {
+               if (frag_target == frag_attacker) // damage done to themselves
+               {
+                       M_ARGV(4, float) *= autocvar_g_balance_keyhunt_carrier_damage.x;
+                       M_ARGV(6, vector) *= autocvar_g_balance_keyhunt_carrier_force.x;
+               }
+               else if (frag_target.kh_next != NULL) // damage done to other key carriers
+               {
+                       M_ARGV(4, float) *= autocvar_g_balance_keyhunt_carrier_damage.y;
+                       M_ARGV(6, vector) *= autocvar_g_balance_keyhunt_carrier_force.y;
+               }
+               else // damage done to noncarriers
+               {
+                       M_ARGV(4, float) *= autocvar_g_balance_keyhunt_carrier_damage.z;
+                       M_ARGV(6, vector) *= autocvar_g_balance_keyhunt_carrier_force.z;
+               }
+       }
+       else
+       {
+               if (frag_target == frag_attacker) // damage done to themselves
+               {
+                       M_ARGV(4, float) *= autocvar_g_balance_keyhunt_noncarrier_damage.x;
+                       M_ARGV(6, vector) *= autocvar_g_balance_keyhunt_noncarrier_force.x;
+               }
+               else if (frag_target.kh_next != NULL) // damage done to key carriers
+               {
+                       M_ARGV(4, float) *= autocvar_g_balance_keyhunt_noncarrier_damage.y;
+                       M_ARGV(6, vector) *= autocvar_g_balance_keyhunt_noncarrier_force.y;
+               }
+               else // damage done to other noncarriers
+               {
+                       M_ARGV(4, float) *= autocvar_g_balance_keyhunt_noncarrier_damage.z;
+                       M_ARGV(6, vector) *= autocvar_g_balance_keyhunt_noncarrier_force.z;
+               }
+       }
+}
+
 MUTATOR_HOOKFUNCTION(kh, ClientDisconnect)
 {
        entity player = M_ARGV(0, entity);