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
+1 -1
View File
@@ -68670,7 +68670,7 @@ type=Sorcery
[card] [card]
name=Obzedat, Ghost Council name=Obzedat, Ghost Council
auto=ability$!choice life:-2 target(opponent) && life:2 controller!$ controller auto=ability$!choice life:-2 target(opponent) && life:2 controller!$ controller
auto=@each my end:may name(exile) all(this) transforms((,newability[moveto(exile)],newability[phaseactionmulti[my upkeep once] moveto(ownerbattlefield) && all(this) haste])) auto=@each my end:may name(exile) all(this) transforms((,newability[moveto(exile)],newability[phaseactionmulti[my upkeep once checkex] moveto(ownerbattlefield) && all(this) haste]))
text=When Obzedat, Ghost Council enters the battlefield, target opponent loses 2 life and you gain 2 life. -- At the beginning of your end step, you may exile Obzedat. If you do, return it to the battlefield under its owner's control at the beginning of your next upkeep. It gains haste. text=When Obzedat, Ghost Council enters the battlefield, target opponent loses 2 life and you gain 2 life. -- At the beginning of your end step, you may exile Obzedat. If you do, return it to the battlefield under its owner's control at the beginning of your next upkeep. It gains haste.
mana={1}{W}{W}{B}{B} mana={1}{W}{W}{B}{B}
type=Legendary Creature type=Legendary Creature
+29 -28
View File
@@ -207,8 +207,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -227,8 +227,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -247,8 +247,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -267,8 +267,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -287,8 +287,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -307,8 +307,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -327,8 +327,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -347,8 +347,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -367,8 +367,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -387,8 +387,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -424,8 +424,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = card->getObserver()->players[i]; Player * p = card->getObserver()->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library }; MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if (tc->targetsZone(zone, card)) if (tc->targetsZone(zone, card))
@@ -516,8 +516,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = card->getObserver()->players[i]; Player * p = card->getObserver()->players[i];
MTGGameZone * zones[] = { p->game->battlefield, p->game->graveyard, p->game->hand, p->game->library }; MTGGameZone * zones[] = { p->game->battlefield, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if(tc->targetsZone(zone,target)) if(tc->targetsZone(zone,target))
@@ -2916,8 +2916,8 @@ public:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = game->players[i]; Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library }; MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
Value = zone->countByCanTarget(tc); Value = zone->countByCanTarget(tc);
@@ -4913,10 +4913,11 @@ public:
bool myturn; bool myturn;
bool opponentturn; bool opponentturn;
bool once; bool once;
bool checkexile;
Player * abilityOwner; Player * abilityOwner;
APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase = APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false); MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false, bool checkexile = false);
void Update(float dt); void Update(float dt);
int resolve(); int resolve();
const string getMenuText(); const string getMenuText();
@@ -4931,7 +4932,7 @@ public:
string sAbility; string sAbility;
APhaseAction * ability; APhaseAction * ability;
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase = APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false); MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false,bool checkexile = false);
int resolve(); int resolve();
const string getMenuText(); const string getMenuText();
APhaseActionGeneric * clone() const; APhaseActionGeneric * clone() const;
+6 -6
View File
@@ -650,8 +650,8 @@ MTGCardInstance * AIPlayerBaka::chooseCard(TargetChooser * tc, MTGCardInstance *
} }
for(int players = 0; players < 2;++players) for(int players = 0; players < 2;++players)
{ {
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack }; MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 5; j++) for (int j = 0; j < 6; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = observer->players[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()->canTarget((Targetable*)p))
{ {
if(a->getActionTc()->maxtargets == 1) if(a->getActionTc()->maxtargets == 1)
@@ -1225,7 +1225,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
else else
potentialTargets.push_back(p); potentialTargets.push_back(p);
} }
for (int j = 0; j < 5; j++) for (int j = 0; j < 6; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (int k = 0; k < zone->nb_cards; k++) 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; MTGPlayerCards * playerZones = target->game;
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack }; MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 5; j++) for (int j = 0; j < 6; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) for (int k = 0; k < zone->nb_cards; k++)
+19 -5
View File
@@ -5092,8 +5092,8 @@ AUpkeep::~AUpkeep()
} }
//A Phase based Action //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) : 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) MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once),checkexile(checkexile)
{ {
abilityId = _id; abilityId = _id;
abilityOwner = card->controller(); abilityOwner = card->controller();
@@ -5110,6 +5110,14 @@ MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(f
void APhaseAction::Update(float dt) 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 (newPhase != currentPhase)
{ {
if((myturn && game->currentPlayer == source->controller())|| if((myturn && game->currentPlayer == source->controller())||
@@ -5186,11 +5194,11 @@ APhaseAction::~APhaseAction()
} }
// the main ability // 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) InstantAbility(observer, _id, card, target)
{ {
MTGCardInstance * _target = 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() int APhaseActionGeneric::resolve()
@@ -5236,7 +5244,7 @@ void ABlink::Update(float dt)
resolveBlink(); 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) if (Blinked == NULL)
MTGAbility::Update(dt); MTGAbility::Update(dt);
@@ -5272,6 +5280,7 @@ void ABlink::resolveBlink()
return; return;
} }
_target = _target->next; _target = _target->next;
_target->blinked = true;
Blinked = _target; Blinked = _target;
if(!blinkueot && !blinkForSource) if(!blinkueot && !blinkForSource)
{ {
@@ -5282,6 +5291,11 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) { void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL; MTGCardInstance * Blinker = NULL;
if(!_target->blinked)
{
this->forceDestroy = 1;
return;
}
if (!blinkhand) if (!blinkhand)
Blinker = _target->controller()->game->putInZone( Blinker = _target->controller()->game->putInZone(
_target, _target,
+6 -5
View File
@@ -518,12 +518,13 @@ bool GameObserver::operator==(const GameObserver& aGame)
{ {
error++; 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, MTGGameZone * thisZones[] = { players[i]->game->graveyard,
players[i]->game->library, players[i]->game->library,
players[i]->game->hand, players[i]->game->hand,
players[i]->game->inPlay }; players[i]->game->inPlay,
for (int j = 0; j < 4; j++) players[i]->game->exile };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = aZones[j]; MTGGameZone * zone = aZones[j];
if (zone->nb_cards != thisZones[j]->nb_cards) if (zone->nb_cards != thisZones[j]->nb_cards)
@@ -595,8 +596,8 @@ void GameObserver::gameStateBasedEffects()
///////////////////////////////////// /////////////////////////////////////
for (int d = 0; d < 2; d++) 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 }; 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 < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
+21 -11
View File
@@ -14,16 +14,21 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
self->zoom = 0.9f; 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(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(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)); Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f; opponent->zoom = 0.9f;
//opponenthandveiw button //opponentExile
Add(opponentHand = NEW GuiOpponentHand(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this)); false, mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponenthandveiwends //opponentHand
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false, Add(opponentHand = NEW GuiOpponentHand(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); 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, Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); mpDuelLayers->getRenderedPlayerOpponent(), this));
@@ -33,9 +38,10 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
observer->getCardSelector()->Add(selfLibrary); observer->getCardSelector()->Add(selfLibrary);
observer->getCardSelector()->Add(opponent); observer->getCardSelector()->Add(opponent);
observer->getCardSelector()->Add(opponentGraveyard); observer->getCardSelector()->Add(opponentGraveyard);
observer->getCardSelector()->Add(opponentExile);
observer->getCardSelector()->Add(opponentLibrary); observer->getCardSelector()->Add(opponentLibrary);
observer->getCardSelector()->Add(opponentHand); 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() float GuiAvatars::LeftBoundarySelf()
@@ -52,9 +58,9 @@ void GuiAvatars::Activate(PlayGuiObject* c)
c->zoom = 1.2f; c->zoom = 1.2f;
c->mHasFocus = true; 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; active = opponent;
opponent->zoom = 1.2f; opponent->zoom = 1.2f;
} }
@@ -71,9 +77,9 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
{ {
c->zoom = 1.0; c->zoom = 1.0;
c->mHasFocus = false; 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; opponent->zoom = 0.9f;
active = NULL; active = NULL;
} }
@@ -87,7 +93,7 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
int GuiAvatars::receiveEventPlus(WEvent* e) 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) int GuiAvatars::receiveEventMinus(WEvent* e)
@@ -95,6 +101,7 @@ int GuiAvatars::receiveEventMinus(WEvent* e)
selfGraveyard->receiveEventMinus(e); selfGraveyard->receiveEventMinus(e);
selfExile->receiveEventMinus(e); selfExile->receiveEventMinus(e);
opponentGraveyard->receiveEventMinus(e); opponentGraveyard->receiveEventMinus(e);
opponentExile->receiveEventMinus(e);
opponentHand->receiveEventMinus(e); opponentHand->receiveEventMinus(e);
return 1; return 1;
} }
@@ -111,6 +118,8 @@ bool GuiAvatars::CheckUserInput(JButton key)
return true; return true;
if (opponentGraveyard->CheckUserInput(key)) if (opponentGraveyard->CheckUserInput(key))
return true; return true;
if (opponentExile->CheckUserInput(key))
return true;
if (opponentHand->CheckUserInput(key)) if (opponentHand->CheckUserInput(key))
return true; return true;
if (selfLibrary->CheckUserInput(key)) if (selfLibrary->CheckUserInput(key))
@@ -128,6 +137,7 @@ void GuiAvatars::Update(float dt)
selfExile->Update(dt); selfExile->Update(dt);
opponentHand->Update(dt); opponentHand->Update(dt);
opponentGraveyard->Update(dt); opponentGraveyard->Update(dt);
opponentExile->Update(dt);
selfLibrary->Update(dt); selfLibrary->Update(dt);
opponentLibrary->Update(dt); opponentLibrary->Update(dt);
} }
+13 -1
View File
@@ -164,7 +164,10 @@ void GuiGameZone::Render()
JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID); JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID);
float scale = defaultHeight / quad->mHeight; float scale = defaultHeight / quad->mHeight;
quad->SetColor(ARGB((int)(actA),255,255,255)); 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); JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ);
float x0 = actX; float x0 = actX;
@@ -182,6 +185,15 @@ void GuiGameZone::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[11]; char buffer[11];
int mAlpha = (int) (actA); int mAlpha = (int) (actA);
/*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); sprintf(buffer, "%i", zone->nb_cards);
mFont->SetColor(ARGB(mAlpha,0,0,0)); mFont->SetColor(ARGB(mAlpha,0,0,0));
mFont->DrawString(buffer, x0 + 1, actY + 1); mFont->DrawString(buffer, x0 + 1, actY + 1);
+8 -7
View File
@@ -558,8 +558,8 @@ int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option)
{ {
if (player && player != observer->players[i]) if (player && player != observer->players[i])
continue; continue;
MTGGameZone * zones[] = { observer->players[i]->game->inPlay, observer->players[i]->game->graveyard, observer->players[i]->game->hand }; 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 < 3; k++) for (int k = 0; k < 4; k++)
{ {
for (int j = zones[k]->nb_cards - 1; j >= 0; j--) 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 opponentturn = (s1.find("my") == string::npos);
bool myturn = (s1.find("opponent") == string::npos); bool myturn = (s1.find("opponent") == string::npos);
bool sourceinPlay = (s1.find("sourceinplay") != 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 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); bool once = (s1.find("once") != string::npos);
@@ -3420,7 +3421,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
_target = spell->getNextCardTarget(); _target = spell->getNextCardTarget();
if(!_target) if(!_target)
_target = 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) 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = game->players[i]; Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack }; 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 < 5; k++) for (int k = 0; k < 6; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if (canTarget(zone)) if (canTarget(zone))
@@ -5329,8 +5330,8 @@ void ListMaintainerAbility::checkTargets()
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = game->players[i]; Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack }; 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 < 5; k++) for (int k = 0; k < 6; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if (canTarget(zone)) 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = g->players[i]; Player * p = g->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard }; MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->exile };
for (int j = 0; j < 4; j++) for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) 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, MTGGameZone * loadedPlayerZones[] = { initState.playerData[playerId].player->game->graveyard,
initState.playerData[playerId].player->game->library, initState.playerData[playerId].player->game->library,
initState.playerData[playerId].player->game->hand, 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++) 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; 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, MTGGameZone * loadedPlayerZones[] = { initState.playerData[i].player->game->graveyard,
initState.playerData[i].player->game->library, initState.playerData[i].player->game->library,
initState.playerData[i].player->game->hand, initState.playerData[i].player->game->hand,
initState.playerData[i].player->game->inPlay }; initState.playerData[i].player->game->inPlay,
for (int j = 0; j < 4; j++) initState.playerData[i].player->game->exile };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++) 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = observer->players[i]; Player * p = observer->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard }; MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->exile };
for (int j = 0; j < 4; j++) for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) for (int k = 0; k < zone->nb_cards; k++)
@@ -394,12 +394,13 @@ void TestSuiteGame::assertGame()
error++; 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, MTGGameZone * endstateZones[] = { endState.players[i]->game->graveyard,
endState.players[i]->game->library, endState.players[i]->game->library,
endState.players[i]->game->hand, endState.players[i]->game->hand,
endState.players[i]->game->inPlay }; endState.players[i]->game->inPlay,
for (int j = 0; j < 4; j++) endState.players[i]->game->exile };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
if (zone->nb_cards != endstateZones[j]->nb_cards) if (zone->nb_cards != endstateZones[j]->nb_cards)
@@ -853,12 +854,13 @@ void TestSuiteGame::initGame()
stringstream stream; stringstream stream;
stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream); stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
p->getRandomGenerator()->loadRandValues(stream.str()); 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, MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,
initState.players[i]->game->library, initState.players[i]->game->library,
initState.players[i]->game->hand, initState.players[i]->game->hand,
initState.players[i]->game->inPlay }; initState.players[i]->game->inPlay,
for (int j = 0; j < 4; j++) initState.players[i]->game->exile };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++) 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, MTGGameZone * loadedPlayerZones[] = { initState.players[playerId]->game->graveyard,
initState.players[playerId]->game->library, initState.players[playerId]->game->library,
initState.players[playerId]->game->hand, initState.players[playerId]->game->hand,
initState.players[playerId]->game->exile,
initState.players[playerId]->game->inPlay }; 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++) for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{ {