Vore AI: Correct fearing system, and teach bots to avoid eating someone else the...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 30 Sep 2010 00:39:05 +0000 (03:39 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 30 Sep 2010 00:39:05 +0000 (03:39 +0300)
data/qcsrc/server/bot/havocbot/vore_ai.qc

index dc033ba1e8580b31d88e7d180fa1c4942552368b..1b58e1870fac96a48e29bb18a287e72726e70621 100644 (file)
@@ -102,10 +102,11 @@ void Vore_AI()
 
        // now do the actual checking and swallowing
        entity prey;
-       float randomtry_pred, randomtry_prey;
+       float randomtry_pred, randomtry_prey, fear_pred;
        float decide_pred_time, decide_prey_time;
 
        prey = Swallow_player_check();
+       fear_pred = 1;
 
        // check if we should run the Teamhealing AI rather than continuing with the normal vore AI
        Vore_AI_Teamheal(prey);
@@ -114,9 +115,10 @@ void Vore_AI()
 
        randomtry_pred = randomtry_prey = random() * 10; // there are 10 bot skill steps
        if(prey.items & IT_STRENGTH) // avoid eating bots that have the Strenght powerup
-               randomtry_pred /= cvar("bot_ai_vore_fear") * self.bot_vorefear;
+               fear_pred += cvar("bot_ai_vore_fear") * self.bot_vorefear;
        if(prey.items & IT_INVINCIBLE) // avoid eating bots that have the Invincible powerup
-               randomtry_pred /= cvar("bot_ai_vore_fear") * self.bot_vorefear;
+               fear_pred += cvar("bot_ai_vore_fear") * self.bot_vorefear;
+       fear_pred += self.stomach_load; // the bigger our stomach, the less we want to put someone else in there
        decide_pred_time = cvar("bot_ai_vore_decide_pred") / skill / self.bot_vorethinkpred;
        decide_prey_time = cvar("bot_ai_vore_decide_prey") / skill / self.bot_vorethinkprey;
 
@@ -124,7 +126,7 @@ void Vore_AI()
        if(Swallow_condition_check_bot(prey))
        {
                // the greater the skill, the higher the chance bots will swallow someone each attempt
-               if(skill >= randomtry_pred)
+               if(skill / fear_pred >= randomtry_pred)
                if not(teams_matter && prey.team == self.team)
                {
                        self.BUTTON_ATCK = TRUE; // swallow