exile zone

enabled exile zones for both players
This commit is contained in:
Anthony Calosa
2015-10-26 19:14:50 +08:00
parent 8eeaa40cec
commit cdf94b281f
10 changed files with 125 additions and 81 deletions
+6 -6
View File
@@ -650,8 +650,8 @@ MTGCardInstance * AIPlayerBaka::chooseCard(TargetChooser * tc, MTGCardInstance *
}
for(int players = 0; players < 2;++players)
{
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack };
for (int j = 0; j < 5; j++)
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 6; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -1214,7 +1214,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
for (int i = 0; i < 2; i++)
{
Player * p = observer->players[i];
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay,p->game->stack };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay,p->game->stack,p->game->exile };
if(a->getActionTc()->canTarget((Targetable*)p))
{
if(a->getActionTc()->maxtargets == 1)
@@ -1225,7 +1225,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
else
potentialTargets.push_back(p);
}
for (int j = 0; j < 5; j++)
for (int j = 0; j < 6; j++)
{
MTGGameZone * zone = playerZones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -1553,8 +1553,8 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
}
}
MTGPlayerCards * playerZones = target->game;
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack };
for (int j = 0; j < 5; j++)
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 6; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
+19 -5
View File
@@ -5092,8 +5092,8 @@ AUpkeep::~AUpkeep()
}
//A Phase based Action
APhaseAction::APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance *, string sAbility, int, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once) :
MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once)
APhaseAction::APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance *, string sAbility, int, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once, bool checkexile) :
MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once),checkexile(checkexile)
{
abilityId = _id;
abilityOwner = card->controller();
@@ -5110,6 +5110,14 @@ MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(f
void APhaseAction::Update(float dt)
{
if(checkexile)
{
if(((MTGCardInstance *)target)->next->getCurrentZone() != ((MTGCardInstance *)target)->owner->game->exile)
{
this->forceDestroy = 1;
return;
}
}
if (newPhase != currentPhase)
{
if((myturn && game->currentPlayer == source->controller())||
@@ -5186,11 +5194,11 @@ APhaseAction::~APhaseAction()
}
// the main ability
APhaseActionGeneric::APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once) :
APhaseActionGeneric::APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once, bool checkexile) :
InstantAbility(observer, _id, card, target)
{
MTGCardInstance * _target = target;
ability = NEW APhaseAction(game, _id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn,once);
ability = NEW APhaseAction(game, _id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn,once,checkexile);
}
int APhaseActionGeneric::resolve()
@@ -5236,7 +5244,7 @@ void ABlink::Update(float dt)
resolveBlink();
}
if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game)))
if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game)) && Blinked->blinked)
{
if (Blinked == NULL)
MTGAbility::Update(dt);
@@ -5272,6 +5280,7 @@ void ABlink::resolveBlink()
return;
}
_target = _target->next;
_target->blinked = true;
Blinked = _target;
if(!blinkueot && !blinkForSource)
{
@@ -5282,6 +5291,11 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL;
if(!_target->blinked)
{
this->forceDestroy = 1;
return;
}
if (!blinkhand)
Blinker = _target->controller()->game->putInZone(
_target,
+6 -5
View File
@@ -518,12 +518,13 @@ bool GameObserver::operator==(const GameObserver& aGame)
{
error++;
}
MTGGameZone * aZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * aZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile };
MTGGameZone * thisZones[] = { players[i]->game->graveyard,
players[i]->game->library,
players[i]->game->hand,
players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
players[i]->game->inPlay,
players[i]->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = aZones[j];
if (zone->nb_cards != thisZones[j]->nb_cards)
@@ -595,8 +596,8 @@ void GameObserver::gameStateBasedEffects()
/////////////////////////////////////
for (int d = 0; d < 2; d++)
{
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
+21 -11
View File
@@ -14,16 +14,21 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
self->zoom = 0.9f;
Add(selfGraveyard = NEW GuiGraveyard(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 1, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 5 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 + 20, SCREEN_HEIGHT - GuiAvatar::Height, false, mpDuelLayers->getRenderedPlayer(), this));
//myexile
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 + 10, SCREEN_HEIGHT - GuiAvatar::Height, false, mpDuelLayers->getRenderedPlayer(), this));
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f;
//opponenthandveiw button
Add(opponentHand = NEW GuiOpponentHand(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
//opponentExile
Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponenthandveiwends
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
//opponentHand
Add(opponentHand = NEW GuiOpponentHand(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentGraveyard
Add(opponentGraveyard = NEW GuiGraveyard(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentLibrary
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
@@ -33,9 +38,10 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
observer->getCardSelector()->Add(selfLibrary);
observer->getCardSelector()->Add(opponent);
observer->getCardSelector()->Add(opponentGraveyard);
observer->getCardSelector()->Add(opponentExile);
observer->getCardSelector()->Add(opponentLibrary);
observer->getCardSelector()->Add(opponentHand);
selfGraveyard->alpha = selfExile->alpha = selfLibrary->alpha = opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
selfGraveyard->alpha = selfExile->alpha = opponentExile->alpha = selfLibrary->alpha = opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
}
float GuiAvatars::LeftBoundarySelf()
@@ -52,9 +58,9 @@ void GuiAvatars::Activate(PlayGuiObject* c)
c->zoom = 1.2f;
c->mHasFocus = true;
if ((opponentGraveyard == c) || (opponentLibrary == c) || (opponent == c) || (opponentHand == c))
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentLibrary == c) || (opponent == c) || (opponentHand == c))
{
opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 128.0f;
opponentGraveyard->alpha = opponentExile->alpha = opponentLibrary->alpha = opponentHand->alpha = 128.0f;
active = opponent;
opponent->zoom = 1.2f;
}
@@ -71,9 +77,9 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
{
c->zoom = 1.0;
c->mHasFocus = false;
if ((opponentGraveyard == c) || (opponentLibrary == c) || (opponentHand == c) || (opponent == c))
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentLibrary == c) || (opponentHand == c) || (opponent == c))
{
opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
opponentGraveyard->alpha = opponentExile->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
opponent->zoom = 0.9f;
active = NULL;
}
@@ -87,7 +93,7 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
int GuiAvatars::receiveEventPlus(WEvent* e)
{
return selfGraveyard->receiveEventPlus(e) | selfExile->receiveEventPlus(e) | opponentGraveyard->receiveEventPlus(e) | opponentHand->receiveEventPlus(e);
return selfGraveyard->receiveEventPlus(e) | selfExile->receiveEventPlus(e) | opponentExile->receiveEventPlus(e) | opponentGraveyard->receiveEventPlus(e) | opponentHand->receiveEventPlus(e);
}
int GuiAvatars::receiveEventMinus(WEvent* e)
@@ -95,6 +101,7 @@ int GuiAvatars::receiveEventMinus(WEvent* e)
selfGraveyard->receiveEventMinus(e);
selfExile->receiveEventMinus(e);
opponentGraveyard->receiveEventMinus(e);
opponentExile->receiveEventMinus(e);
opponentHand->receiveEventMinus(e);
return 1;
}
@@ -111,6 +118,8 @@ bool GuiAvatars::CheckUserInput(JButton key)
return true;
if (opponentGraveyard->CheckUserInput(key))
return true;
if (opponentExile->CheckUserInput(key))
return true;
if (opponentHand->CheckUserInput(key))
return true;
if (selfLibrary->CheckUserInput(key))
@@ -128,6 +137,7 @@ void GuiAvatars::Update(float dt)
selfExile->Update(dt);
opponentHand->Update(dt);
opponentGraveyard->Update(dt);
opponentExile->Update(dt);
selfLibrary->Update(dt);
opponentLibrary->Update(dt);
}
+14 -2
View File
@@ -164,7 +164,10 @@ void GuiGameZone::Render()
JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID);
float scale = defaultHeight / quad->mHeight;
quad->SetColor(ARGB((int)(actA),255,255,255));
if(type == GUI_EXILE)
{
quad->SetColor(ARGB((int)(actA),150,150,150));
}
JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ);
float x0 = actX;
@@ -182,7 +185,16 @@ void GuiGameZone::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[11];
int mAlpha = (int) (actA);
sprintf(buffer, "%i", zone->nb_cards);
/*if(type == GUI_GRAVEYARD)
sprintf(buffer, "%i\ng", zone->nb_cards);
else if(type == GUI_LIBRARY)
sprintf(buffer, "%i\nl", zone->nb_cards);
else if(type == GUI_OPPONENTHAND)
sprintf(buffer, "%i\nh", zone->nb_cards);
else if(type == GUI_EXILE)
sprintf(buffer, "%i\ne", zone->nb_cards);
else*/
sprintf(buffer, "%i", zone->nb_cards);
mFont->SetColor(ARGB(mAlpha,0,0,0));
mFont->DrawString(buffer, x0 + 1, actY + 1);
if (actA > 120)
+8 -7
View File
@@ -558,8 +558,8 @@ int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option)
{
if (player && player != observer->players[i])
continue;
MTGGameZone * zones[] = { observer->players[i]->game->inPlay, observer->players[i]->game->graveyard, observer->players[i]->game->hand };
for (int k = 0; k < 3; k++)
MTGGameZone * zones[] = { observer->players[i]->game->inPlay, observer->players[i]->game->graveyard, observer->players[i]->game->hand, observer->players[i]->game->exile };
for (int k = 0; k < 4; k++)
{
for (int j = zones[k]->nb_cards - 1; j >= 0; j--)
{
@@ -3412,6 +3412,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
bool opponentturn = (s1.find("my") == string::npos);
bool myturn = (s1.find("opponent") == string::npos);
bool sourceinPlay = (s1.find("sourceinplay") != string::npos);
bool checkexile = (s1.find("checkex") != string::npos);
bool next = (s1.find("next") == string::npos); //Why is this one the opposite of the two others? That's completely inconsistent
bool once = (s1.find("once") != string::npos);
@@ -3420,7 +3421,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
_target = spell->getNextCardTarget();
if(!_target)
_target = target;
return NEW APhaseActionGeneric(observer, id, card,_target, trim(splitActions[2]), restrictions, phase,sourceinPlay,next,myturn,opponentturn,once);
return NEW APhaseActionGeneric(observer, id, card,_target, trim(splitActions[2]), restrictions, phase,sourceinPlay,next,myturn,opponentturn,once,checkexile);
}
MTGAbility * AbilityFactory::parseChooseActionAbility(string s,MTGCardInstance * card,Spell *,MTGCardInstance * target, int, int id)
@@ -5257,8 +5258,8 @@ void ListMaintainerAbility::updateTargets()
for (int i = 0; i < 2; i++)
{
Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack };
for (int k = 0; k < 5; k++)
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
for (int k = 0; k < 6; k++)
{
MTGGameZone * zone = zones[k];
if (canTarget(zone))
@@ -5329,8 +5330,8 @@ void ListMaintainerAbility::checkTargets()
for (int i = 0; i < 2; i++)
{
Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack };
for (int k = 0; k < 5; k++)
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
for (int k = 0; k < 6; k++)
{
MTGGameZone * zone = zones[k];
if (canTarget(zone))
+9 -7
View File
@@ -79,8 +79,8 @@ MTGCardInstance * Rules::getCardByMTGId(GameObserver* g, int mtgid)
for (int i = 0; i < 2; i++)
{
Player * p = g->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard };
for (int j = 0; j < 4; j++)
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -340,9 +340,10 @@ MTGDeck * Rules::buildDeck(int playerId)
MTGGameZone * loadedPlayerZones[] = { initState.playerData[playerId].player->game->graveyard,
initState.playerData[playerId].player->game->library,
initState.playerData[playerId].player->game->hand,
initState.playerData[playerId].player->game->inPlay };
initState.playerData[playerId].player->game->inPlay,
initState.playerData[playerId].player->game->exile };
for (int j = 0; j < 4; j++)
for (int j = 0; j < 5; j++)
{
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{
@@ -412,12 +413,13 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
{
p->mAvatarName = initState.playerData[i].player->mAvatarName;
}
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile };
MTGGameZone * loadedPlayerZones[] = { initState.playerData[i].player->game->graveyard,
initState.playerData[i].player->game->library,
initState.playerData[i].player->game->hand,
initState.playerData[i].player->game->inPlay };
for (int j = 0; j < 4; j++)
initState.playerData[i].player->game->inPlay,
initState.playerData[i].player->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
+12 -9
View File
@@ -46,8 +46,8 @@ MTGCardInstance * TestSuiteAI::getCard(string action)
for (int i = 0; i < 2; i++)
{
Player * p = observer->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard };
for (int j = 0; j < 4; j++)
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -394,12 +394,13 @@ void TestSuiteGame::assertGame()
error++;
}
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile };
MTGGameZone * endstateZones[] = { endState.players[i]->game->graveyard,
endState.players[i]->game->library,
endState.players[i]->game->hand,
endState.players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
endState.players[i]->game->inPlay,
endState.players[i]->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = playerZones[j];
if (zone->nb_cards != endstateZones[j]->nb_cards)
@@ -853,12 +854,13 @@ void TestSuiteGame::initGame()
stringstream stream;
stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
p->getRandomGenerator()->loadRandValues(stream.str());
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile };
MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,
initState.players[i]->game->library,
initState.players[i]->game->hand,
initState.players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
initState.players[i]->game->inPlay,
initState.players[i]->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
@@ -910,9 +912,10 @@ MTGPlayerCards * TestSuiteGame::buildDeck(Player* player, int playerId)
MTGGameZone * loadedPlayerZones[] = { initState.players[playerId]->game->graveyard,
initState.players[playerId]->game->library,
initState.players[playerId]->game->hand,
initState.players[playerId]->game->exile,
initState.players[playerId]->game->inPlay };
for (int j = 0; j < 4; j++)
for (int j = 0; j < 5; j++)
{
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{