Merge pull request #33 from WagicProject/master

getting master
This commit is contained in:
zethfoxster
2016-07-26 22:46:06 -04:00
committed by GitHub
18 changed files with 1566 additions and 267 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -12447,12 +12447,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Past in Flames
text=Each instant and sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. -- Flashback {4}{R} (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={3}{R}
type=Sorcery
[/card]
[card]
name=Pathbreaker Ibex
text=Whenever Pathbreaker Ibex attacks, creatures you control gain trample and get +X/+X until end of turn, where X is the greatest power among creatures you control.
mana={4}{G}{G}
@@ -13846,12 +13840,6 @@ mana={2}{G}{W}
type=Enchantment
[/card]
[card]
name=Recoup
text=Target sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. (Mana cost includes color.) -- Flashback {3}{R} (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={1}{R}
type=Sorcery
[/card]
[card]
name=Recross the Paths
text=Reveal cards from the top of your library until you reveal a land card. Put that card onto the battlefield and the rest on the bottom of your library in any order. Clash with an opponent. If you win, return Recross the Paths to its owner's hand. (Each clashing player reveals the top card of his or her library, then puts that card on the top or bottom. A player wins if his or her card had a higher converted mana cost.)
mana={2}{G}
@@ -16092,15 +16080,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Snapcaster Mage
text=Flash -- When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. (You may cast that card from your graveyard for its flashback cost. Then exile it.)
mana={1}{U}
type=Creature
subtype=Human Wizard
power=2
toughness=1
[/card]
[card]
name=Snow Mercy
text=Whenever a creature deals damage to you, put a globe counter on it. -- {T}, {untap}, {T}, {untap}, {T}: Tap all creatures with globe counters on them.
mana={2}{W}{W}
+10 -31
View File
@@ -1,43 +1,22 @@
#Bug: Haste from legendary lords
[INIT]
UNTAP
FIRSTMAIN
[PLAYER1]
inplay:Worry Beads,swamp,forest,plains
graveyard:99, Dragonlord Kolaghan
library:Krosan Cloudscraper
hand:5556,Dark Ritual,651,Animate Dead,Exhume
manapool:{2}{B}{B}{G}
graveyard:Krosan Cloudscraper, Dragonlord Kolaghan, Clone
hand:Living Death
manapool:{2}{B}{B}{B}
[PLAYER2]
[DO]
next
#upkeep
next
#draw
next
#firstmain
swamp
forest
plains
Dark Ritual
651
Animate Dead
Krosan Cloudscraper
5556
choice 0
Dragonlord Kolaghan
5556
choice 0
99
Living Death
choice 0
Dragonlord Kolaghan
choice 0
next
#begins
next
#attack
Krosan Cloudscraper
99
next
Clone
Krosan Cloudscraper
#block
next
#damage
@@ -47,8 +26,8 @@ eot
[ASSERT]
UNTAP
[PLAYER1]
inplay:99, Krosan Cloudscraper, Worry Beads,swamp,forest,plains,Animate Dead
graveyard:Dragonlord Kolaghan, Exhume, Dark Ritual, 651, 5556
inplay:Krosan Cloudscraper, Clone
graveyard:Dragonlord Kolaghan, Living Death
[PLAYER2]
life:2
life:1
[END]
+1
View File
@@ -463,6 +463,7 @@ living_lands.txt
livingweapon.txt
lord_of_the_pit.txt
lord_of_the_pit2.txt
Living_Death.txt
magma_spray.txt
manabarbs_dual_lands_i562.txt
master_decoy.txt
+2
View File
@@ -1370,6 +1370,8 @@ public:
{
WEventCardSacrifice * e = dynamic_cast<WEventCardSacrifice *> (event);
if (!e) return 0;
if (e->istoken)
return 1;
MTGCardInstance * check = e->cardAfter;
MTGGameZone * oldZone = e->cardAfter->currentZone;
check->currentZone = check->previousZone;
+2
View File
@@ -126,6 +126,8 @@ class GameObserver{
void Affinity();
bool AffinityNeedsUpdate;
void addObserver(MTGAbility * observer);
void checkLegendary(MTGCardInstance * card);
map<MTGCardInstance *,bool> cards;
bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules);
void untapPhase();
+1
View File
@@ -219,6 +219,7 @@ public:
BESTOW_COST = 35,
ATTACK_COST = 36,
BLOCK_COST = 37,
GRANTEDFLASHBACK_COST = 38,
};
};
+2 -1
View File
@@ -255,7 +255,8 @@ class Constants
OVERLOAD = 133,
SHACKLER = 134,
FLYERSONLY = 135,//can attack only if it has flying
NB_BASIC_ABILITIES = 136,
TEMPFLASHBACK = 136,
NB_BASIC_ABILITIES = 137,
RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics
+15
View File
@@ -150,6 +150,21 @@ public:
virtual MTGFlashBackRule * clone() const;
};
class MTGTempFlashBackRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGTempFlashBackRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Flashback Manacost";
}
virtual MTGTempFlashBackRule * clone() const;
};
class MTGRetraceRule: public MTGAlternativeCostRule
{
public:
+2 -1
View File
@@ -184,7 +184,8 @@ struct WEventCardBlocked : public WEventCardUpdate {
//event when card is sacrificed.
struct WEventCardSacrifice : public WEventCardUpdate {
MTGCardInstance * cardAfter;
WEventCardSacrifice(MTGCardInstance * card,MTGCardInstance * afterCard);
bool istoken;
WEventCardSacrifice(MTGCardInstance * card,MTGCardInstance * afterCard, bool token = false);
virtual Targetable * getTarget(int target);
};
+40 -33
View File
@@ -1138,27 +1138,27 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
if (cardFirst->isLand())
continue;
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
if (cardFirst->isLand())
continue;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (cardFirst->hasColor(i))
{
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->isLand())
continue;
if (cardSecond->hasColor(i) && cardFirst != cardSecond)
{
repeating = true;
}
}
}
}
{
if (cardFirst->hasColor(i))
{
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->isLand())
continue;
if (cardSecond->hasColor(i) && cardFirst != cardSecond)
{
repeating = true;
}
}
}
}
}
do
@@ -1195,18 +1195,18 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->name == cardFirst->name && cardFirst != cardSecond)
{
repeating = true;
}
}
for (vector<MTGCardInstance*>::iterator it = found.begin(); it != found.end(); it++)
{
MTGCardInstance * cardFirst = *it;
for (vector<MTGCardInstance*>::iterator secondit = found.begin(); secondit != found.end(); secondit++)
{
MTGCardInstance * cardSecond = *secondit;
if (cardSecond->name == cardFirst->name && cardFirst != cardSecond)
{
repeating = true;
}
}
}
do
@@ -2716,10 +2716,14 @@ int AASacrificeCard::resolve()
{
Player * p = _target->controller();
MTGCardInstance * beforeCard = _target;
WEvent * e;
if(!_target->isToken)
e = NEW WEventCardSacrifice(beforeCard,_target);
else
e = NEW WEventCardSacrifice(beforeCard,_target,true);
p->game->putInGraveyard(_target);
while(_target->next)
_target = _target->next;
WEvent * e = NEW WEventCardSacrifice(beforeCard,_target);
game->receiveEvent(e);
if(andAbility)
{
@@ -3236,11 +3240,14 @@ int AAFlip::resolve()
{
toughMod =_target->toughness - _target->origtoughness;
}
if(!_target->isCDA)
{
_target->power = powerlessThanOriginal?myFlip->power - powerMod:myFlip->power + powerMod;
_target->life = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod;
_target->toughness = toughLessThanOriginal?myFlip->toughness - toughMod:myFlip->toughness + toughMod;
_target->origpower = myFlip->origpower;
_target->origtoughness = myFlip->origtoughness;
}
SAFE_DELETE(myFlip);
_target->mPropertiesChangedSinceLastUpdate = true;
}
+25 -21
View File
@@ -978,14 +978,14 @@ ManaCost * Convoke::getReduction()
tc->maxtargets = source->getManaCost()->getConvertedCost();
if (tc->getNbTargets())
{
vector<Targetable*>targetlist = tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
vector<Targetable*>targetlist = tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
bool next = false;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (next == true)
break;
{
if (next == true)
break;
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
{
@@ -1004,13 +1004,13 @@ ManaCost * Convoke::getReduction()
{
SAFE_DELETE(toReduce);
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;
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (next == true)
break;
{
if (next == true)
break;
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
{
@@ -1036,9 +1036,9 @@ int Convoke::doPay()
ManaCost * toReduce = getReduction();
target->controller()->getManaPool()->pay(toReduce);
SAFE_DELETE(toReduce);
vector<Targetable*>targetlist = tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
vector<Targetable*>targetlist = tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
source->storedCard = targetCard->createSnapShot();
targetCard->tap();
@@ -1104,9 +1104,9 @@ int Delve::doPay()
target->controller()->getManaPool()->pay(toReduce);
SAFE_DELETE(toReduce);
vector<Targetable*>targetlist = tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
vector<Targetable*>targetlist = tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
source->storedCard = targetCard->createSnapShot();
targetCard->controller()->game->putInExile(targetCard);
@@ -1288,8 +1288,12 @@ int SacrificeCost::doPay()
{
MTGCardInstance * beforeCard = target;
source->storedCard = target->createSnapShot();
WEvent * e;
if(!target->isToken)
e = NEW WEventCardSacrifice(beforeCard,target);
else
e = NEW WEventCardSacrifice(beforeCard,target,true);
target->controller()->game->putInGraveyard(target);
WEvent * e = NEW WEventCardSacrifice(beforeCard,target);
GameObserver * game = target->owner->getObserver();
game->receiveEvent(e);
target = NULL;
@@ -1567,11 +1571,11 @@ int ExtraCosts::doPay()
}
if (costs[i]->tc)
{
vector<Targetable*>targetlist = costs[i]->tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
costs[i]->target = dynamic_cast<MTGCardInstance*>(*it);
costs[i]->doPay();
vector<Targetable*>targetlist = costs[i]->tc->getTargetsFrom();
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
{
costs[i]->target = dynamic_cast<MTGCardInstance*>(*it);
costs[i]->doPay();
}
}
else
+44 -1
View File
@@ -897,7 +897,13 @@ void GameObserver::gameStateBasedEffects()
int nbcards = z->nb_cards;
//------------------------------
p->nomaxhandsize = (z->hasAbility(Constants::NOMAXHAND));
//legendary
for (int cl = 0; cl < nbcards; cl++)
{
MTGCardInstance * c = z->cards[cl];
if(!c->isPhased && c->hasType(Subtypes::TYPE_LEGENDARY) && !c->has(Constants::NOLEGEND))
checkLegendary(c);
}
/////////////////////////////////////////////////
//handle end of turn effects while we're at it.//
/////////////////////////////////////////////////
@@ -1021,6 +1027,43 @@ void GameObserver::gameStateBasedEffects()
}
}
void GameObserver::checkLegendary(MTGCardInstance * card)
{
map<MTGCardInstance *, bool>::iterator it;
int destroy = 0;
vector<MTGCardInstance*>oldCards;
for (it = cards.begin(); it != cards.end(); it++)
{
MTGCardInstance * comparison = (*it).first;
if (comparison != card && comparison->controller() == card->controller() && !(comparison->getName().compare(card->getName())))
{
oldCards.push_back(comparison);
destroy = 1;
}
}
if(destroy)
{
vector<MTGAbility*>selection;
MultiAbility * multi = NEW MultiAbility(this, this->mLayers->actionLayer()->getMaxId(), card, card, NULL);
for(unsigned int i = 0;i < oldCards.size();i++)
{
AAMover *a = NEW AAMover(this, this->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New");
a->oneShot = true;
multi->Add(a);
}
multi->oneShot = 1;
MTGAbility * a1 = multi;
selection.push_back(a1);
AAMover *b = NEW AAMover(this, this->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old");
b->oneShot = true;
MTGAbility * b1 = b;
selection.push_back(b1);
MTGAbility * menuChoice = NEW MenuAbility(this, this->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule");
menuChoice->addToGame();
}
}
void GameObserver::enchantmentStatus()
{
for (int i = 0; i < 2; i++)
+1
View File
@@ -1176,6 +1176,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
if(found != string::npos)
{
observer->addObserver(NEW MTGFlashBackRule(observer, -1));
observer->addObserver(NEW MTGTempFlashBackRule(observer, -1));
return NULL;
}
//alternative cost type flashback
+2 -1
View File
@@ -166,7 +166,8 @@ const char* Constants::MTGBasicAbilities[] = {
"dethrone",
"overload",
"shackler",
"flyersonly"
"flyersonly",
"tempflashback"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+50 -1
View File
@@ -1056,6 +1056,55 @@ MTGFlashBackRule * MTGFlashBackRule::clone() const
return NEW MTGFlashBackRule(*this);
}
//temporary flashback
MTGTempFlashBackRule::MTGTempFlashBackRule(GameObserver* observer, int _id) :
MTGAlternativeCostRule(observer, _id)
{
aType = MTGAbility::GRANTEDFLASHBACK_COST;
}
int MTGTempFlashBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
Player * player = game->currentlyActing();
if (!player->game->graveyard->hasCard(card))
return 0;
if (!card->has(Constants::TEMPFLASHBACK))
return 0;
ManaCost * flashbackCost = card->getManaCost();
if(flashbackCost->extraCosts)
for(unsigned int i = 0; i < flashbackCost->extraCosts->costs.size();i++)
{
flashbackCost->extraCosts->costs[i]->setSource(card);
}
return MTGAlternativeCostRule::isReactingToClick(card, mana, flashbackCost );
}
int MTGTempFlashBackRule::reactToClick(MTGCardInstance * card)
{
ManaCost * flashbackCost = card->getManaCost();
if(flashbackCost->extraCosts)
for(unsigned int i = 0; i < flashbackCost->extraCosts->costs.size();i++)
{
flashbackCost->extraCosts->costs[i]->setSource(card);
}
if (!isReactingToClick(card))
return 0;
card->paymenttype = MTGAbility::FLASHBACK_COST;
return MTGAlternativeCostRule::reactToClick(card, flashbackCost, ManaCost::MANA_PAID_WITH_FLASHBACK);
}
ostream& MTGTempFlashBackRule::toString(ostream& out) const
{
out << "MTGTempFlashBackRule ::: (";
return MTGAbility::toString(out) << ")";
}
MTGTempFlashBackRule * MTGTempFlashBackRule::clone() const
{
return NEW MTGTempFlashBackRule(*this);
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
@@ -3138,7 +3187,7 @@ int MTGLegendRule::canBeInList(MTGCardInstance * card)
return 0;
if (card->hasType(Subtypes::TYPE_LEGENDARY) && card->controller()->game->inPlay->hasCard(card))
{
if(card->has(Constants::NOLEGEND))
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasName("Mirror Gallery")||card->controller()->inPlay()->hasName("Mirror Gallery"))
return 0;
else
return 1;
+2 -2
View File
@@ -99,8 +99,8 @@ player(player), nb_cards(nb_cards),drawAbility(cardDraw)
{
}
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after) :
WEventCardUpdate(card),cardAfter(after)
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after, bool token) :
WEventCardUpdate(card),cardAfter(after),istoken(token)
{
}