Merge pull request #619 from kevlahnota/master

added support for cards like leyline of the void, rest in peace, etc...
This commit is contained in:
Xawotihs
2015-09-07 20:09:36 +02:00
16 changed files with 2005 additions and 94 deletions
File diff suppressed because it is too large Load Diff
@@ -4509,24 +4509,12 @@ mana={3}{W}
type=Enchantment
[/card]
[card]
name=Endless Swarm
text=Put a 1/1 green Snake creature token onto the battlefield for each card in your hand. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability.)
mana={5}{G}{G}{G}
type=Sorcery
[/card]
[card]
name=Endoskeleton
text=You may choose not to untap Endoskeleton during your untap step. -- {2}, {T}: Target creature gets +0/+3 for as long as Endoskeleton remains tapped.
mana={2}
type=Artifact
[/card]
[card]
name=Enduring Ideal
text=Search your library for an enchantment card and put it onto the battlefield. Then shuffle your library. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability.)
mana={5}{W}{W}
type=Sorcery
[/card]
[card]
name=Enduring Renewal
text=Play with your hand revealed. -- If you would draw a card, reveal the top card of your library instead. If it's a creature card, put it into your graveyard. Otherwise, draw a card. -- Whenever a creature is put into your graveyard from the battlefield, return it to your hand.
mana={2}{W}{W}
@@ -4707,12 +4695,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Eternal Dominion
text=Search target opponent's library for an artifact, creature, enchantment, or land card. Put that card onto the battlefield under your control. Then that player shuffles his or her library. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability. You may choose a new target for the copy.)
mana={7}{U}{U}{U}
type=Sorcery
[/card]
[card]
name=Etherium-Horn Sorcerer
text={1}{U}{R}: Return Etherium-Horn Sorcerer to its owner's hand. -- Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.)
mana={4}{U}{R}
@@ -5428,12 +5410,6 @@ mana={2}{G}
type=Enchantment
[/card]
[card]
name=Forbidden Crypt
text=If you would draw a card, return a card from your graveyard to your hand instead. If you can't, you lose the game. -- If a card would be put into your graveyard from anywhere, exile that card instead.
mana={3}{B}{B}
type=Enchantment
[/card]
[card]
name=Forbidden Ritual
text=Sacrifice a nontoken permanent. If you do, target opponent loses 2 life unless he or she sacrifices a permanent or discards a card. You may repeat this process any number of times.
mana={2}{B}{B}
@@ -6598,15 +6574,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Gravebane Zombie
text=If Gravebane Zombie would be put into a graveyard from the battlefield, put Gravebane Zombie on top of its owner's library instead.
mana={3}{B}
type=Creature
subtype=Zombie
power=3
toughness=2
[/card]
[card]
name=Graven Dominator
text=Flying -- Haunt (When this card is put into a graveyard from the battlefield, exile it haunting target creature.) -- When Graven Dominator enters the battlefield or the creature it haunts is put into a graveyard, each other creature becomes 1/1 until end of turn.
mana={4}{W}{W}
@@ -10813,12 +10780,6 @@ power=2
toughness=2
[/card]
[card]
name=Neverending Torment
text=Search target player's library for X cards, where X is the number of cards in your hand, and exile them. Then that player shuffles his or her library. -- Epic (For the rest of the game, you can't cast spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability. You may choose a new target for the copy.)
mana={4}{B}{B}
type=Sorcery
[/card]
[card]
name=New Benalia
text=New Benalia enters the battlefield tapped. -- When New Benalia enters the battlefield, scry 1. (To scry 1, look at the top card of your library, then you may put that card on the bottom of your library.) -- {T}: Add {W} to your mana pool.
type=Land
@@ -13271,15 +13232,6 @@ mana={1}{U}
type=Sorcery
[/card]
[card]
name=Rest in Peace
#Note this is replacement effect, I think wagic has no override rule.
auto=moveto(exile) all(*|graveyard)
auto=@movedTo(*|graveyard):all(trigger[to]) moveTo(exile)
text=When Rest in Peace enters the battlefield, exile all cards from all graveyards. -- If a card or token would be put into a graveyard from anywhere, exile it instead.
mana={1}{W}
type=Enchantment
[/card]
[card]
name=Restless Dreams
text=As an additional cost to cast Restless Dreams, discard X cards. -- Return X target creature cards from your graveyard to your hand.
mana={B}
@@ -18954,12 +18906,6 @@ mana={2}{W}
type=Instant
[/card]
[card]
name=Yawgmoth's Agenda
text=You can't cast more than one spell each turn. -- You may play cards from your graveyard. -- If a card would be put into your graveyard from anywhere, exile it instead.
mana={3}{B}{B}
type=Enchantment
[/card]
[card]
name=Ydwen Efreet
text=Whenever Ydwen Efreet blocks, flip a coin. If you lose the flip, remove Ydwen Efreet from combat and it can't block this turn. Creatures it was blocking that had become blocked by only Ydwen Efreet this combat become unblocked.
mana={R}{R}{R}
@@ -0,0 +1,28 @@
#Testing Gravebane Zombie
#after gravebane zombie dies, activate archivist
#and you must draw gravebane zombie if its on the top
#of your library
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Gravebane Zombie, Archivist
hand:Wrecking Ball
library:mountain, plains, swamp
manapool:{2}{R}{B}
[PLAYER2]
[DO]
Wrecking Ball
Gravebane Zombie
Archivist
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:Archivist
library:mountain, plains, swamp
hand:Gravebane Zombie
graveyard:Wrecking Ball
manapool:{0}
life:20
[PLAYER2]
life:20
[END]
+3
View File
@@ -374,6 +374,7 @@ goblin_lackey4.txt
goblin_offensive.txt
goblin_razerunners.txt
golgari_germination_i153.txt
Gravebane_Zombie.txt
gravedigger.txt
gravity_well.txt
gravity_well2.txt
@@ -440,6 +441,7 @@ kudzu_i168.txt
Lethargy_Trap.txt
Lethargy_Trap2.txt
leveler.txt
leyline_of_the_void.txt
lhurgoyf.txt
liability.txt
library_of_alexandria1.txt
@@ -569,6 +571,7 @@ Rending_Vines2.txt
resounding_roar.txt
resurrection.txt
resuscitate_i210.txt
restinpeace.txt
righteous_cause.txt
rise_from_the_grave.txt
river_kelpie2_i335.txt
@@ -0,0 +1,26 @@
#Testing Leyline of the Void vs Darksteel Colossus and Black Sun's Zenith
#Darksteel Colossus must be on owners library
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Leyline of the Void, Forbidden Orchard
hand:Black Sun's Zenith
manapool:{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{B}
[PLAYER2]
inplay:Darksteel Colossus
library:Mountain
[DO]
Forbidden Orchard
choice 2
Black Sun's Zenith
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:Leyline of the Void, Forbidden Orchard
library:Black Sun's Zenith
manapool:{0}
life:20
[PLAYER2]
library:Mountain, Darksteel Colossus
life:20
[END]
+23
View File
@@ -0,0 +1,23 @@
#Testing Rest in Peace vs Disenchant
#Rest in Peace should be exiled while Disenchant must be put
#in the owner's graveyard..
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:Rest in Peace
hand:Disenchant
manapool:{W}{W}
[PLAYER2]
[DO]
Disenchant
Rest in Peace
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:Disenchant
manapool:{0}
exile:Rest in Peace
life:20
[PLAYER2]
life:20
[END]
+29
View File
@@ -599,6 +599,10 @@ private:
{
intValue = target->controller()->opponent()->drawCounter;
}
else if (s == "epicactivated")
{
intValue = target->controller()->epic;
}
else if (s == "p" || s == "power")
{
intValue = target->getPower();
@@ -635,6 +639,21 @@ private:
{
intValue = target->controller()->opponent()->game->hand->nb_cards;
}
else if (s == "morethanfourcards")
{
if(card->playerTarget)
{//blackvise
intValue = 0;
if ((card->playerTarget->game->hand->nb_cards - 4)>0)
intValue = (card->playerTarget->game->hand->nb_cards - 4);
}
else
{//viseling
intValue = 0;
if ((card->controller()->opponent()->game->hand->nb_cards - 4)>0)
intValue = (card->controller()->opponent()->game->hand->nb_cards - 4);
}
}
else if (s == "powertotalinplay")//Count Total Power of Creatures you control... Formidable
{
intValue = 0;
@@ -1335,6 +1354,16 @@ public:
AAFakeAbility * clone() const;
};
class AAEPIC: public ActivatedAbility
{
public:
string named;
AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
int resolve();
const string getMenuText();
AAEPIC * clone() const;
};
class AAFizzler: public ActivatedAbility
{
public:
+5 -1
View File
@@ -220,7 +220,11 @@ class Constants
NOLEGEND = 102,
CANPLAYFROMGRAVEYARD = 103,
TOKENIZER = 104,
NB_BASIC_ABILITIES = 105,
MYGRAVEEXILER = 105,
OPPGRAVEEXILER = 106,
LIBRARYDEATH = 107,
SHUFFLELIBRARYDEATH = 108,
NB_BASIC_ABILITIES = 109,
RARITY_S = 'S', //Special Rarity
+1
View File
@@ -42,6 +42,7 @@ public:
int skippingTurn;
int extraTurn;
int drawCounter;
int epic;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
+25
View File
@@ -1328,6 +1328,31 @@ AAFakeAbility * AAFakeAbility::clone() const
return NEW AAFakeAbility(*this);
}
//EPIC
AAEPIC::AAEPIC(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * _target, string _named,ManaCost * cost):
ActivatedAbility(observer, id, source, cost, 0),named(_named)
{
this->target = _target;
}
int AAEPIC::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *)target;
_target->controller()->epic = 1;
return 1;
}
const string AAEPIC::getMenuText()
{
if(named.size())
return named.c_str();
return "EPIC";
}
AAEPIC * AAEPIC::clone() const
{
return NEW AAEPIC(*this);
}
// Fizzler
AAFizzler::AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) :
ActivatedAbility(observer, _id, card, _cost, 0)
+6 -1
View File
@@ -540,7 +540,12 @@ ExtraCost("UnTap")
int UnTapCost::isPaymentSet()
{
if (source && !source->isTapped())
/*602.5a A creature's activated ability with the tap symbol ({T}) or the untap symbol ({Q})
* in its activation cost can't be activated unless the creature has been under its
* controller's control since the start of his or her most recent turn.
* Ignore this rule for creatures with haste (see rule 702.10). As of 6/1/2014 Comprehensive Rules
*/
if (source && (!source->isTapped() || source->hasSummoningSickness()))
{
return 0;
}
+11 -1
View File
@@ -2408,7 +2408,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//Reset damages on cards
//Do nothing
found = s.find("donothing");
if (found != string::npos)
{
@@ -2418,6 +2418,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//Epic
found = s.find("epic");
if (found != string::npos)
{
MTGAbility * a = NEW AAEPIC(observer, id, card, target,newName);
a->oneShot = 1;
return a;
}
//Damage
vector<string> splitDamage = parseBetween(s, "damage:", " ", false);
if (splitDamage.size())
+5 -1
View File
@@ -133,7 +133,11 @@ const char* Constants::MTGBasicAbilities[] = {
"lure",
"nolegend",
"canplayfromgraveyard",
"tokenizer"//parallel lives
"tokenizer",//parallel lives,
"mygraveexiler",
"oppgraveexiler",
"librarydeath",
"shufflelibrarydeath"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+30
View File
@@ -321,6 +321,33 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
return card; //Error check
int doCopy = 1;
bool shufflelibrary = card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH];
bool ripToken = false;
if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace"))
ripToken = true;
//Darksteel Colossus, Legacy Weapon ... top priority since we replace destination directly automatically...
for(int i = 0; i < 2; ++i)
{
if ((to == g->players[i]->game->graveyard) && (
card->basicAbilities[(int)Constants::LIBRARYDEATH]||
card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH]))
{
to = g->players[i]->game->library;
}
}
//Leyline of the Void, Yawgmoth's Agenda... effect...
for(int i = 0; i < 2; ++i)
{
if ((to == g->players[i]->game->graveyard) && (
g->players[i]->game->battlefield->hasAbility(Constants::MYGRAVEEXILER) ||
g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER)))
{
if ((card->isToken && ripToken))
to = g->players[i]->game->exile;
if (!card->isToken)
to = g->players[i]->game->exile;
}
}
//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
== g->players[1]->game->inPlay))
@@ -384,6 +411,9 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
}
if(!asCopy)
{
if(shufflelibrary)
copy->owner->game->library->shuffle();
WEvent * e = NEW WEventZoneChange(copy, from, to);
g->receiveEvent(e);
}
+13 -7
View File
@@ -318,13 +318,15 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
}
}
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH)
|| (player == currentPlayer && !game->isInterrupting
|| (player == card->controller() && !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{
if(card->controller()->epic)
return 0;
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
if (card->controller()->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
return 0;
ManaCost * playerMana = player->getManaPool();
ManaCost * cost = card->getManaCost();
@@ -650,12 +652,14 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
return 1;
}
else if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH)
|| (player == currentPlayer && !game->isInterrupting
|| (player == card->controller() && !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
if(card->controller()->epic)
return 0;
if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY)
return 0;
ManaCost * playerMana = player->getManaPool();
@@ -1028,21 +1032,23 @@ int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{
Player * player = game->currentlyActing();
Player * currentPlayer = game->currentPlayer;
//Player * currentPlayer = game->currentPlayer;
if (!player->game->hand->hasCard(card))
return 0;
if (!card->getManaCost()->getMorph())
return 0;
if(!allowedToAltCast(card,player))
return 0;
if(card->controller()->epic)//zoetic cavern... morph is casted for a cost...
return 0;
//note lands can morph too, this is different from other cost types.
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (player == currentPlayer
if ((card->hasType(Subtypes::TYPE_INSTANT)) || card->has(Constants::FLASH) || (player == card->controller()
&& !game->isInterrupting
&& (game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
|| game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
)
{
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(card, game->currentActionPlayer->game->stack) == PlayRestriction::CANT_PLAY)
if (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->stack) == PlayRestriction::CANT_PLAY)
return 0;
ManaCost * playerMana = player->getManaPool();
ManaCost * morph = card->getManaCost()->getMorph();
+1
View File
@@ -33,6 +33,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
skippingTurn = 0;
extraTurn = 0;
drawCounter = 0;
epic = 0;
prowledTypes.clear();
doesntEmpty = NEW ManaCost();
poolDoesntEmpty = NEW ManaCost();