added Prowl support.

example usage:
other={1}{B} name(Prowl)
otherrestriction=prowl
This commit is contained in:
anthonycalosa@gmail.com
2013-05-20 02:59:18 +00:00
parent a055044281
commit f0de00086b
5 changed files with 47 additions and 0 deletions
+1
View File
@@ -42,6 +42,7 @@ public:
int skippingTurn; int skippingTurn;
int extraTurn; int extraTurn;
int drawCounter; int drawCounter;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses; vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL); Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
virtual ~Player(); virtual ~Player();
+27
View File
@@ -153,6 +153,15 @@ int Damage::resolve()
if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD)) if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD))
_target->poisonCount += damage;//this will be changed to poison counters. _target->poisonCount += damage;//this will be changed to poison counters.
_target->damageCount += damage; _target->damageCount += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{
vector<string> values = MTGAllCards::getCreatureValuesById();
for (size_t i = 0; i < values.size(); ++i)
{
if ( source->hasSubtype( values[i] ) && find(source->controller()->prowledTypes.begin(), source->controller()->prowledTypes.end(), values[i])==source->controller()->prowledTypes.end() )
source->controller()->prowledTypes.push_back(values[i]);
}
}
} }
else if (target->type_as_damageable == DAMAGEABLE_PLAYER && (source->has(Constants::POISONTOXIC) || else if (target->type_as_damageable == DAMAGEABLE_PLAYER && (source->has(Constants::POISONTOXIC) ||
source->has(Constants::POISONTWOTOXIC) || source->has(Constants::POISONTHREETOXIC))) source->has(Constants::POISONTWOTOXIC) || source->has(Constants::POISONTHREETOXIC)))
@@ -161,6 +170,15 @@ int Damage::resolve()
Player * _target = (Player *) target; Player * _target = (Player *) target;
a = target->dealDamage(damage); a = target->dealDamage(damage);
target->damageCount += damage; target->damageCount += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{
vector<string> values = MTGAllCards::getCreatureValuesById();
for (size_t i = 0; i < values.size(); ++i)
{
if ( source->hasSubtype( values[i] ) && find(source->controller()->prowledTypes.begin(), source->controller()->prowledTypes.end(), values[i])==source->controller()->prowledTypes.end() )
source->controller()->prowledTypes.push_back(values[i]);
}
}
if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD)) if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD))
{ {
if (source->has(Constants::POISONTOXIC)) if (source->has(Constants::POISONTOXIC))
@@ -197,6 +215,15 @@ int Damage::resolve()
((MTGCardInstance*)source)->damageToOpponent = true; ((MTGCardInstance*)source)->damageToOpponent = true;
} }
target->lifeLostThisTurn += damage; target->lifeLostThisTurn += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{
vector<string> values = MTGAllCards::getCreatureValuesById();
for (size_t i = 0; i < values.size(); ++i)
{
if ( source->hasSubtype( values[i] ) && find(source->controller()->prowledTypes.begin(), source->controller()->prowledTypes.end(), values[i])==source->controller()->prowledTypes.end() )
source->controller()->prowledTypes.push_back(values[i]);
}
}
WEvent * lifed = NEW WEventLife((Player*)target,-damage); WEvent * lifed = NEW WEventLife((Player*)target,-damage);
observer->receiveEvent(lifed); observer->receiveEvent(lifed);
} }
+2
View File
@@ -204,6 +204,7 @@ void GameObserver::nextGamePhase()
cleanupPhase(); cleanupPhase();
currentPlayer->damageCount = 0; currentPlayer->damageCount = 0;
currentPlayer->drawCounter = 0; currentPlayer->drawCounter = 0;
currentPlayer->prowledTypes.clear();
currentPlayer->opponent()->damageCount = 0; //added to clear odcount currentPlayer->opponent()->damageCount = 0; //added to clear odcount
currentPlayer->preventable = 0; currentPlayer->preventable = 0;
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn; mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
@@ -230,6 +231,7 @@ void GameObserver::nextGamePhase()
} }
mLayers->actionLayer()->Update(0); mLayers->actionLayer()->Update(0);
currentPlayer->drawCounter = 0; currentPlayer->drawCounter = 0;
currentPlayer->prowledTypes.clear();
currentPlayer->lifeLostThisTurn = 0; currentPlayer->lifeLostThisTurn = 0;
currentPlayer->opponent()->lifeLostThisTurn = 0; currentPlayer->opponent()->lifeLostThisTurn = 0;
currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty); currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty);
+16
View File
@@ -341,6 +341,22 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0; return 0;
} }
check = restriction[i].find("prowl");
if(check != string::npos)
{
bool isProwled = false;
for (size_t i = 0; i < card->controller()->prowledTypes.size(); ++i)
{
if ( card->hasSubtype( card->controller()->prowledTypes[i] ))
{
isProwled = true;
break;
}
}
if(!isProwled)
return 0;
}
check = restriction[i].find("ownerscontrol"); check = restriction[i].find("ownerscontrol");
if(check != string::npos) if(check != string::npos)
{ {
+1
View File
@@ -33,6 +33,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
skippingTurn = 0; skippingTurn = 0;
extraTurn = 0; extraTurn = 0;
drawCounter = 0; drawCounter = 0;
prowledTypes.clear();
doesntEmpty = NEW ManaCost(); doesntEmpty = NEW ManaCost();
poolDoesntEmpty = NEW ManaCost(); poolDoesntEmpty = NEW ManaCost();
if (deck != NULL) if (deck != NULL)