Erwan
-Fix farhaven elf
This commit is contained in:
@@ -88,6 +88,7 @@ drift_of_the_dead.txt
|
||||
dross_harvester.txt
|
||||
elvish_piper.txt
|
||||
elvish_promenade.txt
|
||||
farhaven_elf.txt
|
||||
fastbond.txt
|
||||
fastbond2.txt
|
||||
fault_line.txt
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#Bug:farhaven elf taps itself
|
||||
[INIT]
|
||||
SECONDMAIN
|
||||
[PLAYER1]
|
||||
hand:farhaven elf
|
||||
library:forest
|
||||
manapool:{2}{G}
|
||||
[PLAYER2]
|
||||
inplay:royal assassin
|
||||
[DO]
|
||||
farhaven elf
|
||||
choice 0
|
||||
forest
|
||||
eot
|
||||
royal assassin
|
||||
farhaven elf
|
||||
[ASSERT]
|
||||
UNTAP
|
||||
[PLAYER1]
|
||||
inplay:farhaven elf,forest
|
||||
[PLAYER2]
|
||||
inplay:royal assassin
|
||||
[END]
|
||||
@@ -217,10 +217,13 @@ public:
|
||||
}
|
||||
|
||||
~MultiAbility(){
|
||||
vector<int>::size_type sz = abilities.size();
|
||||
for (unsigned int i = 0; i < sz; i++){
|
||||
delete abilities[i];
|
||||
if (!isClone){
|
||||
vector<int>::size_type sz = abilities.size();
|
||||
for (unsigned int i = 0; i < sz; i++){
|
||||
delete abilities[i];
|
||||
}
|
||||
}
|
||||
abilities.clear();
|
||||
}
|
||||
|
||||
const char * getMenuText(){
|
||||
|
||||
@@ -142,6 +142,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
s.erase(found+1);
|
||||
else return NULL;
|
||||
|
||||
found=s.find_first_not_of(whitespaces);
|
||||
if (found!=string::npos)
|
||||
s.erase(0,found);
|
||||
else return NULL;
|
||||
|
||||
//TODO This block redundant with calling function
|
||||
if (!card && spell) card = spell->source;
|
||||
if (!card) return NULL;
|
||||
@@ -213,6 +218,25 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
}
|
||||
|
||||
|
||||
//When...comes into play, you may...
|
||||
found = s.find("may ");
|
||||
if (found == 0){
|
||||
string s1 = s.substr(found+4);
|
||||
MTGAbility * a1 = parseMagicLine(s1,id,spell, card);
|
||||
if (!a1) return NULL;
|
||||
TargetChooser * tc = NULL;
|
||||
//Target Abilities
|
||||
found = s.find("target(");
|
||||
if (found != string::npos){
|
||||
int end = s.find(")", found);
|
||||
string starget = s.substr(found + 7,end - found - 7);
|
||||
TargetChooserFactory tcf;
|
||||
tc = tcf.createTargetChooser(starget, card);
|
||||
}
|
||||
if (tc) a1 = NEW GenericTargetAbility(id, card, tc, a1);
|
||||
return NEW MayAbility(id,a1,card);
|
||||
}
|
||||
|
||||
|
||||
//Multiple abilities for ONE cost
|
||||
found = s.find("&&");
|
||||
@@ -287,26 +311,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//When...comes into play, you may...
|
||||
found = s.find("may ");
|
||||
if (found != string::npos){
|
||||
string s1 = s.substr(found+4);
|
||||
MTGAbility * a1 = parseMagicLine(s1,id,spell, card);
|
||||
if (!a1) return NULL;
|
||||
TargetChooser * tc = NULL;
|
||||
//Target Abilities
|
||||
found = s.find("target(");
|
||||
if (found != string::npos){
|
||||
int end = s.find(")", found);
|
||||
string starget = s.substr(found + 7,end - found - 7);
|
||||
TargetChooserFactory tcf;
|
||||
tc = tcf.createTargetChooser(starget, card);
|
||||
}
|
||||
if (tc) a1 = NEW GenericTargetAbility(id, card, tc, a1);
|
||||
return NEW MayAbility(id,a1,card);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Fizzle (counterspell...)
|
||||
found = s.find("fizzle");
|
||||
|
||||
Reference in New Issue
Block a user