Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 30, 2015, 5:39:43 PM (8 years ago)
Author:
gania
Message:

AI attacks targets that are close

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc

    r10898 r10903  
    3737#include "weaponsystem/Weapon.h"
    3838#include "weaponsystem/WeaponSlot.h"
    39 #include "weaponsystem/WeaponSlot.h"
     39#include "weaponsystem/WeaponSystem.h"
     40#include "weaponsystem/Munition.h"
     41
    4042namespace orxonox
    4143{
     
    139141        }
    140142        //too close? How do u expect to dodge anything? Just attack!
    141         else if (diffLength < 400)
     143        else if (diffLength < 1000)
    142144        {   
    143145            this->bKeepFormation_ = false;
    144146
    145147            //at this point, just look and shoot
    146             if (diffLength < 200)
     148            if (diffLength < 500)
    147149            {
    148150                this->stopMoving();
     
    151153            else
    152154            {
    153                 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);
     155                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
    154156            }
    155157        }
     
    158160        {
    159161            this->bKeepFormation_ = false;
    160             this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);
     162            this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
    161163        }
    162164        //That's unfortunate, he is looking and probably shooting... try to dodge what we can... 
     
    166168            if (maneuverCounter_ == 0)
    167169            {
    168                 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f);   
     170                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);   
    169171                return;
    170172            }
    171             dodge(thisPosition, diffUnit);
     173            if (this->actionCounter_ % 3 == 0)
     174                dodge(thisPosition, diffUnit);
    172175        }
    173176    }
     
    365368                    {
    366369                        std::string wName = wMode->getIdentifier()->getName();
     370                        // SubclassIdentifier<Munition> munition =  ClassByString(wName);
    367371                        if (wName == "RocketFire")
    368372                            this->rocketsLeft_ = 10;
     373                            // this->rocketsLeft_ = orxonox_cast<Pawn*>(this->getControllableEntity())->getWeaponSystem()->getMunition(&munition)->getNumMunitionInCurrentMagazine(wMode);
    369374                        if(this->getFiremode(wName) == -1) //only add a weapon, if it is "new"
    370375                            weaponModes_[wName] = wMode->getMode();
     
    375380            }//pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
    376381        }
     382
     383        //orxout (internal_error) << this->rocketsLeft_ << " rockets left" << endl;
    377384    }
    378385
Note: See TracChangeset for help on using the changeset viewer.