]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fine tune enemy rating
authorterencehill <piuntn@gmail.com>
Sat, 21 Jan 2017 18:04:49 +0000 (19:04 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 21 Jan 2017 18:04:49 +0000 (19:04 +0100)
qcsrc/server/bot/default/havocbot/roles.qc

index ebdca2d8923d215dde55c6bc74a05f0180074bc8..1efdab0d3433212936ed61e5a9176b64889ee65a 100644 (file)
@@ -121,6 +121,7 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
        });
 }
 
+#define BOT_RATING_ENEMY 2500
 void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
 {
        if (autocvar_bot_nofire)
@@ -130,6 +131,8 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
        if(this.waterlevel>WATERLEVEL_WETFEET)
                return;
 
+       ratingscale = ratingscale * 0.00005; // enemies are rated around 20000 already
+
        int t;
 
        FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), LAMBDA(
@@ -163,8 +166,17 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
                //               adding a player as a goal seems to be quite dangerous, especially on space maps
                //               remove hack in navigation_poptouchedgoals() after performing this change
 
-               t = (this.health + this.armorvalue ) / (it.health + it.armorvalue );
-               navigation_routerating(this, it, t * ratingscale, 2000);
+               t = ((this.health + this.armorvalue) - (it.health + it.armorvalue)) / 150;
+               t = bound(0, 1 + t, 3);
+               if (skill > 3)
+               {
+                       if (time < this.strength_finished - 1) t += 0.5;
+                       if (time < it.strength_finished - 1) t -= 0.5;
+               }
+               t += max(0, 8 - skill) * 0.05; // less skilled bots attack more mindlessly
+               ratingscale *= t;
+               if (ratingscale > 0)
+                       navigation_routerating(this, it, ratingscale * BOT_RATING_ENEMY, 2000);
        ));
 }