fixed wall of reverence and refactored adynamic ability a bit.

This commit is contained in:
omegablast2002@yahoo.com
2012-03-27 13:57:09 +00:00
parent 252fe216d4
commit 8a53df8ca5
2 changed files with 55 additions and 96 deletions
+1
View File
@@ -3478,6 +3478,7 @@ string menu;
AADynamic(GameObserver* observer, int id, MTGCardInstance * card, Damageable * _target,int type = 0,int effect = 0,int who = 0,int amountsource = 1,MTGAbility * storedAbility = NULL, ManaCost * _cost = NULL); AADynamic(GameObserver* observer, int id, MTGCardInstance * card, Damageable * _target,int type = 0,int effect = 0,int who = 0,int amountsource = 1,MTGAbility * storedAbility = NULL, ManaCost * _cost = NULL);
int resolve(); int resolve();
int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target);
int activateStored(); int activateStored();
const char * getMenuText(); const char * getMenuText();
AADynamic * clone() const; AADynamic * clone() const;
+47 -89
View File
@@ -1914,9 +1914,7 @@ int AADynamic::resolve()
} }
if(secondaryTarget != NULL) if(secondaryTarget != NULL)
{
_target = secondaryTarget; _target = secondaryTarget;
}
if (_target) if (_target)
{ {
while (dynamic_cast<MTGCardInstance *>(_target) && ((MTGCardInstance *)_target)->next) while (dynamic_cast<MTGCardInstance *>(_target) && ((MTGCardInstance *)_target)->next)
@@ -1925,124 +1923,69 @@ int AADynamic::resolve()
sourceamount = 0; sourceamount = 0;
if(targetamount < 0) if(targetamount < 0)
targetamount = 0; targetamount = 0;
std::stringstream out;
out << sourceamount;
string sourceamountstring = out.str();
out << targetamount;
string targetamountstring = out.str();
//set values less then 0 to 0, it was reported that negitive numbers such as a creature who get -3/-3 having the power become //set values less then 0 to 0, it was reported that negitive numbers such as a creature who get -3/-3 having the power become
//negitive, if then used as the amount, would cuase weird side effects on resolves. //negitive, if then used as the amount, would cuase weird side effects on resolves.
switch(effect) switch(effect)
{ {
case DYNAMIC_ABILITY_EFFECT_STRIKE://deal damage case DYNAMIC_ABILITY_EFFECT_STRIKE://deal damage
if(storedAbility)
activateStored();
if(tosrc == false)
{ {
game->mLayers->stackLayer()->addDamage((MTGCardInstance *)source, _target, sourceamount); AADamager * a = NEW AADamager(game, this->GetId(), source,tosrc == true?(Targetable*)OriginalSrc:(Targetable*)_target,sourceamountstring);
game->mLayers->stackLayer()->resolve(); activateMainAbility(a,source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target);
}
else
{
game->mLayers->stackLayer()->addDamage((MTGCardInstance *)source, OriginalSrc, sourceamount);
game->mLayers->stackLayer()->resolve();
}
if(eachother) if(eachother)
{ {
game->mLayers->stackLayer()->addDamage((MTGCardInstance *)_target, source, targetamount); AADamager * a = NEW AADamager(game, this->GetId(), source,tosrc == true?(Targetable*)OriginalSrc:(Targetable*)_target,targetamountstring);
game->mLayers->stackLayer()->resolve(); activateMainAbility(a,source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target);
} }
return 1; return 1;
break; break;
}
case DYNAMIC_ABILITY_EFFECT_DRAW://draw cards case DYNAMIC_ABILITY_EFFECT_DRAW://draw cards
if(storedAbility) {
activateStored(); AADrawer * a = NEW AADrawer(game, this->GetId(), source,_target,NULL, sourceamountstring);
game->mLayers->stackLayer()->addDraw((Player *)_target,sourceamount); return activateMainAbility(a,source,_target);
game->mLayers->stackLayer()->resolve();
return 1;
break; break;
}
case DYNAMIC_ABILITY_EFFECT_LIFEGAIN://gain life case DYNAMIC_ABILITY_EFFECT_LIFEGAIN://gain life
if(storedAbility) {
activateStored(); AALifer * a = NEW AALifer(game, this->GetId(), source,_target, sourceamountstring);
game->mLayers->stackLayer()->addLife(_target,sourceamount); return activateMainAbility(a,source,_target);
game->mLayers->stackLayer()->resolve();
return 1;
break; break;
}
case DYNAMIC_ABILITY_EFFECT_PUMPPOWER://pump power case DYNAMIC_ABILITY_EFFECT_PUMPPOWER://pump power
{ {
if(storedAbility) PTInstant * a = NEW PTInstant(game, this->GetId(), source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target,NEW WParsedPT(sourceamount,0));
activateStored(); return activateMainAbility(a,source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target);
if(tosrc == false)
{
PTInstant * a = NEW PTInstant(game, this->GetId(), source, (MTGCardInstance*)_target,NEW WParsedPT(sourceamount,0));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,(MTGCardInstance*)_target, a);
wrapper->addToGame();
return 1;
}
else
{
PTInstant * a = NEW PTInstant(game, this->GetId(), source, OriginalSrc,NEW WParsedPT(sourceamount,0));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,OriginalSrc, a);
wrapper->addToGame();
return 1;
}
break; break;
} }
case DYNAMIC_ABILITY_EFFECT_PUMPTOUGHNESS://pump toughness case DYNAMIC_ABILITY_EFFECT_PUMPTOUGHNESS://pump toughness
{ {
if(storedAbility) PTInstant * a = NEW PTInstant(game, this->GetId(), source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target,NEW WParsedPT(0,sourceamount));
activateStored(); return activateMainAbility(a,source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target);
if(tosrc == false)
{
PTInstant * a = NEW PTInstant(game, this->GetId(), source, (MTGCardInstance*)_target,NEW WParsedPT(0,sourceamount));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,(MTGCardInstance*)_target, a);
wrapper->addToGame();
return 1;
}
else
{
PTInstant * a = NEW PTInstant(game, this->GetId(), source, OriginalSrc,NEW WParsedPT(0,sourceamount));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,OriginalSrc, a);
wrapper->addToGame();
return 1;
}
break; break;
} }
case DYNAMIC_ABILITY_EFFECT_PUMPBOTH://pump both case DYNAMIC_ABILITY_EFFECT_PUMPBOTH://pump both
{ {
if(storedAbility) PTInstant * a = NEW PTInstant(game, this->GetId(), source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target,NEW WParsedPT(sourceamount,sourceamount));
activateStored(); return activateMainAbility(a,source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target);
if(tosrc == false)
{
PTInstant * a = NEW PTInstant(game, this->GetId(), source, (MTGCardInstance*)_target,NEW WParsedPT(sourceamount,sourceamount));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,(MTGCardInstance*)_target, a);
wrapper->addToGame();
return 1;
}
else
{
PTInstant * a = NEW PTInstant(game, this->GetId(), source, OriginalSrc,NEW WParsedPT(sourceamount,sourceamount));
GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source,OriginalSrc, a);
wrapper->addToGame();
return 1;
}
break; break;
} }
case DYNAMIC_ABILITY_EFFECT_LIFELOSS://lose life case DYNAMIC_ABILITY_EFFECT_LIFELOSS://lose life
if(storedAbility) {
activateStored(); string altered = "-";
game->mLayers->stackLayer()->addLife(_target,(sourceamount * -1)); altered.append(sourceamountstring);
game->mLayers->stackLayer()->resolve(); AALifer * a = NEW AALifer(game, this->GetId(), source,_target, altered);
return activateMainAbility(a,source,_target);
return 1;
break; break;
}
case DYNAMIC_ABILITY_EFFECT_DEPLETE://deplete cards case DYNAMIC_ABILITY_EFFECT_DEPLETE://deplete cards
{ {
if(storedAbility) AADepleter * a = NEW AADepleter(game, this->GetId(), source,_target, sourceamountstring);
activateStored(); return activateMainAbility(a,source,_target);
Player * player = (Player *)_target;
MTGLibrary * library = player->game->library;
for (int i = 0; i < sourceamount; i++)
{
if (library->nb_cards)
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
}
return 1;
break; break;
} }
case DYNAMIC_ABILITY_EFFECT_COUNTERSONEONE: case DYNAMIC_ABILITY_EFFECT_COUNTERSONEONE:
@@ -2060,6 +2003,21 @@ int AADynamic::resolve()
return 0; return 0;
} }
int AADynamic::activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target)
{
if(storedAbility)
activateStored();
if(!toActivate)
return 0;
if(PTInstant * a = dynamic_cast<PTInstant *>(toActivate))
{
a->addToGame();
return 1;
}
toActivate->oneShot = true;
toActivate->resolve();
return 1;
}
int AADynamic::activateStored() int AADynamic::activateStored()
{ {