Files
wagic/projects/mtg/include/Player.h
Anthony Calosa 022a15a5e9 added epic cards, fixed maxcast bug
maxcast(*)0 - checks for the current action player of that turn, but
when you passes the turn to the opponent, you can cast instant or cards
with flash instead because you are not the current player, it mustcheck
the controller of the card with play restriction if he can play it or
not whether it your turn or the opponents turn.
2015-09-07 10:09:34 +08:00

125 lines
2.6 KiB
C++

#ifndef _PLAYER_H_
#define _PLAYER_H_
#include "JGE.h"
#include "MTGGameZones.h"
#include "Damage.h"
#include "Targetable.h"
class MTGDeck;
class MTGPlayerCards;
class MTGInPlay;
class ManaPool;
class Player: public Damageable
{
protected:
ManaPool * manaPool;
JTexture * mAvatarTex;
JQuadPtr mAvatar;
bool loadAvatar(string file, string resName = "playerAvatar");
bool premade;
public:
enum Mode
{
MODE_TEST_SUITE,
MODE_HUMAN,
MODE_AI
};
int deckId;
string mAvatarName;
Mode playMode;
bool nomaxhandsize;
MTGPlayerCards * game;
MTGDeck * mDeck;
string deckFile;
string deckFileSmall;
string deckName;
string phaseRing;
int offerInterruptOnPhase;
int skippingTurn;
int extraTurn;
int drawCounter;
int epic;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
virtual ~Player();
virtual void setObserver(GameObserver*g);
virtual void End();
virtual int displayStack()
{
return 1;
}
const string getDisplayName() const;
int afterDamage();
int gainLife(int value);
int loseLife(int value);
int gainOrLoseLife(int value);
bool isPoisoned() {return (poisonCount > 0);}
int poisoned();
int damaged();
int prevented();
void unTapPhase();
MTGInPlay * inPlay();
ManaPool * getManaPool();
void takeMulligan();
void serumMulligan();
bool DeadLifeState();
ManaCost * doesntEmpty;
ManaCost * poolDoesntEmpty;
void cleanupPhase();
virtual int Act(float)
{
return 0;
}
virtual int isAI()
{
return 0;
}
bool isHuman()
{
return (playMode == MODE_HUMAN);
}
Player * opponent();
int getId();
JQuadPtr getIcon();
virtual int receiveEvent(WEvent *)
{
return 0;
}
virtual void Render()
{
}
/**
** Returns the path to the stats file of currently selected deck.
*/
std::string GetCurrentDeckStatsFile();
virtual bool parseLine(const string& s);
friend ostream& operator<<(ostream&, const Player&);
friend istream& operator>>(istream&, Player&);
bool operator<(Player& aPlayer);
bool isDead();
};
class HumanPlayer: public Player
{
public:
HumanPlayer(GameObserver *observer, string deckFile, string deckFileSmall, bool premade = false, MTGDeck * deck = NULL);
void End();
friend ostream& operator<<(ostream&, const HumanPlayer&);
};
#endif