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