-Issue 31 fixed. Land and tokens don't use the stack anymore. Taking control of a card in opponent's battlefield doesn't trigger "spell cast" triggers either
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-09-22 14:45:01 +00:00
parent 7f396b13b4
commit f5ddbd2396
11 changed files with 53 additions and 30 deletions

View File

@@ -691,7 +691,7 @@ toughness=*
[/card]
[card]
text=Whenever an opponent plays a spell, that player puts the top two cards of his or her library into his or her graveyard.
auto=@movedTo(*[-land]|opponentstack):deplete:2 opponent
auto=@movedTo(*|opponentstack):deplete:2 opponent
id=175108
name=Memory Erosion
rarity=R

View File

@@ -136,6 +136,7 @@ living_lands.txt
lord_of_the_pit.txt
lord_of_the_pit2.txt
master_of_etherium.txt
memory_erosion.txt
millstone.txt
#mind_rot.txt
mobile_fort.txt

View File

@@ -0,0 +1,18 @@
#Bug: Lands use thestack
[INIT]
FIRSTMAIN
[PLAYER1]
hand:plains
library:swamp,mountains
[PLAYER2]
inplay:memory erosion
[DO]
plains
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:plains
library:swamp,mountains
[PLAYER2]
inplay:memory erosion
[END]

View File

