Files
wagic/projects/mtg/include/Rules.h
omegablast2002@yahoo.com 64a234ef44 added support for customphasering construction in rules txt...
exsample

[INIT]
mode=mtg
[PLAYERS]
life:2000
poisoncount:4
customphasering:untap,firstmain,firstmain,draw,firstmain,upkeep,draw
auto=shuffle
auto=draw:7
auto=@each my draw:draw:1
auto=maxPlay(land)1

by default every turn will have normal order we've always been use to
however
before begins --required added automatically
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
anything you want in any order
cleanup---required added automatically
after end of turn---required added automatically

svntax 
customphasering:blah,blah,blah
listed in the order you want it to go. you can repeat a phase as often as you want, you can omit phases.

please note, this was not designed with MTG in mind..some of the rules require certain phases to work...this is for CUSTOM game building...i repeat NOT DESIGNED FOR MTG...tho it can be used with most(almost all, with the exception of those which require certain phases to work, exsample, ninjitsu will only work in a phasering which contains blockers and attackers)

enjoy.....
2011-03-02 21:33:42 +00:00

89 lines
1.5 KiB
C++

#ifndef _RULES_H_
#define _RULES_H_
#include <string>
#include <vector>
using namespace std;
class ManaCost;
class Player;
class MTGPlayerCards;
class MTGDeck;
class MTGCardInstance;
#define MAX_RULES_CARDS 4096;
class RulesPlayerZone
{
public:
vector<int> cards;
void add(int cardid);
RulesPlayerZone();
void cleanup();
};
class RulesPlayerData
{
public:
vector<string> extraRules;
string phaseRing;
int life;
int poisonCount;
int damageCount;
int preventable;
string avatar;
ManaCost * manapool;
RulesPlayerZone zones[5];
RulesPlayerData();
~RulesPlayerData();
void cleanup();
};
class RulesState
{
public:
int phase;
int player;
void parsePlayerState(int playerId, string s);
RulesState();
RulesPlayerData playerData[2];
void cleanup();
};
class Rules
{
protected:
Player * loadPlayerMomir(int isAI);
Player * loadPlayerRandom(int isAI, int mode);
Player * initPlayer(int playerId);
MTGDeck * buildDeck(int playerId);
int strToGameMode(string s);
public:
enum
{
PARSE_UNDEFINED,
PARSE_INIT,
PARSE_PLAYER1,
PARSE_PLAYER2,
PARSE_PLAYERS
};
string bg;
Rules(string filename, string bg = "");
int load(string filename);
int gamemode;
void initPlayers();
void addExtraRules();
void initGame();
void cleanup();
vector<string> extraRules;
RulesState initState;
static int getMTGId(string name);
static MTGCardInstance * getCardByMTGId(int mtgid);
};
#endif