Cleanup tabs
This commit is contained in:
+261
-261
@@ -41,111 +41,111 @@ public:
|
|||||||
class MTGRevealingCards : public MTGAbility, public CardDisplay
|
class MTGRevealingCards : public MTGAbility, public CardDisplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vector<CardView*> cards;
|
vector<CardView*> cards;
|
||||||
Player * playerForZone;
|
Player * playerForZone;
|
||||||
MTGGameZone * RevealZone;
|
MTGGameZone * RevealZone;
|
||||||
MTGGameZone * RevealFromZone;
|
MTGGameZone * RevealFromZone;
|
||||||
string revealCertainTypes;
|
string revealCertainTypes;
|
||||||
string revealUntil;
|
string revealUntil;
|
||||||
|
|
||||||
CardDisplay * revealDisplay;
|
CardDisplay * revealDisplay;
|
||||||
vector<CardDisplay*>trashDisplays;//used for repeat
|
vector<CardDisplay*>trashDisplays;//used for repeat
|
||||||
int nbCard;
|
int nbCard;
|
||||||
string abilityString;
|
string abilityString;
|
||||||
string number;
|
string number;
|
||||||
string abilityOne;
|
string abilityOne;
|
||||||
string abilityTwo;
|
string abilityTwo;
|
||||||
string afterReveal;
|
string afterReveal;
|
||||||
bool afterEffectActivated;
|
bool afterEffectActivated;
|
||||||
MTGAbility * abilityToCast;
|
MTGAbility * abilityToCast;
|
||||||
MTGAbility * abilityFirst;
|
MTGAbility * abilityFirst;
|
||||||
MTGAbility * abilitySecond;
|
MTGAbility * abilitySecond;
|
||||||
MTGAbility * abilityAfter;
|
MTGAbility * abilityAfter;
|
||||||
vector<MTGAbility*>abilities;
|
vector<MTGAbility*>abilities;
|
||||||
bool repeat;//only the first ability can be repeated, and it must be targeted.
|
bool repeat;//only the first ability can be repeated, and it must be targeted.
|
||||||
bool initCD;
|
bool initCD;
|
||||||
|
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
int testDestroy();
|
int testDestroy();
|
||||||
int toResolve();
|
int toResolve();
|
||||||
void CardViewBackup(MTGCardInstance * backup);
|
void CardViewBackup(MTGCardInstance * backup);
|
||||||
void Render();
|
void Render();
|
||||||
bool CheckUserInput(JButton key);
|
bool CheckUserInput(JButton key);
|
||||||
MTGAbility * contructAbility(string abilityToMake = "");
|
MTGAbility * contructAbility(string abilityToMake = "");
|
||||||
MTGRevealingCards(GameObserver* observer, int _id, MTGCardInstance * card, string text);
|
MTGRevealingCards(GameObserver* observer, int _id, MTGCardInstance * card, string text);
|
||||||
virtual MTGRevealingCards * clone() const;
|
virtual MTGRevealingCards * clone() const;
|
||||||
~MTGRevealingCards();
|
~MTGRevealingCards();
|
||||||
int receiveEvent(WEvent*);
|
int receiveEvent(WEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RevealDisplay : public CardDisplay
|
class RevealDisplay : public CardDisplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RevealDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL,
|
RevealDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL,
|
||||||
int nb_displayed_items = 7);
|
int nb_displayed_items = 7);
|
||||||
void AddCard(MTGCardInstance * _card);
|
void AddCard(MTGCardInstance * _card);
|
||||||
bool CheckUserInput(JButton key);
|
bool CheckUserInput(JButton key);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericRevealAbility : public ActivatedAbility
|
class GenericRevealAbility : public ActivatedAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
string howMany;
|
string howMany;
|
||||||
MTGRevealingCards * ability;
|
MTGRevealingCards * ability;
|
||||||
GenericRevealAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string _howMany);
|
GenericRevealAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string _howMany);
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
GenericRevealAbility * clone() const;
|
GenericRevealAbility * clone() const;
|
||||||
~GenericRevealAbility();
|
~GenericRevealAbility();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MTGScryCards : public MTGAbility, public CardDisplay
|
class MTGScryCards : public MTGAbility, public CardDisplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vector<CardView*> cards;
|
vector<CardView*> cards;
|
||||||
MTGGameZone * RevealZone;
|
MTGGameZone * RevealZone;
|
||||||
MTGGameZone * RevealFromZone;
|
MTGGameZone * RevealFromZone;
|
||||||
|
|
||||||
CardDisplay * revealDisplay;
|
CardDisplay * revealDisplay;
|
||||||
vector<CardDisplay*>trashDisplays;//used for repeat
|
vector<CardDisplay*>trashDisplays;//used for repeat
|
||||||
int nbCard;
|
int nbCard;
|
||||||
bool delayed;
|
bool delayed;
|
||||||
bool dontRevealAfter;
|
bool dontRevealAfter;
|
||||||
int revealTopAmount;
|
int revealTopAmount;
|
||||||
string delayedAbilityString;
|
string delayedAbilityString;
|
||||||
string abilityString;
|
string abilityString;
|
||||||
string number;
|
string number;
|
||||||
string abilityOne;
|
string abilityOne;
|
||||||
string abilityTwo;
|
string abilityTwo;
|
||||||
MTGAbility * abilityToCast;
|
MTGAbility * abilityToCast;
|
||||||
MTGAbility * abilityFirst;
|
MTGAbility * abilityFirst;
|
||||||
MTGAbility * abilitySecond;
|
MTGAbility * abilitySecond;
|
||||||
vector<MTGAbility*>abilities;
|
vector<MTGAbility*>abilities;
|
||||||
bool initCD;
|
bool initCD;
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
int testDestroy();
|
int testDestroy();
|
||||||
void initDisplay(int value = 0);
|
void initDisplay(int value = 0);
|
||||||
int toResolve();
|
int toResolve();
|
||||||
void Render();
|
void Render();
|
||||||
bool CheckUserInput(JButton key);
|
bool CheckUserInput(JButton key);
|
||||||
MTGAbility * contructAbility(string abilityToMake = "");
|
MTGAbility * contructAbility(string abilityToMake = "");
|
||||||
MTGScryCards(GameObserver* observer, int _id, MTGCardInstance * card, string text);
|
MTGScryCards(GameObserver* observer, int _id, MTGCardInstance * card, string text);
|
||||||
virtual MTGScryCards * clone() const;
|
virtual MTGScryCards * clone() const;
|
||||||
~MTGScryCards();
|
~MTGScryCards();
|
||||||
int receiveEvent(WEvent*);
|
int receiveEvent(WEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericScryAbility : public ActivatedAbility
|
class GenericScryAbility : public ActivatedAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
string howMany;
|
string howMany;
|
||||||
MTGScryCards * ability;
|
MTGScryCards * ability;
|
||||||
GenericScryAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string _howMany);
|
GenericScryAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string _howMany);
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
GenericScryAbility * clone() const;
|
GenericScryAbility * clone() const;
|
||||||
~GenericScryAbility();
|
~GenericScryAbility();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -166,11 +166,11 @@ private:
|
|||||||
{
|
{
|
||||||
if(!s.size())
|
if(!s.size())
|
||||||
return;
|
return;
|
||||||
if (!card)
|
if (!card)
|
||||||
{
|
{
|
||||||
intValue = atoi(s.c_str());//if there is no card, try parsing a number.
|
intValue = atoi(s.c_str());//if there is no card, try parsing a number.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MTGCardInstance * target = card->target;
|
MTGCardInstance * target = card->target;
|
||||||
if(!card->storedCard)
|
if(!card->storedCard)
|
||||||
card->storedCard = card->storedSourceCard;
|
card->storedCard = card->storedSourceCard;
|
||||||
@@ -255,57 +255,57 @@ private:
|
|||||||
s.erase(otc,otc + 5);
|
s.erase(otc,otc + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.find("plusend") != string::npos || s.find("minusend") != string::npos || s.find("math") != string::npos)
|
if (s.find("plusend") != string::npos || s.find("minusend") != string::npos || s.find("math") != string::npos)
|
||||||
{
|
{
|
||||||
//plus#plusend and minus#minusend splits the first part and second parts and parses the
|
//plus#plusend and minus#minusend splits the first part and second parts and parses the
|
||||||
//ints for each part, then either adds or subtracts those 2 variables as specified.
|
//ints for each part, then either adds or subtracts those 2 variables as specified.
|
||||||
vector<string>mathFound = parseBetween(s, "math", "mathend", true);
|
vector<string>mathFound = parseBetween(s, "math", "mathend", true);
|
||||||
if (mathFound.size())//maths allows us to get the value before applying multipliers
|
if (mathFound.size())//maths allows us to get the value before applying multipliers
|
||||||
{
|
{
|
||||||
WParsedInt numPar(mathFound[1], NULL, card);
|
WParsedInt numPar(mathFound[1], NULL, card);
|
||||||
intValue = numPar.getValue();
|
intValue = numPar.getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vector<string>plusSplit = parseBetween(s, "", "plus", true);
|
vector<string>plusSplit = parseBetween(s, "", "plus", true);
|
||||||
if (plusSplit.size())
|
if (plusSplit.size())
|
||||||
{
|
{
|
||||||
WParsedInt numPar(plusSplit[1], NULL, card);
|
WParsedInt numPar(plusSplit[1], NULL, card);
|
||||||
intValue = numPar.getValue();
|
intValue = numPar.getValue();
|
||||||
}
|
}
|
||||||
vector<string>plusFound = parseBetween(s, "plus", "plusend", true);
|
vector<string>plusFound = parseBetween(s, "plus", "plusend", true);
|
||||||
if (plusFound.size())
|
if (plusFound.size())
|
||||||
{
|
{
|
||||||
WParsedInt numPar(plusFound[1], NULL, card);
|
WParsedInt numPar(plusFound[1], NULL, card);
|
||||||
intValue += numPar.getValue();
|
intValue += numPar.getValue();
|
||||||
}
|
}
|
||||||
vector<string>minusSplit = parseBetween(s, "", "minus", true);
|
vector<string>minusSplit = parseBetween(s, "", "minus", true);
|
||||||
if (minusSplit.size())
|
if (minusSplit.size())
|
||||||
{
|
{
|
||||||
WParsedInt numPar(minusSplit[1], NULL, card);
|
WParsedInt numPar(minusSplit[1], NULL, card);
|
||||||
intValue = numPar.getValue();
|
intValue = numPar.getValue();
|
||||||
}
|
}
|
||||||
vector<string>minusFound = parseBetween(s, "minus", "minusend", true);
|
vector<string>minusFound = parseBetween(s, "minus", "minusend", true);
|
||||||
if (minusFound.size())
|
if (minusFound.size())
|
||||||
{
|
{
|
||||||
WParsedInt numPar(minusFound[1], NULL, card);
|
WParsedInt numPar(minusFound[1], NULL, card);
|
||||||
intValue -= numPar.getValue();
|
intValue -= numPar.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(s == "prex")
|
else if(s == "prex")
|
||||||
{
|
{
|
||||||
if (card->setX > -1)
|
if (card->setX > -1)
|
||||||
{
|
{
|
||||||
intValue = card->setX;
|
intValue = card->setX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ManaCost * cX = card->controller()->getManaPool()->Diff(card->getManaCost());
|
ManaCost * cX = card->controller()->getManaPool()->Diff(card->getManaCost());
|
||||||
intValue = cX->getCost(Constants::NB_Colors);
|
intValue = cX->getCost(Constants::NB_Colors);
|
||||||
delete cX;
|
delete cX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s == "x" || s == "X")
|
else if (s == "x" || s == "X")
|
||||||
{
|
{
|
||||||
@@ -382,10 +382,10 @@ private:
|
|||||||
{
|
{
|
||||||
intValue = countDevotionTo(card,card->controller()->inPlay(),Constants::MTG_COLOR_BLUE,Constants::MTG_COLOR_GREEN);
|
intValue = countDevotionTo(card,card->controller()->inPlay(),Constants::MTG_COLOR_BLUE,Constants::MTG_COLOR_GREEN);
|
||||||
}
|
}
|
||||||
else if (s == "Iroas")//devotion to red white
|
else if (s == "Iroas")//devotion to red white
|
||||||
{
|
{
|
||||||
intValue = countDevotionTo(card, card->controller()->inPlay(), Constants::MTG_COLOR_RED, Constants::MTG_COLOR_WHITE);
|
intValue = countDevotionTo(card, card->controller()->inPlay(), Constants::MTG_COLOR_RED, Constants::MTG_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
else if (s.find("type:") != string::npos)
|
else if (s.find("type:") != string::npos)
|
||||||
{
|
{
|
||||||
size_t begins = s.find("type:");
|
size_t begins = s.find("type:");
|
||||||
@@ -702,10 +702,10 @@ private:
|
|||||||
{
|
{
|
||||||
intValue = target->getCurrentToughness();
|
intValue = target->getCurrentToughness();
|
||||||
}
|
}
|
||||||
else if (s == "countedamount")
|
else if (s == "countedamount")
|
||||||
{
|
{
|
||||||
intValue = target->CountedObjects;
|
intValue = target->CountedObjects;
|
||||||
}
|
}
|
||||||
else if (s == "kicked")
|
else if (s == "kicked")
|
||||||
{
|
{
|
||||||
intValue = target->kicked;
|
intValue = target->kicked;
|
||||||
@@ -828,17 +828,17 @@ private:
|
|||||||
{
|
{
|
||||||
MTGGameZone * checkZone = card->controller()->inPlay();
|
MTGGameZone * checkZone = card->controller()->inPlay();
|
||||||
intValue = //mtg rules 205.4c
|
intValue = //mtg rules 205.4c
|
||||||
cardHasTypeinZone("waste", checkZone) +
|
cardHasTypeinZone("waste", checkZone) +
|
||||||
cardHasTypeinZone("forest", checkZone) +
|
cardHasTypeinZone("forest", checkZone) +
|
||||||
cardHasTypeinZone("plains", checkZone) +
|
cardHasTypeinZone("plains", checkZone) +
|
||||||
cardHasTypeinZone("swamp", checkZone) +
|
cardHasTypeinZone("swamp", checkZone) +
|
||||||
cardHasTypeinZone("island", checkZone) +
|
cardHasTypeinZone("island", checkZone) +
|
||||||
cardHasTypeinZone("mountain", checkZone) +
|
cardHasTypeinZone("mountain", checkZone) +
|
||||||
cardHasTypeinZone("snow-covered forest", checkZone) +
|
cardHasTypeinZone("snow-covered forest", checkZone) +
|
||||||
cardHasTypeinZone("snow-covered plains", checkZone) +
|
cardHasTypeinZone("snow-covered plains", checkZone) +
|
||||||
cardHasTypeinZone("snow-covered swamp", checkZone) +
|
cardHasTypeinZone("snow-covered swamp", checkZone) +
|
||||||
cardHasTypeinZone("snow-covered island", checkZone) +
|
cardHasTypeinZone("snow-covered island", checkZone) +
|
||||||
cardHasTypeinZone("snow-covered mountain", checkZone);
|
cardHasTypeinZone("snow-covered mountain", checkZone);
|
||||||
}
|
}
|
||||||
else if (s == "myname")//Name of the card you control
|
else if (s == "myname")//Name of the card you control
|
||||||
{
|
{
|
||||||
@@ -894,49 +894,49 @@ private:
|
|||||||
intValue += card->controller()->game->inPlay->cards[j]->power;
|
intValue += card->controller()->game->inPlay->cards[j]->power;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s == "revealedp")
|
else if (s == "revealedp")
|
||||||
{
|
{
|
||||||
if (card->revealedLast)
|
if (card->revealedLast)
|
||||||
intValue = card->revealedLast->power;
|
intValue = card->revealedLast->power;
|
||||||
}
|
}
|
||||||
else if (s == "revealedt")
|
else if (s == "revealedt")
|
||||||
{
|
{
|
||||||
if (card->revealedLast)
|
if (card->revealedLast)
|
||||||
intValue = card->revealedLast->toughness;
|
intValue = card->revealedLast->toughness;
|
||||||
}
|
}
|
||||||
else if (s == "revealedmana")
|
else if (s == "revealedmana")
|
||||||
{
|
{
|
||||||
if (card->revealedLast)
|
if (card->revealedLast)
|
||||||
intValue = card->revealedLast->getManaCost()->getConvertedCost();
|
intValue = card->revealedLast->getManaCost()->getConvertedCost();
|
||||||
}
|
}
|
||||||
else if(!intValue)//found nothing, try parsing a atoi
|
else if(!intValue)//found nothing, try parsing a atoi
|
||||||
{
|
{
|
||||||
intValue = atoi(s.c_str());
|
intValue = atoi(s.c_str());
|
||||||
}
|
}
|
||||||
if (intValue > 0)//dont divide by 0 the rest are valid.
|
if (intValue > 0)//dont divide by 0 the rest are valid.
|
||||||
{
|
{
|
||||||
if (halfup)
|
if (halfup)
|
||||||
{
|
{
|
||||||
if (intValue % 2 == 1)
|
if (intValue % 2 == 1)
|
||||||
intValue++;
|
intValue++;
|
||||||
intValue = intValue / 2;
|
intValue = intValue / 2;
|
||||||
}
|
}
|
||||||
if (halfdown)
|
if (halfdown)
|
||||||
intValue = intValue / 2;
|
intValue = intValue / 2;
|
||||||
}
|
}
|
||||||
if (twice)
|
if (twice)
|
||||||
intValue = intValue * 2;
|
intValue = intValue * 2;
|
||||||
if (thrice)
|
if (thrice)
|
||||||
intValue = intValue * 3;
|
intValue = intValue * 3;
|
||||||
if (intValue < 0)
|
if (intValue < 0)
|
||||||
{
|
{
|
||||||
//we remove "-" at the start and are parsing for real values.
|
//we remove "-" at the start and are parsing for real values.
|
||||||
//if we ended up with a value less than 0, then we return just 0
|
//if we ended up with a value less than 0, then we return just 0
|
||||||
intValue = 0;
|
intValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
intValue *= multiplier;
|
intValue *= multiplier;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int countDevotionTo(MTGCardInstance * card, MTGGameZone * zone, int color1, int color2)
|
int countDevotionTo(MTGCardInstance * card, MTGGameZone * zone, int color1, int color2)
|
||||||
@@ -3489,7 +3489,7 @@ public:
|
|||||||
list<int> colors;
|
list<int> colors;
|
||||||
int power, toughness;
|
int power, toughness;
|
||||||
int tokenId;
|
int tokenId;
|
||||||
string _cardName;
|
string _cardName;
|
||||||
string name;
|
string name;
|
||||||
string sabilities;
|
string sabilities;
|
||||||
string starfound;
|
string starfound;
|
||||||
@@ -3501,7 +3501,7 @@ public:
|
|||||||
MTGCardInstance * myToken;
|
MTGCardInstance * myToken;
|
||||||
vector<MTGAbility *> currentAbilities;
|
vector<MTGAbility *> currentAbilities;
|
||||||
Player * tokenReciever;
|
Player * tokenReciever;
|
||||||
//by id
|
//by id
|
||||||
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, int tokenId,string starfound, WParsedInt * multiplier = NULL,
|
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, int tokenId,string starfound, WParsedInt * multiplier = NULL,
|
||||||
int who = 0,bool aLivingWeapon = false) :
|
int who = 0,bool aLivingWeapon = false) :
|
||||||
ActivatedAbility(observer, _id, _source, _cost, 0), tokenId(tokenId), starfound(starfound),multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon)
|
ActivatedAbility(observer, _id, _source, _cost, 0), tokenId(tokenId), starfound(starfound),multiplier(multiplier), who(who),aLivingWeapon(aLivingWeapon)
|
||||||
@@ -3511,18 +3511,18 @@ public:
|
|||||||
if (card) name = card->data->getName();
|
if (card) name = card->data->getName();
|
||||||
battleReady = false;
|
battleReady = false;
|
||||||
}
|
}
|
||||||
//by name, card still require valid card.dat info, this just makes the primitive code far more readable. token(Eldrazi scion) instead of token(-1234234)...
|
//by name, card still require valid card.dat info, this just makes the primitive code far more readable. token(Eldrazi scion) instead of token(-1234234)...
|
||||||
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string cardName, string starfound, WParsedInt * multiplier = NULL,
|
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string cardName, string starfound, WParsedInt * multiplier = NULL,
|
||||||
int who = 0, bool aLivingWeapon = false) :
|
int who = 0, bool aLivingWeapon = false) :
|
||||||
ActivatedAbility(observer, _id, _source, _cost, 0), _cardName(cardName), starfound(starfound), multiplier(multiplier), who(who), aLivingWeapon(aLivingWeapon)
|
ActivatedAbility(observer, _id, _source, _cost, 0), _cardName(cardName), starfound(starfound), multiplier(multiplier), who(who), aLivingWeapon(aLivingWeapon)
|
||||||
{
|
{
|
||||||
if (!multiplier) this->multiplier = NEW WParsedInt(1);
|
if (!multiplier) this->multiplier = NEW WParsedInt(1);
|
||||||
MTGCard * card = MTGCollection()->getCardByName(_cardName);
|
MTGCard * card = MTGCollection()->getCardByName(_cardName);
|
||||||
tokenId = card->getId();
|
tokenId = card->getId();
|
||||||
if (card) name = card->data->getName();
|
if (card) name = card->data->getName();
|
||||||
battleReady = false;
|
battleReady = false;
|
||||||
}
|
}
|
||||||
//by construction
|
//by construction
|
||||||
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string sname, string stypes, int _power, int _toughness,
|
ATokenCreator(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable *, ManaCost * _cost, string sname, string stypes, int _power, int _toughness,
|
||||||
string sabilities, string starfound,WParsedInt * multiplier = NULL, int _who = 0,bool aLivingWeapon = false,string spt = "") :
|
string sabilities, string starfound,WParsedInt * multiplier = NULL, int _who = 0,bool aLivingWeapon = false,string spt = "") :
|
||||||
ActivatedAbility(observer, _id, _source, _cost, 0),sabilities(sabilities),starfound(starfound), multiplier(multiplier), who(_who),aLivingWeapon(aLivingWeapon),spt(spt)
|
ActivatedAbility(observer, _id, _source, _cost, 0),sabilities(sabilities),starfound(starfound), multiplier(multiplier), who(_who),aLivingWeapon(aLivingWeapon),spt(spt)
|
||||||
@@ -4045,12 +4045,12 @@ class AThis: public MTGAbility, public NestedAbility
|
|||||||
public:
|
public:
|
||||||
MTGAbility * a;
|
MTGAbility * a;
|
||||||
ThisDescriptor * td;
|
ThisDescriptor * td;
|
||||||
string restrictionCheck;
|
string restrictionCheck;
|
||||||
AThis(GameObserver* observer, int _id, MTGCardInstance * _source, Damageable * _target, ThisDescriptor * _td, MTGAbility * ability, string restriction = "") :
|
AThis(GameObserver* observer, int _id, MTGCardInstance * _source, Damageable * _target, ThisDescriptor * _td, MTGAbility * ability, string restriction = "") :
|
||||||
MTGAbility(observer, _id, _source, _target), NestedAbility(ability)
|
MTGAbility(observer, _id, _source, _target), NestedAbility(ability)
|
||||||
{
|
{
|
||||||
td = _td;
|
td = _td;
|
||||||
restrictionCheck = restriction;
|
restrictionCheck = restriction;
|
||||||
ability->source = source;
|
ability->source = source;
|
||||||
ability->target = target;
|
ability->target = target;
|
||||||
a = NULL;
|
a = NULL;
|
||||||
@@ -4074,18 +4074,18 @@ public:
|
|||||||
|
|
||||||
int resolve()
|
int resolve()
|
||||||
{
|
{
|
||||||
int match = 0;
|
int match = 0;
|
||||||
if (td)
|
if (td)
|
||||||
{
|
{
|
||||||
match = td->match(source);
|
match = td->match(source);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//restriction check instead of Targetchooser
|
{//restriction check instead of Targetchooser
|
||||||
AbilityFactory abf(target->getObserver());
|
AbilityFactory abf(target->getObserver());
|
||||||
int checkCond = abf.parseCastRestrictions(source, source->controller(), restrictionCheck);
|
int checkCond = abf.parseCastRestrictions(source, source->controller(), restrictionCheck);
|
||||||
if (checkCond)
|
if (checkCond)
|
||||||
match = 1;
|
match = 1;
|
||||||
}
|
}
|
||||||
if (match > 0)
|
if (match > 0)
|
||||||
{
|
{
|
||||||
addAbilityToGame();
|
addAbilityToGame();
|
||||||
@@ -4132,7 +4132,7 @@ public:
|
|||||||
{
|
{
|
||||||
AThis * a = NEW AThis(*this);
|
AThis * a = NEW AThis(*this);
|
||||||
a->ability = ability->clone();
|
a->ability = ability->clone();
|
||||||
if(a->td)
|
if(a->td)
|
||||||
a->td = td->clone();
|
a->td = td->clone();
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@@ -4350,11 +4350,11 @@ public:
|
|||||||
class ABestow : public ActivatedAbility
|
class ABestow : public ActivatedAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MTGCardInstance * _card;
|
MTGCardInstance * _card;
|
||||||
ABestow(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
ABestow(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
ABestow * clone() const;
|
ABestow * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Can tap a target for a cost */
|
/* Can tap a target for a cost */
|
||||||
@@ -4381,16 +4381,16 @@ public:
|
|||||||
class AAWhatsX : public ActivatedAbility
|
class AAWhatsX : public ActivatedAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int value;
|
int value;
|
||||||
MTGAbility * costRule;
|
MTGAbility * costRule;
|
||||||
AAWhatsX(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * source, int value = 0, MTGAbility * costRule = NULL);
|
AAWhatsX(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * source, int value = 0, MTGAbility * costRule = NULL);
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText()
|
const string getMenuText()
|
||||||
{
|
{
|
||||||
sprintf(menuText, "%i", value);
|
sprintf(menuText, "%i", value);
|
||||||
return menuText;
|
return menuText;
|
||||||
};
|
};
|
||||||
AAWhatsX * clone() const;
|
AAWhatsX * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* set max level up on a levelup creature this is an Ai hint ability, no effect for players.*/
|
/* set max level up on a levelup creature this is an Ai hint ability, no effect for players.*/
|
||||||
@@ -4407,17 +4407,17 @@ public:
|
|||||||
class AACountObject : public ActivatedAbility
|
class AACountObject : public ActivatedAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
string value;
|
string value;
|
||||||
|
|
||||||
AACountObject(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * source, ManaCost * _cost = NULL, string value ="");
|
AACountObject(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * source, ManaCost * _cost = NULL, string value ="");
|
||||||
int resolve();
|
int resolve();
|
||||||
AACountObject * clone() const;
|
AACountObject * clone() const;
|
||||||
};
|
};
|
||||||
/* Can prevent a card from untapping next untap */
|
/* Can prevent a card from untapping next untap */
|
||||||
class AAFrozen: public ActivatedAbility
|
class AAFrozen: public ActivatedAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool freeze;
|
bool freeze;
|
||||||
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, bool tap, ManaCost * _cost = NULL);
|
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, bool tap, ManaCost * _cost = NULL);
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
@@ -5208,32 +5208,32 @@ public:
|
|||||||
class AGrant : public MTGAbility
|
class AGrant : public MTGAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MTGCardInstance * Blessed;
|
MTGCardInstance * Blessed;
|
||||||
bool resolved;
|
bool resolved;
|
||||||
MTGAbility * Granted;
|
MTGAbility * Granted;
|
||||||
MTGAbility * toGrant;
|
MTGAbility * toGrant;
|
||||||
AGrant(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target, MTGAbility * toGrant);
|
AGrant(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target, MTGAbility * toGrant);
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
void resolveGrant();
|
void resolveGrant();
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
AGrant * clone() const;
|
AGrant * clone() const;
|
||||||
~AGrant();
|
~AGrant();
|
||||||
private:
|
private:
|
||||||
void removeGranted(MTGCardInstance *_target);
|
void removeGranted(MTGCardInstance *_target);
|
||||||
};
|
};
|
||||||
|
|
||||||
//GrantWrapper
|
//GrantWrapper
|
||||||
class AGrantWrapper : public InstantAbility
|
class AGrantWrapper : public InstantAbility
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AGrant * ability;
|
AGrant * ability;
|
||||||
MTGAbility * Granted;
|
MTGAbility * Granted;
|
||||||
AGrantWrapper(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target, MTGAbility * toGrant);
|
AGrantWrapper(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target, MTGAbility * toGrant);
|
||||||
int resolve();
|
int resolve();
|
||||||
const string getMenuText();
|
const string getMenuText();
|
||||||
AGrantWrapper * clone() const;
|
AGrantWrapper * clone() const;
|
||||||
~AGrantWrapper();
|
~AGrantWrapper();
|
||||||
|
|
||||||
};
|
};
|
||||||
//ABlink
|
//ABlink
|
||||||
@@ -6485,7 +6485,7 @@ public:
|
|||||||
MTGCardInstance * theNamedCard;
|
MTGCardInstance * theNamedCard;
|
||||||
bool noEvent;
|
bool noEvent;
|
||||||
bool putinplay;
|
bool putinplay;
|
||||||
bool asNormalMadness;
|
bool asNormalMadness;
|
||||||
AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool restricted,bool copied,bool _asNormal,string nameCard,string abilityName,bool _noEvent, bool putinplay,bool asNormalMadness = false);
|
AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool restricted,bool copied,bool _asNormal,string nameCard,string abilityName,bool _noEvent, bool putinplay,bool asNormalMadness = false);
|
||||||
|
|
||||||
int testDestroy(){return 0;};
|
int testDestroy(){return 0;};
|
||||||
|
|||||||
@@ -278,22 +278,22 @@ public:
|
|||||||
class Convoke : public ExtraCost
|
class Convoke : public ExtraCost
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ManaCost * getReduction();
|
ManaCost * getReduction();
|
||||||
Convoke(TargetChooser *_tc = NULL);
|
Convoke(TargetChooser *_tc = NULL);
|
||||||
virtual int canPay();
|
virtual int canPay();
|
||||||
virtual int isPaymentSet();
|
virtual int isPaymentSet();
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
virtual Convoke * clone() const;
|
virtual Convoke * clone() const;
|
||||||
};
|
};
|
||||||
//delve
|
//delve
|
||||||
class Delve : public ExtraCost
|
class Delve : public ExtraCost
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Delve(TargetChooser *_tc = NULL);
|
Delve(TargetChooser *_tc = NULL);
|
||||||
virtual int canPay();
|
virtual int canPay();
|
||||||
virtual int isPaymentSet();
|
virtual int isPaymentSet();
|
||||||
virtual int doPay();
|
virtual int doPay();
|
||||||
virtual Delve * clone() const;
|
virtual Delve * clone() const;
|
||||||
};
|
};
|
||||||
//offering cost
|
//offering cost
|
||||||
class Offering : public ExtraCost
|
class Offering : public ExtraCost
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
ManaCost* BuyBack;
|
ManaCost* BuyBack;
|
||||||
ManaCost* FlashBack;
|
ManaCost* FlashBack;
|
||||||
ManaCost* Retrace;
|
ManaCost* Retrace;
|
||||||
ManaCost* Bestow;
|
ManaCost* Bestow;
|
||||||
ManaCost* morph;
|
ManaCost* morph;
|
||||||
ManaCost* suspend;
|
ManaCost* suspend;
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
Pos* view;
|
Pos* view;
|
||||||
int X;
|
int X;
|
||||||
int castX;
|
int castX;
|
||||||
int setX;
|
int setX;
|
||||||
int alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW + 1];
|
int alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW + 1];
|
||||||
int paymenttype;
|
int paymenttype;
|
||||||
int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */
|
int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */
|
||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
bool exileEffects;
|
bool exileEffects;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
bool miracle;
|
bool miracle;
|
||||||
bool isBestowed;
|
bool isBestowed;
|
||||||
int chooseacolor;
|
int chooseacolor;
|
||||||
string chooseasubtype;
|
string chooseasubtype;
|
||||||
int coinSide;//1 = tails
|
int coinSide;//1 = tails
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
int notblocked;
|
int notblocked;
|
||||||
int fresh;
|
int fresh;
|
||||||
int MaxLevelUp;
|
int MaxLevelUp;
|
||||||
int CountedObjects;
|
int CountedObjects;
|
||||||
int kicked;
|
int kicked;
|
||||||
int dredge;
|
int dredge;
|
||||||
bool isDualWielding;
|
bool isDualWielding;
|
||||||
@@ -276,8 +276,8 @@ public:
|
|||||||
string currentimprintName;
|
string currentimprintName;
|
||||||
vector<string>imprintedNames;
|
vector<string>imprintedNames;
|
||||||
|
|
||||||
MTGCardInstance * revealedLast;//last card revealed by a ability this card owns.
|
MTGCardInstance * revealedLast;//last card revealed by a ability this card owns.
|
||||||
bool MadnessPlay;
|
bool MadnessPlay;
|
||||||
void eventattacked();
|
void eventattacked();
|
||||||
void eventattackedAlone();
|
void eventattackedAlone();
|
||||||
void eventattackednotblocked();
|
void eventattackednotblocked();
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class Constants
|
|||||||
MTG_COLOR_WHITE = 5,
|
MTG_COLOR_WHITE = 5,
|
||||||
MTG_COLOR_WASTE = 6,
|
MTG_COLOR_WASTE = 6,
|
||||||
MTG_COLOR_LAND = 7,
|
MTG_COLOR_LAND = 7,
|
||||||
|
|
||||||
|
|
||||||
MTG_NB_COLORS = 8,
|
MTG_NB_COLORS = 8,
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ class Constants
|
|||||||
CAST_WITH_RETRACE = 6,
|
CAST_WITH_RETRACE = 6,
|
||||||
CAST_WITH_MORPH = 7,
|
CAST_WITH_MORPH = 7,
|
||||||
CAST_WITH_SUSPEND = 8,
|
CAST_WITH_SUSPEND = 8,
|
||||||
CAST_WITH_BESTOW = 9,
|
CAST_WITH_BESTOW = 9,
|
||||||
|
|
||||||
CAST_ALTERNATE = -1, //matches all alternate costs, including itself
|
CAST_ALTERNATE = -1, //matches all alternate costs, including itself
|
||||||
CAST_ALL = -2, // matches everything except NOT_CAST
|
CAST_ALL = -2, // matches everything except NOT_CAST
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ class MTGGameZone {
|
|||||||
OWNER_STACK = 66,
|
OWNER_STACK = 66,
|
||||||
TARGETED_PLAYER_STACK = 67,
|
TARGETED_PLAYER_STACK = 67,
|
||||||
|
|
||||||
MY_REVEAL = 71,
|
MY_REVEAL = 71,
|
||||||
OPPONENT_REVEAL = 72,
|
OPPONENT_REVEAL = 72,
|
||||||
TARGET_OWNER_REVEAL = 73,
|
TARGET_OWNER_REVEAL = 73,
|
||||||
TARGET_CONTROLLER_REVEAL = 74,
|
TARGET_CONTROLLER_REVEAL = 74,
|
||||||
REVEAL = 75,
|
REVEAL = 75,
|
||||||
OWNER_REVEAL = 76,
|
OWNER_REVEAL = 76,
|
||||||
TARGETED_PLAYER_REVEAL = 77,
|
TARGETED_PLAYER_REVEAL = 77,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ public:
|
|||||||
MTGRemovedFromGame * exile; //alias to removedFromZone
|
MTGRemovedFromGame * exile; //alias to removedFromZone
|
||||||
MTGGameZone * garbage;
|
MTGGameZone * garbage;
|
||||||
MTGGameZone * garbageLastTurn;
|
MTGGameZone * garbageLastTurn;
|
||||||
MTGGameZone * reveal;
|
MTGGameZone * reveal;
|
||||||
MTGGameZone * temp;
|
MTGGameZone * temp;
|
||||||
|
|
||||||
MTGPlayerCards();
|
MTGPlayerCards();
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ public:
|
|||||||
int Angel[2];
|
int Angel[2];
|
||||||
bool dragonbonusgranted[2];
|
bool dragonbonusgranted[2];
|
||||||
int dragon[2];
|
int dragon[2];
|
||||||
bool eldrazibonusgranted[2];
|
bool eldrazibonusgranted[2];
|
||||||
int eldrazi[2];
|
int eldrazi[2];
|
||||||
bool werewolfbonusgranted[2];
|
bool werewolfbonusgranted[2];
|
||||||
int werewolf[2];
|
int werewolf[2];
|
||||||
|
|
||||||
int receiveEvent(WEvent * event);
|
int receiveEvent(WEvent * event);
|
||||||
void grantAward(string awardName,int amount);
|
void grantAward(string awardName,int amount);
|
||||||
@@ -213,15 +213,15 @@ public:
|
|||||||
class MTGBestowRule : public MTGAlternativeCostRule
|
class MTGBestowRule : public MTGAlternativeCostRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||||
int reactToClick(MTGCardInstance * card);
|
int reactToClick(MTGCardInstance * card);
|
||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
MTGBestowRule(GameObserver* observer, int _id);
|
MTGBestowRule(GameObserver* observer, int _id);
|
||||||
const string getMenuText()
|
const string getMenuText()
|
||||||
{
|
{
|
||||||
return "Bestow";
|
return "Bestow";
|
||||||
}
|
}
|
||||||
virtual MTGBestowRule * clone() const;
|
virtual MTGBestowRule * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ protected:
|
|||||||
ManaCost * manaUsedToCast;
|
ManaCost * manaUsedToCast;
|
||||||
ManaCost * morph;
|
ManaCost * morph;
|
||||||
ManaCost * Retrace;
|
ManaCost * Retrace;
|
||||||
ManaCost * Bestow;
|
ManaCost * Bestow;
|
||||||
ManaCost * FlashBack;
|
ManaCost * FlashBack;
|
||||||
ManaCost * BuyBack;
|
ManaCost * BuyBack;
|
||||||
ManaCost * kicker;
|
ManaCost * kicker;
|
||||||
@@ -76,8 +76,8 @@ public:
|
|||||||
ManaCost * getSuspend(){ return suspend; };
|
ManaCost * getSuspend(){ return suspend; };
|
||||||
void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;};
|
void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;};
|
||||||
|
|
||||||
ManaCost * getBestow() { return Bestow; };
|
ManaCost * getBestow() { return Bestow; };
|
||||||
void setBestow(ManaCost * aMana) { SAFE_DELETE(Bestow); Bestow = aMana; };
|
void setBestow(ManaCost * aMana) { SAFE_DELETE(Bestow); Bestow = aMana; };
|
||||||
|
|
||||||
ManaCost * getManaUsedToCast(){ return manaUsedToCast; };
|
ManaCost * getManaUsedToCast(){ return manaUsedToCast; };
|
||||||
void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;};
|
void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class TargetChooser: public TargetsList
|
|||||||
protected:
|
protected:
|
||||||
int forceTargetListReady;
|
int forceTargetListReady;
|
||||||
public:
|
public:
|
||||||
int forceTargetListReadyByPlayer;
|
int forceTargetListReadyByPlayer;
|
||||||
const static int UNLITMITED_TARGETS = 1000;
|
const static int UNLITMITED_TARGETS = 1000;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,11 +105,11 @@ bool ActionLayer::CheckUserInput(JButton key)
|
|||||||
//being cancelled. currently only menuability and paidability will care.
|
//being cancelled. currently only menuability and paidability will care.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (observer->mExtraPayment->costs.size() && observer->mExtraPayment->costs[0]->tc)
|
if (observer->mExtraPayment->costs.size() && observer->mExtraPayment->costs[0]->tc)
|
||||||
{
|
{
|
||||||
//if we cancel, clear the targets list so that when you try again you dont already have targets from before.
|
//if we cancel, clear the targets list so that when you try again you dont already have targets from before.
|
||||||
observer->mExtraPayment->costs[0]->tc->initTargets();
|
observer->mExtraPayment->costs[0]->tc->initTargets();
|
||||||
}
|
}
|
||||||
observer->mExtraPayment = NULL;
|
observer->mExtraPayment = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -191,11 +191,11 @@ void ActionLayer::Update(float dt)
|
|||||||
without this, the game locks into a freeze state while you try to select the targets and dont have enough to
|
without this, the game locks into a freeze state while you try to select the targets and dont have enough to
|
||||||
fill the maxtargets list.
|
fill the maxtargets list.
|
||||||
*/
|
*/
|
||||||
if (int(ae->getActionTc()->getNbTargets()) == countTargets)//if the amount of targets is equal the all we can target
|
if (int(ae->getActionTc()->getNbTargets()) == countTargets)//if the amount of targets is equal the all we can target
|
||||||
{
|
{
|
||||||
ae->getActionTc()->done = true;//were done
|
ae->getActionTc()->done = true;//were done
|
||||||
ae->getActionTc()->source->getObserver()->cardClick(ae->getActionTc()->source, 0, false);//click source.
|
ae->getActionTc()->source->getObserver()->cardClick(ae->getActionTc()->source, 0, false);//click source.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -467,10 +467,10 @@ void ActionLayer::doReactTo(int menuIndex)
|
|||||||
{
|
{
|
||||||
int controlid = abilitiesMenu->mObjects[menuIndex]->GetId();
|
int controlid = abilitiesMenu->mObjects[menuIndex]->GetId();
|
||||||
DebugTrace("ActionLayer::doReactTo " << controlid);
|
DebugTrace("ActionLayer::doReactTo " << controlid);
|
||||||
if (abilitiesMenu && abilitiesMenu->isMultipleChoice)
|
if (abilitiesMenu && abilitiesMenu->isMultipleChoice)
|
||||||
{
|
{
|
||||||
return ButtonPressedOnMultipleChoice(menuIndex);
|
return ButtonPressedOnMultipleChoice(menuIndex);
|
||||||
}
|
}
|
||||||
ButtonPressed(0, controlid);
|
ButtonPressed(0, controlid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -578,10 +578,10 @@ int ActionStack::addAbility(MTGAbility * ability)
|
|||||||
if (!observer->players[0]->isAI() && ability->source->controller() == observer->players[0] && 0
|
if (!observer->players[0]->isAI() && ability->source->controller() == observer->players[0] && 0
|
||||||
== options[Options::INTERRUPTMYABILITIES].number)
|
== options[Options::INTERRUPTMYABILITIES].number)
|
||||||
interruptDecision[0] = DONT_INTERRUPT;
|
interruptDecision[0] = DONT_INTERRUPT;
|
||||||
if (observer->OpenedDisplay && observer->players[0]->game->reveal->cards.size())
|
if (observer->OpenedDisplay && observer->players[0]->game->reveal->cards.size())
|
||||||
{
|
{
|
||||||
interruptDecision[0] = DONT_INTERRUPT;
|
interruptDecision[0] = DONT_INTERRUPT;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+744
-744
File diff suppressed because it is too large
Load Diff
+191
-191
@@ -72,10 +72,10 @@ int ExtraCost::setPayment(MTGCardInstance * card)
|
|||||||
if (tc)
|
if (tc)
|
||||||
{
|
{
|
||||||
result = tc->addTarget(card);
|
result = tc->addTarget(card);
|
||||||
//this is flawed logic, we need to fix. if there is a target in list
|
//this is flawed logic, we need to fix. if there is a target in list
|
||||||
//we return targetready instead, the card is not pushed back into list
|
//we return targetready instead, the card is not pushed back into list
|
||||||
//how ever, it is made the target becuase the result is 1 even if we couldnt
|
//how ever, it is made the target becuase the result is 1 even if we couldnt
|
||||||
//target it with the targetchooser.
|
//target it with the targetchooser.
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
target = card;
|
target = card;
|
||||||
@@ -166,7 +166,7 @@ int SnowCost::isPaymentSet()
|
|||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -763,7 +763,7 @@ int TapTargetCost::doPay()
|
|||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
source->storedCard = target->createSnapShot();
|
source->storedCard = target->createSnapShot();
|
||||||
_target->tap();
|
_target->tap();
|
||||||
target = NULL;
|
target = NULL;
|
||||||
if (tc)
|
if (tc)
|
||||||
@@ -807,7 +807,7 @@ int UnTapTargetCost::doPay()
|
|||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
source->storedCard = target->createSnapShot();
|
source->storedCard = target->createSnapShot();
|
||||||
_target->untap();
|
_target->untap();
|
||||||
target = NULL;
|
target = NULL;
|
||||||
if (tc)
|
if (tc)
|
||||||
@@ -929,189 +929,189 @@ int Ninja::doPay()
|
|||||||
//Convoke
|
//Convoke
|
||||||
Convoke * Convoke::clone() const
|
Convoke * Convoke::clone() const
|
||||||
{
|
{
|
||||||
Convoke * ec = NEW Convoke(*this);
|
Convoke * ec = NEW Convoke(*this);
|
||||||
if (tc)
|
if (tc)
|
||||||
ec->tc = tc->clone();
|
ec->tc = tc->clone();
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
Convoke::Convoke(TargetChooser *_tc) :
|
Convoke::Convoke(TargetChooser *_tc) :
|
||||||
ExtraCost("Select Cards To Tap", _tc)
|
ExtraCost("Select Cards To Tap", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int Convoke::canPay()
|
int Convoke::canPay()
|
||||||
{
|
{
|
||||||
return isPaymentSet();
|
return isPaymentSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Convoke::isPaymentSet()
|
int Convoke::isPaymentSet()
|
||||||
{
|
{
|
||||||
if (target && target->isTapped())
|
if (target && target->isTapped())
|
||||||
{
|
{
|
||||||
tc->removeTarget(target);
|
tc->removeTarget(target);
|
||||||
target->isExtraCostTarget = false;
|
target->isExtraCostTarget = false;
|
||||||
target = NULL;
|
target = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ManaCost * toReduce = getReduction();
|
ManaCost * toReduce = getReduction();
|
||||||
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
||||||
{
|
{
|
||||||
target = NULL;
|
target = NULL;
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
||||||
{
|
{
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ManaCost * Convoke::getReduction()
|
ManaCost * Convoke::getReduction()
|
||||||
{
|
{
|
||||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||||
tc->maxtargets = source->getManaCost()->getConvertedCost();
|
tc->maxtargets = source->getManaCost()->getConvertedCost();
|
||||||
if (tc->getNbTargets())
|
if (tc->getNbTargets())
|
||||||
{
|
{
|
||||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||||
{
|
{
|
||||||
bool next = false;
|
bool next = false;
|
||||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
||||||
{
|
{
|
||||||
if (next == true)
|
if (next == true)
|
||||||
break;
|
break;
|
||||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||||
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
|
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
|
||||||
{
|
{
|
||||||
toReduce->remove(i, 1);
|
toReduce->remove(i, 1);
|
||||||
next = true;
|
next = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, 1);
|
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||||
next = true;
|
next = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if we didnt find it payable one way, lets try again backwards.
|
//if we didnt find it payable one way, lets try again backwards.
|
||||||
if (!source->controller()->getManaPool()->canAfford(toReduce))
|
if (!source->controller()->getManaPool()->canAfford(toReduce))
|
||||||
{
|
{
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
toReduce = NEW ManaCost(source->getManaCost());
|
toReduce = NEW ManaCost(source->getManaCost());
|
||||||
for (vector<Targetable*>::reverse_iterator it = targetlist.rbegin(); it != targetlist.rend(); it++)
|
for (vector<Targetable*>::reverse_iterator it = targetlist.rbegin(); it != targetlist.rend(); it++)
|
||||||
{
|
{
|
||||||
bool next = false;
|
bool next = false;
|
||||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
||||||
{
|
{
|
||||||
if (next == true)
|
if (next == true)
|
||||||
break;
|
break;
|
||||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||||
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
|
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
|
||||||
{
|
{
|
||||||
toReduce->remove(i, 1);
|
toReduce->remove(i, 1);
|
||||||
next = true;
|
next = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, 1);
|
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||||
next = true;
|
next = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toReduce;
|
return toReduce;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Convoke::doPay()
|
int Convoke::doPay()
|
||||||
{
|
{
|
||||||
if (target && tc->getNbTargets())
|
if (target && tc->getNbTargets())
|
||||||
{
|
{
|
||||||
ManaCost * toReduce = getReduction();
|
ManaCost * toReduce = getReduction();
|
||||||
target->controller()->getManaPool()->pay(toReduce);
|
target->controller()->getManaPool()->pay(toReduce);
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||||
source->storedCard = targetCard->createSnapShot();
|
source->storedCard = targetCard->createSnapShot();
|
||||||
targetCard->tap();
|
targetCard->tap();
|
||||||
}
|
}
|
||||||
if (tc)
|
if (tc)
|
||||||
tc->initTargets();
|
tc->initTargets();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//DELVE
|
//DELVE
|
||||||
Delve * Delve::clone() const
|
Delve * Delve::clone() const
|
||||||
{
|
{
|
||||||
Delve * ec = NEW Delve(*this);
|
Delve * ec = NEW Delve(*this);
|
||||||
if (tc)
|
if (tc)
|
||||||
ec->tc = tc->clone();
|
ec->tc = tc->clone();
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
Delve::Delve(TargetChooser *_tc) :
|
Delve::Delve(TargetChooser *_tc) :
|
||||||
ExtraCost("Select Cards To Exile", _tc)
|
ExtraCost("Select Cards To Exile", _tc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int Delve::canPay()
|
int Delve::canPay()
|
||||||
{
|
{
|
||||||
return isPaymentSet();
|
return isPaymentSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Delve::isPaymentSet()
|
int Delve::isPaymentSet()
|
||||||
{
|
{
|
||||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||||
tc->maxtargets = source->getManaCost()->getCost(Constants::MTG_COLOR_ARTIFACT);
|
tc->maxtargets = source->getManaCost()->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||||
if (tc->getNbTargets())
|
if (tc->getNbTargets())
|
||||||
{
|
{
|
||||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
||||||
}
|
}
|
||||||
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
||||||
{
|
{
|
||||||
target = NULL;
|
target = NULL;
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
||||||
{
|
{
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Delve::doPay()
|
int Delve::doPay()
|
||||||
{
|
{
|
||||||
if (target && tc->getNbTargets())
|
if (target && tc->getNbTargets())
|
||||||
{
|
{
|
||||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||||
|
|
||||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
||||||
|
|
||||||
target->controller()->getManaPool()->pay(toReduce);
|
target->controller()->getManaPool()->pay(toReduce);
|
||||||
SAFE_DELETE(toReduce);
|
SAFE_DELETE(toReduce);
|
||||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||||
source->storedCard = targetCard->createSnapShot();
|
source->storedCard = targetCard->createSnapShot();
|
||||||
targetCard->controller()->game->putInExile(targetCard);
|
targetCard->controller()->game->putInExile(targetCard);
|
||||||
}
|
}
|
||||||
if (tc)
|
if (tc)
|
||||||
tc->initTargets();
|
tc->initTargets();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
@@ -1402,41 +1402,41 @@ int ExtraCosts::tryToSetPayment(MTGCardInstance * card)
|
|||||||
{
|
{
|
||||||
for(size_t k = 0; k < costs.size(); k++)
|
for(size_t k = 0; k < costs.size(); k++)
|
||||||
{
|
{
|
||||||
if (card == costs[k]->target)
|
if (card == costs[k]->target)
|
||||||
{
|
{
|
||||||
//tapping or sacrificing a target to pay for its own cost
|
//tapping or sacrificing a target to pay for its own cost
|
||||||
//is allowed, unless the source is already being tapped and contains a tap target
|
//is allowed, unless the source is already being tapped and contains a tap target
|
||||||
//or sacced and contains a sactarget
|
//or sacced and contains a sactarget
|
||||||
//cost like {t}{s(creature)} the source is allowed to be targeted for this
|
//cost like {t}{s(creature)} the source is allowed to be targeted for this
|
||||||
//if it is a creature. these cases below should be added whenever we a need
|
//if it is a creature. these cases below should be added whenever we a need
|
||||||
//for extra cost that have both a source and target version used on cards.
|
//for extra cost that have both a source and target version used on cards.
|
||||||
if (dynamic_cast<TapCost*>(costs[k]))
|
if (dynamic_cast<TapCost*>(costs[k]))
|
||||||
{
|
{
|
||||||
for (size_t tapCheck = 0; tapCheck < costs.size(); tapCheck++)
|
for (size_t tapCheck = 0; tapCheck < costs.size(); tapCheck++)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<TapTargetCost*>(costs[tapCheck]))
|
if (dynamic_cast<TapTargetCost*>(costs[tapCheck]))
|
||||||
{
|
{
|
||||||
return 0;//{t}{t(creature)}
|
return 0;//{t}{t(creature)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (SacrificeCost * checking = dynamic_cast<SacrificeCost*>(costs[k]))
|
else if (SacrificeCost * checking = dynamic_cast<SacrificeCost*>(costs[k]))
|
||||||
{
|
{
|
||||||
for (size_t sacCheck = 0; sacCheck < costs.size(); sacCheck++)
|
for (size_t sacCheck = 0; sacCheck < costs.size(); sacCheck++)
|
||||||
{
|
{
|
||||||
SacrificeCost * checking2 = dynamic_cast<SacrificeCost*>(costs[sacCheck]);
|
SacrificeCost * checking2 = dynamic_cast<SacrificeCost*>(costs[sacCheck]);
|
||||||
if (checking2)
|
if (checking2)
|
||||||
if ((checking->tc != NULL && checking2->tc == NULL)
|
if ((checking->tc != NULL && checking2->tc == NULL)
|
||||||
|| (checking->tc == NULL && checking2->tc != NULL))
|
|| (checking->tc == NULL && checking2->tc != NULL))
|
||||||
{
|
{
|
||||||
return 0; //{s}{s(creature)}
|
return 0; //{s}{s(creature)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (int result = costs[i]->setPayment(card))
|
if (int result = costs[i]->setPayment(card))
|
||||||
{
|
{
|
||||||
@@ -1481,16 +1481,16 @@ int ExtraCosts::doPay()
|
|||||||
{
|
{
|
||||||
costs[i]->target->isExtraCostTarget = false;
|
costs[i]->target->isExtraCostTarget = false;
|
||||||
}
|
}
|
||||||
if (costs[i]->tc)
|
if (costs[i]->tc)
|
||||||
{
|
{
|
||||||
vector<Targetable*>targetlist = costs[i]->tc->getTargetsFrom();
|
vector<Targetable*>targetlist = costs[i]->tc->getTargetsFrom();
|
||||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||||
{
|
{
|
||||||
costs[i]->target = dynamic_cast<MTGCardInstance*>(*it);
|
costs[i]->target = dynamic_cast<MTGCardInstance*>(*it);
|
||||||
costs[i]->doPay();
|
costs[i]->doPay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result += costs[i]->doPay();
|
result += costs[i]->doPay();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void GameObserver::cleanup()
|
|||||||
connectRule = false;
|
connectRule = false;
|
||||||
actionsList.clear();
|
actionsList.clear();
|
||||||
gameTurn.clear();
|
gameTurn.clear();
|
||||||
OpenedDisplay = NULL;
|
OpenedDisplay = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObserver::~GameObserver()
|
GameObserver::~GameObserver()
|
||||||
@@ -97,7 +97,7 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input)
|
|||||||
targetChooser = NULL;
|
targetChooser = NULL;
|
||||||
cardWaitingForTargets = NULL;
|
cardWaitingForTargets = NULL;
|
||||||
mExtraPayment = NULL;
|
mExtraPayment = NULL;
|
||||||
OpenedDisplay = NULL;
|
OpenedDisplay = NULL;
|
||||||
guiOpenDisplay = NULL;
|
guiOpenDisplay = NULL;
|
||||||
gameOver = NULL;
|
gameOver = NULL;
|
||||||
phaseRing = NULL;
|
phaseRing = NULL;
|
||||||
@@ -328,11 +328,11 @@ void GameObserver::userRequestNextGamePhase(bool allowInterrupt, bool log)
|
|||||||
// Here's what I find weird - if the extra cost is something like a sacrifice, doesn't that imply a TargetChooser?
|
// Here's what I find weird - if the extra cost is something like a sacrifice, doesn't that imply a TargetChooser?
|
||||||
if (WaitForExtraPayment(NULL))
|
if (WaitForExtraPayment(NULL))
|
||||||
return;
|
return;
|
||||||
/*if (OpenedDisplay)//dont let us fly through all the phases with grave and library box still open.
|
/*if (OpenedDisplay)//dont let us fly through all the phases with grave and library box still open.
|
||||||
{
|
{
|
||||||
return;//I want this here, but it locks up on opponents turn, we need to come up with a clever way to close opened
|
return;//I want this here, but it locks up on opponents turn, we need to come up with a clever way to close opened
|
||||||
//displays, it makes no sense that you travel through 4 or 5 phases with library or grave still open.
|
//displays, it makes no sense that you travel through 4 or 5 phases with library or grave still open.
|
||||||
}*/
|
}*/
|
||||||
Phase * cPhaseOld = phaseRing->getCurrentPhase();
|
Phase * cPhaseOld = phaseRing->getCurrentPhase();
|
||||||
if (allowInterrupt && ((cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER)
|
if (allowInterrupt && ((cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER)
|
||||||
|| (cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == TRIGGERS)
|
|| (cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == TRIGGERS)
|
||||||
@@ -716,27 +716,27 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
card->bypassTC = false; //turn off bypass
|
card->bypassTC = false; //turn off bypass
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
//reset extracost shadows//
|
//reset extracost shadows//
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
card->isExtraCostTarget = false;
|
card->isExtraCostTarget = false;
|
||||||
if (mExtraPayment != NULL)
|
if (mExtraPayment != NULL)
|
||||||
{
|
{
|
||||||
for (unsigned int ec = 0; ec < mExtraPayment->costs.size(); ec++)
|
for (unsigned int ec = 0; ec < mExtraPayment->costs.size(); ec++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (mExtraPayment->costs[ec]->tc)
|
if (mExtraPayment->costs[ec]->tc)
|
||||||
{
|
{
|
||||||
vector<Targetable*>targetlist = mExtraPayment->costs[ec]->tc->getTargetsFrom();
|
vector<Targetable*>targetlist = mExtraPayment->costs[ec]->tc->getTargetsFrom();
|
||||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||||
{
|
{
|
||||||
Targetable * cardMasked = *it;
|
Targetable * cardMasked = *it;
|
||||||
dynamic_cast<MTGCardInstance*>(cardMasked)->isExtraCostTarget = true;
|
dynamic_cast<MTGCardInstance*>(cardMasked)->isExtraCostTarget = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
//Unattach Equipments that dont have valid targets//
|
//Unattach Equipments that dont have valid targets//
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
@@ -759,13 +759,13 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
//Remove auras that don't have a valid target anymore//
|
//Remove auras that don't have a valid target anymore//
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
if (card->target && !isInPlay(card->target) && card->isBestowed && card->hasType("aura"))
|
if (card->target && !isInPlay(card->target) && card->isBestowed && card->hasType("aura"))
|
||||||
{
|
{
|
||||||
card->removeType("aura");
|
card->removeType("aura");
|
||||||
card->addType("creature");
|
card->addType("creature");
|
||||||
card->target = NULL;
|
card->target = NULL;
|
||||||
card->isBestowed = false;
|
card->isBestowed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((card->target||card->playerTarget) && !card->hasType(Subtypes::TYPE_EQUIPMENT))
|
if ((card->target||card->playerTarget) && !card->hasType(Subtypes::TYPE_EQUIPMENT))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void GameStateOptions::Start()
|
|||||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDS, "Seconds to pause for an Interrupt", 20, 1));
|
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDS, "Seconds to pause for an Interrupt", 20, 1));
|
||||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYSPELLS, "Interrupt my spells"));
|
optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYSPELLS, "Interrupt my spells"));
|
||||||
// optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities"));
|
// optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities"));
|
||||||
//this is a dev option, not meant for standard play. uncomment if you need to see abilities you own hitting the stack.
|
//this is a dev option, not meant for standard play. uncomment if you need to see abilities you own hitting the stack.
|
||||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDMAIN, "Interrupt opponent's end of turn"));
|
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDMAIN, "Interrupt opponent's end of turn"));
|
||||||
optionsTabs = NEW WGuiTabMenu();
|
optionsTabs = NEW WGuiTabMenu();
|
||||||
optionsTabs->Add(optionsList);
|
optionsTabs->Add(optionsList);
|
||||||
|
|||||||
@@ -149,18 +149,18 @@ ostream& GuiAvatar::toString(ostream& out) const
|
|||||||
|
|
||||||
void GuiGameZone::toggleDisplay()
|
void GuiGameZone::toggleDisplay()
|
||||||
{
|
{
|
||||||
if (showCards)
|
if (showCards)
|
||||||
{
|
{
|
||||||
cd->zone->owner->getObserver()->guiOpenDisplay = NULL;
|
cd->zone->owner->getObserver()->guiOpenDisplay = NULL;
|
||||||
showCards = 0;
|
showCards = 0;
|
||||||
cd->zone->owner->getObserver()->OpenedDisplay = NULL;
|
cd->zone->owner->getObserver()->OpenedDisplay = NULL;
|
||||||
}
|
}
|
||||||
else if(!cd->zone->owner->getObserver()->OpenedDisplay)//one display at a time please.
|
else if(!cd->zone->owner->getObserver()->OpenedDisplay)//one display at a time please.
|
||||||
{
|
{
|
||||||
cd->zone->owner->getObserver()->guiOpenDisplay = this;
|
cd->zone->owner->getObserver()->guiOpenDisplay = this;
|
||||||
showCards = 1;
|
showCards = 1;
|
||||||
cd->init(zone);
|
cd->init(zone);
|
||||||
cd->zone->owner->getObserver()->OpenedDisplay = cd;
|
cd->zone->owner->getObserver()->OpenedDisplay = cd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+167
-167
@@ -353,23 +353,23 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = restriction[i].find("delirium");
|
check = restriction[i].find("delirium");
|
||||||
if (check != string::npos)
|
if (check != string::npos)
|
||||||
{
|
{
|
||||||
Player * checkCurrent = card->controller();
|
Player * checkCurrent = card->controller();
|
||||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||||
|
|
||||||
int checkTypesAmount = 0;
|
int checkTypesAmount = 0;
|
||||||
if(grave->hasType("creature")) checkTypesAmount++;
|
if(grave->hasType("creature")) checkTypesAmount++;
|
||||||
if (grave->hasType("enchantment")) checkTypesAmount++;
|
if (grave->hasType("enchantment")) checkTypesAmount++;
|
||||||
if (grave->hasType("sorcery")) checkTypesAmount++;
|
if (grave->hasType("sorcery")) checkTypesAmount++;
|
||||||
if (grave->hasType("instant")) checkTypesAmount++;
|
if (grave->hasType("instant")) checkTypesAmount++;
|
||||||
if (grave->hasType("land")) checkTypesAmount++;
|
if (grave->hasType("land")) checkTypesAmount++;
|
||||||
if (grave->hasType("artifact")) checkTypesAmount++;
|
if (grave->hasType("artifact")) checkTypesAmount++;
|
||||||
if (grave->hasType("planeswalker")) checkTypesAmount++;
|
if (grave->hasType("planeswalker")) checkTypesAmount++;
|
||||||
if (checkTypesAmount < 4)
|
if (checkTypesAmount < 4)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = restriction[i].find("miracle");
|
check = restriction[i].find("miracle");
|
||||||
if(check != string::npos)
|
if(check != string::npos)
|
||||||
@@ -380,12 +380,12 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = restriction[i].find("madnessplayed");
|
check = restriction[i].find("madnessplayed");
|
||||||
if (check != string::npos)
|
if (check != string::npos)
|
||||||
{
|
{
|
||||||
if (card->previous && !card->previous->MadnessPlay)
|
if (card->previous && !card->previous->MadnessPlay)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = restriction[i].find("prowl");
|
check = restriction[i].find("prowl");
|
||||||
if(check != string::npos)
|
if(check != string::npos)
|
||||||
@@ -462,12 +462,12 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = restriction[i].find("geared");
|
check = restriction[i].find("geared");
|
||||||
if (check != string::npos)
|
if (check != string::npos)
|
||||||
{
|
{
|
||||||
if (card->equipment < 1)
|
if (card->equipment < 1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = restriction[i].find("canuntap");
|
check = restriction[i].find("canuntap");
|
||||||
if(check != string::npos)
|
if(check != string::npos)
|
||||||
@@ -1178,13 +1178,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
observer->addObserver(NEW MTGFlashBackRule(observer, -1));
|
observer->addObserver(NEW MTGFlashBackRule(observer, -1));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
//alternative cost type flashback
|
//alternative cost type flashback
|
||||||
found = s.find("bestowrule");
|
found = s.find("bestowrule");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
observer->addObserver(NEW MTGBestowRule(observer, -1));
|
observer->addObserver(NEW MTGBestowRule(observer, -1));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
//alternative cost type retrace
|
//alternative cost type retrace
|
||||||
found = s.find("retracerule");
|
found = s.find("retracerule");
|
||||||
if(found != string::npos)
|
if(found != string::npos)
|
||||||
@@ -1353,53 +1353,53 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
string unchangedS = "";
|
string unchangedS = "";
|
||||||
unchangedS.append(s);
|
unchangedS.append(s);
|
||||||
|
|
||||||
//Reveal:x remove the core so we dont build them prematurely
|
//Reveal:x remove the core so we dont build them prematurely
|
||||||
vector<string>transPayfound = parseBetween(s, "newability[pay(", " ");
|
vector<string>transPayfound = parseBetween(s, "newability[pay(", " ");
|
||||||
vector<string>transfound = parseBetween(s,"newability[reveal:"," ");//if we are using reveal inside a newability, let transforms remove the string instead.
|
vector<string>transfound = parseBetween(s,"newability[reveal:"," ");//if we are using reveal inside a newability, let transforms remove the string instead.
|
||||||
vector<string>abilfound = parseBetween(s, "ability$!name(reveal) reveal:", " ");
|
vector<string>abilfound = parseBetween(s, "ability$!name(reveal) reveal:", " ");
|
||||||
if(!abilfound.size())
|
if(!abilfound.size())
|
||||||
abilfound = parseBetween(s, "ability$!reveal:", " ");//see above. this allows us to nest reveals inside these 2 other master classes. while also allowing us to nest them inside reveals.
|
abilfound = parseBetween(s, "ability$!reveal:", " ");//see above. this allows us to nest reveals inside these 2 other master classes. while also allowing us to nest them inside reveals.
|
||||||
|
|
||||||
found = s.find("pay(");
|
found = s.find("pay(");
|
||||||
if (found != string::npos && storedPayString.empty() && !transPayfound.size())
|
if (found != string::npos && storedPayString.empty() && !transPayfound.size())
|
||||||
{
|
{
|
||||||
vector<string> splitMayPaystr = parseBetween(s, "pay(", ")", true);
|
vector<string> splitMayPaystr = parseBetween(s, "pay(", ")", true);
|
||||||
if (splitMayPaystr.size())
|
if (splitMayPaystr.size())
|
||||||
{
|
{
|
||||||
storedPayString.append(splitMayPaystr[2]);
|
storedPayString.append(splitMayPaystr[2]);
|
||||||
s = splitMayPaystr[0];
|
s = splitMayPaystr[0];
|
||||||
s.append("pay(");
|
s.append("pay(");
|
||||||
s.append(splitMayPaystr[1]);
|
s.append(splitMayPaystr[1]);
|
||||||
s.append(")");
|
s.append(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> splitGrant = parseBetween(s, "grant ", " grantend", false);
|
vector<string> splitGrant = parseBetween(s, "grant ", " grantend", false);
|
||||||
if (splitGrant.size() && storedAbilityString.empty())
|
if (splitGrant.size() && storedAbilityString.empty())
|
||||||
{
|
{
|
||||||
storedAbilityString = splitGrant[1];
|
storedAbilityString = splitGrant[1];
|
||||||
s = splitGrant[0];
|
s = splitGrant[0];
|
||||||
s.append("grant ");
|
s.append("grant ");
|
||||||
s.append(splitGrant[2]);
|
s.append(splitGrant[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> splitRevealx = parseBetween(s, "reveal:", " revealend", false);
|
vector<string> splitRevealx = parseBetween(s, "reveal:", " revealend", false);
|
||||||
if (!abilfound.size() && !transfound.size() && splitRevealx.size() && storedAbilityString.empty())
|
if (!abilfound.size() && !transfound.size() && splitRevealx.size() && storedAbilityString.empty())
|
||||||
{
|
{
|
||||||
storedAbilityString = splitRevealx[1];
|
storedAbilityString = splitRevealx[1];
|
||||||
s = splitRevealx[0];
|
s = splitRevealx[0];
|
||||||
s.append("reveal: ");
|
s.append("reveal: ");
|
||||||
s.append(splitRevealx[2]);
|
s.append(splitRevealx[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> splitScryx = parseBetween(s, "scry:", " scryend", false);
|
vector<string> splitScryx = parseBetween(s, "scry:", " scryend", false);
|
||||||
if (splitScryx.size() && storedAbilityString.empty())
|
if (splitScryx.size() && storedAbilityString.empty())
|
||||||
{
|
{
|
||||||
storedAbilityString = splitScryx[1];
|
storedAbilityString = splitScryx[1];
|
||||||
s = splitScryx[0];
|
s = splitScryx[0];
|
||||||
s.append("scry: ");
|
s.append("scry: ");
|
||||||
s.append(splitScryx[2]);
|
s.append(splitScryx[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
found = s.find("transforms((");
|
found = s.find("transforms((");
|
||||||
if (found != string::npos && storedString.empty())
|
if (found != string::npos && storedString.empty())
|
||||||
@@ -1832,25 +1832,25 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
}
|
}
|
||||||
if (end != string::npos)
|
if (end != string::npos)
|
||||||
{
|
{
|
||||||
ThisDescriptor * td = NULL;
|
ThisDescriptor * td = NULL;
|
||||||
string thisDescriptorString = s.substr(found + header, end - found - header);
|
string thisDescriptorString = s.substr(found + header, end - found - header);
|
||||||
vector<string> splitRest = parseBetween(s, "restriction{", "}");
|
vector<string> splitRest = parseBetween(s, "restriction{", "}");
|
||||||
if (splitRest.size())
|
if (splitRest.size())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ThisDescriptorFactory tdf;
|
ThisDescriptorFactory tdf;
|
||||||
td = tdf.createThisDescriptor(observer, thisDescriptorString);
|
td = tdf.createThisDescriptor(observer, thisDescriptorString);
|
||||||
|
|
||||||
if (!td)
|
if (!td)
|
||||||
{
|
{
|
||||||
DebugTrace("MTGABILITY: Parsing Error:" << s);
|
DebugTrace("MTGABILITY: Parsing Error:" << s);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGAbility * a = parseMagicLine(s1, id, spell, card, 0, activated);
|
MTGAbility * a = parseMagicLine(s1, id, spell, card, 0, activated);
|
||||||
if (!a)
|
if (!a)
|
||||||
@@ -1887,9 +1887,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
case 1:
|
case 1:
|
||||||
result = NEW AThisForEach(observer, id, card, _target, td, a);
|
result = NEW AThisForEach(observer, id, card, _target, td, a);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
result = NEW AThis(observer, id, card, _target, NULL, a, thisDescriptorString);
|
result = NEW AThis(observer, id, card, _target, NULL, a, thisDescriptorString);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = NULL;
|
result = NULL;
|
||||||
}
|
}
|
||||||
@@ -2251,15 +2251,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//grant ability until source is untapped or leaves battlefield
|
//grant ability until source is untapped or leaves battlefield
|
||||||
found = s.find("grant ");
|
found = s.find("grant ");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
MTGAbility * toGrant = parseMagicLine(storedAbilityString, id, spell, card);
|
MTGAbility * toGrant = parseMagicLine(storedAbilityString, id, spell, card);
|
||||||
MTGAbility * a = NEW AGrantWrapper(observer, id, card, target,toGrant);
|
MTGAbility * a = NEW AGrantWrapper(observer, id, card, target,toGrant);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//momentary blink
|
//momentary blink
|
||||||
found = s.find("(blink)");
|
found = s.find("(blink)");
|
||||||
@@ -2382,21 +2382,21 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
tok->oneShot = 1;
|
tok->oneShot = 1;
|
||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
string tokenDesc = splitToken[1];
|
string tokenDesc = splitToken[1];
|
||||||
vector<string> tokenParameters = split(tokenDesc, ',');
|
vector<string> tokenParameters = split(tokenDesc, ',');
|
||||||
//lets try finding a token by card name.
|
//lets try finding a token by card name.
|
||||||
if (splitToken[1].size() && tokenParameters.size() ==1)
|
if (splitToken[1].size() && tokenParameters.size() ==1)
|
||||||
{
|
{
|
||||||
string cardName = splitToken[1];
|
string cardName = splitToken[1];
|
||||||
MTGCard * safetycard = MTGCollection()->getCardByName(cardName);
|
MTGCard * safetycard = MTGCollection()->getCardByName(cardName);
|
||||||
if (safetycard) //lets try constructing it then,we didnt find it by name
|
if (safetycard) //lets try constructing it then,we didnt find it by name
|
||||||
{
|
{
|
||||||
ATokenCreator * tok = NEW ATokenCreator(observer, id, card, target, NULL, cardName, starfound, multiplier, who);
|
ATokenCreator * tok = NEW ATokenCreator(observer, id, card, target, NULL, cardName, starfound, multiplier, who);
|
||||||
tok->oneShot = 1;
|
tok->oneShot = 1;
|
||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tokenParameters.size() < 3)
|
if (tokenParameters.size() < 3)
|
||||||
{
|
{
|
||||||
DebugTrace("incorrect Parameters for Token" << tokenDesc);
|
DebugTrace("incorrect Parameters for Token" << tokenDesc);
|
||||||
@@ -2599,7 +2599,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
bool withRestrictions = splitCastCard[1].find("restricted") != string::npos;
|
bool withRestrictions = splitCastCard[1].find("restricted") != string::npos;
|
||||||
bool asCopy = splitCastCard[1].find("copied") != string::npos;
|
bool asCopy = splitCastCard[1].find("copied") != string::npos;
|
||||||
bool asNormal = splitCastCard[1].find("normal") != string::npos;
|
bool asNormal = splitCastCard[1].find("normal") != string::npos;
|
||||||
bool asNormalMadness = splitCastCard[1].find("madness") != string::npos;
|
bool asNormalMadness = splitCastCard[1].find("madness") != string::npos;
|
||||||
bool sendNoEvent = splitCastCard[1].find("noevent") != string::npos;
|
bool sendNoEvent = splitCastCard[1].find("noevent") != string::npos;
|
||||||
bool putinplay = splitCastCard[1].find("putinplay") != string::npos;
|
bool putinplay = splitCastCard[1].find("putinplay") != string::npos;
|
||||||
string nameCard = "";
|
string nameCard = "";
|
||||||
@@ -3058,15 +3058,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//bestow
|
//bestow
|
||||||
found = s.find("bstw");
|
found = s.find("bstw");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
MTGAbility * a = NEW ABestow(observer, id, card, target);
|
MTGAbility * a = NEW ABestow(observer, id, card, target);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//no counters on target of optional type
|
//no counters on target of optional type
|
||||||
vector<string> splitCounterShroud = parseBetween(s, "countershroud(", ")");
|
vector<string> splitCounterShroud = parseBetween(s, "countershroud(", ")");
|
||||||
@@ -3257,29 +3257,29 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reveal:x (activate aility)
|
//Reveal:x (activate aility)
|
||||||
vector<string> splitReveal = parseBetween(s, "reveal:", "revealend", false);
|
vector<string> splitReveal = parseBetween(s, "reveal:", "revealend", false);
|
||||||
if (splitReveal.size())
|
if (splitReveal.size())
|
||||||
{
|
{
|
||||||
string backup = storedAbilityString;
|
string backup = storedAbilityString;
|
||||||
storedAbilityString = "";//we clear the string here for cards that contain more than 1 reveal.
|
storedAbilityString = "";//we clear the string here for cards that contain more than 1 reveal.
|
||||||
GenericRevealAbility * a = NEW GenericRevealAbility(observer, id, card, target, backup);
|
GenericRevealAbility * a = NEW GenericRevealAbility(observer, id, card, target, backup);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
a->canBeInterrupted = false;
|
a->canBeInterrupted = false;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//scry:x (activate aility)
|
//scry:x (activate aility)
|
||||||
vector<string> splitScry = parseBetween(s, "scry:", "scryend", false);
|
vector<string> splitScry = parseBetween(s, "scry:", "scryend", false);
|
||||||
if (splitScry.size())
|
if (splitScry.size())
|
||||||
{
|
{
|
||||||
string backup = storedAbilityString;
|
string backup = storedAbilityString;
|
||||||
storedAbilityString = "";//we clear the string here for cards that contain more than 1 reveal.
|
storedAbilityString = "";//we clear the string here for cards that contain more than 1 reveal.
|
||||||
GenericScryAbility * a = NEW GenericScryAbility(observer, id, card, target, backup);
|
GenericScryAbility * a = NEW GenericScryAbility(observer, id, card, target, backup);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
a->canBeInterrupted = false;
|
a->canBeInterrupted = false;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//flip
|
//flip
|
||||||
vector<string> splitFlipStat = parseBetween(s, "flip(", ")", true);
|
vector<string> splitFlipStat = parseBetween(s, "flip(", ")", true);
|
||||||
@@ -3455,14 +3455,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//frozen, next untap this does not untap.
|
//frozen, next untap this does not untap.
|
||||||
found = s.find("freeze");
|
found = s.find("freeze");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
MTGAbility * a = NEW AAFrozen(observer, id, card, target,true);
|
MTGAbility * a = NEW AAFrozen(observer, id, card, target,true);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get a new target - retarget and newtarget makes the card refreshed - from exile to play...
|
//get a new target - retarget and newtarget makes the card refreshed - from exile to play...
|
||||||
if ((s.find("retarget") != string::npos) || s.find("newtarget") != string::npos)
|
if ((s.find("retarget") != string::npos) || s.find("newtarget") != string::npos)
|
||||||
@@ -3498,13 +3498,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> splitCountObject = parseBetween(s, "count(", ")", false);
|
vector<string> splitCountObject = parseBetween(s, "count(", ")", false);
|
||||||
if (splitCountObject.size())
|
if (splitCountObject.size())
|
||||||
{
|
{
|
||||||
MTGAbility * a = NEW AACountObject(observer, id, card, card, NULL, splitCountObject[1]);
|
MTGAbility * a = NEW AACountObject(observer, id, card, card, NULL, splitCountObject[1]);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
//switch targest power with toughness
|
//switch targest power with toughness
|
||||||
found = s.find("swap");
|
found = s.find("swap");
|
||||||
@@ -4801,7 +4801,7 @@ MTGAbility::MTGAbility(const MTGAbility& a): ActionElement(a)
|
|||||||
BuyBack = a.BuyBack; //? NEW ManaCost(a.BuyBack) : NULL;
|
BuyBack = a.BuyBack; //? NEW ManaCost(a.BuyBack) : NULL;
|
||||||
FlashBack = a.FlashBack; // ? NEW ManaCost(a.FlashBack) : NULL;
|
FlashBack = a.FlashBack; // ? NEW ManaCost(a.FlashBack) : NULL;
|
||||||
Retrace = a.Retrace;// ? NEW ManaCost(a.Retrace) : NULL;
|
Retrace = a.Retrace;// ? NEW ManaCost(a.Retrace) : NULL;
|
||||||
Bestow = a.Bestow;
|
Bestow = a.Bestow;
|
||||||
morph = a.morph; //? NEW ManaCost(a.morph) : NULL;
|
morph = a.morph; //? NEW ManaCost(a.morph) : NULL;
|
||||||
suspend = a.suspend;// ? NEW ManaCost(a.suspend) : NULL;
|
suspend = a.suspend;// ? NEW ManaCost(a.suspend) : NULL;
|
||||||
|
|
||||||
@@ -5949,7 +5949,7 @@ int AManaProducer::resolve()
|
|||||||
Player * player = getPlayerFromTarget(_target);
|
Player * player = getPlayerFromTarget(_target);
|
||||||
if (!player)
|
if (!player)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
player->getManaPool()->add(output, source);
|
player->getManaPool()->add(output, source);
|
||||||
if(DoesntEmpty)
|
if(DoesntEmpty)
|
||||||
player->doesntEmpty->add(output);
|
player->doesntEmpty->add(output);
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
|||||||
cardistargetted = 0;
|
cardistargetted = 0;
|
||||||
cardistargetter = 0;
|
cardistargetter = 0;
|
||||||
myconvertedcost = getManaCost()->getConvertedCost();
|
myconvertedcost = getManaCost()->getConvertedCost();
|
||||||
revealedLast = NULL;
|
revealedLast = NULL;
|
||||||
MadnessPlay = false;
|
MadnessPlay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGCardInstance * MTGCardInstance::createSnapShot()
|
MTGCardInstance * MTGCardInstance::createSnapShot()
|
||||||
@@ -153,14 +153,14 @@ int MTGCardInstance::init()
|
|||||||
data = this;
|
data = this;
|
||||||
X = 0;
|
X = 0;
|
||||||
castX = 0;
|
castX = 0;
|
||||||
setX = -1;
|
setX = -1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGCardInstance::initMTGCI()
|
void MTGCardInstance::initMTGCI()
|
||||||
{
|
{
|
||||||
X = 0;
|
X = 0;
|
||||||
setX = -1;
|
setX = -1;
|
||||||
sample = "";
|
sample = "";
|
||||||
model = NULL;
|
model = NULL;
|
||||||
isToken = false;
|
isToken = false;
|
||||||
@@ -198,7 +198,7 @@ void MTGCardInstance::initMTGCI()
|
|||||||
wasDealtDamage = false;
|
wasDealtDamage = false;
|
||||||
isDualWielding = false;
|
isDualWielding = false;
|
||||||
suspended = false;
|
suspended = false;
|
||||||
isBestowed = false;
|
isBestowed = false;
|
||||||
castMethod = Constants::NOT_CAST;
|
castMethod = Constants::NOT_CAST;
|
||||||
mPropertiesChangedSinceLastUpdate = false;
|
mPropertiesChangedSinceLastUpdate = false;
|
||||||
stillNeeded = true;
|
stillNeeded = true;
|
||||||
@@ -228,7 +228,7 @@ void MTGCardInstance::initMTGCI()
|
|||||||
imprintW = 0;
|
imprintW = 0;
|
||||||
currentimprintName = "";
|
currentimprintName = "";
|
||||||
imprintedNames.clear();
|
imprintedNames.clear();
|
||||||
CountedObjects = 0;
|
CountedObjects = 0;
|
||||||
|
|
||||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++)
|
for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++)
|
||||||
alternateCostPaid[i] = 0;
|
alternateCostPaid[i] = 0;
|
||||||
@@ -782,8 +782,8 @@ int MTGCardInstance::getCurrentToughness()
|
|||||||
//check stack
|
//check stack
|
||||||
bool MTGCardInstance::StackIsEmptyandSorcerySpeed()
|
bool MTGCardInstance::StackIsEmptyandSorcerySpeed()
|
||||||
{
|
{
|
||||||
Player * whoInterupts = getObserver()->isInterrupting;//leave this so we can actually debug who is interupting/current.
|
Player * whoInterupts = getObserver()->isInterrupting;//leave this so we can actually debug who is interupting/current.
|
||||||
Player * whoCurrent = getObserver()->currentPlayer;
|
Player * whoCurrent = getObserver()->currentPlayer;
|
||||||
if((getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) &&
|
if((getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) &&
|
||||||
(getObserver()->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN ||
|
(getObserver()->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN ||
|
||||||
getObserver()->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN) &&
|
getObserver()->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN) &&
|
||||||
|
|||||||
@@ -107,17 +107,17 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
|||||||
|
|
||||||
case 'b': //buyback/Bestow
|
case 'b': //buyback/Bestow
|
||||||
if (!primitive) primitive = NEW CardPrimitive();
|
if (!primitive) primitive = NEW CardPrimitive();
|
||||||
if (key[1] == 'e' && key[2] == 's')
|
if (key[1] == 'e' && key[2] == 's')
|
||||||
{ //bestow
|
{ //bestow
|
||||||
if (!primitive) primitive = NEW CardPrimitive();
|
if (!primitive) primitive = NEW CardPrimitive();
|
||||||
if (ManaCost * cost = primitive->getManaCost())
|
if (ManaCost * cost = primitive->getManaCost())
|
||||||
{
|
{
|
||||||
string value = val;
|
string value = val;
|
||||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||||
cost->setBestow(ManaCost::parseManaCost(value));
|
cost->setBestow(ManaCost::parseManaCost(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else//buyback
|
else//buyback
|
||||||
if (ManaCost * cost = primitive->getManaCost())
|
if (ManaCost * cost = primitive->getManaCost())
|
||||||
{
|
{
|
||||||
string value = val;
|
string value = val;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ MTGGamePhase::MTGGamePhase(GameObserver* g, int id) :
|
|||||||
animation = 0;
|
animation = 0;
|
||||||
currentState = -1;
|
currentState = -1;
|
||||||
mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||||
if(mFont)
|
if(mFont)
|
||||||
mFont->SetBase(0); // using 2nd font
|
mFont->SetBase(0); // using 2nd font
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ MTGPlayerCards::~MTGPlayerCards()
|
|||||||
SAFE_DELETE(stack);
|
SAFE_DELETE(stack);
|
||||||
SAFE_DELETE(removedFromGame);
|
SAFE_DELETE(removedFromGame);
|
||||||
SAFE_DELETE(garbage);
|
SAFE_DELETE(garbage);
|
||||||
SAFE_DELETE(reveal);
|
SAFE_DELETE(reveal);
|
||||||
SAFE_DELETE(temp);
|
SAFE_DELETE(temp);
|
||||||
SAFE_DELETE(playRestrictions);
|
SAFE_DELETE(playRestrictions);
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ void MTGPlayerCards::beforeBeginPhase()
|
|||||||
stack->beforeBeginPhase();
|
stack->beforeBeginPhase();
|
||||||
removedFromGame->beforeBeginPhase();
|
removedFromGame->beforeBeginPhase();
|
||||||
garbage->beforeBeginPhase();
|
garbage->beforeBeginPhase();
|
||||||
reveal->beforeBeginPhase();
|
reveal->beforeBeginPhase();
|
||||||
temp->beforeBeginPhase();
|
temp->beforeBeginPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ void MTGPlayerCards::setOwner(Player * player)
|
|||||||
stack->setOwner(player);
|
stack->setOwner(player);
|
||||||
garbage->setOwner(player);
|
garbage->setOwner(player);
|
||||||
garbageLastTurn->setOwner(player);
|
garbageLastTurn->setOwner(player);
|
||||||
reveal->setOwner(player);
|
reveal->setOwner(player);
|
||||||
temp->setOwner(player);
|
temp->setOwner(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ void MTGPlayerCards::init()
|
|||||||
exile = removedFromGame;
|
exile = removedFromGame;
|
||||||
garbage = NEW MTGGameZone();
|
garbage = NEW MTGGameZone();
|
||||||
garbageLastTurn = garbage;
|
garbageLastTurn = garbage;
|
||||||
reveal = NEW MTGGameZone();
|
reveal = NEW MTGGameZone();
|
||||||
temp = NEW MTGGameZone();
|
temp = NEW MTGGameZone();
|
||||||
|
|
||||||
playRestrictions = NEW PlayRestrictions();
|
playRestrictions = NEW PlayRestrictions();
|
||||||
@@ -374,12 +374,12 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//all cards that go from the hand to the graveyard is ALWAYS a discard.
|
//all cards that go from the hand to the graveyard is ALWAYS a discard.
|
||||||
if ((to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard) && (from == g->players[0]->game->hand || from
|
if ((to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard) && (from == g->players[0]->game->hand || from
|
||||||
== g->players[1]->game->hand))
|
== g->players[1]->game->hand))
|
||||||
{
|
{
|
||||||
card->discarded = true;
|
card->discarded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//When a card is moved from inPlay to inPlay (controller change, for example), it is still the same object
|
//When a card is moved from inPlay to inPlay (controller change, for example), it is still the same object
|
||||||
if ((to == g->players[0]->game->inPlay || to == g->players[1]->game->inPlay) && (from == g->players[0]->game->inPlay || from
|
if ((to == g->players[0]->game->inPlay || to == g->players[1]->game->inPlay) && (from == g->players[0]->game->inPlay || from
|
||||||
@@ -1019,12 +1019,12 @@ MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2)
|
|||||||
case STACK:
|
case STACK:
|
||||||
return p->game->stack;
|
return p->game->stack;
|
||||||
|
|
||||||
case MY_REVEAL:
|
case MY_REVEAL:
|
||||||
return p->game->reveal;
|
return p->game->reveal;
|
||||||
case OPPONENT_REVEAL:
|
case OPPONENT_REVEAL:
|
||||||
return p->opponent()->game->reveal;
|
return p->opponent()->game->reveal;
|
||||||
case REVEAL:
|
case REVEAL:
|
||||||
return p->game->reveal;
|
return p->game->reveal;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!p2) return NULL;
|
if (!p2) return NULL;
|
||||||
@@ -1048,8 +1048,8 @@ MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2)
|
|||||||
case TARGET_CONTROLLER_STACK:
|
case TARGET_CONTROLLER_STACK:
|
||||||
return p2->game->stack;
|
return p2->game->stack;
|
||||||
|
|
||||||
case TARGET_CONTROLLER_REVEAL:
|
case TARGET_CONTROLLER_REVEAL:
|
||||||
return p2->game->reveal;
|
return p2->game->reveal;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1149,16 +1149,16 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
|||||||
return source->playerTarget->game->stack;
|
return source->playerTarget->game->stack;
|
||||||
else return source->controller()->game->stack;
|
else return source->controller()->game->stack;
|
||||||
|
|
||||||
case TARGET_OWNER_REVEAL:
|
case TARGET_OWNER_REVEAL:
|
||||||
return target->owner->game->reveal;
|
return target->owner->game->reveal;
|
||||||
case REVEAL:
|
case REVEAL:
|
||||||
return target->owner->game->reveal;
|
return target->owner->game->reveal;
|
||||||
case OWNER_REVEAL:
|
case OWNER_REVEAL:
|
||||||
return target->owner->game->reveal;
|
return target->owner->game->reveal;
|
||||||
case TARGETED_PLAYER_REVEAL:
|
case TARGETED_PLAYER_REVEAL:
|
||||||
if (source->playerTarget)
|
if (source->playerTarget)
|
||||||
return source->playerTarget->game->reveal;
|
return source->playerTarget->game->reveal;
|
||||||
else return source->controller()->game->reveal;
|
else return source->controller()->game->reveal;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1187,7 +1187,7 @@ int MTGGameZone::zoneStringToId(string zoneName)
|
|||||||
|
|
||||||
"mystack", "opponentstack", "targetownerstack", "targetcontrollerstack", "ownerstack", "stack","targetedpersonsstack",
|
"mystack", "opponentstack", "targetownerstack", "targetcontrollerstack", "ownerstack", "stack","targetedpersonsstack",
|
||||||
|
|
||||||
"myreveal", "opponentreveal", "targetownerreveal", "targetcontrollerreveal", "ownerreveal", "reveal","targetedpersonsreveal",
|
"myreveal", "opponentreveal", "targetownerreveal", "targetcontrollerreveal", "ownerreveal", "reveal","targetedpersonsreveal",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1210,7 +1210,7 @@ int MTGGameZone::zoneStringToId(string zoneName)
|
|||||||
|
|
||||||
MY_STACK, OPPONENT_STACK, TARGET_OWNER_STACK, TARGET_CONTROLLER_STACK, OWNER_STACK, STACK,TARGETED_PLAYER_STACK,
|
MY_STACK, OPPONENT_STACK, TARGET_OWNER_STACK, TARGET_CONTROLLER_STACK, OWNER_STACK, STACK,TARGETED_PLAYER_STACK,
|
||||||
|
|
||||||
MY_REVEAL, OPPONENT_REVEAL, TARGET_OWNER_REVEAL, TARGET_CONTROLLER_REVEAL, OWNER_REVEAL, REVEAL,TARGETED_PLAYER_REVEAL };
|
MY_REVEAL, OPPONENT_REVEAL, TARGET_OWNER_REVEAL, TARGET_CONTROLLER_REVEAL, OWNER_REVEAL, REVEAL,TARGETED_PLAYER_REVEAL };
|
||||||
|
|
||||||
int max = sizeof(values) / sizeof *(values);
|
int max = sizeof(values) / sizeof *(values);
|
||||||
|
|
||||||
|
|||||||
+282
-282
@@ -49,10 +49,10 @@ PermanentAbility(observer, _id)
|
|||||||
Angel[i] = 0;
|
Angel[i] = 0;
|
||||||
dragonbonusgranted[i] = false;
|
dragonbonusgranted[i] = false;
|
||||||
dragon[i] = 0;
|
dragon[i] = 0;
|
||||||
eldrazibonusgranted[i] = false;
|
eldrazibonusgranted[i] = false;
|
||||||
eldrazi[i] = 0;
|
eldrazi[i] = 0;
|
||||||
werewolfbonusgranted[i] = false;
|
werewolfbonusgranted[i] = false;
|
||||||
werewolf[i] = 0;
|
werewolf[i] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,10 +175,10 @@ int MTGEventBonus::receiveEvent(WEvent * event)
|
|||||||
Angel[currentPlayer->getId()]++;
|
Angel[currentPlayer->getId()]++;
|
||||||
if(e->card->hasType("dragon")||e->card->hasType("wurm")||e->card->hasType("drake")||e->card->hasType("snake")||e->card->hasType("hydra"))
|
if(e->card->hasType("dragon")||e->card->hasType("wurm")||e->card->hasType("drake")||e->card->hasType("snake")||e->card->hasType("hydra"))
|
||||||
dragon[currentPlayer->getId()]++;
|
dragon[currentPlayer->getId()]++;
|
||||||
if (e->card->hasType("eldrazi"))
|
if (e->card->hasType("eldrazi"))
|
||||||
eldrazi[currentPlayer->getId()]++;
|
eldrazi[currentPlayer->getId()]++;
|
||||||
if (e->card->hasType("werewolf") || e->card->hasType("wolf"))
|
if (e->card->hasType("werewolf") || e->card->hasType("wolf"))
|
||||||
werewolf[currentPlayer->getId()]++;
|
werewolf[currentPlayer->getId()]++;
|
||||||
}
|
}
|
||||||
if(toys[currentPlayer->getId()] > 30 && !toybonusgranted[currentPlayer->getId()])
|
if(toys[currentPlayer->getId()] > 30 && !toybonusgranted[currentPlayer->getId()])
|
||||||
{
|
{
|
||||||
@@ -236,16 +236,16 @@ int MTGEventBonus::receiveEvent(WEvent * event)
|
|||||||
grantAward("Teeth And Scales!",300);
|
grantAward("Teeth And Scales!",300);
|
||||||
dragonbonusgranted[currentPlayer->getId()] = true;
|
dragonbonusgranted[currentPlayer->getId()] = true;
|
||||||
}
|
}
|
||||||
if (eldrazi[currentPlayer->getId()] > 30 && !eldrazibonusgranted[currentPlayer->getId()])
|
if (eldrazi[currentPlayer->getId()] > 30 && !eldrazibonusgranted[currentPlayer->getId()])
|
||||||
{
|
{
|
||||||
grantAward("Colorblind!", 300);
|
grantAward("Colorblind!", 300);
|
||||||
eldrazibonusgranted[currentPlayer->getId()] = true;
|
eldrazibonusgranted[currentPlayer->getId()] = true;
|
||||||
}
|
}
|
||||||
if (werewolf[currentPlayer->getId()] > 30 && !werewolfbonusgranted[currentPlayer->getId()])
|
if (werewolf[currentPlayer->getId()] > 30 && !werewolfbonusgranted[currentPlayer->getId()])
|
||||||
{
|
{
|
||||||
grantAward("Full Moon!", 300);
|
grantAward("Full Moon!", 300);
|
||||||
werewolfbonusgranted[currentPlayer->getId()] = true;
|
werewolfbonusgranted[currentPlayer->getId()] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//bonus for dealing 100+ damage from a single source
|
//bonus for dealing 100+ damage from a single source
|
||||||
@@ -383,65 +383,65 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
|||||||
return 0;
|
return 0;
|
||||||
Player * player = game->currentlyActing();
|
Player * player = game->currentlyActing();
|
||||||
ManaCost * cost = card->getManaCost();
|
ManaCost * cost = card->getManaCost();
|
||||||
ManaCost * playerMana = player->getManaPool();
|
ManaCost * playerMana = player->getManaPool();
|
||||||
///////announce X cost///////
|
///////announce X cost///////
|
||||||
if ((cost->hasX() || cost->hasSpecificX()) && card->setX == -1)
|
if ((cost->hasX() || cost->hasSpecificX()) && card->setX == -1)
|
||||||
{
|
{
|
||||||
vector<MTGAbility*>selection;
|
vector<MTGAbility*>selection;
|
||||||
int options = cost->hasSpecificX() ? 20 : (playerMana->getConvertedCost() - cost->getConvertedCost()) + 1;
|
int options = cost->hasSpecificX() ? 20 : (playerMana->getConvertedCost() - cost->getConvertedCost()) + 1;
|
||||||
//you can set up to 20 for specific X, if you cant afford it, it cancels. I couldnt think of a equation that would
|
//you can set up to 20 for specific X, if you cant afford it, it cancels. I couldnt think of a equation that would
|
||||||
//give me the correct amount sorry.
|
//give me the correct amount sorry.
|
||||||
for (int i = 0; i < options; ++i)
|
for (int i = 0; i < options; ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
MTGAbility * setX = NEW AAWhatsX(game, game->mLayers->actionLayer()->getMaxId(), card, card, i, this);
|
MTGAbility * setX = NEW AAWhatsX(game, game->mLayers->actionLayer()->getMaxId(), card, card, i, this);
|
||||||
MTGAbility * setCardX = setX->clone();
|
MTGAbility * setCardX = setX->clone();
|
||||||
setCardX->oneShot = true;
|
setCardX->oneShot = true;
|
||||||
selection.push_back(setCardX);
|
selection.push_back(setCardX);
|
||||||
SAFE_DELETE(setX);
|
SAFE_DELETE(setX);
|
||||||
}
|
}
|
||||||
if (selection.size())
|
if (selection.size())
|
||||||
{
|
{
|
||||||
MTGAbility * a1 = NEW MenuAbility(game, this->GetId(), card, card, false, selection);
|
MTGAbility * a1 = NEW MenuAbility(game, this->GetId(), card, card, false, selection);
|
||||||
game->mLayers->actionLayer()->currentActionCard = card;
|
game->mLayers->actionLayer()->currentActionCard = card;
|
||||||
a1->resolve();
|
a1->resolve();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//////X is set, below we set sunburst for X if needed and cast or reset the card.//////
|
//////X is set, below we set sunburst for X if needed and cast or reset the card.//////
|
||||||
//////107.3a If a spell or activated ability has a mana cost, alternative cost, //////
|
//////107.3a If a spell or activated ability has a mana cost, alternative cost, //////
|
||||||
//////additional cost, and / or activation cost with an{ X }, [-X], or X in it, //////
|
//////additional cost, and / or activation cost with an{ X }, [-X], or X in it, //////
|
||||||
//////and the value of X isn’t defined by the text of that spell or ability, the //////
|
//////and the value of X isn’t defined by the text of that spell or ability, the //////
|
||||||
//////controller of that spell or ability chooses and announces the value of X as//////
|
//////controller of that spell or ability chooses and announces the value of X as//////
|
||||||
//////part of casting the spell or activating the ability. //////
|
//////part of casting the spell or activating the ability. //////
|
||||||
//////(See rule 601, “Casting Spells.”) While a spell is on the stack, any X in //////
|
//////(See rule 601, “Casting Spells.”) While a spell is on the stack, any X in //////
|
||||||
//////its mana cost or in any alternative cost or additional cost it has equals //////
|
//////its mana cost or in any alternative cost or additional cost it has equals //////
|
||||||
//////the announced value.While an activated ability is on the stack, any X in //////
|
//////the announced value.While an activated ability is on the stack, any X in //////
|
||||||
//////its activation cost equals the announced value. //////
|
//////its activation cost equals the announced value. //////
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (card->setX > -1)
|
if (card->setX > -1)
|
||||||
{
|
{
|
||||||
ManaCost * Xcost = NEW ManaCost();
|
ManaCost * Xcost = NEW ManaCost();
|
||||||
Xcost->copy(cost);
|
Xcost->copy(cost);
|
||||||
Xcost->add(Constants::MTG_COLOR_ARTIFACT, card->setX);
|
Xcost->add(Constants::MTG_COLOR_ARTIFACT, card->setX);
|
||||||
Xcost->remove(7, 1);
|
Xcost->remove(7, 1);
|
||||||
if (playerMana->canAfford(Xcost))
|
if (playerMana->canAfford(Xcost))
|
||||||
{
|
{
|
||||||
cost->copy(Xcost);
|
cost->copy(Xcost);
|
||||||
SAFE_DELETE(Xcost);
|
SAFE_DELETE(Xcost);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (card->setX > -1)
|
if (card->setX > -1)
|
||||||
card->setX = -1;
|
card->setX = -1;
|
||||||
SAFE_DELETE(Xcost);
|
SAFE_DELETE(Xcost);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
////cards without X contenue from here////
|
////cards without X contenue from here////
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
//this handles extra cost payments at the moment a card is played.
|
//this handles extra cost payments at the moment a card is played.
|
||||||
if (cost->isExtraPaymentSet())
|
if (cost->isExtraPaymentSet())
|
||||||
{
|
{
|
||||||
@@ -456,7 +456,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
|
|||||||
game->mExtraPayment = cost->extraCosts;
|
game->mExtraPayment = cost->extraCosts;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
ManaCost * previousManaPool = NEW ManaCost(player->getManaPool());
|
||||||
int payResult = player->getManaPool()->pay(card->getManaCost());
|
int payResult = player->getManaPool()->pay(card->getManaCost());
|
||||||
if (card->getManaCost()->getKicker() && (OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number || card->controller()->isAI()))
|
if (card->getManaCost()->getKicker() && (OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number || card->controller()->isAI()))
|
||||||
@@ -570,9 +570,9 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
|
|||||||
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
|
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
|
||||||
withKickerCost->add(card->getManaCost()->getKicker());
|
withKickerCost->add(card->getManaCost()->getKicker());
|
||||||
//cost reduction/recalculation must be here or outside somehow...
|
//cost reduction/recalculation must be here or outside somehow...
|
||||||
//no recalculations beyound this point, reactToClick is the function that
|
//no recalculations beyound this point, reactToClick is the function that
|
||||||
//happens only with the assumption that you could actually pay for it, any calculations after will
|
//happens only with the assumption that you could actually pay for it, any calculations after will
|
||||||
//have negitive effects. this function is basically "can i play this card?"
|
//have negitive effects. this function is basically "can i play this card?"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
withKickerCost->Dump();
|
withKickerCost->Dump();
|
||||||
#endif
|
#endif
|
||||||
@@ -787,61 +787,61 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
|
|||||||
|
|
||||||
Player * player = game->currentlyActing();
|
Player * player = game->currentlyActing();
|
||||||
ManaPool * playerMana = player->getManaPool();
|
ManaPool * playerMana = player->getManaPool();
|
||||||
///////announce X cost///////
|
///////announce X cost///////
|
||||||
if ((alternateCost->hasX() || alternateCost->hasSpecificX()) && card->setX == -1)
|
if ((alternateCost->hasX() || alternateCost->hasSpecificX()) && card->setX == -1)
|
||||||
{
|
{
|
||||||
vector<MTGAbility*>selection;
|
vector<MTGAbility*>selection;
|
||||||
int options = alternateCost->hasSpecificX()? 20 : (playerMana->getConvertedCost() - alternateCost->getConvertedCost()) + 1;
|
int options = alternateCost->hasSpecificX()? 20 : (playerMana->getConvertedCost() - alternateCost->getConvertedCost()) + 1;
|
||||||
//you can set up to 20 for specific X, if you cant afford it, it cancels. I couldnt think of a equation that would
|
//you can set up to 20 for specific X, if you cant afford it, it cancels. I couldnt think of a equation that would
|
||||||
//give me the correct amount sorry.
|
//give me the correct amount sorry.
|
||||||
for (int i = 0; i < options; ++i)
|
for (int i = 0; i < options; ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
MTGAbility * setX = NEW AAWhatsX(game, game->mLayers->actionLayer()->getMaxId(), card, card, i, this);
|
MTGAbility * setX = NEW AAWhatsX(game, game->mLayers->actionLayer()->getMaxId(), card, card, i, this);
|
||||||
MTGAbility * setCardX = setX->clone();
|
MTGAbility * setCardX = setX->clone();
|
||||||
setCardX->oneShot = true;
|
setCardX->oneShot = true;
|
||||||
selection.push_back(setCardX);
|
selection.push_back(setCardX);
|
||||||
SAFE_DELETE(setX);
|
SAFE_DELETE(setX);
|
||||||
}
|
}
|
||||||
if (selection.size())
|
if (selection.size())
|
||||||
{
|
{
|
||||||
MTGAbility * a1 = NEW MenuAbility(game, this->GetId(), card, card, false, selection);
|
MTGAbility * a1 = NEW MenuAbility(game, this->GetId(), card, card, false, selection);
|
||||||
game->mLayers->actionLayer()->currentActionCard = card;
|
game->mLayers->actionLayer()->currentActionCard = card;
|
||||||
a1->resolve();
|
a1->resolve();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//////X is set, below we set sunburst for X if needed and cast or reset the card.//////
|
//////X is set, below we set sunburst for X if needed and cast or reset the card.//////
|
||||||
//////107.3a If a spell or activated ability has a mana cost, alternative cost, //////
|
//////107.3a If a spell or activated ability has a mana cost, alternative cost, //////
|
||||||
//////additional cost, and / or activation cost with an{ X }, [-X], or X in it, //////
|
//////additional cost, and / or activation cost with an{ X }, [-X], or X in it, //////
|
||||||
//////and the value of X isn’t defined by the text of that spell or ability, the //////
|
//////and the value of X isn’t defined by the text of that spell or ability, the //////
|
||||||
//////controller of that spell or ability chooses and announces the value of X as//////
|
//////controller of that spell or ability chooses and announces the value of X as//////
|
||||||
//////part of casting the spell or activating the ability. //////
|
//////part of casting the spell or activating the ability. //////
|
||||||
//////(See rule 601, “Casting Spells.”) While a spell is on the stack, any X in //////
|
//////(See rule 601, “Casting Spells.”) While a spell is on the stack, any X in //////
|
||||||
//////its mana cost or in any alternative cost or additional cost it has equals //////
|
//////its mana cost or in any alternative cost or additional cost it has equals //////
|
||||||
//////the announced value.While an activated ability is on the stack, any X in //////
|
//////the announced value.While an activated ability is on the stack, any X in //////
|
||||||
//////its activation cost equals the announced value. //////
|
//////its activation cost equals the announced value. //////
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (card->setX > -1)
|
if (card->setX > -1)
|
||||||
{
|
{
|
||||||
ManaCost * Xcost = NEW ManaCost();
|
ManaCost * Xcost = NEW ManaCost();
|
||||||
Xcost->copy(alternateCost);
|
Xcost->copy(alternateCost);
|
||||||
Xcost->add(Constants::MTG_COLOR_ARTIFACT, card->setX);
|
Xcost->add(Constants::MTG_COLOR_ARTIFACT, card->setX);
|
||||||
Xcost->remove(7, 1);//remove the X
|
Xcost->remove(7, 1);//remove the X
|
||||||
if (playerMana->canAfford(Xcost))
|
if (playerMana->canAfford(Xcost))
|
||||||
{
|
{
|
||||||
alternateCost->copy(Xcost);
|
alternateCost->copy(Xcost);
|
||||||
SAFE_DELETE(Xcost);
|
SAFE_DELETE(Xcost);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (card->setX > -1)
|
if (card->setX > -1)
|
||||||
card->setX = -1;
|
card->setX = -1;
|
||||||
SAFE_DELETE(Xcost);
|
SAFE_DELETE(Xcost);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//this handles extra cost payments at the moment a card is played.
|
//this handles extra cost payments at the moment a card is played.
|
||||||
|
|
||||||
@@ -898,7 +898,7 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
|
|||||||
{
|
{
|
||||||
|
|
||||||
ManaCost * c = spellCost->Diff(alternateCost);
|
ManaCost * c = spellCost->Diff(alternateCost);
|
||||||
copy->X = card->setX;
|
copy->X = card->setX;
|
||||||
copy->castX = copy->X;
|
copy->castX = copy->X;
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
@@ -1049,11 +1049,11 @@ int MTGRetraceRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
|||||||
Player * player = game->currentlyActing();
|
Player * player = game->currentlyActing();
|
||||||
if(!card->getManaCost()->getRetrace())
|
if(!card->getManaCost()->getRetrace())
|
||||||
return 0;
|
return 0;
|
||||||
if (!player->game->graveyard->hasCard(card))
|
if (!player->game->graveyard->hasCard(card))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ManaCost * retraceCost = card->getManaCost()->getRetrace();
|
ManaCost * retraceCost = card->getManaCost()->getRetrace();
|
||||||
if(retraceCost->extraCosts)
|
if(retraceCost->extraCosts)
|
||||||
for(unsigned int i = 0; i < retraceCost->extraCosts->costs.size();i++)
|
for(unsigned int i = 0; i < retraceCost->extraCosts->costs.size();i++)
|
||||||
{
|
{
|
||||||
@@ -1364,25 +1364,25 @@ MTGAlternativeCostRule(observer, _id)
|
|||||||
|
|
||||||
int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||||
{
|
{
|
||||||
if (!card->has(Constants::PAYZERO))
|
if (!card->has(Constants::PAYZERO))
|
||||||
return 0;
|
return 0;
|
||||||
Player * player = game->currentlyActing();
|
Player * player = game->currentlyActing();
|
||||||
if (card->isLand() || (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card)))
|
if (card->isLand() || (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card)))
|
||||||
{
|
{
|
||||||
//only allowed to pay zero for cards in library??? above is "if you dont have it in hand, grave, or exile"
|
//only allowed to pay zero for cards in library??? above is "if you dont have it in hand, grave, or exile"
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card)) || (!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
|
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card)) || (!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, NULL));
|
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, NULL));
|
||||||
ManaCost * newCost = card->computeNewCost(card, cost, cost);
|
ManaCost * newCost = card->computeNewCost(card, cost, cost);
|
||||||
if (newCost->extraCosts)
|
if (newCost->extraCosts)
|
||||||
for (unsigned int i = 0; i < newCost->extraCosts->costs.size(); i++)
|
for (unsigned int i = 0; i < newCost->extraCosts->costs.size(); i++)
|
||||||
{
|
{
|
||||||
newCost->extraCosts->costs[i]->setSource(card);
|
newCost->extraCosts->costs[i]->setSource(card);
|
||||||
}
|
}
|
||||||
if(card->has(Constants::CANPLAYFROMGRAVEYARD))
|
if(card->has(Constants::CANPLAYFROMGRAVEYARD))
|
||||||
CustomName = "Zero Cast From Graveyard";
|
CustomName = "Zero Cast From Graveyard";
|
||||||
else if(card->has(Constants::CANPLAYFROMEXILE))
|
else if(card->has(Constants::CANPLAYFROMEXILE))
|
||||||
@@ -1432,19 +1432,19 @@ int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
|||||||
{
|
{
|
||||||
if (!card->has(Constants::OVERLOAD))
|
if (!card->has(Constants::OVERLOAD))
|
||||||
return 0;
|
return 0;
|
||||||
if (card->isLand())
|
if (card->isLand())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Player * player = card->controller();
|
Player * player = card->controller();
|
||||||
if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card))
|
if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card)) || (!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
|
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card)) || (!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ManaCost * newCost = card->getManaCost()->getAlternative();
|
ManaCost * newCost = card->getManaCost()->getAlternative();
|
||||||
if(newCost->extraCosts)
|
if(newCost->extraCosts)
|
||||||
for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
|
for(unsigned int i = 0; i < newCost->extraCosts->costs.size();i++)
|
||||||
@@ -1484,64 +1484,64 @@ MTGOverloadRule * MTGOverloadRule::clone() const
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//bestow
|
//bestow
|
||||||
MTGBestowRule::MTGBestowRule(GameObserver* observer, int _id) :
|
MTGBestowRule::MTGBestowRule(GameObserver* observer, int _id) :
|
||||||
MTGAlternativeCostRule(observer, _id)
|
MTGAlternativeCostRule(observer, _id)
|
||||||
{
|
{
|
||||||
aType = MTGAbility::BESTOW_COST;
|
aType = MTGAbility::BESTOW_COST;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGBestowRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
int MTGBestowRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||||
{
|
{
|
||||||
if (!card->model)
|
if (!card->model)
|
||||||
return 0;
|
return 0;
|
||||||
if (!card->model->data->getManaCost()->getBestow())
|
if (!card->model->data->getManaCost()->getBestow())
|
||||||
return 0;
|
return 0;
|
||||||
if (card->isInPlay(game))
|
if (card->isInPlay(game))
|
||||||
return 0;
|
return 0;
|
||||||
if (card->isLand())
|
if (card->isLand())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!card->controller()->inPlay()->hasType("creature") && !card->controller()->opponent()->inPlay()->hasType("creature"))
|
if (!card->controller()->inPlay()->hasType("creature") && !card->controller()->opponent()->inPlay()->hasType("creature"))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ManaCost * newCost = card->getManaCost()->getBestow();
|
ManaCost * newCost = card->getManaCost()->getBestow();
|
||||||
if (newCost->extraCosts)
|
if (newCost->extraCosts)
|
||||||
for (unsigned int i = 0; i < newCost->extraCosts->costs.size(); i++)
|
for (unsigned int i = 0; i < newCost->extraCosts->costs.size(); i++)
|
||||||
{
|
{
|
||||||
newCost->extraCosts->costs[i]->setSource(card);
|
newCost->extraCosts->costs[i]->setSource(card);
|
||||||
}
|
}
|
||||||
return MTGAlternativeCostRule::isReactingToClick(card, mana, newCost);
|
return MTGAlternativeCostRule::isReactingToClick(card, mana, newCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MTGBestowRule::reactToClick(MTGCardInstance * card)
|
int MTGBestowRule::reactToClick(MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
if (!isReactingToClick(card))
|
if (!isReactingToClick(card))
|
||||||
return 0;
|
return 0;
|
||||||
//this new method below in all alternative cost type causes a memleak, however, you cant safedelete the cost here as it cause a crash
|
//this new method below in all alternative cost type causes a memleak, however, you cant safedelete the cost here as it cause a crash
|
||||||
//TODO::::we need to get to the source of this leak and fix it.
|
//TODO::::we need to get to the source of this leak and fix it.
|
||||||
ManaCost * newCost = card->getManaCost()->getBestow();
|
ManaCost * newCost = card->getManaCost()->getBestow();
|
||||||
|
|
||||||
if (newCost->extraCosts)
|
if (newCost->extraCosts)
|
||||||
for (unsigned int i = 0; i < newCost->extraCosts->costs.size(); i++)
|
for (unsigned int i = 0; i < newCost->extraCosts->costs.size(); i++)
|
||||||
{
|
{
|
||||||
newCost->extraCosts->costs[i]->setSource(card);
|
newCost->extraCosts->costs[i]->setSource(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
card->paymenttype = MTGAbility::BESTOW_COST;
|
card->paymenttype = MTGAbility::BESTOW_COST;
|
||||||
card->spellTargetType = "creature|battlefield";
|
card->spellTargetType = "creature|battlefield";
|
||||||
return MTGAlternativeCostRule::reactToClick(card, newCost, ManaCost::MANA_PAID_WITH_BESTOW, false);
|
return MTGAlternativeCostRule::reactToClick(card, newCost, ManaCost::MANA_PAID_WITH_BESTOW, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& MTGBestowRule::toString(ostream& out) const
|
ostream& MTGBestowRule::toString(ostream& out) const
|
||||||
{
|
{
|
||||||
out << "MTGBestowRule ::: (";
|
out << "MTGBestowRule ::: (";
|
||||||
return MTGAbility::toString(out) << ")";
|
return MTGAbility::toString(out) << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGBestowRule * MTGBestowRule::clone() const
|
MTGBestowRule * MTGBestowRule::clone() const
|
||||||
{
|
{
|
||||||
return NEW MTGBestowRule(*this);
|
return NEW MTGBestowRule(*this);
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -1732,19 +1732,19 @@ int MTGAttackRule::receiveEvent(WEvent *e)
|
|||||||
for (int i = 0; i < z->nb_cards; i++)
|
for (int i = 0; i < z->nb_cards; i++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * card = z->cards[i];
|
MTGCardInstance * card = z->cards[i];
|
||||||
if (card->isAttacker() && card->has(Constants::NOSOLO))
|
if (card->isAttacker() && card->has(Constants::NOSOLO))
|
||||||
{
|
{
|
||||||
TargetChooserFactory tf(game);
|
TargetChooserFactory tf(game);
|
||||||
TargetChooser * tc = tf.createTargetChooser("creature[attacking]", NULL);
|
TargetChooser * tc = tf.createTargetChooser("creature[attacking]", NULL);
|
||||||
int Check = card->controller()->game->battlefield->countByCanTarget(tc);
|
int Check = card->controller()->game->battlefield->countByCanTarget(tc);
|
||||||
if (Check <2)
|
if (Check <2)
|
||||||
card->initAttackersDefensers();
|
card->initAttackersDefensers();
|
||||||
}
|
}
|
||||||
if (card->isAttacker() && card->has(Constants::DETHRONE))
|
if (card->isAttacker() && card->has(Constants::DETHRONE))
|
||||||
{
|
{
|
||||||
if (p->opponent()->life >= p->life)
|
if (p->opponent()->life >= p->life)
|
||||||
card->counters->addCounter(1, 1);
|
card->counters->addCounter(1, 1);
|
||||||
}
|
}
|
||||||
if (!card->isAttacker() && !event->from->isExtra && card->has(Constants::MUSTATTACK))//cards are only required to attack in the real attack phase of a turn.
|
if (!card->isAttacker() && !event->from->isExtra && card->has(Constants::MUSTATTACK))//cards are only required to attack in the real attack phase of a turn.
|
||||||
reactToClick(card);
|
reactToClick(card);
|
||||||
if (!card->isAttacker() && card->has(Constants::TREASON) && p->isAI())
|
if (!card->isAttacker() && card->has(Constants::TREASON) && p->isAI())
|
||||||
@@ -2058,49 +2058,49 @@ PermanentAbility(observer, _id)
|
|||||||
int MTGBlockRule::receiveEvent(WEvent *e)
|
int MTGBlockRule::receiveEvent(WEvent *e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dynamic_cast<WEventBlockersChosen*>(e))
|
if (dynamic_cast<WEventBlockersChosen*>(e))
|
||||||
{//do not refactor, these are keep seperate for readability.
|
{//do not refactor, these are keep seperate for readability.
|
||||||
Player * p = game->currentPlayer;
|
Player * p = game->currentPlayer;
|
||||||
|
|
||||||
vector<MTGCardInstance *> Attacker;
|
vector<MTGCardInstance *> Attacker;
|
||||||
MTGGameZone * k = p->game->inPlay;
|
MTGGameZone * k = p->game->inPlay;
|
||||||
for (int i = 0; i < k->nb_cards; i++)
|
for (int i = 0; i < k->nb_cards; i++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * card = k->cards[i];
|
MTGCardInstance * card = k->cards[i];
|
||||||
if (card->isAttacker())
|
if (card->isAttacker())
|
||||||
{
|
{
|
||||||
Attacker.push_back(card);
|
Attacker.push_back(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//force cards that must block, to block whatever is first found. players have a chance to set thier own
|
//force cards that must block, to block whatever is first found. players have a chance to set thier own
|
||||||
//but if ignored we do it for them.
|
//but if ignored we do it for them.
|
||||||
if (Attacker.size())
|
if (Attacker.size())
|
||||||
{
|
{
|
||||||
MTGGameZone * tf = p->opponent()->game->inPlay;
|
MTGGameZone * tf = p->opponent()->game->inPlay;
|
||||||
for (size_t i = 0; i < tf->cards.size(); i++)
|
for (size_t i = 0; i < tf->cards.size(); i++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * card = tf->cards[i];
|
MTGCardInstance * card = tf->cards[i];
|
||||||
if (card->has(Constants::MUSTBLOCK) && !card->defenser && card->canBlock())
|
if (card->has(Constants::MUSTBLOCK) && !card->defenser && card->canBlock())
|
||||||
{//force mustblockers to block the first thing theyre allowed to block if player leaves blockers with them
|
{//force mustblockers to block the first thing theyre allowed to block if player leaves blockers with them
|
||||||
//unassigned as a block.
|
//unassigned as a block.
|
||||||
for (size_t i = 0; i < Attacker.size(); i++)
|
for (size_t i = 0; i < Attacker.size(); i++)
|
||||||
{
|
{
|
||||||
if (card->canBlock(Attacker[i]) && !card->defenser)
|
if (card->canBlock(Attacker[i]) && !card->defenser)
|
||||||
{
|
{
|
||||||
blocker = NEW AABlock(card->getObserver(), -1, card, NULL);
|
blocker = NEW AABlock(card->getObserver(), -1, card, NULL);
|
||||||
blocker->oneShot = true;
|
blocker->oneShot = true;
|
||||||
blocker->forceDestroy = 1;
|
blocker->forceDestroy = 1;
|
||||||
blocker->canBeInterrupted = false;
|
blocker->canBeInterrupted = false;
|
||||||
blocker->target = Attacker[i];
|
blocker->target = Attacker[i];
|
||||||
blocker->resolve();
|
blocker->resolve();
|
||||||
SAFE_DELETE(blocker);
|
SAFE_DELETE(blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (dynamic_cast<WEventBlockersChosen*>(e))
|
if (dynamic_cast<WEventBlockersChosen*>(e))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2120,23 +2120,23 @@ int MTGBlockRule::receiveEvent(WEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if a card with menace is not blocked by 2 or more, remove any known blockers and attacking as normal.
|
//if a card with menace is not blocked by 2 or more, remove any known blockers and attacking as normal.
|
||||||
MTGGameZone * z = p->game->inPlay;
|
MTGGameZone * z = p->game->inPlay;
|
||||||
for (int i = 0; i < z->nb_cards; i++)
|
for (int i = 0; i < z->nb_cards; i++)
|
||||||
{
|
{
|
||||||
MTGCardInstance * card = z->cards[i];
|
MTGCardInstance * card = z->cards[i];
|
||||||
if (card->has(Constants::MENACE) && card->blockers.size() < 2)
|
if (card->has(Constants::MENACE) && card->blockers.size() < 2)
|
||||||
{
|
{
|
||||||
while (card->blockers.size())
|
while (card->blockers.size())
|
||||||
{
|
{
|
||||||
MTGCardInstance * blockingCard = card->blockers.front();
|
MTGCardInstance * blockingCard = card->blockers.front();
|
||||||
blockingCard->toggleDefenser(NULL);
|
blockingCard->toggleDefenser(NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -2906,7 +2906,7 @@ int MTGPersistRule::receiveEvent(WEvent * event)
|
|||||||
}
|
}
|
||||||
AAMover *putinplay = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), copy, copy,"ownerbattlefield",code,NULL,undying,persist);
|
AAMover *putinplay = NEW AAMover(game, game->mLayers->actionLayer()->getMaxId(), copy, copy,"ownerbattlefield",code,NULL,undying,persist);
|
||||||
putinplay->oneShot = true;
|
putinplay->oneShot = true;
|
||||||
game->mLayers->actionLayer()->garbage.push_back(putinplay);
|
game->mLayers->actionLayer()->garbage.push_back(putinplay);
|
||||||
putinplay->fireAbility();
|
putinplay->fireAbility();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
//Exile
|
//Exile
|
||||||
manaCost->addExtraCost(NEW ExileTargetCost(tc));
|
manaCost->addExtraCost(NEW ExileTargetCost(tc));
|
||||||
break;
|
break;
|
||||||
case 'h': //bounce (move to Hand)
|
case 'h': //bounce (move to Hand)
|
||||||
@@ -179,12 +179,12 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd': //DiscardRandom cost
|
case 'd': //DiscardRandom cost
|
||||||
if (value.find("delve") != string::npos)
|
if (value.find("delve") != string::npos)
|
||||||
{
|
{
|
||||||
if(!tc)
|
if(!tc)
|
||||||
tc = tcf.createTargetChooser("*|mygraveyard", c);
|
tc = tcf.createTargetChooser("*|mygraveyard", c);
|
||||||
manaCost->addExtraCost(NEW Delve(tc));
|
manaCost->addExtraCost(NEW Delve(tc));
|
||||||
}
|
}
|
||||||
else if (value == "d")
|
else if (value == "d")
|
||||||
{
|
{
|
||||||
manaCost->addExtraCost(NEW DiscardRandomCost(tc));
|
manaCost->addExtraCost(NEW DiscardRandomCost(tc));
|
||||||
@@ -259,12 +259,12 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
break;
|
break;
|
||||||
case 'c': //Counters or cycle
|
case 'c': //Counters or cycle
|
||||||
{
|
{
|
||||||
if (value.find("convoke") != string::npos)
|
if (value.find("convoke") != string::npos)
|
||||||
{
|
{
|
||||||
if (!tc)
|
if (!tc)
|
||||||
tc = tcf.createTargetChooser("creature|mybattlefield", c);
|
tc = tcf.createTargetChooser("creature|mybattlefield", c);
|
||||||
manaCost->addExtraCost(NEW Convoke(tc));
|
manaCost->addExtraCost(NEW Convoke(tc));
|
||||||
}
|
}
|
||||||
else if(value == "chosencolor")
|
else if(value == "chosencolor")
|
||||||
{
|
{
|
||||||
if(c)
|
if(c)
|
||||||
@@ -389,22 +389,22 @@ ManaCost::ManaCost(ManaCost * manaCost)
|
|||||||
{
|
{
|
||||||
cost[i] = manaCost->getCost(i);
|
cost[i] = manaCost->getCost(i);
|
||||||
}
|
}
|
||||||
hybrids = manaCost->hybrids;
|
hybrids = manaCost->hybrids;
|
||||||
kicker = NEW ManaCost(manaCost->kicker);
|
kicker = NEW ManaCost(manaCost->kicker);
|
||||||
if (kicker)
|
if (kicker)
|
||||||
kicker->isMulti = manaCost->isMulti;
|
kicker->isMulti = manaCost->isMulti;
|
||||||
Retrace = NEW ManaCost( manaCost->Retrace );
|
Retrace = NEW ManaCost( manaCost->Retrace );
|
||||||
BuyBack = NEW ManaCost( manaCost->BuyBack );
|
BuyBack = NEW ManaCost( manaCost->BuyBack );
|
||||||
alternative = NEW ManaCost( manaCost->alternative );
|
alternative = NEW ManaCost( manaCost->alternative );
|
||||||
FlashBack = NEW ManaCost( manaCost->FlashBack );
|
FlashBack = NEW ManaCost( manaCost->FlashBack );
|
||||||
morph = NEW ManaCost( manaCost->morph );
|
morph = NEW ManaCost( manaCost->morph );
|
||||||
suspend = NEW ManaCost( manaCost->suspend );
|
suspend = NEW ManaCost( manaCost->suspend );
|
||||||
Bestow = NEW ManaCost(manaCost->Bestow);
|
Bestow = NEW ManaCost(manaCost->Bestow);
|
||||||
extraCosts = NULL;
|
extraCosts = NULL;
|
||||||
if (manaCost->extraCosts)
|
if (manaCost->extraCosts)
|
||||||
{
|
{
|
||||||
extraCosts = manaCost->extraCosts->clone();
|
extraCosts = manaCost->extraCosts->clone();
|
||||||
}
|
}
|
||||||
manaUsedToCast = NULL;
|
manaUsedToCast = NULL;
|
||||||
xColor = manaCost->xColor;
|
xColor = manaCost->xColor;
|
||||||
}
|
}
|
||||||
@@ -431,12 +431,12 @@ ManaCost::ManaCost(const ManaCost& manaCost)
|
|||||||
FlashBack = NEW ManaCost( manaCost.FlashBack );
|
FlashBack = NEW ManaCost( manaCost.FlashBack );
|
||||||
morph = NEW ManaCost( manaCost.morph );
|
morph = NEW ManaCost( manaCost.morph );
|
||||||
suspend = NEW ManaCost( manaCost.suspend );
|
suspend = NEW ManaCost( manaCost.suspend );
|
||||||
Bestow = NEW ManaCost(manaCost.Bestow);
|
Bestow = NEW ManaCost(manaCost.Bestow);
|
||||||
extraCosts = NULL;
|
extraCosts = NULL;
|
||||||
if (manaCost.extraCosts)
|
if (manaCost.extraCosts)
|
||||||
{
|
{
|
||||||
extraCosts = manaCost.extraCosts->clone();
|
extraCosts = manaCost.extraCosts->clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
manaUsedToCast = NULL;
|
manaUsedToCast = NULL;
|
||||||
xColor = manaCost.xColor;
|
xColor = manaCost.xColor;
|
||||||
@@ -459,7 +459,7 @@ ManaCost & ManaCost::operator= (const ManaCost & manaCost)
|
|||||||
FlashBack = manaCost.FlashBack;
|
FlashBack = manaCost.FlashBack;
|
||||||
morph = manaCost.morph;
|
morph = manaCost.morph;
|
||||||
suspend = manaCost.suspend;
|
suspend = manaCost.suspend;
|
||||||
Bestow = manaCost.Bestow;
|
Bestow = manaCost.Bestow;
|
||||||
manaUsedToCast = manaCost.manaUsedToCast;
|
manaUsedToCast = manaCost.manaUsedToCast;
|
||||||
xColor = manaCost.xColor;
|
xColor = manaCost.xColor;
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ ManaCost::~ManaCost()
|
|||||||
SAFE_DELETE(Retrace);
|
SAFE_DELETE(Retrace);
|
||||||
SAFE_DELETE(morph);
|
SAFE_DELETE(morph);
|
||||||
SAFE_DELETE(suspend);
|
SAFE_DELETE(suspend);
|
||||||
SAFE_DELETE(Bestow);
|
SAFE_DELETE(Bestow);
|
||||||
SAFE_DELETE(manaUsedToCast);
|
SAFE_DELETE(manaUsedToCast);
|
||||||
|
|
||||||
cost.erase(cost.begin() ,cost.end());
|
cost.erase(cost.begin() ,cost.end());
|
||||||
@@ -558,7 +558,7 @@ void ManaCost::init()
|
|||||||
Retrace = NULL;
|
Retrace = NULL;
|
||||||
morph = NULL;
|
morph = NULL;
|
||||||
suspend = NULL;
|
suspend = NULL;
|
||||||
Bestow = NULL;
|
Bestow = NULL;
|
||||||
manaUsedToCast = NULL;
|
manaUsedToCast = NULL;
|
||||||
isMulti = false;
|
isMulti = false;
|
||||||
xColor = -1;
|
xColor = -1;
|
||||||
@@ -583,7 +583,7 @@ void ManaCost::resetCosts()
|
|||||||
SAFE_DELETE(Retrace);
|
SAFE_DELETE(Retrace);
|
||||||
SAFE_DELETE(morph);
|
SAFE_DELETE(morph);
|
||||||
SAFE_DELETE(suspend);
|
SAFE_DELETE(suspend);
|
||||||
SAFE_DELETE(Bestow);
|
SAFE_DELETE(Bestow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManaCost::copy(ManaCost * _manaCost)
|
void ManaCost::copy(ManaCost * _manaCost)
|
||||||
@@ -650,12 +650,12 @@ void ManaCost::copy(ManaCost * _manaCost)
|
|||||||
suspend = NEW ManaCost();
|
suspend = NEW ManaCost();
|
||||||
suspend->copy(_manaCost->suspend);
|
suspend->copy(_manaCost->suspend);
|
||||||
}
|
}
|
||||||
SAFE_DELETE(Bestow);
|
SAFE_DELETE(Bestow);
|
||||||
if (_manaCost->Bestow)
|
if (_manaCost->Bestow)
|
||||||
{
|
{
|
||||||
Bestow = NEW ManaCost();
|
Bestow = NEW ManaCost();
|
||||||
Bestow->copy(_manaCost->Bestow);
|
Bestow->copy(_manaCost->Bestow);
|
||||||
}
|
}
|
||||||
xColor = _manaCost->xColor;
|
xColor = _manaCost->xColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1120,7 +1120,7 @@ void ManaPool::Empty()
|
|||||||
SAFE_DELETE(Retrace);
|
SAFE_DELETE(Retrace);
|
||||||
SAFE_DELETE(morph);
|
SAFE_DELETE(morph);
|
||||||
SAFE_DELETE(suspend);
|
SAFE_DELETE(suspend);
|
||||||
SAFE_DELETE(Bestow);
|
SAFE_DELETE(Bestow);
|
||||||
SAFE_DELETE(manaUsedToCast);
|
SAFE_DELETE(manaUsedToCast);
|
||||||
init();
|
init();
|
||||||
WEvent * e = NEW WEventEmptyManaPool(this);
|
WEvent * e = NEW WEventEmptyManaPool(this);
|
||||||
@@ -1150,8 +1150,8 @@ int ManaPool::remove(int color, int value)
|
|||||||
|
|
||||||
int ManaPool::add(int color, int value, MTGCardInstance * source, bool extra)
|
int ManaPool::add(int color, int value, MTGCardInstance * source, bool extra)
|
||||||
{
|
{
|
||||||
if (color == Constants::MTG_COLOR_ARTIFACT)
|
if (color == Constants::MTG_COLOR_ARTIFACT)
|
||||||
color = Constants::MTG_COLOR_WASTE;
|
color = Constants::MTG_COLOR_WASTE;
|
||||||
int result = ManaCost::add(color, value);
|
int result = ManaCost::add(color, value);
|
||||||
for (int i = 0; i < value; ++i)
|
for (int i = 0; i < value; ++i)
|
||||||
{
|
{
|
||||||
@@ -1171,15 +1171,15 @@ int ManaPool::add(ManaCost * _cost, MTGCardInstance * source)
|
|||||||
{
|
{
|
||||||
if (!_cost)
|
if (!_cost)
|
||||||
return 0;
|
return 0;
|
||||||
//while colorless is still exactly the same, there are now cards that require
|
//while colorless is still exactly the same, there are now cards that require
|
||||||
//true colorless mana, ei:eldrazi. so whenever we add mana, we now replace it with the
|
//true colorless mana, ei:eldrazi. so whenever we add mana, we now replace it with the
|
||||||
//new type. keeping the old type intact for payment methods {1}{c} ....
|
//new type. keeping the old type intact for payment methods {1}{c} ....
|
||||||
int replaceArtifact = _cost->getCost(Constants::MTG_COLOR_ARTIFACT);
|
int replaceArtifact = _cost->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||||
if (replaceArtifact)
|
if (replaceArtifact)
|
||||||
{
|
{
|
||||||
_cost->add(Constants::MTG_COLOR_WASTE, replaceArtifact);
|
_cost->add(Constants::MTG_COLOR_WASTE, replaceArtifact);
|
||||||
_cost->remove(Constants::MTG_COLOR_ARTIFACT, replaceArtifact);
|
_cost->remove(Constants::MTG_COLOR_ARTIFACT, replaceArtifact);
|
||||||
}
|
}
|
||||||
int result = ManaCost::add(_cost);
|
int result = ManaCost::add(_cost);
|
||||||
for (int i = 0; i < Constants::NB_Colors; i++)
|
for (int i = 0; i < Constants::NB_Colors; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
|
|||||||
initState.playerData[i].player->game->hand,
|
initState.playerData[i].player->game->hand,
|
||||||
initState.playerData[i].player->game->inPlay,
|
initState.playerData[i].player->game->inPlay,
|
||||||
initState.playerData[i].player->game->exile,
|
initState.playerData[i].player->game->exile,
|
||||||
initState.playerData[i].player->game->reveal };
|
initState.playerData[i].player->game->reveal };
|
||||||
for (int j = 0; j < 5; j++)
|
for (int j = 0; j < 5; j++)
|
||||||
{
|
{
|
||||||
MTGGameZone * zone = playerZones[j];
|
MTGGameZone * zone = playerZones[j];
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
{
|
{
|
||||||
zones[nbzones++] = MTGGameZone::ALL_ZONES;
|
zones[nbzones++] = MTGGameZone::ALL_ZONES;
|
||||||
}
|
}
|
||||||
else if (zoneName.compare("reveal") == 0)
|
else if (zoneName.compare("reveal") == 0)
|
||||||
{
|
{
|
||||||
zones[nbzones++] = MTGGameZone::MY_REVEAL;
|
zones[nbzones++] = MTGGameZone::MY_REVEAL;
|
||||||
zones[nbzones++] = MTGGameZone::OPPONENT_REVEAL;
|
zones[nbzones++] = MTGGameZone::OPPONENT_REVEAL;
|
||||||
}
|
}
|
||||||
else if (zoneName.compare("graveyard") == 0)
|
else if (zoneName.compare("graveyard") == 0)
|
||||||
{
|
{
|
||||||
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
|
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
|
||||||
@@ -642,15 +642,15 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attribute.find("colorless") != string::npos)
|
if (attribute.find("colorless") != string::npos)
|
||||||
{
|
{
|
||||||
attributefound = 1;
|
attributefound = 1;
|
||||||
for (int cid = 1; cid < Constants::NB_Colors; cid++)
|
for (int cid = 1; cid < Constants::NB_Colors; cid++)
|
||||||
{
|
{
|
||||||
cd->SetExclusionColor(cid);
|
cd->SetExclusionColor(cid);
|
||||||
}
|
}
|
||||||
cd->mode = CardDescriptor::CD_OR;
|
cd->mode = CardDescriptor::CD_OR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attribute.find("chosencolor") != string::npos)
|
if (attribute.find("chosencolor") != string::npos)
|
||||||
{
|
{
|
||||||
@@ -822,7 +822,7 @@ TargetChooser::TargetChooser(GameObserver *observer, MTGCardInstance * card, int
|
|||||||
TargetsList(), observer(observer)
|
TargetsList(), observer(observer)
|
||||||
{
|
{
|
||||||
forceTargetListReady = 0;
|
forceTargetListReady = 0;
|
||||||
forceTargetListReadyByPlayer = 0;
|
forceTargetListReadyByPlayer = 0;
|
||||||
source = card;
|
source = card;
|
||||||
targetter = card;
|
targetter = card;
|
||||||
maxtargets = _maxtargets;
|
maxtargets = _maxtargets;
|
||||||
@@ -905,10 +905,10 @@ int TargetChooser::ForceTargetListReady()
|
|||||||
|
|
||||||
int TargetChooser::targetsReadyCheck()
|
int TargetChooser::targetsReadyCheck()
|
||||||
{
|
{
|
||||||
if (targetMin == false && !targets.size() && forceTargetListReadyByPlayer)
|
if (targetMin == false && !targets.size() && forceTargetListReadyByPlayer)
|
||||||
{
|
{
|
||||||
return TARGET_OK_FULL;//we have no min amount for targets and 0 targets is a valid amount player called for a forced finish.
|
return TARGET_OK_FULL;//we have no min amount for targets and 0 targets is a valid amount player called for a forced finish.
|
||||||
}
|
}
|
||||||
if (!targets.size())
|
if (!targets.size())
|
||||||
{
|
{
|
||||||
return TARGET_NOK;
|
return TARGET_NOK;
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ int TargetsList::addTarget(Targetable * target)
|
|||||||
{
|
{
|
||||||
if (!alreadyHasTarget(target))
|
if (!alreadyHasTarget(target))
|
||||||
{
|
{
|
||||||
|
|
||||||
TargetChooser * tc = target->getObserver()->getCurrentTargetChooser();
|
TargetChooser * tc = target->getObserver()->getCurrentTargetChooser();
|
||||||
if(!tc || (tc && tc->maxtargets == 1))
|
if(!tc || (tc && tc->maxtargets == 1))
|
||||||
{
|
{
|
||||||
if (dynamic_cast<TargetChooser*>(this)->maxtargets > int(getNbTargets()))
|
if (dynamic_cast<TargetChooser*>(this)->maxtargets > int(getNbTargets()))
|
||||||
{
|
{
|
||||||
targets.push_back(target);
|
targets.push_back(target);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//because this was originally coded with targets as an array
|
//because this was originally coded with targets as an array
|
||||||
//we have to add this conditional to insure that cards with single target effects
|
//we have to add this conditional to insure that cards with single target effects
|
||||||
//and abilities that seek the nextcardtarget still work correctly.
|
//and abilities that seek the nextcardtarget still work correctly.
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ WEventTarget::WEventTarget(MTGCardInstance * card,MTGCardInstance * source) :
|
|||||||
WEventCardUpdate(card),card(card),source(source)
|
WEventCardUpdate(card),card(card),source(source)
|
||||||
{
|
{
|
||||||
card->cardistargetted = 1;
|
card->cardistargetted = 1;
|
||||||
if(source)
|
if(source)
|
||||||
source->cardistargetter = 1;
|
source->cardistargetter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user