@@ -76,6 +76,7 @@ class Spell: public Interruptible {
protected:
public:
MTGGameZone * from;
TargetChooser * tc;
ManaCost * cost;
Spell(MTGCardInstance* _source);

View File

@@ -475,10 +475,8 @@ public:
for ( it=abilities.begin() ; it != abilities.end(); it++ ){
myToken->basicAbilities[*it] = 1;
}
source->controller()->game->stack->addCard(myToken);
source->controller()->game->temp->addCard(myToken);
Spell * spell = NEW Spell(myToken);
spell->resolve();
delete spell;
}
@@ -524,9 +522,8 @@ public:
//inplay is a special zone !
for (int i=0; i < 2; i++){
if (destZone == g->players[i]->game->inPlay && fromZone != g->players[i]->game->inPlay && fromZone != g->players[i]->opponent()->game->inPlay){
MTGCardInstance * copy = g->players[i]->game->putInZone(_target, fromZone, g->players[i]->game->stack);
MTGCardInstance * copy = g->players[i]->game->putInZone(_target, fromZone, g->players[i]->game->temp);
Spell * spell = NEW Spell(copy);
spell->resolve();
delete spell;
return 1;
@@ -2656,10 +2653,8 @@ class AAnimateDead:public MTGAbility{
//Put the card in play again, with all its abilities !
//AbilityFactory af;
MTGCardInstance * copy = source->controller()->game->putInZone(card, _target->controller()->game->graveyard, source->controller()->game->stack);
MTGCardInstance * copy = source->controller()->game->putInZone(card, _target->controller()->game->graveyard, source->controller()->game->temp);
Spell * spell = NEW Spell(copy);
//af.addAbilities(game->mLayers->actionLayer()->getMaxId(), spell);
spell->resolve();
target = spell->source;
card = spell->source;

View File

@@ -152,6 +152,7 @@ class MTGPlayerCards {
MTGRemovedFromGame * removedFromGame;
MTGRemovedFromGame * exile; //alias to removedFromZone
MTGGameZone * garbage;
MTGGameZone * temp;
MTGAllCards * collection;

View File

@@ -110,6 +110,7 @@ Spell::Spell(MTGCardInstance * _source): Interruptible(0){
type = ACTION_SPELL;
cost = NEW ManaCost();
tc = NULL;
from = _source->getCurrentZone();
}
@@ -117,6 +118,7 @@ Spell::Spell(int id, MTGCardInstance * _source, TargetChooser * tc, ManaCost * _
source = _source;
mHeight = 40;
type = ACTION_SPELL;
from = _source->getCurrentZone();
}
@@ -132,11 +134,13 @@ Spell::~Spell(){
int Spell::resolve(){
GameObserver * game = GameObserver::GetInstance();
//TODO Remove target if it's not targettable anymore
while (source->next){
/* while (source->next){
source = source->next;
}
if (!source->hasType("instant") && !source->hasType("sorcery")){
source = source->controller()->game->putInPlay(source);
}*/
if (!source->hasType("instant") && !source->hasType("sorcery")){
Player * p = source->controller();
source = p->game->putInZone(source,from,p->game->battlefield);
from = p->game->battlefield;
}

View File

@@ -748,7 +748,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
card->target = spell->getNextCardTarget();
if (card->target && !spell->tc->canTarget(card->target)){
MTGPlayerCards * zones = card->controller()->game;
zones->putInGraveyard(card);
zones->putInZone(card,spell->from,card->owner->game->graveyard);
return; //fizzle
}
}
@@ -1523,13 +1523,13 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
{
Player * player = spell->getNextPlayerTarget();
if (player->life < (INT_MAX / 4) ) player->life += player->life;
zones->putInZone(card,zones->stack,zones->library);
zones->putInZone(card,spell->from,zones->library);
zones->library->shuffle();
break;
}
case 135262:// Beacon of Destruction & unrest
{
zones->putInZone(card,zones->stack,zones->library);
zones->putInZone(card,spell->from,zones->library);
zones->library->shuffle();
break;
}

View File

@@ -159,8 +159,8 @@ MTGGameZone * MTGCardInstance::getCurrentZone(){
GameObserver * game = GameObserver::GetInstance();
for (int i = 0; i < 2; i++){
MTGPlayerCards * g = game->players[i]->game;
MTGGameZone * zones[] = {g->inPlay,g->graveyard,g->hand, g->library};
for (int k = 0; k < 4; k++){
MTGGameZone * zones[] = {g->inPlay,g->graveyard,g->hand, g->library, g->stack, g->temp};
for (int k = 0; k < 6; k++){
MTGGameZone * zone = zones[k];
if (zone->hasCard(this)) return zone;
}
@@ -299,6 +299,7 @@ Player * MTGCardInstance::controller(){
if (game->players[i]->game->graveyard->hasCard(this)) return game->players[i];
if (game->players[i]->game->hand->hasCard(this)) return game->players[i];
if (game->players[i]->game->library->hasCard(this)) return game->players[i];
if (game->players[i]->game->temp->hasCard(this)) return game->players[i];
}
return lastController;
}

View File

@@ -49,6 +49,7 @@ MTGPlayerCards::~MTGPlayerCards(){
SAFE_DELETE(stack);
SAFE_DELETE(removedFromGame);
SAFE_DELETE(garbage);
SAFE_DELETE(temp);
}
void MTGPlayerCards::setOwner(Player * player){
@@ -59,6 +60,7 @@ void MTGPlayerCards::setOwner(Player * player){
removedFromGame->setOwner(player);
stack->setOwner(player);
garbage->setOwner(player);
temp->setOwner(player);
}
void MTGPlayerCards::initGame(int shuffle, int draw){
@@ -71,13 +73,12 @@ void MTGPlayerCards::initGame(int shuffle, int draw){
}
void MTGPlayerCards::drawFromLibrary(){
MTGCardInstance * drownCard = library->draw();
if(drownCard){
hand->addCard(drownCard);
MTGCardInstance * drawnCard = library->draw();
if(drawnCard){
hand->addCard(drawnCard);
GameObserver *g = GameObserver::GetInstance();
WEvent * e = NEW WEventZoneChange(drownCard,library,hand);
WEvent * e = NEW WEventZoneChange(drawnCard,library,hand);
g->receiveEvent(e);
//delete e;
}
}
@@ -92,6 +93,7 @@ void MTGPlayerCards::init(){
removedFromGame = NEW MTGRemovedFromGame();
exile = removedFromGame;
garbage = NEW MTGGameZone();
temp = NEW MTGGameZone();
}

View File

@@ -54,7 +54,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){
ManaCost * spellCost = previousManaPool->Diff(player->getManaPool());
delete previousManaPool;
if (card->hasType("land")){
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack);
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->temp);
Spell * spell = NEW Spell(copy);
spell->resolve();
delete spellCost;
@@ -62,13 +62,13 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){
player->canPutLandsIntoPlay--;
}else{
Spell * spell = NULL;
if (game->targetChooser){
spell = game->mLayers->stackLayer()->addSpell(card,game->targetChooser, spellCost);
game->targetChooser = NULL;
}else
spell = game->mLayers->stackLayer()->addSpell(card,NULL, spellCost);
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack);
spell->source = copy;
if (game->targetChooser){
spell = game->mLayers->stackLayer()->addSpell(copy,game->targetChooser, spellCost);
game->targetChooser = NULL;
}else{
spell = game->mLayers->stackLayer()->addSpell(copy,NULL, spellCost);
}
}
return 1;
}