-fix for issue 604 (Land play limitation should not apply in all cases)
-- this adds a "castMehod" variable to MTGCardInstance. IF this variable is 0, the card was not "cast" (or for lands, "put into play" as part of the lands rule), but "added" to the battlefield with some other effect. On the other hand, if this variable is set, it means the card was cast 
-- as we discussed, I did not touch the "alternateCostPaid" variable, as I'm still not really sure these two concepts are actually the same
This commit is contained in:
wagic.the.homebrew@gmail.com
2011-03-02 13:41:24 +00:00
parent 8f9b1d5b8d
commit b021417324
12 changed files with 95 additions and 15 deletions

View File

@@ -201,11 +201,14 @@ Interruptible(0)
cost = NEW ManaCost();
tc = NULL;
from = _source->getCurrentZone();
payResult = ManaCost::MANA_UNPAID;
source->castMethod = Constants::NOT_CAST;
}
Spell::Spell(int id, MTGCardInstance * _source, TargetChooser * tc, ManaCost * _cost, int payResult) :
Interruptible(id), tc(tc), cost(_cost), payResult(payResult)
{
if (!cost) cost = NEW ManaCost();
source = _source;
mHeight = 40;
type = ACTION_SPELL;
@@ -215,6 +218,20 @@ Interruptible(id), tc(tc), cost(_cost), payResult(payResult)
if(tc && tc->targets[i] != NULL)
_source->backupTargets[i] = tc->targets[i];
}
// fill information on how the card came into this zone. Right now the quickest way is to do it here, based on how the mana was paid...
switch(payResult) {
case ManaCost::MANA_UNPAID:
source->castMethod = Constants::NOT_CAST;
break;
case ManaCost::MANA_PAID:
case ManaCost::MANA_PAID_WITH_KICKER:
source->castMethod = Constants::CAST_NORMALLY;
break;
default:
source->castMethod = Constants::CAST_ALTERNATE;
break;
}
}
int Spell::computeX(MTGCardInstance * card)
@@ -275,7 +292,13 @@ int Spell::resolve()
if (!source->hasType("instant") && !source->hasType("sorcery"))
{
Player * p = source->controller();
int castMethod = source->castMethod;
source = p->game->putInZone(source, from, p->game->battlefield);
// We need to get the information about the cast method on both the card in the stack AND the card in play,
//so we copy it from the previous card (in the stack) to the new one (in play).
source->castMethod = castMethod;
from = p->game->battlefield;
}