Index: /code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- /code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc	(revision 8722)
+++ /code/branches/ai2/src/modules/weapons/projectiles/Rocket.cc	(revision 8723)
@@ -58,4 +58,5 @@
         this->localAngularVelocity_ = 0;
         this->lifetime_ = 100;
+        this->bIsRocket=true;
 
         if (GameMode::isMaster())
@@ -116,4 +117,5 @@
         if(this->isInitialized())
         {
+            this->bIsRocket=false;
             if (GameMode::isMaster())
             {
Index: /code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- /code/branches/ai2/src/orxonox/controllers/ArtificialController.cc	(revision 8722)
+++ /code/branches/ai2/src/orxonox/controllers/ArtificialController.cc	(revision 8723)
@@ -44,4 +44,7 @@
 #include "controllers/NewHumanController.h"
 #include "controllers/DroneController.h"
+#include "weaponsystem/WeaponMode.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/Weapon.h"
 
 namespace orxonox
@@ -52,4 +55,5 @@
     SetConsoleCommand("ArtificialController", "passivebehaviour", &ArtificialController::passivebehaviour);
     SetConsoleCommand("ArtificialController", "formationsize",    &ArtificialController::formationsize);
+    SetConsoleCommand("ArtificialController", "setbotlevel",      &ArtificialController::setAllBotLevel);
 
     static const unsigned int STANDARD_MAX_FORMATION_SIZE = 7;
@@ -84,4 +88,9 @@
 
         this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this));
+        this->bSetupWorked = false;
+        this->numberOfWeapons = 0;
+        this->botlevel_ = 1.0f;
+        this->mode_ = DEFAULT;////Vector-implementation: mode_.push_back(DEFAULT);
+        this->timeout_=0;
     }
 
@@ -89,5 +98,5 @@
     {
         if (this->isInitialized())
-        {
+        {//Vector-implementation: mode_.erase(mode_.begin(),mode_.end());
             this->removeFromFormation();
 
@@ -1020,3 +1029,115 @@
         return (team1 == team2 && team1 != -1);
     }
+
+    /**
+        @brief DoFire is called when a bot should shoot and decides which weapon is used and whether the bot shoots at all.
+    */
+    void ArtificialController::doFire()
+    {
+        if(!bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ...
+        {
+            this->setupWeapons();
+            if(numberOfWeapons>0)
+                bSetupWorked=true;
+        }
+        else if(this->getControllableEntity()&&(numberOfWeapons>0)&&this->bShooting_ && this->isCloseAtTarget((1 + 2*botlevel_)*1000) && this->isLookingAtTarget(math::pi / 20.0f))
+        {
+            if (this->isCloseAtTarget(130) &&(weapons[1]==1) )
+            {//LENSFLARE: short range weapon     
+                this->getControllableEntity()->fire(1); //ai uses lens flare if they're close enough to the target
+            }
+            else if((weapons[3]==3)&& this->isCloseAtTarget(400) /*&&projectiles[3]*/ )
+            {//ROCKET: mid range weapon
+                //TODO: Which weapon is the rocket? How many rockets are available?
+                this->mode_ = ROCKET;//Vector-implementation: mode_.push_back(ROCKET);
+                this->getControllableEntity()->fire(3);//launch rocket
+                if(this->getControllableEntity()&&this->target_)//after fire(3) getControllableEntity() refers to the rocket!
+                {
+                    float speed = this->getControllableEntity()->getVelocity().length() - target_->getVelocity().length();
+                    if(!speed) speed = 0.1f;
+                    float distance = target_->getPosition().length() - this->getControllableEntity()->getPosition().length();
+                    this->timeout_= distance/speed*sgn(speed*distance) + 1.8f;//predicted time of target hit (+ tolerance)
+                }
+                else
+                    this->timeout_ = 4.0f;//TODO: find better default value
+                
+                this->projectiles[3]-=1;//decrease ammo !!
+            }
+            else if ((weapons[0]==0))//LASER: default weapon
+                this->getControllableEntity()->fire(0);
+        }
+    }
+
+    /**
+        @brief Information gathering: Which weapons are ready to use?
+    */
+    void ArtificialController::setupWeapons() //TODO: Make this function generic!! (at the moment is is based on conventions)
+    {
+        if(this->getControllableEntity())
+        {
+            Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
+            if(pawn)
+            {
+                for(unsigned int i=0; i<WeaponSystem::MAX_WEAPON_MODES; i++)
+                {
+                    const std::string wpn = getWeaponname(i, pawn); COUT(0)<<wpn<< std::endl;//Temporary debug info.
+                    /*if(wpn=="")
+                        weapons[i]=-1;
+                    else if(wpn=="LaserMunition")//other munitiontypes are not defined yet :-(
+                        weapons[0]=0;
+                    else if(wpn=="FusionMunition")
+                        weapons[1]=1;
+                    else if(wpn=="TargetSeeking Rockets")
+                        weapons[2]=2;
+                    else if(wpn=="ROCKET")//TODO: insert right munition name
+                        weapons[3]=3;
+                    */
+                    if(pawn->getWeaponSet(i)) //main part: find which weapons a pawn can use; hard coded at the moment!
+                    {
+                        weapons[i]=i;
+                        projectiles[i]=1;//TODO: how to express infinite ammo? how to get data?? getWeaponmode(i)->getMunition()->getNumMunition(WeaponMode* user)
+                          numberOfWeapons++;
+                    }
+                    else
+                        weapons[i]=-1;
+                }
+                 //pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
+            }
+        }
+    }
+
+    const std::string& ArtificialController::getWeaponname(int i, Pawn* pawn)
+    {//is there a way to minimize this long if-return structure, without triggering nullpointer exceptions?
+        if(!pawn) return "";
+        WeaponPack* wPack = pawn->getWeaponPack(i);
+        if(!wPack) return "";
+        Weapon* wpn = wPack->getWeapon(i);
+        if(!wpn) return "";
+        WeaponMode* wMode = wpn->getWeaponmode(i);
+        if(!wMode) return "";
+        return wMode->getMunitionName();
+    }//pawn->getWeaponpack(i)->getWeapon(i)->getWeaponmode(i)->getMunitionName()
+
+    
+    void ArtificialController::setBotLevel(float level)
+    {
+        if (level < 0.0f)
+            this->botlevel_ = 0.0f; 
+        else if (level > 1.0f)
+            this->botlevel_ = 1.0f;
+        else
+            this->botlevel_ = level;
+    }
+    
+    void ArtificialController::setAllBotLevel(float level)
+    {
+        for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)
+            it->setBotLevel(level);
+    }
+
+    void ArtificialController::setPreviousMode()
+    {
+        this->mode_ = DEFAULT; //Vector-implementation: mode_.pop_back();
+    }
+    
 }
Index: /code/branches/ai2/src/orxonox/controllers/ArtificialController.h
===================================================================
--- /code/branches/ai2/src/orxonox/controllers/ArtificialController.h	(revision 8722)
+++ /code/branches/ai2/src/orxonox/controllers/ArtificialController.h	(revision 8723)
@@ -37,4 +37,5 @@
 #include "Controller.h"
 #include "controllers/NewHumanController.h"
+#include "weaponsystem/WeaponSystem.h"
 
 namespace orxonox
@@ -77,4 +78,10 @@
             static void passivebehaviour(const bool passive);
             static void formationsize(const int size);
+
+            virtual void doFire();
+	    void setBotLevel(float level=1.0f);
+	    inline float getBotLevel() const
+                { return this->botlevel_; }
+            static void setAllBotLevel(float level);
 
         protected:
@@ -141,5 +148,18 @@
             bool bShooting_;
 
+            int numberOfWeapons; //< Used for weapon init function. Displayes number of weapons available for a bot.
+            int weapons[WeaponSystem::MAX_WEAPON_MODES];
+            int projectiles[WeaponSystem::MAX_WEAPON_MODES];
+            float botlevel_; //< Makes the level of a bot configurable.
+            float timeout_; //< Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
+
+            enum Mode {DEFAULT, ROCKET, DEFENCE, MOVING};//TODO; implement DEFENCE, MOVING modes
+            Mode mode_; //TODO: replace single value with stack-like implementation: std::vector<Mode> mode_;
+            void setPreviousMode();
+
         private:
+            void setupWeapons();
+            const std::string& getWeaponname(int i, Pawn* pawn);
+            bool bSetupWorked;
     };
 }
