added miracle ability.
i choose to use other cost instead of creating a brand new cost type.
otherrestriction determines if the card is the miracle for the turn.
[card]
name=Devastation Tide
auto=all(*[-land]) moveto(ownerhand)
other={1}{u} name(Miracle)
otherrestriction=miracle
text=Return all nonland permanents to their owners' hands. -- Miracle {1}{U} (You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)
mana={3}{U}{U}
type=Sorcery
[/card]
This commit is contained in:
@@ -88,6 +88,7 @@ public:
|
|||||||
bool graveEffects;
|
bool graveEffects;
|
||||||
bool exileEffects;
|
bool exileEffects;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
|
bool miracle;
|
||||||
int chooseacolor;
|
int chooseacolor;
|
||||||
string chooseasubtype;
|
string chooseasubtype;
|
||||||
int coinSide;//1 = tails
|
int coinSide;//1 = tails
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ class MTGGameZone {
|
|||||||
|
|
||||||
class MTGLibrary: public MTGGameZone {
|
class MTGLibrary: public MTGGameZone {
|
||||||
public:
|
public:
|
||||||
|
bool miracle;//we already consider a card a miracle drawn from here.
|
||||||
vector<MTGCardInstance*>placeOnTop;
|
vector<MTGCardInstance*>placeOnTop;
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
const char * getName(){return "library";}
|
const char * getName(){return "library";}
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ void GameObserver::nextGamePhase()
|
|||||||
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
||||||
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
|
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
|
||||||
mLayers->actionLayer()->Update(0);
|
mLayers->actionLayer()->Update(0);
|
||||||
|
currentPlayer->game->library->miracle = false;
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
//Cleanup of each player's gamezones
|
//Cleanup of each player's gamezones
|
||||||
|
|||||||
@@ -333,6 +333,14 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
|||||||
if(!isMorbid)
|
if(!isMorbid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check = restriction[i].find("miracle");
|
||||||
|
if(check != string::npos)
|
||||||
|
{
|
||||||
|
if(!card->miracle)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
check = restriction[i].find("ownerscontrol");
|
check = restriction[i].find("ownerscontrol");
|
||||||
if(check != string::npos)
|
if(check != string::npos)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
|||||||
castMethod = castMethodBackUP;
|
castMethod = castMethodBackUP;
|
||||||
backupTargets = this->backupTargets;
|
backupTargets = this->backupTargets;
|
||||||
storedCard = oldStored;
|
storedCard = oldStored;
|
||||||
|
miracle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGCardInstance::~MTGCardInstance()
|
MTGCardInstance::~MTGCardInstance()
|
||||||
@@ -171,6 +172,7 @@ void MTGCardInstance::initMTGCI()
|
|||||||
storedCard = NULL;
|
storedCard = NULL;
|
||||||
storedSourceCard = NULL;
|
storedSourceCard = NULL;
|
||||||
myPair = NULL;
|
myPair = NULL;
|
||||||
|
miracle = false;
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -242,18 +242,27 @@ void MTGPlayerCards::drawFromLibrary()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(putInZone(toMove, library, hand))
|
if(putInZone(toMove, library, hand))
|
||||||
|
{
|
||||||
toMove->currentZone = hand;
|
toMove->currentZone = hand;
|
||||||
|
if (!library->miracle)
|
||||||
|
{
|
||||||
|
library->miracle = true;
|
||||||
|
toMove->miracle = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGPlayerCards::resetLibrary()
|
void MTGPlayerCards::resetLibrary()
|
||||||
{
|
{
|
||||||
SAFE_DELETE(library);
|
SAFE_DELETE(library);
|
||||||
library = NEW MTGLibrary();
|
library = NEW MTGLibrary();
|
||||||
|
library->miracle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGPlayerCards::init()
|
void MTGPlayerCards::init()
|
||||||
{
|
{
|
||||||
library = NEW MTGLibrary();
|
library = NEW MTGLibrary();
|
||||||
|
library->miracle = false;
|
||||||
graveyard = NEW MTGGraveyard();
|
graveyard = NEW MTGGraveyard();
|
||||||
hand = NEW MTGHand();
|
hand = NEW MTGHand();
|
||||||
inPlay = NEW MTGInPlay();
|
inPlay = NEW MTGInPlay();
|
||||||
|
|||||||
Reference in New Issue
Block a user