1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Johannes Ritz |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _Dynamicmatch_H__ |
---|
30 | #define _Dynamicmatch_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include <map> |
---|
35 | #include <set> |
---|
36 | #include <vector> |
---|
37 | |
---|
38 | #include "tools/Timer.h" |
---|
39 | |
---|
40 | #include "Gametype.h" |
---|
41 | |
---|
42 | namespace orxonox |
---|
43 | { |
---|
44 | /** |
---|
45 | @brief |
---|
46 | Short Gaming Manual: |
---|
47 | There are three different parties a player can belong to: victim, chaser or killer |
---|
48 | Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them. |
---|
49 | In order to win you have to earn as much points as possible: |
---|
50 | - as victim by escaping the chasers |
---|
51 | - as chaser by shooting the victim |
---|
52 | - as killer by killing the chasers |
---|
53 | |
---|
54 | |
---|
55 | What you shouldn't do is shooting at players of your own party. By doing so your score will decrease. |
---|
56 | P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser. |
---|
57 | |
---|
58 | @todo: |
---|
59 | pig punkte vergeben pro Zeit! |
---|
60 | killerfarbe schwarz; evtl. eigenes Raumfahrzeug; |
---|
61 | Low; Codeoptimierung und Dokumentation |
---|
62 | */ |
---|
63 | class _OrxonoxExport Dynamicmatch : public Gametype |
---|
64 | { |
---|
65 | public: |
---|
66 | Dynamicmatch(Context* context); |
---|
67 | virtual ~Dynamicmatch(); |
---|
68 | |
---|
69 | bool notEnoughPigs; |
---|
70 | bool notEnoughKillers; |
---|
71 | bool notEnoughChasers; |
---|
72 | |
---|
73 | //three different parties |
---|
74 | int chaser; |
---|
75 | int piggy; |
---|
76 | int killer; |
---|
77 | |
---|
78 | virtual void evaluatePlayerParties(); |
---|
79 | int getParty(PlayerInfo* player); |
---|
80 | void setPlayerColour(PlayerInfo* player);//own function |
---|
81 | void setConfigValues();//done |
---|
82 | |
---|
83 | bool friendlyfire; //goal: player can switch it on/off |
---|
84 | bool tutorial; //goal: new players receive messages how the new gametype works - later it can be switched off. |
---|
85 | |
---|
86 | virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //ok - score function and management of parties |
---|
87 | virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //ok - simple |
---|
88 | virtual void start() override; |
---|
89 | virtual void end() override; //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht? |
---|
90 | virtual void playerEntered(PlayerInfo* player) override; |
---|
91 | virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;//is used to initialize the player's party and colour |
---|
92 | virtual bool playerLeft(PlayerInfo* player) override; |
---|
93 | virtual bool playerChangedName(PlayerInfo* player) override;//unchanged |
---|
94 | |
---|
95 | /*virtual void instructions(); |
---|
96 | virtual void furtherInstructions();*/ |
---|
97 | virtual void rewardPig(); |
---|
98 | void grantPigBoost(SpaceShip* spaceship); // Grant the piggy a boost. |
---|
99 | void resetSpeedFactor(SpaceShip* spaceship, Timer* timer); |
---|
100 | virtual void tick (float dt) override;// used to end the game |
---|
101 | virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const override; |
---|
102 | |
---|
103 | |
---|
104 | protected: |
---|
105 | inline unsigned int getPlayerCount() const |
---|
106 | { return this->numberOf[chaser] + numberOf[piggy] + this->numberOf[killer]; } |
---|
107 | |
---|
108 | std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here |
---|
109 | std::vector<ColourValue> partyColours_; //aus TeamDeathmatch |
---|
110 | std::set<Timer*> piggyTimers_; |
---|
111 | unsigned int numberOf[3]; //array to count number of chasers, pigs, killers |
---|
112 | float pointsPerTime; |
---|
113 | float gameTime_; // from UnderAttack |
---|
114 | bool gameEnded_; // true if game is over |
---|
115 | int timesequence_; //used for countdown |
---|
116 | //Timer callInstructions_; |
---|
117 | }; |
---|
118 | } |
---|
119 | |
---|
120 | #endif /* _Dynamicmatch_H__ */ |
---|