Merge remote-tracking branch 'refs/remotes/WagicProject/master'

This commit is contained in:
Anthony Calosa
2016-07-31 07:32:08 +08:00
+27 -36
View File
@@ -416,12 +416,10 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
{ {
if (this->source->controller() != game->isInterrupting) if (this->source->controller() != game->isInterrupting)
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false); game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
//if (game->currentActionPlayer->isAI() && key != JGE_BTN_OK) if (key == 0)
//{ key = JGE_BTN_NEXT;
// key = JGE_BTN_NEXT; if (key != JGE_BTN_OK && key != JGE_BTN_NEXT)
// game->Update(0); key = JGE_BTN_OK;
//}
} }
if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)//android back button if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)//android back button
{ {
@@ -434,16 +432,14 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
if (!abilitySecond && !tc->getNbTargets() && tc->source) if (!abilitySecond && !tc->getNbTargets() && tc->source)
{//we selected nothing for the first ability. {//we selected nothing for the first ability.
tc->source->getObserver()->cardClick(tc->source, 0, false); tc->source->getObserver()->cardClick(tc->source, 0, false);
if (abilityFirst)///some abilities resolve themselves and remove faster than you can removethem from the game. //remove the first ability to avoid a menu react.
{ source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
abilityFirst->removeFromGame(); game->removeObserver(abilityFirst);
game->mLayers->stackLayer()->Remove(abilityFirst);
abilityFirst = NULL; if (!this->source->controller()->isAI())
}
game->Update(0); game->Update(0);
//remove it from the game, update, and remove it from stack if needed.
//before adding next ability, otherwise we end up with a menu reactToClick. if (zone->cards.size())//generally only want to add ability 2 if anything is left in the zone.
if (zone->cards.size() && abilityFirst->testDestroy())//generally only want to add ability 2 if anything is left in the zone.
{ {
repeat = false; repeat = false;
abilitySecond = contructAbility(abilityTwo); abilitySecond = contructAbility(abilityTwo);
@@ -466,11 +462,9 @@ bool MTGRevealingCards::CheckUserInput(JButton key)
//if statement that becomes very very hard to follow. //if statement that becomes very very hard to follow.
if (!tc && !abilitySecond) if (!tc && !abilitySecond)
{ {
if (abilityFirst) source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
{ game->removeObserver(abilityFirst);
abilityFirst->removeFromGame(); if (!this->source->controller()->isAI())
game->mLayers->stackLayer()->Remove(abilityFirst);
}
game->Update(1); game->Update(1);
if (zone->cards.size()) if (zone->cards.size())
@@ -730,11 +724,10 @@ bool MTGScryCards::CheckUserInput(JButton key)
//in the future we will need a way to find out if the human is pressing the keys and which player. //in the future we will need a way to find out if the human is pressing the keys and which player.
if (this->source->controller() != game->isInterrupting) if (this->source->controller() != game->isInterrupting)
game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false); game->mLayers->stackLayer()->cancelInterruptOffer(ActionStack::DONT_INTERRUPT, false);
//if (game->currentActionPlayer->isAI() && key != JGE_BTN_OK) if (key == 0)
//{ key = JGE_BTN_NEXT;
// key = JGE_BTN_NEXT; if (key != JGE_BTN_OK && key != JGE_BTN_NEXT)
// game->Update(0); key = JGE_BTN_OK;
//}
} }
if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key) if (JGE_BTN_SEC == key || JGE_BTN_PREV == key || JGE_BTN_NEXT == key || JGE_BTN_MENU == key)
{ {
@@ -745,13 +738,12 @@ bool MTGScryCards::CheckUserInput(JButton key)
if (!abilitySecond && !tc->getNbTargets() && tc->source) if (!abilitySecond && !tc->getNbTargets() && tc->source)
{ {
tc->source->getObserver()->cardClick(tc->source, 0, false); tc->source->getObserver()->cardClick(tc->source, 0, false);
if (abilityFirst)///some abilities resolve themselves and remove faster than you can removethem from the game. //remove the first ability to avoid a menu react.
{ source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
abilityFirst->removeFromGame(); game->removeObserver(abilityFirst);
game->mLayers->stackLayer()->Remove(abilityFirst); if (!this->source->controller()->isAI())
}
game->Update(0); game->Update(0);
if (zone->cards.size() && abilityFirst->testDestroy()) if (zone->cards.size())
{ {
initDisplay(revealTopAmount); initDisplay(revealTopAmount);
abilitySecond = contructAbility(abilityTwo); abilitySecond = contructAbility(abilityTwo);
@@ -773,11 +765,10 @@ bool MTGScryCards::CheckUserInput(JButton key)
{ {
if (!tc && !abilitySecond) if (!tc && !abilitySecond)
{ {
if (abilityFirst) //remove the first ability to avoid a menu react.
{ source->getObserver()->mLayers->stackLayer()->Remove(abilityFirst);
abilityFirst->removeFromGame(); game->removeObserver(abilityFirst);
game->mLayers->stackLayer()->Remove(abilityFirst); if (!this->source->controller()->isAI())
}
game->Update(1); game->Update(1);
if (zone->cards.size() || (revealDisplay && !zone->cards.size())) if (zone->cards.size() || (revealDisplay && !zone->cards.size()))