Files
wagic/projects/mtg/include/Player.h
wagic.the.homebrew@gmail.com 8eac9c587e Erwan
- added maxCast and maxPlay abilities, this deprecates the following abilities: nospells,nocreatures,onlyonespell,land
I usually don't like to deprecate abilities, but the existing ones, despite having easy to remember names, were really not flexible enough.

If you want to use these old keywords, instead use:
-- nospells  =>  maxCast(*)0
-- onlyOneSpell => maxCast(*)1
--nocreatures => maxCast(creature)0
--land:1 => maxplay(land)+1

note maxPlay and maxCast. They follow similar rules, but maxPlay monitors the number of cards that are going on the Battlefield, while maxCast monitors the stack. In most cases, maxCast should be the one to use, but lands are a special case because they go directly to play.

I unfortunately cannot guarantee I didn't break anything, especially in the AI, but the test suite passes ,and I added a few additional tests yesterday and today, to feel more confident about the change.

next step is removing the creatures keywords that do the same kind of thing (cantcast, etc...) and replace them with maxCast
2011-02-13 08:01:13 +00:00

117 lines
2.1 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;
public:
enum ENUM_PLAY_MODE
{
MODE_TEST_SUITE,
MODE_HUMAN,
MODE_AI
};
JTexture * mAvatarTex;
JQuadPtr mAvatar;
int playMode;
bool nomaxhandsize;
int castedspellsthisturn;
bool onlyonecast;
int castcount;
bool castrestrictedcreature;
bool castrestrictedspell;
bool onlyoneboth;
bool bothrestrictedspell;
bool bothrestrictedcreature;
bool isPoisoned;
MTGPlayerCards * game;
string deckFile;
string deckFileSmall;
string deckName;
Player(MTGDeck * deck, string deckFile, string deckFileSmall);
virtual ~Player();
virtual void End();
virtual int displayStack()
{
return 1;
}
const string getDisplayName() const;
int typeAsTarget()
{
return TARGET_PLAYER;
}
int afterDamage();
int gainLife(int value);
int loseLife(int value);
int gainOrLoseLife(int value);
int poisoned();
int damaged();
int prevented();
void unTapPhase();
MTGInPlay * inPlay();
ManaPool * getManaPool();
void takeMulligan();
void cleanupPhase();
virtual int Act(float dt)
{
return 0;
}
virtual int isAI()
{
return 0;
}
Player * opponent();
int getId();
JQuadPtr getIcon();
virtual int receiveEvent(WEvent * event)
{
return 0;
}
virtual void Render()
{
}
void loadAvatar(string file);
/**
** Returns the path to the stats file of currently selected deck.
*/
std::string GetCurrentDeckStatsFile();
};
class HumanPlayer: public Player
{
public:
HumanPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
HumanPlayer(string deckFile);
};
ostream& operator<<(ostream&, const Player&);
istream& operator>>(istream& in, Player& p);
#endif