Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 7654)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 7655)
@@ -95,4 +95,5 @@
     class Dynamicmatch;
     class Gametype;
+    class LastManStanding;
     class TeamBaseMatch;
     class TeamDeathmatch;
Index: code/trunk/src/orxonox/gametypes/Asteroids.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Asteroids.cc	(revision 7654)
+++ code/trunk/src/orxonox/gametypes/Asteroids.cc	(revision 7655)
@@ -41,4 +41,5 @@
         RegisterObject(Asteroids);
         this->firstCheckpointReached_ = false;
+        this->numberOfBots_=0; //sets number of default bots temporarly to 0
     }
 
@@ -75,4 +76,5 @@
         COUT(0) << message << std::endl;
         Host::Broadcast(message);
+
     }
 
Index: code/trunk/src/orxonox/gametypes/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/gametypes/CMakeLists.txt	(revision 7654)
+++ code/trunk/src/orxonox/gametypes/CMakeLists.txt	(revision 7655)
@@ -7,3 +7,4 @@
   Asteroids.cc
   Dynamicmatch.cc
+  LastManStanding.cc
 )
Index: code/trunk/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/LastManStanding.cc	(revision 7655)
+++ code/trunk/src/orxonox/gametypes/LastManStanding.cc	(revision 7655)
@@ -0,0 +1,280 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "LastManStanding.h"
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include "infos/PlayerInfo.h"
+#include "worldentities/pawns/Pawn.h"
+#include "core/ConfigValueIncludes.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(LastManStanding);
+
+    LastManStanding::LastManStanding(BaseObject* creator) : Deathmatch(creator)
+    {
+        RegisterObject(LastManStanding);
+        this->bForceSpawn_=true;
+        this->lives=4;
+        this->playersAlive=0;
+        this->timeRemaining=15.0f;
+        this->respawnDelay=4.0f;
+        this->bNoPunishment=false;
+        this->bHardPunishment=false;
+        this->punishDamageRate=0.4f;
+        this->setHUDTemplate("LastmanstandingHUD");
+    }
+
+    void LastManStanding::spawnDeadPlayersIfRequested()
+    {
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+            if (it->second.state_ == PlayerState::Dead)
+            {
+                bool alive = (0<playerLives_[it->first]&&(inGame_[it->first]));
+                if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
+                {
+                    this->spawnPlayer(it->first);
+                }
+            }
+    }
+
+
+    void LastManStanding::setConfigValues()
+    {
+        SetConfigValue(lives, 4);
+        SetConfigValue(timeRemaining, 15.0f);
+        SetConfigValue(respawnDelay, 4.0f);
+        SetConfigValue(bNoPunishment, false);
+        SetConfigValue(bHardPunishment, false);
+    }
+
+    bool LastManStanding::allowPawnDamage(Pawn* victim, Pawn* originator)
+    {
+        if (originator && originator->getPlayer())// only for safety
+        {
+            this->timeToAct_[originator->getPlayer()]=timeRemaining;
+
+            std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
+            if (it != this->players_.end())
+            {
+                if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                    return true;
+                const std::string& message = ""; // resets Camper-Warning-message
+                this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
+            }    
+        }
+        return true;
+    }
+
+    bool LastManStanding::allowPawnDeath(Pawn* victim, Pawn* originator)
+    {
+        if (!victim||!victim->getPlayer())// only for safety
+            return true;
+        playerLives_[victim->getPlayer()]=playerLives_[victim->getPlayer()]-1;
+        this->inGame_[victim->getPlayer()]=false;//if player dies he, isn't allowed to respawn immediately
+        if (playerLives_[victim->getPlayer()]<=0)//if player lost all lives
+        {
+            this->playersAlive--;
+            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
+            COUT(0) << message << std::endl;
+            Host::Broadcast(message);
+        }
+
+        return true;
+    }
+
+    int LastManStanding::getMinLives()
+    {
+        int min=lives;
+        for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
+        {
+            if (it->second<=0)
+                continue;
+            if (it->second<lives)
+                min=it->second;
+        }
+        return min;
+    }
+
+    void LastManStanding::end()
+    {
+        Gametype::end();
+        
+        for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
+        {
+            if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                continue;
+
+            if (it->second > 0)
+                this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
+            else
+                this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
+        }
+    }
+
+    int LastManStanding::playerGetLives(PlayerInfo* player)
+    {
+        if (player)
+            return  playerLives_[player];
+        else
+            return 0;
+    }
+    
+    int LastManStanding::getNumPlayersAlive() const
+    {
+        return this->playersAlive;
+    }
+
+    void LastManStanding::playerEntered(PlayerInfo* player)
+    {
+        if (!player)// only for safety
+            return;
+        Deathmatch::playerEntered(player);
+        if (playersAlive<=1)
+            playerLives_[player]=lives;
+        else
+            playerLives_[player]=getMinLives();//new players only get minimum of lives
+        this->playersAlive++;
+        this->timeToAct_[player]=timeRemaining;
+        this->playerDelayTime_[player]=respawnDelay;
+        this->inGame_[player]=true;
+    }
+
+    bool LastManStanding::playerLeft(PlayerInfo* player)
+    {
+        bool valid_player = Deathmatch::playerLeft(player);
+        if (valid_player)
+        {
+            this->playersAlive--;
+            this->playerLives_.erase (player);
+            this->playerDelayTime_.erase (player);
+            this->inGame_.erase (player);
+            this->timeToAct_.erase(player);
+        }
+
+        return valid_player;
+    }
+
+    void LastManStanding::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
+    {
+        if (!player)
+            return;
+        this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
+        this->playerDelayTime_[player]=respawnDelay;
+        
+        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
+        if (it != this->players_.end())
+        {
+            if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                return;
+            const std::string& message = ""; // resets Camper-Warning-message
+            this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
+        }  
+    }
+
+    void LastManStanding::punishPlayer(PlayerInfo* player)
+    {
+        if(!player)
+            return;
+        if(bNoPunishment)
+            return;
+        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
+        if (it != this->players_.end())
+        {
+            if(!player->getControllableEntity())
+                return;
+            Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());
+            if(!pawn)
+                return;
+            if(bHardPunishment)
+            {
+                pawn->kill();
+                this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
+            }
+            else
+            {
+                float damage=pawn->getMaxHealth()*punishDamageRate*0.5;//TODO: Factor 0.5 is hard coded. Where is the ratio between MaxHealth actually defined?
+                pawn->removeHealth(damage);
+                this->timeToAct_[player]=timeRemaining;//reset timer
+            }
+        }
+    }
+
+    void LastManStanding::tick(float dt)
+    {
+        SUPER(LastManStanding, tick, dt);
+        if(this->hasStarted()&&(!this->hasEnded()))
+        {
+            if ((this->hasStarted()&&(playersAlive<=1)))//last player remaining
+            {
+                this->end();
+            }
+            for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
+            {   
+                if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
+                    continue;     
+                it->second-=dt;//Decreases punishment time.
+                if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 
+                {
+                    playerDelayTime_[it->first]-=dt;
+                    if (playerDelayTime_[it->first]<=0)
+                    this->inGame_[it->first]=true;
+
+                    if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                        continue;
+                    int output=1+playerDelayTime_[it->first];
+                    const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
+                    this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
+                }
+                else if (it->second<0.0f)
+                {
+                    it->second=timeRemaining+3.0f;//reset punishment-timer
+                    if (playerGetLives(it->first)>0)
+                    {
+                        this->punishPlayer(it->first);
+                        if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                            return;
+                        const std::string& message = ""; // resets Camper-Warning-message
+                        this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
+                    }
+                }
+                else if (it->second<timeRemaining/5)//Warning message
+                {
+                    if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                        continue;
+                    const std::string& message = "Camper Warning! Don't forget to shoot.";
+                    this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
+                }
+            }
+        }
+    }
+
+}
Index: code/trunk/src/orxonox/gametypes/LastManStanding.h
===================================================================
--- code/trunk/src/orxonox/gametypes/LastManStanding.h	(revision 7655)
+++ code/trunk/src/orxonox/gametypes/LastManStanding.h	(revision 7655)
@@ -0,0 +1,86 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+/**
+    @file LastManStanding.h
+    @brief Declaration of the Gametype "Last Man Standing".
+*/
+
+#ifndef _LastManStanding_H__
+#define _LastManStanding_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Deathmatch.h"
+#include <map>
+#include <vector>
+
+namespace orxonox
+{
+    class _OrxonoxExport LastManStanding : public Deathmatch
+    {
+    /**
+    @brief
+        Last Man Standing is a gametype where each player fights against each other, until one player remains. 
+    @author
+        Johannes Ritz
+    */
+        protected:
+            int lives; //!< Standard amount of lives. Each player starts a game with so many lives.
+            std::map< PlayerInfo*, int > playerLives_; //!< Each player's lives are stored here.
+            int playersAlive; //!< Counter counting players with more than 0 lives.
+            float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
+            std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
+            float respawnDelay; //!<Time in seconds when a player will respawn after death.
+            std::map<PlayerInfo*, float> playerDelayTime_; //!< Stores each Player's delay time.
+            std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state.
+            bool bNoPunishment; //!< Config value to switch off Punishment function if it is set to true.
+            bool bHardPunishment; //!< Switches between damage and death as punishment.
+            float punishDamageRate; //!< Makes Damage adjustable.
+            virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
+            virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped; 
+
+        public:
+            LastManStanding(BaseObject* creator); //!< Default Constructor.
+            virtual ~LastManStanding() {} //!< Default Destructor.
+            void setConfigValues(); //!< Makes values configurable.
+
+            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
+            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
+
+            virtual void end(); //!< Sends an end message.
+            int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
+            int getNumPlayersAlive() const; //!< Returns the number of players that are still alive.
+            virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
+            virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
+            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Resets punishment time and respawn delay.
+
+            void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
+            void tick (float dt); //!< used to end the game
+    };
+}
+
+#endif /* _LastManStanding_H__ */
Index: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h	(revision 7654)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h	(revision 7655)
@@ -155,5 +155,5 @@
             float shieldAbsorption_; // Has to be between 0 and 1
 
-            Pawn* lastHitOriginator_;
+            WeakPtr<Pawn> lastHitOriginator_;
 
             WeaponSystem* weaponSystem_;
