fix for cards with restrictions

This commit is contained in:
Anthony Calosa
2017-01-22 00:14:46 +08:00
parent 37b3f28065
commit 6fe57be115
6 changed files with 17 additions and 5 deletions
+1
View File
@@ -260,6 +260,7 @@ int Damage::resolve()
target->lifeLostThisTurn += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{
source->controller()->dealsdamagebycombat = 1; // for restriction check
vector<string> values = MTGAllCards::getCreatureValuesById();//getting a weird crash here. rarely.
for (size_t i = 0; i < values.size(); ++i)
{
+1
View File
@@ -213,6 +213,7 @@ void GameObserver::nextGamePhase()
currentPlayer->nonCombatDamage = 0;
currentPlayer->drawCounter = 0;
currentPlayer->raidcount = 0;
currentPlayer->dealsdamagebycombat = 0; //clear check for restriction
currentPlayer->opponent()->raidcount = 0;
currentPlayer->prowledTypes.clear();
currentPlayer->opponent()->damageCount = 0; //added to clear odcount
+8
View File
@@ -540,6 +540,14 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
if(card->controller()->raidcount < 1)
return 0;
}
check = restriction[i].find("opponentdamagedbycombat");
if(check != string::npos)
{
if(card->controller()->dealsdamagebycombat < 1)
return 0;
}
check = restriction[i].find("outnumbered");//opponent controls atleast 4 or more creatures than you
if(check != string::npos)
+1
View File
@@ -37,6 +37,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
energyCount = 0;
epic = 0;
forcefield = 0;
dealsdamagebycombat = 0;
raidcount = 0;
handmodifier = 0;
snowManaG = 0;