added a return( effect ) to blink...

This commit is contained in:
omegablast2002@yahoo.com
2011-02-02 21:22:10 +00:00
parent f42227933c
commit e47eb86304
3 changed files with 48 additions and 7 deletions
+4 -2
View File
@@ -4014,7 +4014,8 @@ public:
bool blinkhand; bool blinkhand;
MTGCardInstance * Blinked; MTGCardInstance * Blinked;
bool resolved; bool resolved;
ABlink(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false); MTGAbility * stored;
ABlink(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
void Update(float dt); void Update(float dt);
void resolveBlink(); void resolveBlink();
int resolve(); int resolve();
@@ -4031,7 +4032,8 @@ public:
bool blinkForSource; bool blinkForSource;
bool blinkhand; bool blinkhand;
ABlink * ability; ABlink * ability;
ABlinkGeneric(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false); MTGAbility * stored;
ABlinkGeneric(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
int resolve(); int resolve();
const char * getMenuText(); const char * getMenuText();
ABlinkGeneric * clone() const; ABlinkGeneric * clone() const;
+36 -4
View File
@@ -2958,8 +2958,8 @@ APhaseActionGeneric::~APhaseActionGeneric()
} }
//a blink //a blink
ABlink::ABlink(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot,bool blinkForSource,bool blinkhand) : ABlink::ABlink(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot,bool blinkForSource,bool blinkhand,MTGAbility * stored) :
MTGAbility(_id, card),blinkueot(blinkueot),blinkForSource(blinkForSource),blinkhand(blinkhand) MTGAbility(_id, card),blinkueot(blinkueot),blinkForSource(blinkForSource),blinkhand(blinkhand),stored(stored)
{ {
target = _target; target = _target;
Blinked = NULL; Blinked = NULL;
@@ -3028,6 +3028,20 @@ void ABlink::Update(float dt)
if(!spell->source->hasSubtype("aura")) if(!spell->source->hasSubtype("aura"))
{ {
spell->resolve(); spell->resolve();
if(stored)
{
MTGAbility * clonedStored = stored->clone();
clonedStored->target = spell->source;
if (clonedStored->oneShot)
{
clonedStored->resolve();
delete (clonedStored);
}
else
{
clonedStored->addToGame();
}
}
} }
delete spell; delete spell;
this->forceDestroy = 1; this->forceDestroy = 1;
@@ -3102,9 +3116,25 @@ void ABlink::resolveBlink()
spell->source->power = spell->source->origpower; spell->source->power = spell->source->origpower;
spell->source->toughness = spell->source->origtoughness; spell->source->toughness = spell->source->origtoughness;
spell->resolve(); spell->resolve();
if(stored)
{
MTGAbility * clonedStored = stored->clone();
clonedStored->target = spell->source;
if (clonedStored->oneShot)
{
clonedStored->resolve();
delete (clonedStored);
}
else
{
clonedStored->addToGame();
}
}
delete tc; delete tc;
delete spell; delete spell;
this->forceDestroy = 1; this->forceDestroy = 1;
if(stored)
delete(stored);
Blinked = NULL; Blinked = NULL;
} }
} }
@@ -3128,12 +3158,14 @@ ABlink * ABlink::clone() const
}; };
ABlink::~ABlink() ABlink::~ABlink()
{ {
if (!isClone)
SAFE_DELETE(stored);
} }
ABlinkGeneric::ABlinkGeneric(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot,bool blinkForSource,bool blinkhand) : ABlinkGeneric::ABlinkGeneric(int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot,bool blinkForSource,bool blinkhand,MTGAbility * stored) :
InstantAbility(_id, source, _target) InstantAbility(_id, source, _target)
{ {
ability = NEW ABlink(_id,card,_target,blinkueot,blinkForSource,blinkhand); ability = NEW ABlink(_id,card,_target,blinkueot,blinkForSource,blinkhand,stored);
} }
int ABlinkGeneric::resolve() int ABlinkGeneric::resolve()
+8 -1
View File
@@ -1623,7 +1623,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
size_t hblink = s.find("hand(blink)"); size_t hblink = s.find("hand(blink)");
if(hblink != string::npos) if(hblink != string::npos)
blinkhand = true; blinkhand = true;
MTGAbility * a = NEW ABlinkGeneric(id, card, target,ueoteffect,forsource,blinkhand); size_t returnAbility = s.find("return(");
string sAbility = s.substr(returnAbility + 7);
MTGAbility * stored = NULL;
if(!sAbility.empty())
{
stored = parseMagicLine(sAbility, id, spell, card);
}
MTGAbility * a = NEW ABlinkGeneric(id, card, target,ueoteffect,forsource,blinkhand,stored);
a->oneShot = 1; a->oneShot = 1;
return a; return a;
} }