Merge branch 'master' into cmake

This commit is contained in:
xawotihs
2016-06-07 23:35:26 +02:00
34 changed files with 12994 additions and 2149 deletions
+78 -6
View File
@@ -584,6 +584,18 @@ private:
if (target->controller()->life >= target->controller()->initLife)
intValue = 1;
}
else if (s == "plibrarycount")
{
intValue = 0;
if (target->controller()->game->library->nb_cards)
intValue = target->controller()->game->library->nb_cards;
}
else if (s == "olibrarycount")
{
intValue = 0;
if (target->controller()->opponent()->game->library->nb_cards)
intValue = target->controller()->opponent()->game->library->nb_cards;
}
else if (s == "highestlifetotal")
{
intValue = target->controller()->life <= target->controller()->opponent()->life? target->controller()->opponent()->life:target->controller()->life;
@@ -652,6 +664,10 @@ private:
{
intValue = target->controller()->epic;
}
else if (s == "snowcount")
{//this is just to count the number of snow mana produced ... just for debugging purposes...
intValue = target->controller()->snowManaG + target->controller()->snowManaU +target->controller()->snowManaR + target->controller()->snowManaB + target->controller()->snowManaW + target->controller()->snowManaC;
}
else if (s == "p" || s == "power")
{
intValue = target->getCurrentPower();
@@ -778,6 +794,46 @@ private:
intValue = 1;
}//end
}
else if (s == "cantargetmycre")// can target my creature
{
intValue = 0;
for (int j = card->controller()->game->battlefield->nb_cards - 1; j >= 0; --j)
{
if (card->controller()->game->battlefield->cards[j]->hasType("creature") && !card->controller()->game->battlefield->cards[j]->protectedAgainst(card))
{
intValue += 1;
}
}
}
else if (s == "cantargetoppocre")// can target opponent creature
{
intValue = 0;
for (int j = card->controller()->opponent()->game->battlefield->nb_cards - 1; j >= 0; --j)
{
if (card->controller()->opponent()->game->battlefield->cards[j]->hasType("creature") && !card->controller()->opponent()->game->battlefield->cards[j]->protectedAgainst(card))
{
intValue += 1;
}
}
}
else if (s == "cantargetcre")// can target any creature
{
intValue = 0;
for (int j = card->controller()->opponent()->game->battlefield->nb_cards - 1; j >= 0; --j)
{
if (card->controller()->opponent()->game->battlefield->cards[j]->hasType("creature") && !card->controller()->opponent()->game->battlefield->cards[j]->protectedAgainst(card))
{
intValue += 1;
}
}
for (int k = card->controller()->game->battlefield->nb_cards - 1; k >= 0; --k)
{
if (card->controller()->game->battlefield->cards[k]->hasType("creature") && !card->controller()->game->battlefield->cards[k]->protectedAgainst(card))
{
intValue += 1;
}
}
}
else if (s == "controllerturn")//intvalue = 1 if its your turn this(variable{controllerturn})
{
intValue = 0;
@@ -1698,7 +1754,8 @@ class AAEPIC: public ActivatedAbility
{
public:
string named;
AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
bool FField;
AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL, bool ffield = false );
int resolve();
const string getMenuText();
AAEPIC * clone() const;
@@ -2356,7 +2413,8 @@ public:
{
if (!isReactingToClick(_card)) return 0;
game->currentlyActing()->getManaPool()->pay(cost);
game->currentlyActing()->life += life;
if(!game->currentlyActing()->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
game->currentlyActing()->life += life;
lastUsedOn = lastChecked;
return 1;
}
@@ -2964,7 +3022,7 @@ public:
{
if (newPhase != currentPhase && newPhase == phase && game->currentPlayer == ((MTGCardInstance *) target)->controller())
{
if (!onlyIfTargetTapped || ((MTGCardInstance *) target)->isTapped())
if ((!onlyIfTargetTapped || ((MTGCardInstance *) target)->isTapped()) && (!game->currentPlayer->inPlay()->hasAbility(Constants::CANTCHANGELIFE)))
{
if (life > 0)
{
@@ -4547,7 +4605,7 @@ public:
void Update(float)
{
if (newPhase != currentPhase && newPhase == phase)
if (newPhase != currentPhase && newPhase == phase && !game->currentPlayer->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
{
if ((controller && game->currentPlayer == source->controller()) || (!controller && game->currentPlayer
!= source->controller()))
@@ -6019,12 +6077,26 @@ public:
string nbcardsStr;
bool toexile;
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET, bool toexile = false);
int who = TargetChooser::UNSET, bool toexile = false);
int resolve();
const string getMenuText();
AADepleter * clone() const;
};
//AACascade
class AACascade: public ActivatedAbilityTP
{
public:
string nbcardsStr;
AACascade(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
void toCastCard(MTGCardInstance * card);
const string getMenuText();
AACascade * clone() const;
};
//Generic skip turn/extra turn
class AAModTurn: public ActivatedAbilityTP
{
@@ -6193,7 +6265,7 @@ public:
{
Player * p = (Player *) isDamaged->damage->target;
WParsedInt lifetoset(life_s, NULL, source);
if(p && p == source->controller() && p->life <= lifetoset.getValue())
if(p && p == source->controller() && p->life <= lifetoset.getValue() && !p->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
p->life = lifetoset.getValue();
}
}
+20
View File
@@ -155,6 +155,15 @@ public:
virtual ToLibraryCost * clone() const;
};
//toGraveyard cost
class ToGraveCost : public ExtraCost
{
public:
ToGraveCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ToGraveCost * clone() const;
};
//Millyourself cost
class MillCost : public ExtraCost
{
@@ -195,6 +204,17 @@ public:
virtual TapCost * clone() const;
};
//Snow cost
class SnowCost : public ExtraCost
{
public:
SnowCost();
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual SnowCost * clone() const;
};
//untap cost
class UnTapCost : public ExtraCost
{
+3 -1
View File
@@ -89,6 +89,7 @@ public:
bool isMorphed;
bool isFlipped;
bool isPhased;
bool isCascaded;
int phasedTurn;
bool graveEffects;
bool exileEffects;
@@ -254,7 +255,8 @@ public:
bool isTargetter();
int cardistargetter;
int myconvertedcost;
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost);
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false);
int countTrini;
void eventattacked();
void eventattackedAlone();
+8 -3
View File
@@ -72,6 +72,7 @@ class Constants
static const string kManaRed;
static const string kManaBlack;
static const string kManaWhite;
static const string kManaWaste;
// alternative costs constants
@@ -94,9 +95,11 @@ class Constants
MTG_COLOR_RED = 3,
MTG_COLOR_BLACK = 4,
MTG_COLOR_WHITE = 5,
MTG_COLOR_LAND = 6,
MTG_COLOR_WASTE = 6,
MTG_COLOR_LAND = 7,
MTG_NB_COLORS = 7,
MTG_NB_COLORS = 8,
MTG_UNCOLORED = 0,
@@ -238,7 +241,9 @@ class Constants
TRINISPHERE = 120,
CANPLAYFROMEXILE = 121,
LIBRARYEATER = 122,
NB_BASIC_ABILITIES = 123,
DEVOID = 123,
CANTCHANGELIFE = 124,
NB_BASIC_ABILITIES = 125,
RARITY_S = 'S', //Special Rarity
+9
View File
@@ -43,9 +43,16 @@ public:
int extraTurn;
int drawCounter;
int epic;
int forcefield;
int initLife;
int raidcount;
int handmodifier;
int snowManaG;
int snowManaR;
int snowManaB;
int snowManaU;
int snowManaW;
int snowManaC;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
@@ -73,6 +80,8 @@ public:
ManaPool * getManaPool();
void takeMulligan();
void serumMulligan();
bool hasPossibleAttackers();
bool noPossibleAttackers();
bool DeadLifeState(bool check = false);
ManaCost * doesntEmpty;
ManaCost * poolDoesntEmpty;