Index: /code/branches/ai2/src/orxonox/controllers/DroneController.cc
===================================================================
--- /code/branches/ai2/src/orxonox/controllers/DroneController.cc	(revision 8722)
+++ /code/branches/ai2/src/orxonox/controllers/DroneController.cc	(revision 8723)
@@ -103,5 +103,6 @@
                     this->isShooting_ = true;
                     this->aimAtTarget();
-                    this->getDrone()->fire(0);
+		    if(!this->friendlyFire())
+                        this->getDrone()->fire(0);
                 }
             }
@@ -147,3 +148,22 @@
             this->destroy();
     }
+
+    bool DroneController::friendlyFire()
+    {   ControllableEntity* droneEntity_ = this->getControllableEntity();
+        if (!droneEntity_) return false;
+        if(!owner_) return false;
+        if(this->bHasTargetPosition_)
+        {
+            Vector3 ownerPosition_ = owner_->getPosition();
+            Vector3 toOwner_ = owner_->getPosition() - droneEntity_->getPosition();
+            Vector3 toTarget_ = targetPosition_ - droneEntity_->getPosition();
+            if(toTarget_.length() < toOwner_.length()) return false; //owner is far away = in safty
+            float angleToOwner = getAngle(droneEntity_->getPosition(), droneEntity_->getOrientation() * WorldEntity::FRONT, ownerPosition_);
+            float angleToTarget = getAngle(droneEntity_->getPosition(), droneEntity_->getOrientation() * WorldEntity::FRONT, targetPosition_);
+            float angle = angleToOwner - angleToTarget;//angle between target and owner, observed by the drone
+            if(std::sin(angle)*toOwner_.length() < 5.0f)//calculate owner's distance to shooting line
+            return true;
+        }
+        return false;//Default return value: Usually there is no friendlyFire
+    }
 }
Index: /code/branches/ai2/src/orxonox/controllers/DroneController.h
===================================================================
--- /code/branches/ai2/src/orxonox/controllers/DroneController.h	(revision 8722)
+++ /code/branches/ai2/src/orxonox/controllers/DroneController.h	(revision 8723)
@@ -66,4 +66,5 @@
             virtual void action();
             void ownerDied();
+	    bool friendlyFire(); //< returns true if the owner_ would be hit.
             bool isShooting_;
 
Index: /code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- /code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h	(revision 8722)
+++ /code/branches/ai2/src/orxonox/worldentities/ControllableEntity.h	(revision 8723)
@@ -163,4 +163,6 @@
                 { return this->target_.get(); }
             void setTargetInternal( uint32_t targetID );
+            inline bool getRocket() const
+                { return this-> bIsRocket; }
 
         protected:
@@ -181,4 +183,5 @@
 
             Ogre::SceneNode* cameraPositionRootNode_;
+            bool bIsRocket; //Workaround to see, if the controllable entity is a Rocket.
 
         private:
