rewrote transformsFOREVER to be better handled and condense previous code.
This commit is contained in:
@@ -2553,7 +2553,7 @@ public:
|
||||
return a;}
|
||||
~ATransformer(){}
|
||||
};
|
||||
//Adds types/abilities/P/T to a card (until end of turn)
|
||||
//Adds types/abilities/changes color to a card (until end of turn)
|
||||
class ATransformerUEOT: public InstantAbility{
|
||||
public:
|
||||
ATransformer * ability;
|
||||
@@ -2573,53 +2573,24 @@ public:
|
||||
delete ability;
|
||||
}};
|
||||
//transforms forever
|
||||
class ATransformerFOREVER:public MTGAbility{
|
||||
class ATransformerFOREVER: public InstantAbility{
|
||||
public:
|
||||
list<int>abilities;
|
||||
list<int>types;
|
||||
list<int>colors;
|
||||
ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities):MTGAbility(id,source,target){
|
||||
for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){
|
||||
size_t found = sabilities.find(Constants::MTGBasicAbilities[j]);
|
||||
if (found != string::npos){
|
||||
abilities.push_back(j);}
|
||||
}
|
||||
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
|
||||
size_t found = sabilities.find(Constants::MTGColorStrings[j]);
|
||||
if (found != string::npos){
|
||||
colors.push_back(j);}
|
||||
}
|
||||
string s = stypes;
|
||||
while (s.size()){
|
||||
size_t found = s.find(" ");
|
||||
if (found != string::npos){
|
||||
int id = Subtypes::subtypesList->find(s.substr(0,found));
|
||||
types.push_back(id);
|
||||
s = s.substr(found+1);
|
||||
}else{
|
||||
int id = Subtypes::subtypesList->find(s);
|
||||
types.push_back(id);
|
||||
s = "";}
|
||||
}
|
||||
}
|
||||
int addToGame(){
|
||||
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||
if (_target){
|
||||
while (_target->next) _target=_target->next;
|
||||
list<int>::iterator it;
|
||||
for( it=colors.begin(); it != colors.end();it++){ _target->setColor(0,1);}
|
||||
for ( it=types.begin() ; it != types.end(); it++ ){_target->addType(*it);}
|
||||
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();
|
||||
}
|
||||
ATransformer * ability;
|
||||
ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities):InstantAbility(id,source,target){
|
||||
ability = NEW ATransformer(id,source,target,types,abilities);}
|
||||
int resolve(){
|
||||
ATransformer * a = ability->clone();
|
||||
GenericInstantAbility * wrapper = NEW GenericInstantAbility(1,source,(Damageable *)(this->target),a);
|
||||
wrapper->addToGame();
|
||||
return 1;}
|
||||
ATransformerFOREVER * clone() const{
|
||||
ATransformerFOREVER * a = NEW ATransformerFOREVER(*this);
|
||||
a->ability = this->ability->clone();
|
||||
a->isClone = 1;
|
||||
return a;}
|
||||
~ATransformerFOREVER(){}
|
||||
};
|
||||
return a;}
|
||||
~ATransformerFOREVER(){
|
||||
}};
|
||||
//becomes ability
|
||||
//Adds types/abilities/P/T to a card (aura)
|
||||
class ABecomes:public MTGAbility{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user