- moved all "loseLife/gainLife" duplicated code into 1 Player method
This commit is contained in:
wagic.the.homebrew@gmail.com
2011-01-23 06:59:00 +00:00
parent 14f2e9b0f2
commit f63aa379e7
9 changed files with 88 additions and 92 deletions
+3 -18
View File
@@ -3269,12 +3269,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
game->mLayers->stackLayer()->addDamage(card, target, x);
if (target->life < x)
x = target->life;
game->currentlyActing()->life += x;
game->currentlyActing()->thatmuch = x;
WEvent * lifed = NULL;
lifed = NEW WEventLife(game->currentlyActing(),x);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(lifed);
game->currentlyActing()->gainLife(x);
break;
}
case 1159: //Erg Raiders
@@ -3485,12 +3480,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (current->hasType("Artifact"))
{
game->players[i]->game->putInGraveyard(current);
current->controller()->life += current->getManaCost()->getConvertedCost();
current->controller()->thatmuch = current->getManaCost()->getConvertedCost();
WEvent * lifed = NULL;
lifed = NEW WEventLife(current->controller(),current->getManaCost()->getConvertedCost());
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(lifed);
current->controller()->gainLife(current->getManaCost()->getConvertedCost());
}
}
}
@@ -3603,12 +3593,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell)
if (library->nb_cards)
player->game->putInZone(library->cards[library->nb_cards - 1], library, player->game->graveyard);
}
game->currentlyActing()->life += x;
game->currentlyActing()->thatmuch = x;
WEvent * lifed = NULL;
lifed = NEW WEventLife(game->currentlyActing(),x);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(lifed);
game->currentlyActing()->gainLife(x);
break;
}