2 things,

fixed a bug with Withering Wisps, moved the parsing of the limit string into the isreactingtoclick function, this allows word varibles such as type: to be used.

2nd, removed a varible isTempPhased, it *appear* it might not be needed, tho i didn't handle phasing the way im converting it to for a reason, so cross your fingers and hope all goes well.
BTW: do not email me about any bugs that ariase with phasing or phased out creature, im not excepting bug reports on it to my email box...instead open a ticket with a repro method and mark it as critical.
This commit is contained in:
omegablast2002@yahoo.com
2011-04-03 12:24:21 +00:00
parent 4cd0953ebc
commit 2eca724001
6 changed files with 32 additions and 16 deletions

View File

@@ -1027,10 +1027,11 @@ class GenericActivatedAbility: public ActivatedAbility, public NestedAbility
{
public:
int limitPerTurn;
string limit;
int counters;
MTGGameZone * activeZone;
GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, int limit = 0,
GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 0, string limit = "",
int restrictions = 0, MTGGameZone * dest = NULL);
int resolve();
const char * getMenuText();
@@ -1153,11 +1154,12 @@ class GenericTargetAbility: public TargetAbility
public:
int limitPerTurn;
string limit;
int counters;
MTGGameZone * activeZone;
GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL,
int _tap = 0, int limit = 0, int restrictions = 0, MTGGameZone * dest = NULL);
int _tap = 0, string limit = "", int restrictions = 0, MTGGameZone * dest = NULL);
const char * getMenuText();
~GenericTargetAbility();
GenericTargetAbility * clone() const;

View File

@@ -76,7 +76,6 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
bool turningOver;
bool isMorphed;
bool isPhased;
bool isTempPhased;
int phasedTurn;
bool graveEffects;
bool exileEffects;

View File

@@ -5,8 +5,8 @@
//Generic Activated Abilities
GenericActivatedAbility::GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap,
int limit, int restrictions, MTGGameZone * dest) :
ActivatedAbility(_id, card, _cost, restrictions, _tap), NestedAbility(a), limitPerTurn(limit), activeZone(dest)
string limit, int restrictions, MTGGameZone * dest) :
ActivatedAbility(_id, card, _cost, restrictions, _tap), NestedAbility(a), limit(limit), activeZone(dest)
{
counters = 0;
target = ability->target;
@@ -37,6 +37,12 @@ int GenericActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost
{
if (dynamic_cast<AAMorph*> (ability) && !card->isMorphed && !card->morphed && card->turningOver)
return 0;
if(limit.size())
{
WParsedInt * value = NEW WParsedInt(limit.c_str(),NULL,source);
limitPerTurn = value->getValue();
delete value;
}
if (limitPerTurn && counters >= limitPerTurn)
return 0;
return ActivatedAbility::isReactingToClick(card, mana);
@@ -268,7 +274,12 @@ int AAPhaseOut::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
_target->isTempPhased = true;
_target->isPhased = true;
_target->phasedTurn = game->turn;
if(_target->view)
_target->view->alpha = 50;
_target->initAttackersDefensers();
return 1;
}
return 0;
@@ -2001,8 +2012,8 @@ MultiAbility::~MultiAbility()
//Generic Target Ability
GenericTargetAbility::GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a,
ManaCost * _cost, int _tap, int limit, int restrictions, MTGGameZone * dest) :
TargetAbility(_id, _source, _tc, _cost, restrictions, _tap), limitPerTurn(limit), activeZone(dest)
ManaCost * _cost, int _tap, string limit, int restrictions, MTGGameZone * dest) :
TargetAbility(_id, _source, _tc, _cost, restrictions, _tap), limit(limit), activeZone(dest)
{
ability = a;
MTGAbility * core = AbilityFactory::getCoreAbility(a);
@@ -2088,6 +2099,12 @@ int GenericTargetAbility::resolve()
int GenericTargetAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
if(limit.size())
{
WParsedInt * value = NEW WParsedInt(limit.c_str(),NULL,source);
limitPerTurn = value->getValue();
delete value;
}
if (limitPerTurn && counters >= limitPerTurn)
return 0;
return TargetAbility::isReactingToClick(card, mana);

View File

@@ -435,7 +435,7 @@ void GameObserver::gameStateBasedEffects()
//////////////////////////
//handles phasing events//
//////////////////////////
if((card->has(Constants::PHASING)&& currentGamePhase == Constants::MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn && !card->isPhased) || (card->isTempPhased && !card->isPhased))
if(card->has(Constants::PHASING)&& currentGamePhase == Constants::MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn && !card->isPhased)
{
card->isPhased = true;
card->phasedTurn = turn;
@@ -443,13 +443,12 @@ void GameObserver::gameStateBasedEffects()
card->view->alpha = 50;
card->initAttackersDefensers();
}
else if((card->has(Constants::PHASING) || card->isTempPhased)&& currentGamePhase == Constants::MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn)
else if((card->has(Constants::PHASING) || card->isPhased)&& currentGamePhase == Constants::MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn)
{
card->isPhased = false;
card->phasedTurn = turn;
if(card->view)
card->view->alpha = 255;
card->isTempPhased = false;
}
if (card->target && isInPlay(card->target) && (card->hasSubtype("equipment") || card->hasSubtype("aura")))
{

View File

@@ -930,11 +930,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return amp;
}
int limit = 0;
string limit = "";
size_t limit_str = sWithoutTc.find("limit:");
if (limit_str != string::npos)
{
limit = atoi(sWithoutTc.substr(limit_str + 6).c_str());
limit = sWithoutTc.substr(limit_str + 6);
}
AEquip *ae = dynamic_cast<AEquip*> (a);
@@ -3184,7 +3184,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (spell->getNbTargets() == 1)
{
card->target = spell->getNextCardTarget();
if (card->target && (!spell->tc->canTarget(card->target) || card->target->isTempPhased))
if (card->target && (!spell->tc->canTarget(card->target) || card->target->isPhased))
{
MTGPlayerCards * zones = card->controller()->game;
zones->putInZone(card, spell->from, card->owner->game->graveyard);
@@ -4195,7 +4195,7 @@ int TargetAbility::resolve()
ability->target = t;
//do nothing if the target controller responded by phasing out the target.
MTGCardInstance * targeted = (MTGCardInstance*)t;
if (targeted->typeAsTarget() == TARGET_CARD && targeted->isTempPhased)
if (targeted->typeAsTarget() == TARGET_CARD && targeted->isPhased)
return 0;
if (ability->oneShot)

View File

@@ -136,7 +136,6 @@ void MTGCardInstance::initMTGCI()
turningOver = false;
isMorphed = false;
isPhased = false;
isTempPhased = false;
phasedTurn = -1;
didattacked = 0;
didblocked = 0;