- Fix an android warning (false instead of null in GuiCombat)
- removed unnecessary "if" in some parts of MTGRules.cpp
This commit is contained in:
@@ -41,7 +41,7 @@ struct Right: public Exp
|
|||||||
JTexture* GuiCombat::ok_tex = NULL;
|
JTexture* GuiCombat::ok_tex = NULL;
|
||||||
|
|
||||||
GuiCombat::GuiCombat(GameObserver* go) :
|
GuiCombat::GuiCombat(GameObserver* go) :
|
||||||
GuiLayer(go), active(0), activeAtk(NULL), ok(SCREEN_WIDTH - MARGIN, 210, 1, 0, 255), enemy_avatar(SCREEN_WIDTH
|
GuiLayer(go), active(NULL), activeAtk(NULL), ok(SCREEN_WIDTH - MARGIN, 210, 1, 0, 255), enemy_avatar(SCREEN_WIDTH
|
||||||
- MARGIN, TOP_LINE, 2, 0, 255), cursor_pos(NONE), step(DAMAGE)
|
- MARGIN, TOP_LINE, 2, 0, 255), cursor_pos(NONE), step(DAMAGE)
|
||||||
{
|
{
|
||||||
if (NULL == ok_tex && go->getResourceManager())
|
if (NULL == ok_tex && go->getResourceManager())
|
||||||
|
|||||||
@@ -62,15 +62,14 @@ int MTGEventBonus::receiveEvent(WEvent * event)
|
|||||||
return 0;
|
return 0;
|
||||||
if (WEventCardTappedForMana* e = dynamic_cast<WEventCardTappedForMana*>(event))
|
if (WEventCardTappedForMana* e = dynamic_cast<WEventCardTappedForMana*>(event))
|
||||||
{
|
{
|
||||||
if(e)
|
|
||||||
|
if(chain[currentPlayer->getId()]/5 > 0)
|
||||||
{
|
{
|
||||||
if(chain[currentPlayer->getId()]/5 > 0)
|
text = "Chain Broken!";
|
||||||
{
|
textAlpha = 255;
|
||||||
text = "Chain Broken!";
|
|
||||||
textAlpha = 255;
|
|
||||||
}
|
|
||||||
chain[currentPlayer->getId()] = 0;
|
|
||||||
}
|
}
|
||||||
|
chain[currentPlayer->getId()] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (event->type == WEvent::CHANGE_ZONE && !currentPlayer->isAI())
|
if (event->type == WEvent::CHANGE_ZONE && !currentPlayer->isAI())
|
||||||
{
|
{
|
||||||
@@ -481,11 +480,11 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
|||||||
return 0;
|
return 0;
|
||||||
Player * player = game->currentlyActing();
|
Player * player = game->currentlyActing();
|
||||||
if(!player->game->hand->hasCard(card))
|
if(!player->game->hand->hasCard(card))
|
||||||
return 0;
|
return 0;
|
||||||
ManaCost * kicker = card->getManaCost()->kicker;
|
ManaCost * kicker = card->getManaCost()->kicker;
|
||||||
if(!kicker)
|
if(!kicker)
|
||||||
{
|
{
|
||||||
SAFE_DELETE(kicker);
|
SAFE_DELETE(kicker);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ManaCost * playerMana = player->getManaPool();
|
ManaCost * playerMana = player->getManaPool();
|
||||||
@@ -1503,25 +1502,24 @@ int MTGBlockRule::receiveEvent(WEvent *e)
|
|||||||
{
|
{
|
||||||
if (WEventBlockersChosen * event = dynamic_cast<WEventBlockersChosen*>(e))
|
if (WEventBlockersChosen * event = dynamic_cast<WEventBlockersChosen*>(e))
|
||||||
{
|
{
|
||||||
if (event)
|
|
||||||
|
Player * p = game->currentPlayer;
|
||||||
|
MTGCardInstance * lurer = p->game->inPlay->findALurer();
|
||||||
|
if(lurer)
|
||||||
{
|
{
|
||||||
Player * p = game->currentPlayer;
|
MTGGameZone * z = p->opponent()->game->inPlay;
|
||||||
MTGCardInstance * lurer = p->game->inPlay->findALurer();
|
for (int i = 0; i < z->nb_cards; i++)
|
||||||
if(lurer)
|
|
||||||
{
|
{
|
||||||
MTGGameZone * z = p->opponent()->game->inPlay;
|
MTGCardInstance * card = z->cards[i];
|
||||||
for (int i = 0; i < z->nb_cards; i++)
|
if ((card->defenser && !card->defenser->has(Constants::LURE))||!card->defenser)
|
||||||
{
|
if(card->canBlock(lurer))
|
||||||
MTGCardInstance * card = z->cards[i];
|
card->setDefenser(lurer);
|
||||||
if ((card->defenser && !card->defenser->has(Constants::LURE))||!card->defenser)
|
//force a block on a lurer, the player has a chance to set his own choice on multiple lures
|
||||||
if(card->canBlock(lurer))
|
//but this action can not be ignored.
|
||||||
card->setDefenser(lurer);
|
|
||||||
//force a block on a lurer, the player has a chance to set his own choice on multiple lures
|
|
||||||
//but this action can not be ignored.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user