Erwan
- fix issue 153 (Tokens should go to graveyard) - "token" keyword can now be used in the parser with things such as Creature[-token] for "noncreature token" - Let's stop using "token" as a type
This commit is contained in:
@@ -511,7 +511,7 @@ abilities=mountainwalk
|
||||
[card]
|
||||
text=Whenever a nontoken creature you control is put into a graveyard from the battlefield, put a 1/1 green Saproling creature token onto the battlefield.
|
||||
id=89069
|
||||
auto=@movedto(creature|graveyard) from(myBattlefield):token(Saproling,creature saproling, 1/1,green)
|
||||
auto=@movedto(creature[-token]|graveyard) from(myBattlefield):token(Saproling,creature saproling, 1/1,green)
|
||||
name=Golgari Germination
|
||||
rarity=U
|
||||
type=Enchantment
|
||||
|
||||
@@ -165,6 +165,7 @@ death_ward.txt
|
||||
deja_vu.txt
|
||||
delusions_of_mediocrity.txt
|
||||
dingus_egg.txt
|
||||
dingus_staff_i153.txt
|
||||
divergent_growth.txt
|
||||
doomed_necromancer.txt
|
||||
double_strike_i145.txt
|
||||
@@ -230,6 +231,7 @@ goblin_lackey2.txt
|
||||
goblin_lackey3.txt
|
||||
goblin_lackey4.txt
|
||||
goblin_offensive.txt
|
||||
golgari_germination_i153.txt
|
||||
gravedigger.txt
|
||||
great_defender.txt
|
||||
hannas_custody.txt
|
||||
|
||||
21
projects/mtg/bin/Res/test/dingus_staff_i153.txt
Normal file
21
projects/mtg/bin/Res/test/dingus_staff_i153.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
#Bug: Tokens don't go to the graveyard
|
||||
#see: http://code.google.com/p/wagic/issues/detail?id=153
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
inplay:1138,dingus staff
|
||||
hand:shock
|
||||
manapool:{5}{R}
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
1138
|
||||
shock
|
||||
-1138
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
life:18
|
||||
inplay:1138,dingus staff
|
||||
graveyard:shock
|
||||
[PLAYER2]
|
||||
[END]
|
||||
21
projects/mtg/bin/Res/test/golgari_germination_i153.txt
Normal file
21
projects/mtg/bin/Res/test/golgari_germination_i153.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
#Bug: Tokens and graveyard
|
||||
#see http://code.google.com/p/wagic/issues/detail?id=153
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
inplay:grizzly bears,89069
|
||||
manapool:{R}{R}
|
||||
hand:lightning bolt,shock
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
lightning bolt
|
||||
grizzly bears
|
||||
shock
|
||||
-89069
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
graveyard:lightning bolt,grizzly bears,shock
|
||||
inplay:89069
|
||||
[PLAYER2]
|
||||
[END]
|
||||
@@ -47,7 +47,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
MTGGameZone * currentZone;
|
||||
Pos* view;
|
||||
int regenerateTokens;
|
||||
bool isToken;
|
||||
int isToken;
|
||||
int stillInUse();
|
||||
Player * lastController;
|
||||
MTGGameZone * getCurrentZone();
|
||||
|
||||
@@ -64,6 +64,16 @@ class MTGPersistRule:public MTGAbility{
|
||||
};
|
||||
|
||||
|
||||
class MTGTokensCleanup:public MTGAbility{
|
||||
public:
|
||||
vector<MTGCardInstance *> list;
|
||||
MTGTokensCleanup(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
int testDestroy();
|
||||
void Update(float dt);
|
||||
virtual MTGTokensCleanup * clone() const;
|
||||
};
|
||||
|
||||
/*
|
||||
* Rule 420.5e (Legend Rule)
|
||||
* If two or more legendary permanents with the same name are in play, all are put into their
|
||||
|
||||
@@ -150,7 +150,9 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card){
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
|
||||
if ((isToken== -1 && card->isToken) || (isToken == 1 && !card->isToken)){
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if (attacker == 1){
|
||||
if (defenser == &AnyCard){
|
||||
|
||||
@@ -28,6 +28,7 @@ void DuelLayers::init(){
|
||||
action->Add(NEW MTGLifelinkRule(-1));
|
||||
action->Add(NEW MTGDeathtouchRule(-1));
|
||||
action->Add(NEW OtherAbilitiesEventReceiver(-1));
|
||||
action->Add(NEW MTGTokensCleanup(-1));
|
||||
//Other display elements
|
||||
action->Add(NEW HUDDisplay(-1));
|
||||
|
||||
|
||||
@@ -148,12 +148,12 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
}
|
||||
|
||||
MTGCardInstance * ret = copy;
|
||||
if (card->isToken){
|
||||
/*if (card->isToken){
|
||||
if (to != g->players[0]->game->inPlay && to != g->players[1]->game->inPlay){
|
||||
to = garbage;
|
||||
ret = NULL;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
to->addCard(copy);
|
||||
copy->changedZoneRecently = 1.f;
|
||||
@@ -211,13 +211,21 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
|
||||
nb_cards--;
|
||||
cards.erase(cards.begin()+i);
|
||||
MTGCardInstance * copy = card;
|
||||
if (card->isToken) //TODO better than this ?
|
||||
return card;
|
||||
//if (card->isToken) //TODO better than this ?
|
||||
// return card;
|
||||
//card->lastController = card->controller();
|
||||
if (createCopy) {
|
||||
copy = NEW MTGCardInstance(card->model,card->owner->game);
|
||||
copy->previous = card;
|
||||
copy->view = card->view;
|
||||
copy->isToken = card->isToken;
|
||||
|
||||
//stupid bug with tokens...
|
||||
if (card->model == card)
|
||||
copy->model = copy;
|
||||
if (card->data == card)
|
||||
copy->data = copy;
|
||||
|
||||
card->next = copy;
|
||||
}
|
||||
copy->previousZone = this;
|
||||
|
||||
@@ -516,6 +516,36 @@ HUDDisplay::~HUDDisplay(){
|
||||
}
|
||||
|
||||
|
||||
MTGTokensCleanup::MTGTokensCleanup(int _id):MTGAbility(_id, NULL){}
|
||||
|
||||
int MTGTokensCleanup::receiveEvent(WEvent * e){
|
||||
if (WEventZoneChange* event = dynamic_cast<WEventZoneChange*>(e)){
|
||||
if (!event->card->isToken) return 0;
|
||||
if (event->to == game->players[0]->game->inPlay || event->to == game->players[1]->game->inPlay) return 0;
|
||||
if (event->to == game->players[0]->game->garbage || event->to == game->players[1]->game->garbage) return 0;
|
||||
list.push_back(event->card);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MTGTokensCleanup::testDestroy(){return 0;}
|
||||
|
||||
void MTGTokensCleanup::Update(float dt){
|
||||
MTGAbility::Update(dt);
|
||||
for(size_t i= 0; i < list.size(); ++i){
|
||||
MTGCardInstance * c = list[i];
|
||||
c->controller()->game->putInZone(c,c->currentZone, c->controller()->game->garbage);
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
|
||||
MTGTokensCleanup * MTGTokensCleanup::clone() const{
|
||||
MTGTokensCleanup * a = NEW MTGTokensCleanup(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
/* Legend Rule */
|
||||
MTGLegendRule::MTGLegendRule(int _id):ListMaintainerAbility(_id){};
|
||||
|
||||
|
||||
@@ -176,6 +176,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
}else{
|
||||
cd->unsecureSetTapped(1);
|
||||
}
|
||||
//Token
|
||||
}else if (attribute.find("token") != string::npos){
|
||||
if (minus){
|
||||
cd->isToken = -1;
|
||||
}else{
|
||||
cd->isToken = 1;
|
||||
}
|
||||
//Power restrictions
|
||||
}else if (attribute.find("power") != string::npos){
|
||||
cd->setPower(comparisonCriterion);
|
||||
|
||||
@@ -12,6 +12,7 @@ Token::Token(string _name, MTGCardInstance * source, int _power, int _toughness)
|
||||
setMTGId(- source->getMTGId());
|
||||
setId = source->setId;
|
||||
model = this;
|
||||
data=this;
|
||||
owner = source->owner;
|
||||
belongs_to=source->controller()->game;
|
||||
attacker = 0;
|
||||
|
||||
Reference in New Issue
Block a user