Index: code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10903)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10906)
@@ -118,7 +118,5 @@
         if ( !this->target_ || !this->getControllableEntity())
             return;
-        maneuverCounter_++;
-        if (maneuverCounter_ > 5)
-            maneuverCounter_ = 0;
+
 
         Vector3 thisPosition = this->getControllableEntity()->getWorldPosition();
@@ -128,5 +126,5 @@
         float diffLength = diffVector.length();
         Vector3 diffUnit = diffVector/diffLength;
-        bool bTargetIsLookingAtThis = CommonController::isLooking (this->target_, this->getControllableEntity(), math::pi/15.0f)
+        bool bTargetIsLookingAtThis = CommonController::isLooking (this->target_, this->getControllableEntity(), math::pi/10.0f)
             || this->deltaHp < 0;
 
@@ -140,5 +138,40 @@
             this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);
         }
-        //too close? How do u expect to dodge anything? Just attack!
+        else
+        {
+            this->bKeepFormation_ = false;
+            // if (this->actionCounter_ % 3 == 0)
+            if (maneuverCounter_ <= 1.2)
+            {
+                // orxout(internal_error) << "attacking" << endl;
+                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f);   
+                return;
+            }
+            else if (bTargetIsLookingAtThis || diffLength < 700.0f)
+            {
+                // orxout(internal_error) << "dodging" << endl;
+                if (!this->bStartedDodging_)
+                {
+                    this->bStartedDodging_ = true;
+                    dodge(thisPosition, diffLength, diffUnit);        
+                }
+            }
+            else
+            {
+                if (diffLength < 1000)
+                {
+                // orxout(internal_error) << "looking" << endl;                    
+                    this->stopMoving();
+                    this->startLookingAtTarget();
+
+                }
+                else
+                {
+                // orxout(internal_error) << "closing up" << endl;                    
+                    this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
+                }
+            }
+        }
+        /*//too close? How do u expect to dodge anything? Just attack!
         else if (diffLength < 1000)
         {   
@@ -146,8 +179,9 @@
 
             //at this point, just look and shoot
-            if (diffLength < 500)
+            if (diffLength < 1000)
             {
                 this->stopMoving();
                 this->startLookingAtTarget();
+
             }
             else
@@ -160,5 +194,5 @@
         {
             this->bKeepFormation_ = false;
-            this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
+            this->setTargetPosition(this->positionOfTarget_ - diffUnit * 900.0f);
         }
         //That's unfortunate, he is looking and probably shooting... try to dodge what we can...  
@@ -168,10 +202,10 @@
             if (maneuverCounter_ == 0)
             {
-                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);   
+                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 900.0f);   
                 return;
             }
             if (this->actionCounter_ % 3 == 0)
-                dodge(thisPosition, diffUnit);
-        }
+                dodge(thisPosition, diffLength, diffUnit);
+        }*/
     }
     void FightingController::dodgeTowards (Vector3& position)
@@ -200,12 +234,21 @@
         this->boostControl();
     }
-    void FightingController::dodge(const Vector3& thisPosition, Vector3& diffUnit)
+    void FightingController::dodge(const Vector3& thisPosition, float diffLength, Vector3& diffUnit)
     {
         //d.x*x + d.y*y + d.z*z == 0
         //z = 1/d.z * (-d.y*y - d.x * x)
-        float x = CommonController::randomInRange (100, 800) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
-        float y = CommonController::randomInRange (100, 800) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
+        float x = CommonController::randomInRange (300, 800) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
+        float y = CommonController::randomInRange (300, 800) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
         float z = diffUnit.z == 0 ? 0 : (1/diffUnit.z) * (-x * diffUnit.x - y * diffUnit.y);
-        this->setTargetPosition(thisPosition + Vector3(x,y,z) + (this->deltaHp < 0 ? -diffUnit * 450.0f : diffUnit * 100.0f));
+        if (diffLength < 150.0f)
+        {
+            this->setTargetPosition(this->positionOfTarget_ + Vector3(z,x,y));
+        }
+        else
+        {
+        this->setTargetPosition(thisPosition + Vector3(x,y,z) + (this->deltaHp < 0 ? -diffUnit * 450.0f : 
+            (diffLength < 700.0f ? -diffUnit*700.0f : diffUnit * 50.0f)));
+
+        }
         this->boostControl();
 
@@ -225,5 +268,5 @@
         }
 
-        return squaredDistanceToTarget() < this->attackRange_*this->attackRange_ && this->isLookingAtTarget(math::pi / 20.0f);
+        return squaredDistanceToTarget() < this->attackRange_*this->attackRange_ && this->isLookingAtTarget(math::pi / 10.0f);
     }
 
