Files
wagic/projects/mtg/include/Rules.h
omegablast2002@yahoo.com e275a599b7 ok this may, or may not get me yelled at...but i can explain why i do it in rules...so don't kill me :(
added 
"offerinterruptonphase=blah"
to the parsing of the rules.txt files...the reason i want to handle it inside the rules.txt....
originally i was going to use the options variable for this, then i realized that if i use that variable, it would apply it to every game mode and peoples custom games...so instead i added the parsing in the actual rules.txt files, this way, if we want to offer interrupt on phase blah to MTG, but NOT have this interrupt offered in a mod or different mode, or if the different mod or mode should offer you a chance to interrupt ai in a different phase ...you can set each rule to interrupt in the phase you want...

now for the reason i added it in the first place...previously we were allowed an interrupt when the opponent drew a card in the draw step, this gave us a chance to do stuff on opponents turn....
recently wololo i beleave made draw actions not use the stack anymore(which was a good change, since as per MTG rules the actions of drawing is not a stack action)...but as a side-effect, we lose our chance to interrupt ai and do stuff on ais turn....

also, changed the ingame bonus thing, to start recording stuff towards bonuses on turn 2+...this solves reported issues with story mode "setting up" causing massive bonuses to be gained for doing nothing.....
2011-05-10 17:08:08 +00:00

104 lines
2.0 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 offerInterruptOnPhase;
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);
bool postUpdateInitDone;
public:
enum
{
PARSE_UNDEFINED,
PARSE_INIT,
PARSE_PLAYER1,
PARSE_PLAYER2,
PARSE_PLAYERS
};
string bg;
string filename;
int gamemode;
bool hidden;
string displayName;
int unlockOption;
static vector<Rules *> RulesList;
Rules(string bg = "");
int load(string _filename);
static int loadAllRules();
static void unloadAllRules();
static Rules * getRulesByFilename(string _filename);
void initPlayers();
bool canChooseDeck(); //True if the players get to select their decks, false if the decks are automatically generated by the mode
void addExtraRules();
void initGame();
//second part of the initialization, needs to happen after the first update call
void postUpdateInit();
void cleanup();
vector<string> extraRules;
RulesState initState;
static int getMTGId(string name);
static MTGCardInstance * getCardByMTGId(int mtgid);
};
#endif