Merge branch 'master' into cmake

This commit is contained in:
xawotihs
2015-10-25 00:22:57 +02:00
60 changed files with 1588 additions and 694 deletions
+143 -16
View File
@@ -556,6 +556,15 @@ private:
intValue = card->previous->previous->sunburst;
}
}
else if (s == "converge")
{
intValue = 0;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if(card->getManaCost()->getManaUsedToCast()->hasColor(i))
intValue +=1;
}
}
else if (s == "targetedcurses")
{
if(card->playerTarget)
@@ -645,11 +654,11 @@ private:
}
else if (s == "p" || s == "power")
{
intValue = target->getPower();
intValue = target->getCurrentPower();
}
else if (s == "t" || s == "toughness")
{
intValue = target->getToughness();
intValue = target->getCurrentToughness();
}
else if (s == "kicked")
{
@@ -679,6 +688,20 @@ private:
{
intValue = target->controller()->opponent()->game->hand->nb_cards;
}
else if (s == "urzatron")//Urza lands
{
if(card->controller()->game->battlefield->hasAlias(4192) && card->controller()->game->battlefield->hasAlias(4193) && card->controller()->game->battlefield->hasAlias(4194))
intValue = 1;
else
intValue = 0;
}
else if (s == "worshipped")//Worship
{
if(card->controller()->game->battlefield->hasType("creature"))
intValue = card->controller()->life;
else
intValue = 0;
}
else if (s == "pancientooze")//Ancient Ooze
{
intValue = 0;
@@ -708,7 +731,7 @@ private:
else if (s == "pbasiclandtypes")//Basic Land types
{
intValue = 0;
int forest, plains, swamp, island, mountain = 0;
int forest = 0, plains = 0, swamp = 0, island = 0, mountain = 0;
for (int j = card->controller()->game->battlefield->nb_cards - 1; j >= 0; --j)
{
if (card->controller()->game->battlefield->cards[j]->hasType("forest"))
@@ -801,7 +824,7 @@ private:
else if (s == "gravecardtypes")//Tarmogoyf
{
intValue = 0;
int art, cre, enc, ins, lnd, sor, trb, pwk = 0;
int art = 0, cre = 0, enc = 0, ins = 0, lnd = 0, sor = 0, trb = 0, pwk = 0;
for (int i = 0; i < 2; i++)
{
Player * p = card->getObserver()->players[i];
@@ -1173,9 +1196,9 @@ public:
class TrcardDrawn: public Trigger
{
public:
TrcardDrawn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false) :
Trigger(observer, id, source,once, tc)
bool thiscontroller, thisopponent;
TrcardDrawn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false, bool thiscontroller = false, bool thisopponent = false) :
Trigger(observer, id, source,once, tc),thiscontroller(thiscontroller),thisopponent(thisopponent)
{
}
@@ -1184,7 +1207,12 @@ public:
WEventcardDraw * e = dynamic_cast<WEventcardDraw *> (event);
if (!e) return 0;
if (!tc->canTarget(e->player)) return 0;
if(thiscontroller)
if(e->player != source->controller())
return 0;
if(thisopponent)
if(e->player == source->controller())
return 0;
return 1;
}
@@ -1272,8 +1300,10 @@ public:
bool sourceUntapped;
bool limitOnceATurn;
int triggeredTurn;
TrDamaged(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, TargetChooser * fromTc = NULL, int type = 0,bool sourceUntapped = false,bool limitOnceATurn = false,bool once = false) :
Trigger(observer, id, source, once, tc), fromTc(fromTc), type(type) , sourceUntapped(sourceUntapped),limitOnceATurn(limitOnceATurn)
bool thiscontroller;
bool thisopponent;
TrDamaged(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, TargetChooser * fromTc = NULL, int type = 0,bool sourceUntapped = false,bool limitOnceATurn = false,bool once = false, bool thiscontroller = false, bool thisopponent = false) :
Trigger(observer, id, source, once, tc), fromTc(fromTc), type(type) , sourceUntapped(sourceUntapped),limitOnceATurn(limitOnceATurn),thiscontroller(thiscontroller),thisopponent(thisopponent)
{
triggeredTurn = -1;
}
@@ -1290,6 +1320,15 @@ public:
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
if (type == 1 && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT) return 0;
if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
if (e->damage->target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
if(thiscontroller)
if(e->damage->target != (Damageable *)source->controller())
return 0;
if(thisopponent)
if(e->damage->target == (Damageable *)source->controller())
return 0;
}
e->damage->target->thatmuch = e->damage->damage;
e->damage->source->thatmuch = e->damage->damage;
this->source->thatmuch = e->damage->damage;
@@ -1314,9 +1353,9 @@ class TrLifeGained: public Trigger
public:
TargetChooser * fromTc;
int type;//this allows damagenoncombat and combatdamage to share this trigger
bool sourceUntapped;
TrLifeGained(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, TargetChooser * fromTc = NULL, int type = 0,bool sourceUntapped = false,bool once = false) :
Trigger(observer, id, source, once , tc), fromTc(fromTc), type(type) , sourceUntapped(sourceUntapped)
bool sourceUntapped, thiscontroller, thisopponent;
TrLifeGained(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, TargetChooser * fromTc = NULL, int type = 0,bool sourceUntapped = false,bool once = false, bool thiscontroller = false, bool thisopponent = false) :
Trigger(observer, id, source, once , tc), fromTc(fromTc), type(type) , sourceUntapped(sourceUntapped) , thiscontroller(thiscontroller) , thisopponent(thisopponent)
{
}
@@ -1330,6 +1369,12 @@ public:
if (fromTc && !fromTc->canTarget(e->player)) return 0;
if (type == 1 && (e->amount > 0)) return 0;
if (type == 0 && (e->amount < 0)) return 0;
if(thiscontroller)
if(e->player != source->controller())
return 0;
if(thisopponent)
if(e->player == source->controller())
return 0;
e->player->thatmuch = abs(e->amount);
this->source->thatmuch = abs(e->amount);
@@ -1417,7 +1462,7 @@ public:
}
};
//targetted trigger
//counter trigger
class TrCounter: public Trigger
{
public:
@@ -1749,7 +1794,9 @@ public:
string destination;
MTGAbility * andAbility;
string named;
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
bool undying;
bool persist;
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL, bool undying = false, bool persist = false);
MTGGameZone * destinationZone(Targetable * target = NULL);
int resolve();
const string getMenuText();
@@ -2068,6 +2115,7 @@ public:
assert(value < 2);
_target->basicAbilities.set(ability, value > 0);
_target->modifiedbAbi += 1;
return InstantAbility::addToGame();
}
@@ -2080,7 +2128,10 @@ public:
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
_target->basicAbilities.set(ability, stateBeforeActivation);
_target->modifiedbAbi -= 1;
}
return 1;
}
@@ -4170,7 +4221,9 @@ class AANewTarget: public ActivatedAbility
{
public:
bool retarget;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
bool reequip;
bool newhook;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL, bool reequip = false, bool newhook = false);
int resolve();
const string getMenuText();
AANewTarget * clone() const;
@@ -4780,6 +4833,49 @@ public:
~AVanishing();
};
//Produce Mana when tapped for mana...
class AProduceMana: public MTGAbility
{
public:
string ManaDescription;
string mana[5];
AProduceMana(GameObserver* observer, int _id, MTGCardInstance * _source, string _ManaDescription);
int receiveEvent(WEvent * event);
int produce();
const string getMenuText();
//virtual ostream& toString(ostream& out) const;
AProduceMana * clone() const;
~AProduceMana();
};
//Produce Mana when a mana is engaged...
class AEngagedManaAbility: public MTGAbility
{
public:
string colorname;
AEngagedManaAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _colorname) :
MTGAbility(observer, _id, _source)
{
colorname = _colorname;
}
int receiveEvent(WEvent * event)
{
if(WEventEngageMana * isManaProduced = dynamic_cast<WEventEngageMana *> (event))
{
if ((isManaProduced->card == source) && isManaProduced->color == Constants::GetColorStringIndex(colorname))
{
source->controller()->getManaPool()->add(Constants::GetColorStringIndex(colorname),1);
}
}
return 1;
}
AEngagedManaAbility * clone() const
{
return NEW AEngagedManaAbility(*this);
}
};
//Upkeep Cost
class AUpkeep: public ActivatedAbility, public NestedAbility
{
@@ -5953,6 +6049,37 @@ public:
}
};
//Reduce to .. Ali from Cairo...
class AReduceToAbility: public MTGAbility
{
public:
string life_s;
AReduceToAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _life_s) :
MTGAbility(observer, _id, _source)
{
life_s = _life_s;
}
int receiveEvent(WEvent * event)
{
if(WEventDamage * isDamaged = dynamic_cast<WEventDamage *> (event))
{
if (isDamaged->damage->target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
Player * p = (Player *) isDamaged->damage->target;
WParsedInt lifetoset(life_s, NULL, source);
if(p && p == source->controller() && p->life <= lifetoset.getValue())
p->life = lifetoset.getValue();
}
}
return 1;
}
AReduceToAbility * clone() const
{
return NEW AReduceToAbility(*this);
}
};
//flanking ability
class AFlankerAbility: public MTGAbility
{
+3 -3
View File
@@ -33,7 +33,7 @@ protected:
/*
** Tries to render the Big version of a card picture, backups to text version in case of failure
*/
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false);
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos);
@@ -55,8 +55,8 @@ public:
virtual void Render();
virtual void Update(float dt);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false);
static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const;
+2
View File
@@ -58,6 +58,8 @@ public:
uint8_t colors;
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
BasicAbilitiesSet basicAbilities;
BasicAbilitiesSet origbasicAbilities;
BasicAbilitiesSet LKIbasicAbilities;
map<string,string> magicTexts;
string magicText;
+1
View File
@@ -73,6 +73,7 @@ public:
static hgeParticleSystem * Particles[6];
static bool HasMusic;
static string systemError;
static char mynbcardsStr[512];
static JMusic* music;
static string currentMusicFile;
static void playMusic(string filename = "", bool loop = true);
+1 -2
View File
@@ -24,7 +24,6 @@ private:
float mCreditsYPos;
int currentState;
int mVolume;
char nbcardsStr[400];
vector<string> langs;
vector<string> primitives;
@@ -46,7 +45,6 @@ private:
bool langChoices;
void runTest(); //!!
void listPrimitives();
void genNbCardsStr(); //computes the contents of nbCardsStr
void ensureMGuiController(); //creates the MGuiController if it doesn't exist
string loadRandomWallpaper(); //loads a list of string of textures that can be randolmy shown on the loading screen
@@ -66,6 +64,7 @@ public:
int nextSetFolder(const string & root, const string & file); // Retrieves the next directory to have matching file
void createUsersFirstDeck(int setId);
static void genNbCardsStr(); //computes the contents of nbCardsStr
virtual ostream& toString(ostream& out) const;
enum
+1 -1
View File
@@ -22,7 +22,7 @@ private:
InOutQuadEasing zoomFactorEasing;
DuelLayers* mpDuelLayers;
void DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale);
void DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale, float z);
public:
GuiPhaseBar(DuelLayers* duelLayers);
~GuiPhaseBar();
+12
View File
@@ -233,6 +233,10 @@ public:
void addbaseT(int t = 0);
void revertbaseP();
void revertbaseT();
int getCurrentPower();
int getCurrentToughness();
int LKIpower;
int LKItoughness;
void cdaPT(int p = 0, int t = 0);
bool isCDA;
void switchPT(bool apply = false);
@@ -241,6 +245,14 @@ public:
bool isSwitchedPT;
bool isACopier;
bool bypassTC;
bool discarded;
int copiedID;
int modifiedbAbi;
bool StackIsEmptyandSorcerySpeed();
bool isTargetted();
int cardistargetted;
bool isTargetter();
int cardistargetter;
void eventattacked();
void eventattackedAlone();
+5 -1
View File
@@ -230,7 +230,11 @@ class Constants
NOLIFEGAIN = 112,
NOLIFEGAINOPPONENT = 113,
AURAWARD = 114,
NB_BASIC_ABILITIES = 115,
MADNESS = 115,
PROTECTIONFROMCOLOREDSPELLS = 116,
MYGCREATUREEXILER = 117,
OPPGCREATUREEXILER = 118,
NB_BASIC_ABILITIES = 119,
RARITY_S = 'S', //Special Rarity
+2
View File
@@ -103,6 +103,8 @@ class MTGGameZone {
//returns true if one of the cards in the zone has the ability
bool hasAbility(int ability);
//returns true if one of the cards in the zone has the alias
bool hasAlias(int alias);
//returns true if one of the cards in the zone has the type
bool hasType(const char * value);
+8 -8
View File
@@ -76,7 +76,7 @@ public:
MTGPutInPlayRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "cast card normally";
return "Cast Card Normally";
}
virtual MTGPutInPlayRule * clone() const;
};
@@ -90,7 +90,7 @@ public:
MTGKickerRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "pay kicker";
return "Pay Kicker";
}
virtual MTGKickerRule * clone() const;
};
@@ -110,7 +110,7 @@ public:
{
if(alternativeName.size())
return alternativeName.c_str();
return "pay alternative cost";
return "Pay Alternative Cost";
}
virtual MTGAlternativeCostRule * clone() const;
};
@@ -124,7 +124,7 @@ public:
MTGBuyBackRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "cast and buy back";
return "Cast and Buyback";
}
virtual MTGBuyBackRule * clone() const;
};
@@ -139,7 +139,7 @@ public:
MTGFlashBackRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "flash back";
return "Flashback";
}
virtual MTGFlashBackRule * clone() const;
};
@@ -153,7 +153,7 @@ public:
MTGRetraceRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "retrace";
return "Retrace";
}
virtual MTGRetraceRule * clone() const;
};
@@ -168,7 +168,7 @@ public:
MTGMorphCostRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "play morphed";
return "Play Morphed";
}
virtual MTGMorphCostRule * clone() const;
};
@@ -182,7 +182,7 @@ public:
MTGPlayFromGraveyardRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "cast card from graveyard";
return "Cast Card From Graveyard";
}
virtual MTGPlayFromGraveyardRule * clone() const;
};
+2 -1
View File
@@ -44,6 +44,7 @@ public:
int drawCounter;
int epic;
int initLife;
int raidcount;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
@@ -71,7 +72,7 @@ public:
ManaPool * getManaPool();
void takeMulligan();
void serumMulligan();
bool DeadLifeState();
bool DeadLifeState(bool check = false);
ManaCost * doesntEmpty;
ManaCost * poolDoesntEmpty;
void cleanupPhase();
+6
View File
@@ -279,6 +279,12 @@ struct WEventCardUnattached : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card moves from player/opponent battlefield to player/opponent battlefield
struct WEventCardControllerChange : public WEventCardUpdate {
WEventCardControllerChange(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
#endif
+2 -2
View File
@@ -12,8 +12,8 @@ Author: Michael Nguyen
/* Wagic versions */
#define WAGIC_VERSION_MAJOR 0
#define WAGIC_VERSION_MEDIUM 20
#define WAGIC_VERSION_MINOR 1
#define WAGIC_VERSION_MEDIUM 19
#define WAGIC_VERSION_MINOR 2
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c