- reworked the testsuite and the rules (storyflow) to use the same game deserialization code, moved that code to the players and zone classes
- removed every references to the gameobserver singleton. This object can now be instantiated several times as it's needed for minmax. To be able to do that, I mostly added a reference to a gameobserver from any targetable object (cards, players, spells) and abilities.
This commit is contained in:
@@ -215,7 +215,7 @@ int DiscardCost::doPay()
|
||||
if (target)
|
||||
{
|
||||
WEvent * e = NEW WEventCardDiscard(target);
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
GameObserver * game = target->owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
_target->controller()->game->putInGraveyard(_target);
|
||||
target = NULL;
|
||||
@@ -503,10 +503,9 @@ ExtraCost("Select unblocked attacker", _tc)
|
||||
|
||||
int Ninja::isPaymentSet()
|
||||
{
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
int currentPhase = g->getCurrentGamePhase();
|
||||
if (target && ((target->isAttacker() && target->blocked) || target->isAttacker() < 1 || currentPhase
|
||||
!= Constants::MTG_PHASE_COMBATBLOCKERS))
|
||||
if (target && ((target->isAttacker() && target->blocked) ||
|
||||
target->isAttacker() < 1 ||
|
||||
target->getObserver()->getCurrentGamePhase() != Constants::MTG_PHASE_COMBATBLOCKERS))
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
@@ -551,7 +550,7 @@ int SacrificeCost::doPay()
|
||||
if (target)
|
||||
{
|
||||
WEvent * e = NEW WEventCardSacrifice(target);
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
GameObserver * game = target->owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
target->controller()->game->putInGraveyard(target);
|
||||
target = NULL;
|
||||
|
||||
Reference in New Issue
Block a user