Erwan
- fix issue 111
This commit is contained in:
@@ -82,6 +82,9 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
|||||||
int toggleDefenser(MTGCardInstance * opponent);
|
int toggleDefenser(MTGCardInstance * opponent);
|
||||||
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
||||||
int bringBlockerToFrontOfOrder(MTGCardInstance * blocker);
|
int bringBlockerToFrontOfOrder(MTGCardInstance * blocker);
|
||||||
|
|
||||||
|
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
|
||||||
|
int getDefenserRank(MTGCardInstance * blocker);
|
||||||
int toggleAttacker();
|
int toggleAttacker();
|
||||||
MTGCardInstance * banding; // If belongs to a band when attacking
|
MTGCardInstance * banding; // If belongs to a band when attacking
|
||||||
int canBlock();
|
int canBlock();
|
||||||
|
|||||||
@@ -84,9 +84,14 @@ void GuiPlay::BattleField::EnstackAttacker(CardView* card)
|
|||||||
void GuiPlay::BattleField::EnstackBlocker(CardView* card)
|
void GuiPlay::BattleField::EnstackBlocker(CardView* card)
|
||||||
{
|
{
|
||||||
GameObserver* game = GameObserver::GetInstance();
|
GameObserver* game = GameObserver::GetInstance();
|
||||||
if (card->card && card->card->defenser && card->card->defenser->view)
|
MTGCardInstance * c = card->card;
|
||||||
card->x = card->card->defenser->view->x;
|
if (!c) return;
|
||||||
card->y = baseY + (game->players[0] == card->card->controller() ? 20 + y : -20 - y);
|
int offset = 0;
|
||||||
|
if (c->defenser && c->defenser->view){
|
||||||
|
offset = c->defenser->getDefenserRank(c);
|
||||||
|
card->x = c->defenser->view->x + 5 * offset;
|
||||||
|
}
|
||||||
|
card->y = baseY + (game->players[0] == card->card->controller() ? 20 + y + 6 * offset : -20 - y + 6 * offset);
|
||||||
}
|
}
|
||||||
void GuiPlay::BattleField::Update(float dt)
|
void GuiPlay::BattleField::Update(float dt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -512,6 +512,15 @@ int MTGCardInstance::bringBlockerToFrontOfOrder(MTGCardInstance * blocker){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MTGCardInstance::getDefenserRank(MTGCardInstance * blocker){
|
||||||
|
int result = 0;
|
||||||
|
for(list<MTGCardInstance *>::iterator it1 = blockers.begin(); it1 != blockers.end(); ++it1){
|
||||||
|
result++;
|
||||||
|
if ((*it1) == blocker) return result;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
int MTGCardInstance::removeBlocker(MTGCardInstance * blocker){
|
int MTGCardInstance::removeBlocker(MTGCardInstance * blocker){
|
||||||
blockers.remove(blocker);
|
blockers.remove(blocker);
|
||||||
if (!blockers.size()) blocked = false;
|
if (!blockers.size()) blocked = false;
|
||||||
@@ -558,6 +567,8 @@ MTGCardInstance * MTGCardInstance::getNextOpponent(MTGCardInstance * previous){
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int MTGCardInstance::setDefenser(MTGCardInstance * opponent){
|
int MTGCardInstance::setDefenser(MTGCardInstance * opponent){
|
||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
if (defenser) {
|
if (defenser) {
|
||||||
|
|||||||
Reference in New Issue
Block a user