From b883cd2f476bf3cdce894af8bae07ade4fcb72ba Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sun, 31 Jul 2011 23:56:41 +0300 Subject: [PATCH] Teach bots to use the new feature wisely --- data/qcsrc/server/bot/havocbot/vore_ai.qc | 31 ++++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/data/qcsrc/server/bot/havocbot/vore_ai.qc b/data/qcsrc/server/bot/havocbot/vore_ai.qc index e582678a..cfe03625 100644 --- a/data/qcsrc/server/bot/havocbot/vore_ai.qc +++ b/data/qcsrc/server/bot/havocbot/vore_ai.qc @@ -98,6 +98,7 @@ void Vore_AI_Teamheal(entity prey) void Vore_AI() { // main vore AI code + entity head; if(!cvar("g_vore")) // the vore system is disabled return; @@ -117,7 +118,6 @@ void Vore_AI() // aim toward the nearest possible victim. The greater the skill, the quicker the aim // this only does the aiming, checking and swallowing is handled below - entity head; head = findradius(self.origin, cvar("g_balance_vore_swallow_range")); while(head) { @@ -186,6 +186,23 @@ void Vore_AI() if(self.stomach_load && time > self.decide_pred) { + // if the predator's stomach contains only dead prey, and he has reached the maximum amount of health + // he can gain from digestion, there's no reason to keep the dead prey any longer + if(cvar("g_balance_vore_digestion_limit") < 0 && skill >= 9) // such awareness comes from skill level 9 and up + { + float found_live_prey; + FOR_EACH_PLAYER(head) + { + if(head.predator == self) + if(head.deadflag != DEAD_NO) + found_live_prey = TRUE; + } + + if(!found_live_prey) + if(self.health >= cvar("g_balance_vore_digestion_vampire_stable")) + self.BUTTON_REGURGITATE = TRUE; + } + // if the predator's health is smaller than the damage a stomach kick can do, regurgitate the player(s) // otherwise the predator is putting himself at risk by keeping you inside float kick_dmg; @@ -194,18 +211,18 @@ void Vore_AI() kick_dmg = cvar("g_balance_vore_kick_damage"); if(cvar("g_healthsize")) { - entity e; - FOR_EACH_PLAYER(e) // count the size of all players in the stomach for accounting the danger level + FOR_EACH_PLAYER(head) // count the size of all players in the stomach for accounting the danger level { - if(e.predator == self) - if not(teamplay && e.team == self.team) // don't count team mates - kick_dmg *= pow(e.scale / self.scale, cvar("g_balance_vore_kick_scalediff")); // based on the damage the prey can do to us at his size + if(head.predator == self) + if not(teamplay && head.team == self.team) // don't count team mates + if(head.deadflag != DEAD_NO) // don't count dead prey + kick_dmg *= pow(head.scale / self.scale, cvar("g_balance_vore_kick_scalediff")); // based on the damage the prey can do to us at his size } } } + if(self.health <= kick_dmg) self.BUTTON_REGURGITATE = TRUE; - else if(!self.digesting && cvar("g_vore_digestion")) { // the higher the skill, the faster bots will start to digest -- 2.39.2