[1992] | 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 | * Damian 'Mozork' Frick |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _Quest_H__ |
---|
| 30 | #define _Quest_H__ |
---|
| 31 | |
---|
| 32 | #include <list> |
---|
| 33 | #include <string> |
---|
| 34 | |
---|
[1996] | 35 | #include "QuestDescription.h" |
---|
[1992] | 36 | #include "QuestItem.h" |
---|
| 37 | #include "QuestHint.h" |
---|
| 38 | #include "QuestEffect.h" |
---|
| 39 | |
---|
[2021] | 40 | namespace questStatus |
---|
| 41 | { |
---|
| 42 | |
---|
| 43 | enum Enum |
---|
| 44 | { |
---|
| 45 | inactive, |
---|
| 46 | active, |
---|
| 47 | failed, |
---|
| 48 | completed |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | } |
---|
| 52 | |
---|
[1992] | 53 | namespace orxonox { |
---|
| 54 | |
---|
[2021] | 55 | class Player; //Forward declaration, remove when fully integrated into the objecthirarchy. |
---|
| 56 | |
---|
[1992] | 57 | /** |
---|
| 58 | @brief |
---|
| 59 | Represents a quest in the game. |
---|
| 60 | A quest has a sub |
---|
| 61 | |
---|
| 62 | @author |
---|
| 63 | Damian 'Mozork' Frick |
---|
| 64 | */ |
---|
| 65 | class Quest : public QuestItem |
---|
| 66 | { |
---|
| 67 | public: |
---|
[2021] | 68 | Quest(); |
---|
[1992] | 69 | Quest(std::string id, std::string title = "", std::string description = ""); |
---|
[1996] | 70 | virtual ~Quest(); |
---|
[1992] | 71 | |
---|
| 72 | inline Quest* getParentQuest(void) const //!< Returns the parent quest of the quest. |
---|
| 73 | { return this->parentQuest_; } |
---|
[2021] | 74 | inline const std::list<Quest*> & getSubQuest(void) const //!< Returns the list of sub quests. |
---|
[1992] | 75 | { return this->subQuests_; } |
---|
| 76 | |
---|
| 77 | //TDO: Necessary? Shouldn't this be decided whilest creating the object? |
---|
[2021] | 78 | // Yes it absolutely should and will. Add these methods to protected then? |
---|
[1996] | 79 | bool setParentQuest(Quest* quest); //!< Sets the parent quest of the quest. |
---|
[2021] | 80 | bool addSubQuest(Quest* quest); //!< Adds a sub quest to the quest. |
---|
[1992] | 81 | |
---|
[2021] | 82 | inline bool isInactive(Player* player) //!< Returns true if the quest status for the specific player is 'inactive'. |
---|
[1996] | 83 | { return this->getStatus(player) == questStatus::inactive; } |
---|
[2021] | 84 | inline bool isActive(Player* player) //!< Returns true if the quest status for the specific player is 'active'. |
---|
[1992] | 85 | { return this->getStatus(player) == questStatus::active; } |
---|
[2021] | 86 | inline bool isFailed(Player* player) //!< Returns true if the quest status for the specific player is 'failed'. |
---|
[1992] | 87 | { return this->getStatus(player) == questStatus::failed; } |
---|
[2021] | 88 | inline bool isCompleted(Player* player) //!< Returns true if the quest status for the specific player is 'completed'. |
---|
[1992] | 89 | { return this->getStatus(player) == questStatus::completed; } |
---|
| 90 | |
---|
[2021] | 91 | bool start(Player* player); //!< Sets a quest to active. |
---|
| 92 | bool fail(Player* player); //!< Fails the quest. |
---|
| 93 | bool complete(Player* player); //!< Completes the quest. |
---|
[1992] | 94 | |
---|
[2021] | 95 | void addHint(QuestHint* hint); //!< Add a hint to the list of hints. |
---|
[1992] | 96 | |
---|
| 97 | protected: |
---|
| 98 | void initialize(void); //!< Initialized the object. |
---|
| 99 | |
---|
[2021] | 100 | virtual bool isStartable(Player* player) = 0; //!< Checks whether the quest can be started. |
---|
| 101 | virtual bool isFailable(Player* player) = 0; //!< Checks whether the quest can be failed. |
---|
| 102 | virtual bool isCompletable(Player* player) = 0; //!< Checks whether the quest can be completed. |
---|
[1996] | 103 | |
---|
[2021] | 104 | //TDO: Get the parameter const... |
---|
| 105 | virtual questStatus::Enum getStatus(const Player* player) = 0; //!< Returns the status of the quest for a specific player. |
---|
| 106 | virtual bool setStatus(Player* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player. |
---|
[1992] | 107 | |
---|
| 108 | Quest* parentQuest_; //!< Pointer to the parent quest. |
---|
[2021] | 109 | std::list<Quest*> subQuests_; //!< List of all the sub quests. |
---|
[1992] | 110 | |
---|
[2021] | 111 | std::list<QuestHint*> hints_; //!< A list of all the hints tied to this quest. |
---|
[1992] | 112 | |
---|
[2021] | 113 | std::list<QuestEffect*> failEffects_; //!< A list of all effects to be invoked, when the quest has been failed. |
---|
| 114 | std::list<QuestEffect*> completeEffects_; //!< A list of effects to be invoked, when the quest has been completed. |
---|
[1992] | 115 | |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | #endif /* _Quest_H__ */ |
---|