Changeset 8732
- Timestamp:
- Jul 5, 2011, 10:57:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/src/orxonox/controllers/AIController.cc
r8731 r8732 65 65 if (this->freedomCount_ == 1) 66 66 { 67 this->state_ = SLAVE;68 this->freedomCount_ = 0;67 this->state_ = SLAVE; 68 this->freedomCount_ = 0; 69 69 } 70 70 … … 159 159 // search enemy 160 160 random = rnd(maxrand); 161 if (random < 15 && (!this->target_))161 if (random < (botlevel_)*25 && (!this->target_)) 162 162 this->searchNewTarget(); 163 163 164 164 // forget enemy 165 165 random = rnd(maxrand); 166 if (random < 5&& (this->target_))166 if (random < (1-botlevel_)*6 && (this->target_)) 167 167 this->forgetTarget(); 168 168 … … 185 185 // shoot 186 186 random = rnd(maxrand); 187 if (!(this->passive_) && random < 9&& (this->target_ && !this->bShooting_))188 { 189 this->bShooting_ = true;190 this->forceFreeSlaves();187 if (!(this->passive_) && random < 25*(botlevel_)+1 && (this->target_ && !this->bShooting_)) 188 { 189 this->bShooting_ = true; 190 this->forceFreeSlaves(); 191 191 } 192 192 193 193 // stop shooting 194 194 random = rnd(maxrand); 195 if (random < 25&& (this->bShooting_))195 if (random < ( (1- botlevel_)*25 ) && (this->bShooting_)) 196 196 this->bShooting_ = false; 197 197 … … 218 218 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 219 219 this->forgetTarget(); 220 else this->aimAtTarget(); 220 else 221 { 222 this->aimAtTarget(); 223 random = rnd(maxrand); 224 if(this->botlevel_*100 > random) 225 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily. 226 } 221 227 } 222 228 … … 249 255 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 250 256 this->forgetTarget(); 251 else this->aimAtTarget(); 257 else 258 { 259 this->aimAtTarget(); 260 random = rnd(maxrand); 261 if(this->botlevel_*100 > random) 262 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily. 263 } 252 264 } 253 265
Note: See TracChangeset
for help on using the changeset viewer.