diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 857c90d92..de1c13fe1 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -55,6 +55,8 @@ public: intValue = computeX(spell,card); }else if (s == "xx" || s == "XX"){ intValue = computeXX(spell,card); + }else if (s == "equips"){ + intValue = target->equipment; }else if (s == "manacost"){ intValue = target->getManaCost()->getConvertedCost(); }else if (s == "lifetotal"){ @@ -792,10 +794,19 @@ class AAWinGame:public ActivatedAbilityTP{ int cantlosers = 0; MTGGameZone * z = ((Player *)_target)->opponent()->game->inPlay; int nbcards = z->nb_cards; - for (int i = 0; i < nbcards; ++i){ + + for (int i = 0; i < nbcards; i++){ MTGCardInstance * c = z->cards[i]; if (c->has(Constants::CANTLOSE)){ cantlosers++; + } + } + MTGGameZone * k = ((Player *)_target)->game->inPlay; + int onbcards = k->nb_cards; + for (int m = 0; m < onbcards; ++m){ + MTGCardInstance * e = k->cards[m]; + if (e->has(Constants::CANTWIN)){ + cantlosers++; } } if(cantlosers < 1){ @@ -1190,7 +1201,7 @@ class ABasicAbilityAuraModifierUntilEOT: public ActivatedAbility{ } }; - +//equipment class AEquip:public TargetAbility{ public: vector currentAbilities; @@ -1199,6 +1210,7 @@ public: } int unequip(){ + if(source->target){source->target->equipment -= 1;} source->target = NULL; for (size_t i = 0; i < currentAbilities.size(); ++i){ MTGAbility * a = currentAbilities[i]; @@ -1215,6 +1227,7 @@ public: int equip(MTGCardInstance * equipped){ source->target = equipped; + source->target->equipment += 1; AbilityFactory af; af.getAbilities(¤tAbilities,NULL,source); for (size_t i = 0; i < currentAbilities.size(); ++i){ @@ -1233,7 +1246,6 @@ public: if (mTarget == source) return 0; unequip(); equip(mTarget); - return 1; } diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index d833aa2f8..963520320 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -49,6 +49,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable { int flashedback; int paymenttype; int frozen; + int equipment; int reduxamount; int regenerateTokens; int isToken; diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index 87c43e15b..c13f6116d 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -131,9 +131,10 @@ class Constants AFFINITYMOUNTAIN = 73, AFFINITYSWAMP = 74, AFFINITYGREENCREATURES = 75, + CANTWIN = 76, + NOMAXHAND = 77, - - NB_BASIC_ABILITIES = 76, + NB_BASIC_ABILITIES = 78, RARITY_S = 'S', //Special Rarity diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index 2d8696a41..eae67ba64 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -22,6 +22,7 @@ class Player: public Damageable{ JTexture * mAvatarTex; JQuad * mAvatar; int canPutLandsIntoPlay; + int nomaxhandsize; int castedspellsthisturn; int onlyonecast; int castcount; diff --git a/projects/mtg/include/ThisDescriptor.h b/projects/mtg/include/ThisDescriptor.h index 61aa013cb..05a98549d 100644 --- a/projects/mtg/include/ThisDescriptor.h +++ b/projects/mtg/include/ThisDescriptor.h @@ -41,6 +41,27 @@ class ThisCounterAny:public ThisDescriptor{ ThisCounterAny(int nb); }; +class ThisControllerlife:public ThisDescriptor{ + public: + virtual int match(MTGCardInstance * card); + + ThisControllerlife(int life); +}; + +class ThisOpponentlife:public ThisDescriptor{ + public: + virtual int match(MTGCardInstance * card); + + ThisOpponentlife(int olife); +}; + +class ThisEquip:public ThisDescriptor{ + public: + virtual int match(MTGCardInstance * card); + + ThisEquip(int equipment); +}; + class ThisPower:public ThisDescriptor{ public: virtual int match(MTGCardInstance * card); diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 702372c4b..b263762f9 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -137,7 +137,7 @@ void GameObserver::nextGamePhase(){ if (currentGamePhase == Constants::MTG_PHASE_AFTER_EOT){ //Auto Hand cleaning, in case the player didn't do it himself - while(currentPlayer->game->hand->nb_cards > 7) + while(currentPlayer->game->hand->nb_cards > 7 && currentPlayer->nomaxhandsize < 1) currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]); mLayers->actionLayer()->Update(0); return nextGamePhase(); @@ -358,6 +358,14 @@ void GameObserver::stateEffects() MTGCardInstance * c = z->cards[j]; if (c->has(Constants::CANTLOSE) || c->has(Constants::CANTLIFELOSE)){ cantlosers++; + } + } + MTGGameZone * k = players[i]->opponent()->game->inPlay; + int onbcards = k->nb_cards; + for (int m = 0; m < onbcards; ++m){ + MTGCardInstance * e = k->cards[m]; + if (e->has(Constants::CANTWIN)){ + cantlosers++; } } if(cantlosers < 1){ @@ -549,7 +557,7 @@ void GameObserver::cardClick (MTGCardInstance * card, Targetable * object){ if (!card) return; //Current player's hand - if (currentPlayer->game->hand->hasCard(card) && currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentPlayer->game->hand->nb_cards > 7){ + if (currentPlayer->game->hand->hasCard(card) && currentGamePhase == Constants::MTG_PHASE_CLEANUP && currentPlayer->game->hand->nb_cards > 7 && currentPlayer->nomaxhandsize < 1){ currentPlayer->game->putInGraveyard(card); }else if (reaction){ if (reaction == 1){ diff --git a/projects/mtg/src/GameStateOptions.cpp b/projects/mtg/src/GameStateOptions.cpp index 95f5a2105..c1251d120 100644 --- a/projects/mtg/src/GameStateOptions.cpp +++ b/projects/mtg/src/GameStateOptions.cpp @@ -186,7 +186,8 @@ void GameStateOptions::Render() "", "Dev Team: Abrasax, almosthumane, Daddy32, Dr.Solomat" "J, Jeck, Leungclj, linshier, Salmelo, Superhiro", - "Psyringe, Wololo, Yeshua, Zethfox", + "Psyringe, Wololo, Yeshua, Zethfox,", + "Special thanks to Mnguyen(mico) for the awesome menu improvements,", "", "Music by Celestial Aeon Project, http://www.jamendo.com", "", diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 74ef65333..cb448bc55 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -99,6 +99,7 @@ void MTGCardInstance::initMTGCI(){ tapped = 0; untapping = 0; frozen = 0; + equipment = NULL; boughtback = 0; flashedback = 0; paymenttype = 0; diff --git a/projects/mtg/src/MTGDefinitions.cpp b/projects/mtg/src/MTGDefinitions.cpp index 8715b8041..7b2fe4cdc 100644 --- a/projects/mtg/src/MTGDefinitions.cpp +++ b/projects/mtg/src/MTGDefinitions.cpp @@ -84,6 +84,8 @@ const char* Constants::MTGBasicAbilities[] = { "affinitymountains", "affinityswamps", "affinitygreencreatures", +"cantwin", +"nomaxhand", }; diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index aa62a6391..79da0fae4 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -87,7 +87,15 @@ void MTGPlayerCards::drawFromLibrary(){ if (c->has(Constants::CANTLOSE) || c->has(Constants::CANTMILLLOSE)){ cantlosers++; } - } + } + MTGGameZone * k = library->owner->opponent()->game->inPlay; + int onbcards = k->nb_cards; + for (int m = 0; m < onbcards; ++m){ + MTGCardInstance * e = k->cards[m]; + if (e->has(Constants::CANTWIN)){ + cantlosers++; + } + } if(cantlosers < 1){ GameObserver::GetInstance()->gameOver = library->owner;} return; diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 53590b3fd..877197b71 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -1091,7 +1091,7 @@ HUDDisplay::~HUDDisplay(){ WEventZoneChange * e = (WEventZoneChange *) event; MTGCardInstance * card = e->card->previous; if(card){ - if (card->basicAbilities[Constants::BOTHCANTCAST] || card->basicAbilities[Constants::BOTHNOCREATURE] || card->basicAbilities[Constants::CANTCAST] || card->basicAbilities[Constants::CANTCASTCREATURE] || card->basicAbilities[Constants::CANTCASTTWO] || card->basicAbilities[Constants::ONLYONEBOTH]){ + if (card->basicAbilities[Constants::BOTHCANTCAST] || card->basicAbilities[Constants::BOTHNOCREATURE] || card->basicAbilities[Constants::CANTCAST] || card->basicAbilities[Constants::CANTCASTCREATURE] || card->basicAbilities[Constants::CANTCASTTWO] || card->basicAbilities[Constants::ONLYONEBOTH] || card->basicAbilities[Constants::NOMAXHAND] ){ int ok = 0; @@ -1109,6 +1109,21 @@ HUDDisplay::~HUDDisplay(){ MTGGameZone * y = card->controller()->opponent()->game->inPlay; int nbcards = z->nb_cards; int onbcards = y->nb_cards; + //handsize modifier + //check my battlefield and opponents + for (int j = 0; j < nbcards; ++j){ + MTGCardInstance * c = z->cards[j]; + if (c->has(Constants::NOMAXHAND)){ + card->controller()->nomaxhandsize = 1; + } + } //any on other side? + for (int j = 0; j < onbcards; ++j){ + MTGCardInstance * c = y->cards[j]; + if (c->has(Constants::NOMAXHAND)){ + card->controller()->opponent()->nomaxhandsize = 1; + } + } +//--------------both cant cast----------------- //check my battlefield and opponents for (int j = 0; j < nbcards; ++j){ MTGCardInstance * c = z->cards[j]; @@ -1235,7 +1250,7 @@ HUDDisplay::~HUDDisplay(){ if (event->type == WEvent::CHANGE_ZONE){ WEventZoneChange * e = (WEventZoneChange *) event; MTGCardInstance * card = e->card->previous; - if (card && (card->basicAbilities[Constants::BOTHCANTCAST] || card->basicAbilities[Constants::BOTHNOCREATURE] || card->basicAbilities[Constants::CANTCAST] || card->basicAbilities[Constants::CANTCASTCREATURE] || card->basicAbilities[Constants::CANTCASTTWO] || card->basicAbilities[Constants::ONLYONEBOTH])){ + if (card && (card->basicAbilities[Constants::BOTHCANTCAST] || card->basicAbilities[Constants::BOTHNOCREATURE] || card->basicAbilities[Constants::CANTCAST] || card->basicAbilities[Constants::CANTCASTCREATURE] || card->basicAbilities[Constants::CANTCASTTWO] || card->basicAbilities[Constants::ONLYONEBOTH]|| card->basicAbilities[Constants::NOMAXHAND])){ int ok = 0; for (int i = 0; i < 2 ; i++){ Player * p = game->players[i]; @@ -1247,6 +1262,8 @@ HUDDisplay::~HUDDisplay(){ if (e->to == p->game->graveyard || e->to == p->game->hand || e->to == p->game->library || e->to == p->game->exile){//if it goes ANYWHERE but inplay. //check happens---------- //reset restrictions + p->nomaxhandsize = 0; + p->opponent()->nomaxhandsize = 0; p->onlyonecast = 0; p->opponent()->onlyonecast = 0; p->castrestrictedspell = 0;//0 means no restrictions apply. @@ -1258,6 +1275,21 @@ HUDDisplay::~HUDDisplay(){ MTGGameZone * y = card->controller()->opponent()->game->inPlay; int nbcards = z->nb_cards; int onbcards = y->nb_cards; + + //no max hand size + for (int j = 0; j < nbcards; ++j){ + MTGCardInstance * c = z->cards[j]; + if (c->has(Constants::NOMAXHAND)){ + p->nomaxhandsize = 1; + } + } //any on other side? + for (int j = 0; j < onbcards; ++j){ + MTGCardInstance * c = y->cards[j]; + if (c->has(Constants::NOMAXHAND)){ + p->opponent()->nomaxhandsize = 1; + } + } + //check my battlefield and opponents for (int j = 0; j < nbcards; ++j){ MTGCardInstance * c = z->cards[j]; @@ -1705,7 +1737,7 @@ HUDDisplay::~HUDDisplay(){ for (int j = 0; j < nbcards; ++j){ MTGCardInstance * c = z->cards[j]; if (c->has(Constants::AFFINITYSWAMP)){ - if(c->reduxamount > 0){ c->reduxamount -+ 1;} + if(c->reduxamount > 0){ c->reduxamount -= 1;} else{ c->getManaCost()->add(0,1); } diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index 535044dff..71eb585ff 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -12,6 +12,7 @@ Player::Player(MTGPlayerCards * deck, string file, string fileSmall) : Damageabl game->setOwner(this); manaPool = NEW ManaPool(this); canPutLandsIntoPlay = 1; + nomaxhandsize = 0; castedspellsthisturn = 0; castrestrictedspell = 0; castrestrictedcreature = 0; diff --git a/projects/mtg/src/ThisDescriptor.cpp b/projects/mtg/src/ThisDescriptor.cpp index 2a4ca5eae..1c131f1d3 100644 --- a/projects/mtg/src/ThisDescriptor.cpp +++ b/projects/mtg/src/ThisDescriptor.cpp @@ -126,7 +126,40 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(string s){ return NULL; } - //power + //equips + found = s.find("equip"); + if (found != string::npos) { + ThisEquip * td = NEW ThisEquip(criterion); + if (td) { + td->comparisonMode = mode; + return td; + } + return NULL; + } + + //controller life + found = s.find("opponentlife"); + if (found != string::npos) { + ThisOpponentlife * td = NEW ThisOpponentlife(criterion); + if (td) { + td->comparisonMode = mode; + return td; + } + return NULL; + } + + //controller life + found = s.find("controllerlife"); + if (found != string::npos) { + ThisControllerlife * td = NEW ThisControllerlife(criterion); + if (td) { + td->comparisonMode = mode; + return td; + } + return NULL; + } + + //power found = s.find("power"); if (found != string::npos) { ThisPower * td = NEW ThisPower(criterion); @@ -198,6 +231,22 @@ ThisCounter::~ThisCounter() { SAFE_DELETE(counter); } +ThisOpponentlife::ThisOpponentlife(int olife){ + comparisonCriterion = olife; +} + +int ThisOpponentlife::match(MTGCardInstance * card){ + return matchValue(card->controller()->opponent()->life); +} + +ThisControllerlife::ThisControllerlife(int life){ + comparisonCriterion = life; +} + +int ThisControllerlife::match(MTGCardInstance * card){ + return matchValue(card->controller()->life); +} + ThisPower::ThisPower(int power){ comparisonCriterion = power; } @@ -206,6 +255,14 @@ int ThisPower::match(MTGCardInstance * card){ return matchValue(card->power); } +ThisEquip::ThisEquip(int equipment){ + comparisonCriterion = equipment; +} +int ThisEquip::match(MTGCardInstance * card){ + return matchValue(card->equipment); +} + + ThisToughness::ThisToughness(int toughness){ comparisonCriterion = toughness; }