]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: improve flag carrier escort role
authorterencehill <piuntn@gmail.com>
Sat, 9 Jun 2018 13:16:06 +0000 (15:16 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 9 Jun 2018 13:16:06 +0000 (15:16 +0200)
qcsrc/server/mutators/mutator/gamemode_ctf.qc

index 1b3e54407e181c82ed2c4ec7f26e0711ce6aa913..059af1e491d94066ff61142c7125a2b5ed00b7e7 100644 (file)
@@ -1515,7 +1515,12 @@ void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale)
        if (head)
        {
                if (head.ctf_status == FLAG_CARRY)
+               {
+                       // adjust rating of our flag carrier depending on his health
                        head = head.tag_entity;
+                       float f = bound(0, (head.health + head.armorvalue) / 100, 2) - 1;
+                       ratingscale += ratingscale * f * 0.1;
+               }
                navigation_routerating(this, head, ratingscale, 10000);
        }
 }
@@ -1737,8 +1742,7 @@ void havocbot_role_ctf_escort(entity this)
 
        // If the flag carrier reached the base switch to defense
        mf = havocbot_ctf_find_flag(this);
-       if(mf.ctf_status!=FLAG_BASE)
-       if(vdist(ef.origin - mf.dropped_origin, <, 300))
+       if (mf.ctf_status != FLAG_BASE && vdist(ef.origin - mf.dropped_origin, <, 900))
        {
                havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
                return;
@@ -1763,9 +1767,10 @@ void havocbot_role_ctf_escort(entity this)
        {
                navigation_goalrating_start(this);
 
-               havocbot_goalrating_ctf_enemyflag(this, 30000);
-               havocbot_goalrating_ctf_ourstolenflag(this, 40000);
-               havocbot_goalrating_items(this, 10000, this.origin, 10000);
+               // role: escort
+               havocbot_goalrating_ctf_enemyflag(this, 10000);
+               havocbot_goalrating_ctf_ourstolenflag(this, 6000);
+               havocbot_goalrating_items(this, 21000, this.origin, 10000);
 
                navigation_goalrating_end(this);