- Fixed a Bug where AI would not correctly assign blockers if the first attacker is super strong. - Added a hack to prevent AI from an infinite loop while choosing a target. There are edge cases where the AI gets to choose the targets for a TargetChooser that doesn't belong to it. I couldn't dig too long for the root cause, so I added a "return 0" when the case happens. Should probably open a ticket - Added a "Hint" System in AI decks, to help the AI with its strategy. This is not really usable yet, it only works with abilities (not cards to play), and I only added some basic code for counters and tokens. This can probably be extended, but let's wait until we see it working on that other game I'm working on, before rushing into adding hints to all AI decks... - minor cleanup of AI Code
110 lines
1.9 KiB
C++
110 lines
1.9 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;
|
|
bool isPoisoned;
|
|
MTGPlayerCards * game;
|
|
MTGDeck * mDeck;
|
|
string deckFile;
|
|
string deckFileSmall;
|
|
string deckName;
|
|
string phaseRing;
|
|
Player(string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
|
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(string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
|
HumanPlayer(string deckFile);
|
|
|
|
};
|
|
|
|
ostream& operator<<(ostream&, const Player&);
|
|
istream& operator>>(istream& in, Player& p);
|
|
|
|
#endif
|