ifthen ability sometimes wasn't grabbing the right target, i now pass it through MTGAbility creations target.

also, i see now why targeted counter cost were left broken for so long. i think this way fixes it in all cases. what a pain.
This commit is contained in:
omegablast2002@yahoo.com
2011-09-15 11:50:04 +00:00
parent d04b4eca38
commit a6c458d0cb
4 changed files with 17 additions and 11 deletions
+4 -6
View File
@@ -2164,8 +2164,8 @@ AAWinGame * AAWinGame::clone() const
//IfThenEffect
IfThenAbility::IfThenAbility(int _id, MTGAbility * delayedAbility, MTGCardInstance * _source, int type,string Cond) :
MTGAbility(_id, _source),delayedAbility(delayedAbility), type(type),Cond(Cond)
IfThenAbility::IfThenAbility(int _id, MTGAbility * delayedAbility, MTGCardInstance * _source, Targetable * _target, int type,string Cond) :
MTGAbility(_id, _source,_target),delayedAbility(delayedAbility), type(type),Cond(Cond)
{
}
@@ -2173,6 +2173,7 @@ int IfThenAbility::resolve()
{
MTGCardInstance * card = (MTGCardInstance*)source;
AbilityFactory af;
Targetable* aTarget = (Targetable*)target;
int checkCond = af.parseCastRestrictions(card,card->controller(),Cond);
if(Cond.find("cantargetcard(") != string::npos)
{
@@ -2194,10 +2195,7 @@ int IfThenAbility::resolve()
MTGAbility * a1 = delayedAbility->clone();
if (!a1)
return 0;
if(target)
a1->target = target;
if(!a1->target)
a1->target = source->target;
a1->target = aTarget;
if(a1->oneShot)
{
a1->resolve();