Merge remote-tracking branch 'refs/remotes/WagicProject/master'
This commit is contained in:
@@ -81,6 +81,7 @@ class GameObserver{
|
|||||||
int oldGamePhase;
|
int oldGamePhase;
|
||||||
TargetChooser * targetChooser;
|
TargetChooser * targetChooser;
|
||||||
CardDisplay * OpenedDisplay;
|
CardDisplay * OpenedDisplay;
|
||||||
|
GuiGameZone * guiOpenDisplay;
|
||||||
DuelLayers * mLayers;
|
DuelLayers * mLayers;
|
||||||
ReplacementEffects *replacementEffects;
|
ReplacementEffects *replacementEffects;
|
||||||
vector<Player *> players; //created outside
|
vector<Player *> players; //created outside
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input)
|
|||||||
cardWaitingForTargets = NULL;
|
cardWaitingForTargets = NULL;
|
||||||
mExtraPayment = NULL;
|
mExtraPayment = NULL;
|
||||||
OpenedDisplay = NULL;
|
OpenedDisplay = NULL;
|
||||||
|
guiOpenDisplay = NULL;
|
||||||
gameOver = NULL;
|
gameOver = NULL;
|
||||||
phaseRing = NULL;
|
phaseRing = NULL;
|
||||||
replacementEffects = NEW ReplacementEffects();
|
replacementEffects = NEW ReplacementEffects();
|
||||||
|
|||||||
@@ -151,11 +151,13 @@ void GuiGameZone::toggleDisplay()
|
|||||||
{
|
{
|
||||||
if (showCards)
|
if (showCards)
|
||||||
{
|
{
|
||||||
|
cd->zone->owner->getObserver()->guiOpenDisplay = NULL;
|
||||||
showCards = 0;
|
showCards = 0;
|
||||||
cd->zone->owner->getObserver()->OpenedDisplay = NULL;
|
cd->zone->owner->getObserver()->OpenedDisplay = NULL;
|
||||||
}
|
}
|
||||||
else if(!cd->zone->owner->getObserver()->OpenedDisplay)//one display at a time please.
|
else if(!cd->zone->owner->getObserver()->OpenedDisplay)//one display at a time please.
|
||||||
{
|
{
|
||||||
|
cd->zone->owner->getObserver()->guiOpenDisplay = this;
|
||||||
showCards = 1;
|
showCards = 1;
|
||||||
cd->init(zone);
|
cd->init(zone);
|
||||||
cd->zone->owner->getObserver()->OpenedDisplay = cd;
|
cd->zone->owner->getObserver()->OpenedDisplay = cd;
|
||||||
|
|||||||
@@ -363,6 +363,16 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
|||||||
if (!card->isToken)
|
if (!card->isToken)
|
||||||
to = g->players[i]->game->exile;
|
to = g->players[i]->game->exile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (from == g->players[i]->game->library || from == g->players[i]->game->graveyard || from == g->players[i]->game->exile)
|
||||||
|
{
|
||||||
|
if (g->guiOpenDisplay)
|
||||||
|
{
|
||||||
|
g->ButtonPressed(g->guiOpenDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//all cards that go from the hand to the graveyard is ALWAYS a discard.
|
//all cards that go from the hand to the graveyard is ALWAYS a discard.
|
||||||
if ((to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard) && (from == g->players[0]->game->hand || from
|
if ((to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard) && (from == g->players[0]->game->hand || from
|
||||||
@@ -370,6 +380,7 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
|||||||
{
|
{
|
||||||
card->discarded = true;
|
card->discarded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//When a card is moved from inPlay to inPlay (controller change, for example), it is still the same object
|
//When a card is moved from inPlay to inPlay (controller change, for example), it is still the same object
|
||||||
if ((to == g->players[0]->game->inPlay || to == g->players[1]->game->inPlay) && (from == g->players[0]->game->inPlay || from
|
if ((to == g->players[0]->game->inPlay || to == g->players[1]->game->inPlay) && (from == g->players[0]->game->inPlay || from
|
||||||
== g->players[1]->game->inPlay))
|
== g->players[1]->game->inPlay))
|
||||||
|
|||||||
@@ -2774,11 +2774,9 @@ WEvent * MTGDredgeRule::replace(WEvent * event)
|
|||||||
Player * p = game->players[i];
|
Player * p = game->players[i];
|
||||||
if (e->player == p)
|
if (e->player == p)
|
||||||
{
|
{
|
||||||
|
int Dredgers = 0;
|
||||||
for(int draw = 0;draw < e->nb_cards;draw++)
|
for(int draw = 0;draw < e->nb_cards;draw++)
|
||||||
{
|
{
|
||||||
tcb = tf.createTargetChooser("dredgeable",card);
|
|
||||||
tcb->targetter = NULL;
|
|
||||||
|
|
||||||
vector<MTGAbility*>selection;
|
vector<MTGAbility*>selection;
|
||||||
//look for other draw replacement effects
|
//look for other draw replacement effects
|
||||||
list<ReplacementEffect *>::iterator it;
|
list<ReplacementEffect *>::iterator it;
|
||||||
@@ -2802,27 +2800,36 @@ WEvent * MTGDredgeRule::replace(WEvent * event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//there is a memleak here that i have no idea what causes it.
|
//there is a memleak here that i have no idea what causes it. got it reduced to just 4 bytes but its still bothering me.
|
||||||
dredgeAbility = NEW dredgeCard(game, game->mLayers->actionLayer()->getMaxId(), card,NULL);
|
if (Dredgers < e->nb_cards)
|
||||||
dredgeAbility->oneShot = true;
|
{
|
||||||
targetAbility = NEW GenericTargetAbility(game, "Dredge A Card","",game->mLayers->actionLayer()->getMaxId(), card,tcb->clone(),dredgeAbility->clone());
|
tcb = tf.createTargetChooser("dredgeable", card);
|
||||||
targetAbility->oneShot = true;
|
tcb->targetter = NULL;
|
||||||
SAFE_DELETE(dredgeAbility);
|
|
||||||
|
|
||||||
targetAbilityAdder = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), card,NULL,targetAbility->clone());
|
dredgeAbility = NEW dredgeCard(game, game->mLayers->actionLayer()->getMaxId(), card, NULL);
|
||||||
targetAbilityAdder->oneShot = true;
|
dredgeAbility->oneShot = true;
|
||||||
SAFE_DELETE(targetAbility);
|
dredgeAbility->canBeInterrupted = false;
|
||||||
MTGAbility * setDredge = targetAbilityAdder->clone();
|
targetAbility = NEW GenericTargetAbility(game, "Dredge A Card", "", game->mLayers->actionLayer()->getMaxId(), card, tcb->clone(), dredgeAbility->clone());
|
||||||
SAFE_DELETE(targetAbilityAdder);
|
SAFE_DELETE(tcb);
|
||||||
setDredge->oneShot = true;
|
SAFE_DELETE(dredgeAbility);
|
||||||
|
targetAbility->oneShot = true;
|
||||||
|
targetAbility->canBeInterrupted = false;
|
||||||
|
targetAbilityAdder = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), card, NULL, targetAbility->clone());
|
||||||
|
targetAbilityAdder->oneShot = true;
|
||||||
|
SAFE_DELETE(targetAbility);
|
||||||
|
MTGAbility * setDredge = targetAbilityAdder->clone();
|
||||||
|
SAFE_DELETE(targetAbilityAdder);
|
||||||
|
setDredge->oneShot = true;
|
||||||
|
|
||||||
selection.push_back(setDredge);
|
selection.push_back(setDredge);
|
||||||
targetAbility1 = NEW AADrawer(game, this->GetId(), card,card,NULL, "1",TargetChooser::CONTROLLER,true);
|
targetAbility1 = NEW AADrawer(game, this->GetId(), card, card, NULL, "1", TargetChooser::CONTROLLER, true);
|
||||||
selection.push_back(targetAbility1);
|
targetAbility1->canBeInterrupted = false;
|
||||||
MTGAbility * menuChoice = NEW MenuAbility(game, this->GetId(), card, card,true,selection,card->controller(),"Dredge or Draw");
|
selection.push_back(targetAbility1);
|
||||||
|
MTGAbility * menuChoice = NEW MenuAbility(game, this->GetId(), card, card, true, selection, card->controller(), "Dredge or Draw");
|
||||||
|
|
||||||
menuChoice->addToGame();
|
menuChoice->addToGame();
|
||||||
SAFE_DELETE(tcb);
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SAFE_DELETE(event);
|
SAFE_DELETE(event);
|
||||||
|
|||||||
Reference in New Issue
Block a user