]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
First step in teaching bots to use the teamheal feature in team games. Not ready...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 7 Sep 2010 15:09:42 +0000 (18:09 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 7 Sep 2010 15:09:42 +0000 (18:09 +0300)
data/qcsrc/server/bot/havocbot/vore_ai.qc

index 6676c88160c716eaaf764982b1a3b5ef63ffe578..aa0efddfcd045f6691c8d40d13d8b2685762efbe 100644 (file)
@@ -19,11 +19,35 @@ float Swallow_condition_check_bot(entity prey)
        if(self.eater.classname != "player" && self.stomach_load < cvar("g_balance_vore_swallow_limit") && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves
        if not(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load)
        if(self.health > cvar("g_balance_vore_kick_damage_max")) // explained below
-       if not(teamplay && prey.team == self.team)
                return TRUE;
        return FALSE;
 }
 
+void Vore_AI_Teamheal(entity prey)
+{
+       if not(teamplay)
+               return;
+
+       // check if we can heal a damaged team mate we came across, and if so swallow them
+       if(prey.classname == "player" && prey.team == self.team)
+       if(Swallow_condition_check_bot(prey))
+       if(prey.health < cvar("g_balance_vore_teamheal_stable"))
+               self.BUTTON_ATCK = TRUE; // swallow
+
+       // if we are holding a team mate that's been healed to the max, we can release them
+       entity head;
+       if(self.stomach_load)
+       {
+               FOR_EACH_PLAYER(head)
+               {
+                       if(head.eater.classname == "player")
+                       if(head.team == self.team)
+                       if(head.health >= cvar("g_balance_vore_teamheal_stable"))
+                               self.BUTTON_REGURGITATE = TRUE;
+               }
+       }
+}
+
 .float swallow_retry, decide_delay1, decide_delay2;
 void Vore_AI()
 {
@@ -56,11 +80,12 @@ void Vore_AI()
        decide_prey = cvar("bot_ai_vore_decide_prey") / (skill * 2 + 1);
        decide_pred = cvar("bot_ai_vore_decide_pred") / (skill * 2 + 1);
 
-       if(Swallow_condition_check_bot(prey))
        if(time > self.swallow_retry)
+       if(Swallow_condition_check_bot(prey))
        {
                // the greater the skill, the higher the chance bots will swallow someone each attempt
                if(skill >= random_try)
+               if not(teamplay && prey.team == self.team)
                {
                        self.BUTTON_ATCK = TRUE; // swallow
                        self.decide_delay1 = time + decide_pred; // time before the bot decides what to do with their prey
@@ -68,6 +93,8 @@ void Vore_AI()
                self.swallow_retry = time + 0.5; // bots retry swallowing every 0.5 seconds, otherwise each frame would be random chance
        }
 
+       Vore_AI_Teamheal(prey);
+
        // deciding what to do with a victim:
 
        if(self.stomach_load > 0 && time > self.decide_delay1)