Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2013, 8:06:44 PM (10 years ago)
Author:
jo
Message:

Adding most of the changes that were proposed in the release2012 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/gametypes/UnderAttack.cc

    r9667 r9941  
    3838namespace orxonox
    3939{
     40    const int attacker_ = 0; // teamnumber of the attacking team
     41    const int defender_ = 1; // defender's teamnumber
     42
    4043    RegisterUnloadableClass(UnderAttack);
    4144
     
    7679                continue;
    7780
    78             if (it->second == 0)
     81            if (it->second == attacker_)
    7982                this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
    8083            else
     
    188191        }
    189192    }
     193
     194    void UnderAttack::playerEntered(PlayerInfo* player)
     195    {
     196        if (!player)
     197            return;
     198        TeamDeathmatch::playerEntered(player);
     199        this->setTransporterHealth();
     200    }
     201
     202    void UnderAttack::setTransporterHealth()
     203    {
     204        if (this->destroyer_ != 0)
     205        {
     206            //Calculation: Each attacker deals about 3500 damage. A human attacker deals 1500 damage additionally.
     207            //Each defender prevents 500 damage. If human 2000 damage will be additionally be prevented.
     208            //TODO: use gametime and the damage dealt so far in order to calculate the transporter's life more precisely
     209            float health = this->getTeamSize(attacker_)*2000.0f + this->getHumansInTeam(attacker_)*3000.0f - this->getTeamSize(defender_)*500.0f - this->getHumansInTeam(defender_)*2000.0f ;
     210            this->destroyer_->setHealth(std::max(health, 5000.0f)); //the destoyer should have at least 5000.0f life.
     211        }
     212    }
     213
     214
    190215}
Note: See TracChangeset for help on using the changeset viewer.