/* * Copyright 2007-2008 Ben Boeckel * * 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 3 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, see . */ #ifndef SIGBATTLE_ARENA #define SIGBATTLE_ARENA // Sigbattle includes #include "Global.h" #include "Team.h" #include "TeamMember.h" // Qt includes #include #include #include #include #include // Forward declarations namespace Kross { class Action; class ActionCollection; } namespace Sigmod { class Script; } namespace Sigscript { class SigmodWrapper; } namespace Sigbattle { class Player; class SIGBATTLE_EXPORT Arena : public Sigscript::Config { Q_OBJECT public: typedef QPair Spoil; ~Arena(); QList active() const; int numActiveTeams() const; bool isOver() const; Sigscript::SigmodWrapper* sigmod() const; signals: void battleStart(); void battleEnd(); void aboutToClearActions(); public slots: void registerScript(const Sigmod::Script& script); protected slots: virtual void cleanUp(); protected: Arena(Sigscript::SigmodWrapper* sigmod, QList players, const bool isWild, QObject* parent); virtual void handleAction(TeamMember* teamMember, TeamMember::Action action); virtual void setupBattle(); void distributeWinnings(); virtual void checkForLosers(); TeamMember* findMember(const QUuid& id); Sigscript::SigmodWrapper* m_sigmod; const bool m_isWild; bool m_isOver; QList m_players; Kross::ActionCollection* m_actions; QMap m_spoils; private: const QUuid m_id; }; TeamMember::RequestedAction requestDecision(TeamMember* teamMember); TeamMember::Action decision(TeamMember* teamMember); } Q_DECLARE_METATYPE(Sigbattle::Arena*) #endif