[Orxonox-commit 4061] r8732 - code/branches/ai2/src/orxonox/controllers
jo at orxonox.net
jo at orxonox.net
Tue Jul 5 22:57:40 CEST 2011
Author: jo
Date: 2011-07-05 22:57:40 +0200 (Tue, 05 Jul 2011)
New Revision: 8732
Modified:
code/branches/ai2/src/orxonox/controllers/AIController.cc
Log:
doFire() is definitely the error's source.
Modified: code/branches/ai2/src/orxonox/controllers/AIController.cc
===================================================================
--- code/branches/ai2/src/orxonox/controllers/AIController.cc 2011-07-05 20:39:50 UTC (rev 8731)
+++ code/branches/ai2/src/orxonox/controllers/AIController.cc 2011-07-05 20:57:40 UTC (rev 8732)
@@ -64,8 +64,8 @@
// return to Master after being forced free
if (this->freedomCount_ == 1)
{
- this->state_ = SLAVE;
- this->freedomCount_ = 0;
+ this->state_ = SLAVE;
+ this->freedomCount_ = 0;
}
random = rnd(maxrand);
@@ -158,12 +158,12 @@
// search enemy
random = rnd(maxrand);
- if (random < 15 && (!this->target_))
+ if (random < (botlevel_)*25 && (!this->target_))
this->searchNewTarget();
// forget enemy
random = rnd(maxrand);
- if (random < 5 && (this->target_))
+ if (random < (1-botlevel_)*6 && (this->target_))
this->forgetTarget();
// next enemy
@@ -184,15 +184,15 @@
// shoot
random = rnd(maxrand);
- if (!(this->passive_) && random < 9 && (this->target_ && !this->bShooting_))
+ if (!(this->passive_) && random < 25*(botlevel_)+1 && (this->target_ && !this->bShooting_))
{
- this->bShooting_ = true;
- this->forceFreeSlaves();
+ this->bShooting_ = true;
+ this->forceFreeSlaves();
}
// stop shooting
random = rnd(maxrand);
- if (random < 25 && (this->bShooting_))
+ if (random < ( (1- botlevel_)*25 ) && (this->bShooting_))
this->bShooting_ = false;
}
@@ -217,7 +217,13 @@
{
if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
this->forgetTarget();
- else this->aimAtTarget();
+ else
+ {
+ this->aimAtTarget();
+ random = rnd(maxrand);
+ if(this->botlevel_*100 > random)
+ this->follow();//If a bot is shooting a player, it shouldn't let him go away easily.
+ }
}
if (this->bHasTargetPosition_)
@@ -248,7 +254,13 @@
{
if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
this->forgetTarget();
- else this->aimAtTarget();
+ else
+ {
+ this->aimAtTarget();
+ random = rnd(maxrand);
+ if(this->botlevel_*100 > random)
+ this->follow();//If a bot is shooting a player, it shouldn't let him go away easily.
+ }
}
if (this->bHasTargetPosition_)
More information about the Orxonox-commit
mailing list