- Timestamp:
- Dec 16, 2011, 8:36:41 PM (12 years ago)
- Location:
- code/branches/presentation2011
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2011
- Property svn:mergeinfo changed
/code/branches/formation (added) merged: 8885,8908,8939,8943,8948,8953,8957,8965,8967,8978,8985,8989-8991
- Property svn:mergeinfo changed
-
code/branches/presentation2011/src/orxonox/controllers/AIController.cc
r8980 r8992 75 75 76 76 this->defaultBehaviour(maxrand); 77 } 78 79 if (this->state_ == SLAVE) 80 { 77 78 } 79 80 if (this->state_ == SLAVE && this->formationMode_ == ATTACK) //TODO: add botlevel parameter 81 { 82 // search enemy 83 random = rnd(maxrand); 84 if (random < 75 && (!this->target_)) 85 this->searchNewTarget(); 86 87 // next enemy 88 random = rnd(maxrand); 89 if (random < 10 && (this->target_)) 90 this->searchNewTarget(); 91 92 // shoot 93 random = rnd(maxrand); 94 if (!(this->passive_) && random < 75 && (this->target_ && !this->bShooting_)) 95 this->bShooting_ = true; 96 97 // stop shooting 98 random = rnd(maxrand); 99 if (random < 25 && (this->bShooting_)) 100 this->bShooting_ = false; 81 101 82 102 } … … 101 121 this->spinInit(); 102 122 103 / / follow a randomly chosen human - a specific Master Action123 /*// follow a randomly chosen human - a specific Master Action 104 124 random = rnd(1000.0f); 105 125 if (random < 1) 106 126 this->followRandomHumanInit(); 107 127 */ 108 128 // lose master status (only if less than 4 slaves in formation) 109 129 random = rnd(maxrand); … … 117 137 118 138 this->defaultBehaviour(maxrand); 119 } 120 } 139 140 } 141 } 142 121 143 } 122 144 … … 129 151 float maxrand = 100.0f / ACTION_INTERVAL; 130 152 ControllableEntity* controllable = this->getControllableEntity(); 131 153 //DOES: Either move to the waypoint or search for a Point of interest 132 154 if (controllable && this->mode_ == DEFAULT)// bot is ready to move to a target 133 155 { … … 151 173 } 152 174 } 153 if(this->mode_ == DEFAULT) 154 { 175 176 if (this->mode_ == DEFAULT) 177 { 155 178 if (this->state_ == MASTER) 156 179 { … … 165 188 this->aimAtTarget(); 166 189 random = rnd(maxrand); 167 if(this->botlevel_* 100 > random && !this->isCloseAtTarget(20))190 if(this->botlevel_*70 > random && !this->isCloseAtTarget(100)) 168 191 this->follow(); //If a bot is shooting a player, it shouldn't let him go away easily. 169 192 } … … 172 195 if (this->bHasTargetPosition_) 173 196 this->moveToTargetPosition(); 174 175 197 this->doFire(); 176 198 } … … 185 207 } 186 208 187 if (this->state_ == SLAVE )209 if (this->state_ == SLAVE && this->formationMode_ != ATTACK) 188 210 { 189 211 if (this->bHasTargetPosition_) … … 191 213 } 192 214 193 if (this->state_ == FREE )215 if (this->state_ == FREE || (this->state_==SLAVE && this->formationMode_ == ATTACK) ) 194 216 { 195 217 if (this->target_) … … 197 219 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 198 220 this->forgetTarget(); 199 else 200 { 201 this->aimAtTarget(); 202 random = rnd(maxrand); 203 204 if(this->botlevel_*100 > random && !this->isCloseAtTarget(20)) 205 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily. 206 } 221 else this->aimAtTarget(); 207 222 } 208 223 … … 210 225 this->moveToTargetPosition(); 211 226 212 this->doFire();213 } 214 } //END_OF DEFAULT MODE227 this->doFire(); 228 } 229 } 215 230 else if (this->mode_ == ROCKET)//Rockets do not belong to a group of bots -> bot states are not relevant. 216 231 { //Vector-implementation: mode_.back() == ROCKET; … … 237 252 SUPER(AIController, tick, dt); 238 253 } 239 254 //**********************************************NEW 240 255 void AIController::defaultBehaviour(float maxrand) 241 256 { float random;
Note: See TracChangeset
for help on using the changeset viewer.