Modifications to make the game more generic.

Included in a new modrules.xml tags.
 <cardgui>
   <background> Stores information concerning the colors </ background>
   <renderbig> Stores information to draw the card </ renderbig>
  <rendertinycrop> Stores information to draw the card </ rendertinycrop>
 </ cardgui>

 Change the variables array for vectors
This commit is contained in:
rodrigodemoura@gmail.com
2011-10-13 12:25:58 +00:00
parent dee49728aa
commit e6b199f599
30 changed files with 919 additions and 556 deletions
+11 -5
View File
@@ -71,7 +71,7 @@ private:
if(s == "prex")
{
ManaCost * cX = card->controller()->getManaPool()->Diff(card->getManaCost());
intValue = cX->getCost(Constants::MTG_NB_COLORS);
intValue = cX->getCost(Constants::NB_Colors);
delete cX;
}
else if (s == "x" || s == "X")
@@ -2533,7 +2533,7 @@ public:
if(sabilities.find("battleready") != string::npos)
battleReady = true;
for (int j = 0; j < Constants::MTG_NB_COLORS; j++)
for (int j = 0; j < Constants::NB_Colors; j++)
{
size_t found = sabilities.find(Constants::MTGColorStrings[j]);
if (found != string::npos)
@@ -3834,7 +3834,9 @@ public:
MTGAbility(observer, id, _source)
{
counters = 0;
int8_t _cost[] = { Constants::MTG_COLOR_ARTIFACT, 4 };
std::vector<int8_t> _cost;
_cost.push_back(Constants::MTG_COLOR_ARTIFACT);
_cost.push_back(4);
cost = ManaCost(_cost, 1);
}
@@ -3896,7 +3898,9 @@ public:
MTGAbility(observer, _id, _source)
{
canprevent = 0;
int8_t _cost[] = { Constants::MTG_COLOR_ARTIFACT, 2 };
std::vector<int8_t> _cost;
_cost.push_back(Constants::MTG_COLOR_ARTIFACT);
_cost.push_back(2);
cost = ManaCost(_cost, 1);
}
@@ -3990,7 +3994,9 @@ public:
AFarmstead(GameObserver* observer, int _id, MTGCardInstance * source, MTGCardInstance * _target) :
ActivatedAbility(observer, _id, source, 0, 1)
{
int8_t _cost[] = { Constants::MTG_COLOR_WHITE, 2 };
std::vector<int8_t> _cost;
_cost.push_back(Constants::MTG_COLOR_WHITE);
_cost.push_back(2);
setCost(NEW ManaCost(_cost, 1), true);
target = _target;
usedThisTurn = 0;
+1
View File
@@ -38,6 +38,7 @@ protected:
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos);
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
static string FormattedData (string data, string replace, string value);
public:
static const float Width;
+1 -1
View File
@@ -108,6 +108,6 @@ public:
};
extern JQuadPtr manaIcons[7];
extern vector<JQuadPtr> manaIcons;
#endif
+3 -3
View File
@@ -75,13 +75,13 @@ enum DECK_VIEWER_MENU_ITEMS
#define MED_SPEED 5.0f
#define LOW_SPEED 1.5
#define MAX_SAVED_FILTERS 8
#define CARDS_DISPLAYED 7
#define MAX_SAVED_FILTERS Constants::NB_Colors + 1
#define CARDS_DISPLAYED 10
class GameStateDeckViewer: public GameState, public JGuiListener
{
private:
JQuadPtr mIcons[CARDS_DISPLAYED];
vector<JQuadPtr> mIcons;
JQuadPtr pspIcons[8];
JTexture * pspIconsTexture;
float last_user_activity;
+1 -1
View File
@@ -99,7 +99,7 @@ private:
protected:
int conf_read_mode;
int colorsCount[Constants::MTG_NB_COLORS];
vector <int> colorsCount;
int total_cards;
void init();
void initCounters();
+2 -2
View File
@@ -249,7 +249,7 @@ class Constants
};
static char MTGColorChars[];
static const char* MTGColorStrings[];
static vector <const char*> MTGColorStrings;
static int _r[], _g[], _b[];
static map<string,int> MTGBasicAbilitiesMap;
@@ -259,7 +259,7 @@ class Constants
static int GetBasicAbilityIndex(string mtgAbility);
static int GetColorStringIndex(string mtgColor);
static int NB_Colors;
};
#endif
+4 -4
View File
@@ -23,7 +23,7 @@ class ManaCost
friend std::ostream& operator<<(std::ostream& out, ManaCost m);
protected:
int8_t cost[Constants::MTG_NB_COLORS+1];
std::vector<int8_t> cost;
std::vector<ManaCostHybrid> hybrids;
@@ -56,7 +56,7 @@ public:
virtual void reinit();
void x();
int hasX();
ManaCost(int8_t _cost[], int nb_elems = 1);
ManaCost(std::vector<int8_t>& _cost, int nb_elems = 1);
ManaCost();
~ManaCost();
ManaCost(ManaCost * _manaCost);
@@ -83,8 +83,8 @@ public:
int doPayExtra();
int addHybrid(int c1, int v1, int c2, int v2);
int tryToPayHybrids(std::vector<ManaCostHybrid>& _hybrids, int _nbhybrids, int8_t diff[]);
void randomDiffHybrids(ManaCost * _cost, int8_t diff[]);
int tryToPayHybrids(std::vector<ManaCostHybrid>& _hybrids, int _nbhybrids,std::vector<int8_t>& diff);
void randomDiffHybrids(ManaCost * _cost, std::vector<int8_t>& diff);
int add(ManaCost * _cost);
int remove(ManaCost * _cost);
int removeAll(int color);
+37 -1
View File
@@ -84,6 +84,42 @@ public:
~ModRulesMenu();
};
class ModRulesBackGroundCardGuiItem
{
protected:
static int strToint(string str);
public:
int mColorId;
string MColorName;
string mDisplayImg;
string mDisplayThumb;
int mMenuIcon;
ModRulesBackGroundCardGuiItem(string ColorId,string ColorName, string DisplayImg, string DisplayThumb,string MenuIcon);
};
class ModRulesRenderCardGuiItem
{
public:
string mName;
int mPosX;
int mPosY;
string mType;
string mFormattedData;
ModRulesRenderCardGuiItem(string Name, string PosX, string PosY, string FormattedData, string Type);
};
class ModRulesCardGui
{
public:
vector<ModRulesBackGroundCardGuiItem *> background;
vector<ModRulesRenderCardGuiItem *> renderbig;
vector<ModRulesRenderCardGuiItem *> rendertinycrop;
void parse(TiXmlElement* element);
~ModRulesCardGui();
};
class ModRulesGame
{
public:
@@ -123,7 +159,7 @@ public:
ModRulesCards cards;
ModRulesMenu menu;
ModRulesGame game;
ModRulesCardGui cardgui;
bool load(string filename);
static int getValueAsInt(TiXmlElement* element, string childName);