Changeset 9370
- Timestamp:
- Sep 4, 2012, 6:13:03 PM (12 years ago)
- Location:
- code/branches/release2012
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/release2012/data/levels/underAttack.oxw
r9348 r9370 46 46 <?lua end ?> 47 47 48 49 50 51 48 52 <Destroyer 49 53 position = "100,150,0" … … 53 57 angularDamping = 0.9999999 54 58 health = 10000 55 maxhealth = 10000 59 maxhealth = 10000000 56 60 initialhealth = 10000 57 61 radarname = "Transporter" … … 59 63 60 64 <attached> 61 <TeamSpawnPoint team=1 position="150,0, 7" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />62 <TeamSpawnPoint team=1 position="0,0, 7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />63 <TeamSpawnPoint team=1 position="-50,0, 7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />64 <TeamSpawnPoint team=1 position="100,0, 7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />65 <TeamSpawnPoint team=1 position="50,0, 7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />65 <TeamSpawnPoint team=1 position="150,0,-50" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 66 <TeamSpawnPoint team=1 position="0,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 67 <TeamSpawnPoint team=1 position="-50,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 68 <TeamSpawnPoint team=1 position="100,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 69 <TeamSpawnPoint team=1 position="50,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 66 70 <?lua for i = 1, 100, 1 do ?> 67 71 <TeamSpawnPoint -
code/branches/release2012/src/orxonox/gametypes/TeamGametype.cc
r9363 r9370 188 188 } 189 189 190 int TeamGametype::getTeamSize(int team) 191 { 192 int teamSize = 0; 193 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) 194 { 195 if (it->second == team) 196 teamSize++; 197 } 198 return teamSize; 199 } 200 201 int TeamGametype::getHumansInTeam(int team) 202 { 203 int teamSize = 0; 204 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) 205 { 206 if (it->second == team && it->first->isHumanPlayer()) 207 teamSize++; 208 } 209 return teamSize; 210 } 211 212 190 213 SpawnPoint* TeamGametype::getBestSpawnPoint(PlayerInfo* player) const 191 214 { -
code/branches/release2012/src/orxonox/gametypes/TeamGametype.h
r9363 r9370 63 63 { return this->teamcolours_[teamnr]; } 64 64 int getTeamScore(PlayerInfo* player); 65 65 int getTeamSize(int team); 66 int getHumansInTeam(int team); 66 67 67 68 protected: -
code/branches/release2012/src/orxonox/gametypes/UnderAttack.cc
r9348 r9370 39 39 { 40 40 CreateUnloadableFactory(UnderAttack); 41 static const int attacker_ = 0; // teamnumber of the attacking team 42 static const int defender_ = 1; // defender's teamnumber 41 43 42 44 UnderAttack::UnderAttack(BaseObject* creator) : TeamDeathmatch(creator) … … 51 53 this->setConfigValues(); 52 54 this->timesequence_ = static_cast<int>(this->gameTime_); 55 53 56 } 54 57 … … 76 79 continue; 77 80 78 if (it->second == 0)81 if (it->second == attacker_) 79 82 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID()); 80 83 else … … 188 191 } 189 192 } 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_)*3500.0f + this->getHumansInTeam(attacker_)*1500.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 190 215 } -
code/branches/release2012/src/orxonox/gametypes/UnderAttack.h
r5929 r9370 51 51 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); 52 52 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); 53 virtual void playerEntered(PlayerInfo* player); 53 54 54 55 protected: 55 56 virtual void killedDestroyer(); 57 void setTransporterHealth(); 56 58 57 59 WeakPtr<Destroyer> destroyer_;
Note: See TracChangeset
for help on using the changeset viewer.