Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8732


Ignore:
Timestamp:
Jul 5, 2011, 10:57:40 PM (13 years ago)
Author:
jo
Message:

doFire() is definitely the error's source.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ai2/src/orxonox/controllers/AIController.cc

    r8731 r8732  
    6565                if (this->freedomCount_ == 1)
    6666                {
    67                 this->state_ = SLAVE;
    68                 this->freedomCount_ = 0;
     67                    this->state_ = SLAVE;
     68                    this->freedomCount_ = 0;
    6969                }
    7070
     
    159159                // search enemy
    160160                random = rnd(maxrand);
    161                 if (random < 15 && (!this->target_))
     161                if (random < (botlevel_)*25 && (!this->target_))
    162162                    this->searchNewTarget();
    163163
    164164                // forget enemy
    165165                random = rnd(maxrand);
    166                 if (random < 5 && (this->target_))
     166                if (random < (1-botlevel_)*6 && (this->target_))
    167167                    this->forgetTarget();
    168168
     
    185185                // shoot
    186186                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();
    191191                }
    192192
    193193                // stop shooting
    194194                random = rnd(maxrand);
    195                 if (random < 25 && (this->bShooting_))
     195                if (random < ( (1- botlevel_)*25 ) && (this->bShooting_))
    196196                    this->bShooting_ = false;
    197197
     
    218218                        if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
    219219                            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                        }
    221227                    }
    222228
     
    249255                    if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
    250256                        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                     }
    252264                }
    253265
Note: See TracChangeset for help on using the changeset viewer.