revert this
I introduce more bugs than helped. I think there's alternative method for this,,,
This commit is contained in:
@@ -1543,11 +1543,10 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
|
|||||||
|
|
||||||
int AACopier::resolve()
|
int AACopier::resolve()
|
||||||
{
|
{
|
||||||
bool tokencopied = false;
|
|
||||||
AbilityFactory af(game);
|
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
|
bool tokencopied = false;
|
||||||
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
|
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
|
||||||
tokencopied = true;
|
tokencopied = true;
|
||||||
|
|
||||||
@@ -1557,38 +1556,6 @@ int AACopier::resolve()
|
|||||||
{
|
{
|
||||||
source->copy(_target);
|
source->copy(_target);
|
||||||
}
|
}
|
||||||
//abilities
|
|
||||||
for(unsigned int i = 0;i < source->cardsAbilities.size();i++)
|
|
||||||
{
|
|
||||||
MTGAbility * a = dynamic_cast<MTGAbility *>(source->cardsAbilities[i]);
|
|
||||||
|
|
||||||
if(a) game->removeObserver(a);
|
|
||||||
}
|
|
||||||
source->cardsAbilities.clear();
|
|
||||||
af.getAbilities(¤tAbilities, NULL, source);
|
|
||||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
|
||||||
{
|
|
||||||
MTGAbility * a = currentAbilities[i];
|
|
||||||
a->source = (MTGCardInstance *) source;
|
|
||||||
if (a)
|
|
||||||
{
|
|
||||||
if (a->oneShot)
|
|
||||||
{
|
|
||||||
a->resolve();
|
|
||||||
SAFE_DELETE(a);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
a->addToGame();
|
|
||||||
MayAbility * dontAdd = dynamic_cast<MayAbility*>(a);
|
|
||||||
if(!dontAdd)
|
|
||||||
{
|
|
||||||
source->cardsAbilities.push_back(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
source->isACopier = true;
|
source->isACopier = true;
|
||||||
source->hasCopiedToken = tokencopied;
|
source->hasCopiedToken = tokencopied;
|
||||||
source->copiedID = _target->copiedID;
|
source->copiedID = _target->copiedID;
|
||||||
@@ -1605,35 +1572,9 @@ int AACopier::resolve()
|
|||||||
source->basicAbilities.reset();
|
source->basicAbilities.reset();
|
||||||
source->getManaCost()->resetCosts();
|
source->getManaCost()->resetCosts();
|
||||||
}
|
}
|
||||||
if(_target->TokenAndAbility)
|
//todo andAbility and tokenandAbility
|
||||||
{//the source copied a token with andAbility
|
//
|
||||||
MTGAbility * TokenandAbilityClone = _target->TokenAndAbility->clone();
|
//
|
||||||
TokenandAbilityClone->target = source;
|
|
||||||
if(_target->TokenAndAbility->oneShot)
|
|
||||||
{
|
|
||||||
TokenandAbilityClone->resolve();
|
|
||||||
SAFE_DELETE(TokenandAbilityClone);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TokenandAbilityClone->addToGame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(andAbility)
|
|
||||||
{
|
|
||||||
MTGAbility * andAbilityClone = andAbility->clone();
|
|
||||||
andAbilityClone->target = source;
|
|
||||||
if(andAbility->oneShot)
|
|
||||||
{
|
|
||||||
andAbilityClone->resolve();
|
|
||||||
SAFE_DELETE(andAbilityClone);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
andAbilityClone->addToGame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//source->mPropertiesChangedSinceLastUpdate = true;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1069,7 +1069,7 @@ void GameObserver::checkLegendary(MTGCardInstance * card)
|
|||||||
{
|
{
|
||||||
if(!foundlegendrule)
|
if(!foundlegendrule)
|
||||||
return;
|
return;
|
||||||
if(card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE))
|
if(card->isPhased||card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE))
|
||||||
return;
|
return;
|
||||||
int destroy = 0;
|
int destroy = 0;
|
||||||
vector<MTGCardInstance*>oldCards;
|
vector<MTGCardInstance*>oldCards;
|
||||||
|
|||||||
@@ -1410,13 +1410,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
found = s.find("legendrule");
|
found = s.find("legendrule");
|
||||||
if(found != string::npos)
|
if(found != string::npos)
|
||||||
{
|
{
|
||||||
//I replaced this rule since it broke cards with copy effects and with andability and other
|
observer->addObserver(NEW MTGLegendRule(observer, -1));
|
||||||
//complex cards. So I moved it to gameobserver state based effects, if there are no more
|
//observer->foundlegendrule = true;
|
||||||
//abilities that needs resolving then trigger this legend check... example bug:
|
|
||||||
//cast Phantasmal Image, then copy Vendilion Clique in play, after you choose target player
|
|
||||||
//there will be infinite menu for legendary rule that conflicts with Phantasmal andAbility
|
|
||||||
//observer->addObserver(NEW MTGLegendRule(observer, -1));
|
|
||||||
observer->foundlegendrule = true;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
//this handles the planeswalker named legend rule which is dramatically different from above.
|
//this handles the planeswalker named legend rule which is dramatically different from above.
|
||||||
|
|||||||
@@ -139,11 +139,11 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
|||||||
int castMethodBackUP = this->castMethod;
|
int castMethodBackUP = this->castMethod;
|
||||||
mtgid = source->getId();
|
mtgid = source->getId();
|
||||||
MTGCardInstance * oldStored = this->storedSourceCard;
|
MTGCardInstance * oldStored = this->storedSourceCard;
|
||||||
/*Spell * spell = NEW Spell(observer, this);
|
Spell * spell = NEW Spell(observer, this);
|
||||||
observer = card->observer;
|
observer = card->observer;
|
||||||
AbilityFactory af(observer);
|
AbilityFactory af(observer);
|
||||||
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell);
|
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell);
|
||||||
delete spell;*/
|
delete spell;
|
||||||
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
|
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
|
||||||
mtgid = backupid; // there must be a way to get the token id...
|
mtgid = backupid; // there must be a way to get the token id...
|
||||||
else
|
else
|
||||||
@@ -151,14 +151,11 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
|||||||
mtgid = card->getMTGId(); ///////////////////////////////////////////////////
|
mtgid = card->getMTGId(); ///////////////////////////////////////////////////
|
||||||
setId = card->setId; // Copier/Cloner cards produces the same token...//
|
setId = card->setId; // Copier/Cloner cards produces the same token...//
|
||||||
rarity = card->getRarity(); ///////////////////////////////////////////////////
|
rarity = card->getRarity(); ///////////////////////////////////////////////////
|
||||||
|
|
||||||
setMTGId(card->copiedID); //**************sets copier image****************//
|
|
||||||
}
|
}
|
||||||
castMethod = castMethodBackUP;
|
castMethod = castMethodBackUP;
|
||||||
backupTargets = this->backupTargets;
|
backupTargets = this->backupTargets;
|
||||||
storedCard = oldStored;
|
storedCard = oldStored;
|
||||||
miracle = false;
|
miracle = false;
|
||||||
mPropertiesChangedSinceLastUpdate = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGCardInstance::~MTGCardInstance()
|
MTGCardInstance::~MTGCardInstance()
|
||||||
|
|||||||
Reference in New Issue
Block a user