added a targetchooser for dummycards source and a method for retrieving card->storedCards variables for docs card package.

This commit is contained in:
omegablast2002@yahoo.com
2012-03-22 21:50:50 +00:00
parent 26239cdc91
commit 2a17b9c11b
5 changed files with 22 additions and 0 deletions
+5
View File
@@ -58,6 +58,10 @@ private:
return;
MTGCardInstance * target = card->target;
intValue = 0;
if(s.find("stored") != string::npos)
{
return init(s.substr(+6),spell,card->storedCard);
}
bool halfup = false;
bool halfdown = false;
if (!target) target = card;
@@ -2898,6 +2902,7 @@ public:
setAbilityOwner();
myDummy->setObserver(abilityReciever->getObserver());
myDummy->owner = abilityReciever;
myDummy->storedCard = source;
vector<string>magictextlines = split(sabilities,'_');
if(magictextlines.size())
{
+1
View File
@@ -154,6 +154,7 @@ public:
int canAttack();
int isAttacker();
Targetable * isAttacking;
MTGCardInstance * storedCard;
MTGCardInstance * isDefenser();
int initAttackersDefensers();
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
+11
View File
@@ -186,6 +186,7 @@ int DiscardRandomCost::doPay()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (target)
{
source->storedCard = target;
_target->controller()->game->discardRandom(_target->controller()->game->hand, source);
target = NULL;
if (tc)
@@ -214,6 +215,7 @@ int DiscardCost::doPay()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (target)
{
source->storedCard = target;
WEvent * e = NEW WEventCardDiscard(target);
GameObserver * game = target->owner->getObserver();
game->receiveEvent(e);
@@ -277,6 +279,7 @@ int ToLibraryCost::doPay()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (target)
{
source->storedCard = target;
_target->controller()->game->putInLibrary(target);
target = NULL;
if (tc)
@@ -314,6 +317,7 @@ int MillCost::doPay()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (target)
{
source->storedCard = target;
_target->controller()->game->putInZone(
_target->controller()->game->library->cards[_target->controller()->game->library->nb_cards - 1],
_target->controller()->game->library, _target->controller()->game->graveyard);
@@ -335,6 +339,7 @@ MillExileCost::MillExileCost(TargetChooser *_tc)
int MillExileCost::doPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
source->storedCard = target;
if (target)
{
_target->controller()->game->putInZone(
@@ -452,6 +457,7 @@ int TapTargetCost::isPaymentSet()
int TapTargetCost::doPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
source->storedCard = target;
if (target)
{
_target->tap();
@@ -482,6 +488,7 @@ int ExileTargetCost::doPay()
if (target)
{
source->storedCard = target;
target->controller()->game->putInExile(target);
target = NULL;
if (tc)
@@ -510,6 +517,7 @@ int BounceTargetCost::doPay()
if (target)
{
source->storedCard = target;
target->controller()->game->putInHand(target);
target = NULL;
if (tc)
@@ -589,6 +597,7 @@ int SacrificeCost::doPay()
if (target)
{
MTGCardInstance * beforeCard = target;
source->storedCard = target;
target->controller()->game->putInGraveyard(target);
WEvent * e = NEW WEventCardSacrifice(beforeCard,target);
GameObserver * game = target->owner->getObserver();
@@ -762,6 +771,7 @@ int ExtraCosts::setAction(MTGAbility * _action, MTGCardInstance * _card)
{
action = _action;
source = _card;
source->storedCard = NULL;
for (size_t i = 0; i < costs.size(); i++)
{
costs[i]->setSource(_card);
@@ -772,6 +782,7 @@ int ExtraCosts::setAction(MTGAbility * _action, MTGCardInstance * _card)
int ExtraCosts::reset()
{
action = NULL;
source->storedCard = NULL;
source = NULL;
//TODO set all payments to "unset"
return 1;
+1
View File
@@ -156,6 +156,7 @@ void MTGCardInstance::initMTGCI()
chooseasubtype = "";
coinSide = -1;
isAttacking = NULL;
storedCard = NULL;
for (int i = 0; i < ManaCost::MANA_PAID_WITH_RETRACE +1; i++)
alternateCostPaid[i] = 0;
+4
View File
@@ -664,6 +664,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
{
return NEW CardTargetChooser(observer, card, card, zones, nbzones);
}
else if (typeName.compare("mystored") == 0)
{
return NEW CardTargetChooser(observer, card->storedCard, card, zones, nbzones);
}
else
{
tc = NEW TypeTargetChooser(observer, typeName.c_str(), zones, nbzones, card, maxtargets, other, targetMin);