untap target as cost.

This commit is contained in:
omegablast2002@yahoo.com
2012-04-01 17:39:41 +00:00
parent 26fba2d7aa
commit 4dfacaa409
3 changed files with 58 additions and 1 deletions

View File

@@ -173,6 +173,15 @@ public:
virtual int doPay();
virtual TapTargetCost * clone() const;
};
//untap a target as cost
class UnTapTargetCost : public ExtraCost
{
public:
UnTapTargetCost(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual UnTapTargetCost * clone() const;
};
//exile as cost
class ExileTargetCost : public ExtraCost

View File

@@ -469,6 +469,49 @@ int TapTargetCost::doPay()
return 0;
}
//untap other as a cost
UnTapTargetCost * UnTapTargetCost::clone() const
{
UnTapTargetCost * ec = NEW UnTapTargetCost(*this);
if (tc)
ec->tc = tc->clone();
return ec;
}
UnTapTargetCost::UnTapTargetCost(TargetChooser *_tc)
: ExtraCost("Untap Target", _tc)
{
}
int UnTapTargetCost::isPaymentSet()
{
if (target && !target->isTapped())
{
tc->removeTarget(target);
target->isExtraCostTarget = false;
target = NULL;
return 0;
}
if (target)
return 1;
return 0;
}
int UnTapTargetCost::doPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
source->storedCard = target;
if (target)
{
_target->untap();
target = NULL;
if (tc)
tc->initTargets();
return 1;
}
return 0;
}
//exile as cost
ExileTargetCost * ExileTargetCost::clone() const
{

View File

@@ -159,10 +159,15 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
break;
}
case 'q':
if(value == "q")
{
manaCost->addExtraCost(NEW UnTapCost);
break;
}
else
{
manaCost->addExtraCost(NEW UnTapTargetCost(tc));
}
break;
case 'c': //Counters or cycle
{
if(value == "chosencolor")