added abilities=lure
"all creatures able to block blah must do so."
This commit is contained in:
@@ -219,8 +219,8 @@ class Constants
|
|||||||
ONLYMANA = 98,
|
ONLYMANA = 98,
|
||||||
POISONDAMAGER = 99,
|
POISONDAMAGER = 99,
|
||||||
soulbond = 100,
|
soulbond = 100,
|
||||||
|
LURE = 101,
|
||||||
NB_BASIC_ABILITIES = 101,
|
NB_BASIC_ABILITIES = 102,
|
||||||
|
|
||||||
|
|
||||||
RARITY_S = 'S', //Special Rarity
|
RARITY_S = 'S', //Special Rarity
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ class MTGInPlay: public MTGGameZone {
|
|||||||
public:
|
public:
|
||||||
void untapAll();
|
void untapAll();
|
||||||
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
||||||
|
MTGCardInstance * getNextLurer(MTGCardInstance * previous);
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
const char * getName(){return "battlefield";}
|
const char * getName(){return "battlefield";}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ const char* Constants::MTGBasicAbilities[] = {
|
|||||||
"nomanaability",
|
"nomanaability",
|
||||||
"onlymanaability",
|
"onlymanaability",
|
||||||
"poisondamager",//deals damage to players as poison counters.
|
"poisondamager",//deals damage to players as poison counters.
|
||||||
"soulbond"
|
"soulbond",
|
||||||
|
"lure"
|
||||||
};
|
};
|
||||||
|
|
||||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||||
|
|||||||
@@ -761,6 +761,28 @@ MTGCardInstance * MTGInPlay::getNextAttacker(MTGCardInstance * previous)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MTGCardInstance * MTGInPlay::getNextLurer(MTGCardInstance * previous)
|
||||||
|
{
|
||||||
|
int foundprevious = 0;
|
||||||
|
if (previous == NULL)
|
||||||
|
{
|
||||||
|
foundprevious = 1;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < nb_cards; i++)
|
||||||
|
{
|
||||||
|
MTGCardInstance * current = cards[i];
|
||||||
|
if (current == previous)
|
||||||
|
{
|
||||||
|
foundprevious = 1;
|
||||||
|
}
|
||||||
|
else if (foundprevious && current->isAttacker() && current->has(Constants::LURE))
|
||||||
|
{
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void MTGInPlay::untapAll()
|
void MTGInPlay::untapAll()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -1547,17 +1547,33 @@ int MTGBlockRule::reactToClick(MTGCardInstance * card)
|
|||||||
card->toggleDefenser(NULL);
|
card->toggleDefenser(NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
bool lured = false;
|
||||||
|
int lureFound = 0;
|
||||||
|
MTGCardInstance * lurers = NULL;
|
||||||
|
while(!lureFound)
|
||||||
|
{
|
||||||
|
lurers = game->currentPlayer->game->inPlay->getNextLurer(lurers);
|
||||||
|
lureFound = (lurers == NULL || lurers->attacker);
|
||||||
|
if(lurers)
|
||||||
|
lured = true;
|
||||||
|
}
|
||||||
while (!result)
|
while (!result)
|
||||||
{
|
{
|
||||||
currentOpponent = game->currentPlayer->game->inPlay->getNextAttacker(currentOpponent);
|
currentOpponent = game->currentPlayer->game->inPlay->getNextAttacker(currentOpponent);
|
||||||
canDefend = card->toggleDefenser(currentOpponent);
|
|
||||||
|
if(lured && currentOpponent && !currentOpponent->has(Constants::LURE))
|
||||||
|
currentOpponent = game->currentPlayer->game->inPlay->getNextAttacker(currentOpponent);
|
||||||
|
canDefend = card->toggleDefenser(currentOpponent);
|
||||||
|
|
||||||
DebugTrace("Defenser Toggle: " << card->getName() << endl
|
DebugTrace("Defenser Toggle: " << card->getName() << endl
|
||||||
<< "- canDefend: " << (canDefend == 0) << endl
|
<< "- canDefend: " << (canDefend == 0) << endl
|
||||||
<< "- currentOpponent: " << currentOpponent);
|
<< "- currentOpponent: " << currentOpponent);
|
||||||
result = (canDefend || currentOpponent == NULL);
|
result = (currentOpponent == NULL || canDefend);
|
||||||
}
|
}
|
||||||
return 1;
|
lured = false;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * MTGBlockRule::getMenuText()
|
const char * MTGBlockRule::getMenuText()
|
||||||
|
|||||||
@@ -1534,6 +1534,18 @@ bool BlockableChooser::canTarget(Targetable * target,bool withoutProtections)
|
|||||||
{
|
{
|
||||||
if(!card->isAttacker() || !source->canBlock(card))
|
if(!card->isAttacker() || !source->canBlock(card))
|
||||||
return false;
|
return false;
|
||||||
|
bool lured = false;
|
||||||
|
int lureFound = 0;
|
||||||
|
MTGCardInstance * lurers = NULL;
|
||||||
|
while(!lureFound)
|
||||||
|
{
|
||||||
|
lurers = card->controller()->game->inPlay->getNextLurer(lurers);
|
||||||
|
lureFound = (lurers == NULL || lurers->attacker);
|
||||||
|
if(lurers)
|
||||||
|
lured = true;
|
||||||
|
}
|
||||||
|
if(lured && card->controller()->inPlay()->hasAbility(Constants::LURE) && !card->has(Constants::LURE))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return TypeTargetChooser::canTarget(target,withoutProtections);
|
return TypeTargetChooser::canTarget(target,withoutProtections);
|
||||||
|
|||||||
Reference in New Issue
Block a user