slight tweaks to transforms(

This commit is contained in:
omegablast2002@yahoo.com
2010-08-18 01:47:10 +00:00
parent 704a3018fa
commit af048ca230
2 changed files with 21 additions and 20 deletions

View File

@@ -220,10 +220,12 @@ class AACounter: public ActivatedAbility{
MTGCardInstance * _target = (MTGCardInstance *)target;
if (nb>0){
for (int i=0; i < nb; i++){
while (_target->next) _target=_target->next;
_target->counters->addCounter(name.c_str(), power, toughness);
}
}else{
for (int i=0; i < -nb; i++){
while (_target->next) _target=_target->next;
_target->counters->removeCounter(name.c_str(), power, toughness);
}
}
@@ -2476,7 +2478,6 @@ public:
_target->getManaCost()->add(type,amount);
return MTGAbility::addToGame();
}
AManaRedux * clone() const{
AManaRedux * a = NEW AManaRedux(*this);
a->isClone = 1;
@@ -2519,23 +2520,25 @@ public:
}
int addToGame(){
MTGCardInstance * _target = (MTGCardInstance *)target;
while (_target->next) _target=_target->next;
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
if (_target->hasColor(j))
oldcolors.push_back(j);
_target->removeColor(j);
}
list<int>::iterator it;
for ( it=types.begin() ; it != types.end(); it++ ){_target->addType(*it);}
for ( it=colors.begin() ; it != colors.end(); it++ ){_target->setColor(*it,1);}
for ( it=oldcolors.begin() ; it != oldcolors.end(); it++ ){}
for ( it=colors.begin() ; it != colors.end(); it++ ){_target->setColor(*it);}
for ( it=abilities.begin() ; it != abilities.end(); it++ ){_target->basicAbilities[*it]++;}
for ( it=oldcolors.begin() ; it != oldcolors.end(); it++ ){}
return MTGAbility::addToGame();}
int destroy(){
MTGCardInstance * _target = (MTGCardInstance *)target;
list<int>::iterator it;
for ( it=types.begin() ; it != types.end(); it++ ){_target->removeType(*it);}
for ( it=colors.begin() ; it != colors.end(); it++ ){_target->removeColor(*it);}
for ( it=oldcolors.begin() ; it != oldcolors.end(); it++ ){_target->setColor(*it);}
for ( it=abilities.begin() ; it != abilities.end(); it++ ){_target->basicAbilities[*it]--;}
for ( it=oldcolors.begin() ; it != oldcolors.end(); it++ ){_target->setColor(*it);}
return 1;}
ATransformer * clone() const{
ATransformer * a = NEW ATransformer(*this);
@@ -2569,7 +2572,6 @@ public:
list<int>types;
list<int>colors;
ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities):MTGAbility(id,source,target){
//TODO this is a copy/past of other code that's all around the place, everything should be in a dedicated parser class;
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
size_t found = sabilities.find(Constants::MTGBasicAbilities[j]);
if (found != string::npos){
@@ -2593,11 +2595,15 @@ public:
s = "";}
}
}
int addToGame(){
int addToGame(){
MTGCardInstance * _target = (MTGCardInstance *)target;
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
if (_target->hasColor(j))
_target->removeColor(j);
}
list<int>::iterator it;
for ( it=types.begin() ; it != types.end(); it++ ){_target->addType(*it);}
for ( it=colors.begin() ; it != colors.end(); it++ ){_target->setColor(*it,1);}
for ( it=colors.begin() ; it != colors.end(); it++ ){_target->setColor(*it);}
for ( it=abilities.begin() ; it != abilities.end(); it++ ){_target->basicAbilities[*it]++;}
return MTGAbility::addToGame();}
ATransformerFOREVER * clone() const{

View File

@@ -1044,26 +1044,21 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
string sabilities;
if (end != real_end){
int previous = end+1;
end = s.find(",",previous);
if (end == string::npos) end = real_end;
string temp = s.substr(previous, end - previous);
if (end == real_end){
sabilities = temp;
}
}
if (end != real_end){
sabilities = s.substr(end+1, real_end - end);
}
MTGAbility * ab;
if (forceUEOT){
ab = NEW ATransformerUEOT(id,card,target,stypes,sabilities);
}else{
ab = NEW ATransformer(id,card,target,stypes,sabilities);
}if(forceFOREVER){ab = NEW ATransformerFOREVER(id,card,target,stypes,sabilities);
}
return ab;
MTGAbility * a;
if (forceUEOT){
a = NEW ATransformerUEOT(id,card,target,stypes,sabilities);
}else{
a = NEW ATransformer(id,card,target,stypes,sabilities);
}if(forceFOREVER){a = NEW ATransformerFOREVER(id,card,target,stypes,sabilities);
}
return a;
}
//Change Power/Toughness
WParsedPT * wppt = NEW WParsedPT(s,spell,card);
if (wppt->ok){