-fix for issue 408 (issues with life + targetcontroller + targets on the stack)
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-09-26 12:57:12 +00:00
parent cc668e98b9
commit 82ab92a61f
4 changed files with 46 additions and 21 deletions

View File

@@ -55867,7 +55867,7 @@ subtype=Island Swamp
name=Undermine
target=*|stack
auto=fizzle
auto=life:-3 opponent
auto=life:-3 targetController
text=Counter target spell. Its controller loses 3 life.
mana={U}{U}{B}
type=Instant

View File

@@ -476,6 +476,7 @@ twinstrike.txt
twinstrike2.txt
twinstrike3.txt
twitch.txt
undermine_i408.txt
underworld_dreams.txt
unearth1.txt
unearth2.txt

View File

@@ -0,0 +1,24 @@
#Testing undermine on bad moon
[INIT]
FIRSTMAIN
[PLAYER1]
hand:Bad Moon
manapool:{1}{B}
[PLAYER2]
hand:Undermine
manapool:{U}{U}{B}
[DO]
Bad Moon
no
yes
Undermine
Bad Moon
endinterruption
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:Bad Moon
life:17
[PLAYER2]
graveyard:Undermine
[END]

View File

@@ -677,17 +677,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
size_t end = s.find(")", found);
int tokenId = atoi(s.substr(found + 6,end - found - 6).c_str());
if (tokenId){
MTGCard * safetycard = GameApp::collection->getCardById(tokenId);
if (safetycard){//contenue
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,tokenId,0, multiplier);
tok->oneShot = 1;
return tok;
}else{
tokenId = 0;
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,"ID NOT FOUND","ERROR ID",NULL,NULL,"",0,NULL);
return tok;
}
}
MTGCard * safetycard = GameApp::collection->getCardById(tokenId);
if (safetycard){//contenue
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,tokenId,0, multiplier);
tok->oneShot = 1;
return tok;
}else{
tokenId = 0;
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,"ID NOT FOUND","ERROR ID",NULL,NULL,"",0,NULL);
return tok;
}
}
end = s.find(",", found);
string sname = s.substr(found + 6,end - found - 6);
@@ -697,11 +697,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
previous = end+1;
end = s.find(",",previous);
string spt = s.substr(previous,end - previous);
int value = 0;
int value = 0;
int power, toughness;
if(!spt.find("X/X") || !spt.find("x/x")){value = spell->computeX(card);}
if(!spt.find("XX/XX") || !spt.find("xx/xx")){value = spell->computeXX(card);}
parsePowerToughness(spt,&power, &toughness);
if(!spt.find("X/X") || !spt.find("x/x")){value = spell->computeX(card);}
if(!spt.find("XX/XX") || !spt.find("xx/xx")){value = spell->computeXX(card);}
parsePowerToughness(spt,&power, &toughness);
string sabilities = s.substr(end+1);
ATokenCreator * tok = NEW ATokenCreator(id,card,NULL,sname,stypes,power + value,toughness + value,sabilities,0, multiplier);
@@ -848,8 +848,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
d = s.substr(start+1);
}
WParsedInt * damage = NEW WParsedInt(d,spell,card);
Damageable * t = NULL;
if (spell) t = spell->getNextDamageableTarget();
Targetable * t = NULL;
if (spell) t = spell->getNextTarget();
MTGAbility * a = NEW AADamager(id,card,t, damage, NULL, 0, who);
a->oneShot = 1;
return a;
@@ -922,9 +922,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
life_s = s.substr(start+1);
}
WParsedInt * life = NEW WParsedInt(life_s,spell,card);
Damageable * d = NULL;
if (spell) d = spell->getNextDamageableTarget();
MTGAbility * a = NEW AALifer(id,card,d,life,NULL,0,who);
Targetable * t = NULL;
if (spell) t = spell->getNextTarget();
MTGAbility * a = NEW AALifer(id,card,t,life,NULL,0,who);
a->oneShot = 1;
return a;
}