mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-27 06:22:27 +00:00
Tweaked bandaging code
This commit is contained in:
parent
10d8937803
commit
2c6b13be74
3 changed files with 70 additions and 22 deletions
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.27 2002/06/01 13:37:02 makro
|
||||
// Tweaked bandaging code
|
||||
//
|
||||
// Revision 1.26 2002/05/30 21:18:28 makro
|
||||
// Bots should reload/bandage when roaming around
|
||||
// Added "pathtarget" key to all the entities
|
||||
|
@ -2357,14 +2360,17 @@ AIEnter_Battle_Fight
|
|||
==================
|
||||
*/
|
||||
void AIEnter_Battle_Fight(bot_state_t *bs, char *s) {
|
||||
float attack_skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
||||
BotRecordNodeSwitch(bs, "battle fight", "", s);
|
||||
trap_BotResetLastAvoidReach(bs->ms);
|
||||
//Makro - check if the bot has leg damage
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
if (random() > attack_skill) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
}
|
||||
bs->ainode = AINode_Battle_Fight;
|
||||
}
|
||||
|
||||
|
@ -2423,6 +2429,7 @@ int AINode_Battle_Fight(bot_state_t *bs) {
|
|||
if (bs->enemydeath_time) {
|
||||
if (bs->enemydeath_time < FloatTime() - 1.0) {
|
||||
bs->enemydeath_time = 0;
|
||||
if (random() > 0.3f) {
|
||||
//Makro - check if the bot needs to bandage
|
||||
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
||||
if (RQ3_Bot_CheckBandage(bs)) {
|
||||
|
@ -2430,6 +2437,7 @@ int AINode_Battle_Fight(bot_state_t *bs) {
|
|||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}//
|
||||
if (bs->enemysuicide) {
|
||||
BotChat_EnemySuicide(bs);
|
||||
|
@ -2777,12 +2785,15 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
//if the enemy is NOT visible for 4 seconds
|
||||
if (bs->enemyvisible_time < FloatTime() - 4) {
|
||||
//Makro - bot retreating, enemy not in sight - a good time to bandage
|
||||
if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
|
||||
//if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
|
||||
if (random() > 0.3f) {
|
||||
if (RQ3_Bot_NeedToBandage(bs)) {
|
||||
//If not bandaging already
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
}
|
||||
AIEnter_Seek_LTG(bs, "battle retreat: lost enemy");
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -2790,13 +2801,15 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
else if (bs->enemyvisible_time < FloatTime()) {
|
||||
//if there is another enemy
|
||||
if (BotFindEnemy(bs, -1)) {
|
||||
//if the bot has leg damage
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
if (random() < 0.5f) {
|
||||
//if the bot is hurt
|
||||
if (RQ3_Bot_NeedToBandage(bs)) {
|
||||
//If the bot wants to bandage and not bandaging already
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING && RQ3_Bot_CheckBandage(bs)) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
}
|
||||
AIEnter_Battle_Fight(bs, "battle retreat: another enemy");
|
||||
return qfalse;
|
||||
} else {
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.40 2002/06/01 13:37:02 makro
|
||||
// Tweaked bandaging code
|
||||
//
|
||||
// Revision 1.39 2002/05/31 18:17:10 makro
|
||||
// Bot stuff. Added a server command that prints a line to a client
|
||||
// and everyone who is spectating him
|
||||
|
@ -2710,7 +2713,7 @@ void RQ3_Bot_IdleActions( bot_state_t *bs ) {
|
|||
|
||||
|
||||
//check if the bot needs to bandage
|
||||
if (damage == 2 || ((damage == 1) && RQ3_Bot_CheckBandage(bs))) {
|
||||
if (damage && RQ3_Bot_CheckBandage(bs)) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
bs->idleAction_time = FloatTime() + 4;
|
||||
|
@ -5997,10 +6000,24 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
|
|||
case EV_FALL_FAR:
|
||||
case EV_FALL_FAR_NOSOUND: // Makro - check for falling damage
|
||||
{
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
qboolean willBandage = qfalse;
|
||||
//Makro - this is the attack skill, we should be using the overall skill
|
||||
int skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
||||
if (random() > (1.0f - skill)) {
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
//if the bot isn't in the middle of a fight
|
||||
if (bs->enemy == -1) {
|
||||
if (BotFindEnemy(bs, -1)) {
|
||||
//if an enemy is nearby, a smart bot won't bandage
|
||||
willBandage = (random() > skill);
|
||||
} else {
|
||||
//but it will otherwise
|
||||
willBandage = (random() > (1.0f - skill));
|
||||
}
|
||||
} else {
|
||||
//smart bots don't bandage during a fight
|
||||
willBandage = (random() > skill);
|
||||
}
|
||||
if (willBandage) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,15 @@
|
|||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: cgame - Win32 Release--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
cgamex86.dll - 0 error(s), 0 warning(s)
|
||||
<h3>
|
||||
--------------------Configuration: game - Win32 Release--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
@ -11,6 +20,15 @@
|
|||
|
||||
<h3>Results</h3>
|
||||
qagamex86.dll - 0 error(s), 0 warning(s)
|
||||
<h3>
|
||||
--------------------Configuration: ui - Win32 Release TA--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
uix86.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue