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: public:
int limitPerTurn; int limitPerTurn;
string limit;
int counters; int counters;
MTGGameZone * activeZone; 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 restrictions = 0, MTGGameZone * dest = NULL);
int resolve(); int resolve();
const char * getMenuText(); const char * getMenuText();
@@ -1153,11 +1154,12 @@ class GenericTargetAbility: public TargetAbility
public: public:
int limitPerTurn; int limitPerTurn;
string limit;
int counters; int counters;
MTGGameZone * activeZone; MTGGameZone * activeZone;
GenericTargetAbility(int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, 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(); const char * getMenuText();
~GenericTargetAbility(); ~GenericTargetAbility();
GenericTargetAbility * clone() const; GenericTargetAbility * clone() const;

View File

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

View File

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

View File

@@ -435,7 +435,7 @@ void GameObserver::gameStateBasedEffects()
////////////////////////// //////////////////////////
//handles phasing events// //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->isPhased = true;
card->phasedTurn = turn; card->phasedTurn = turn;
@@ -443,13 +443,12 @@ void GameObserver::gameStateBasedEffects()
card->view->alpha = 50; card->view->alpha = 50;
card->initAttackersDefensers(); 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->isPhased = false;
card->phasedTurn = turn; card->phasedTurn = turn;
if(card->view) if(card->view)
card->view->alpha = 255; card->view->alpha = 255;
card->isTempPhased = false;
} }
if (card->target && isInPlay(card->target) && (card->hasSubtype("equipment") || card->hasSubtype("aura"))) 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; return amp;
} }
int limit = 0; string limit = "";
size_t limit_str = sWithoutTc.find("limit:"); size_t limit_str = sWithoutTc.find("limit:");
if (limit_str != string::npos) 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); AEquip *ae = dynamic_cast<AEquip*> (a);
@@ -3184,7 +3184,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (spell->getNbTargets() == 1) if (spell->getNbTargets() == 1)
{ {
card->target = spell->getNextCardTarget(); 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; MTGPlayerCards * zones = card->controller()->game;
zones->putInZone(card, spell->from, card->owner->game->graveyard); zones->putInZone(card, spell->from, card->owner->game->graveyard);
@@ -4195,7 +4195,7 @@ int TargetAbility::resolve()
ability->target = t; ability->target = t;
//do nothing if the target controller responded by phasing out the target. //do nothing if the target controller responded by phasing out the target.
MTGCardInstance * targeted = (MTGCardInstance*)t; MTGCardInstance * targeted = (MTGCardInstance*)t;
if (targeted->typeAsTarget() == TARGET_CARD && targeted->isTempPhased) if (targeted->typeAsTarget() == TARGET_CARD && targeted->isPhased)
return 0; return 0;
if (ability->oneShot) if (ability->oneShot)

View File

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