From 0727343ebe53f900d09b5bbeb473d05c45ef5575 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Mon, 23 May 2011 11:46:04 +0000 Subject: [PATCH] first moved the def of handsize for a game into the rules.txt as discussed with wololo... this update requires you to update your rules folder files!!! 2nd added 2 new vanguard game modes. Stone Hewer Basic - when ever a creature enters play, a random equipment with a converted mana cost less than or equal to that creature is put into play and attached to it. this mode is unlockable, requirement = win a match where 10 or more equipment were in the battlefeild at the moment you won. Hermit Druid basic- in this game mode, during each of the players upkeeps, a random land card from their deck is placed into the battlefield, these do not count against your 1 land per turn limit. to unlock this, win any match with less then 10 lands. --- projects/mtg/include/AllAbilities.h | 19 +++ projects/mtg/include/Credits.h | 2 + projects/mtg/include/Damage.h | 1 + projects/mtg/include/GameApp.h | 3 + projects/mtg/include/GameOptions.h | 2 + projects/mtg/include/MTGRules.h | 41 ++++++ projects/mtg/src/AIPlayer.cpp | 18 ++- projects/mtg/src/AllAbilities.cpp | 39 ++++++ projects/mtg/src/Credits.cpp | 32 +++++ projects/mtg/src/GameObserver.cpp | 4 +- projects/mtg/src/GameOptions.cpp | 2 + projects/mtg/src/GameStateAwards.cpp | 8 ++ projects/mtg/src/GameStateDuel.cpp | 11 +- projects/mtg/src/GameStateMenu.cpp | 2 + projects/mtg/src/MTGAbility.cpp | 11 ++ projects/mtg/src/MTGRules.cpp | 194 +++++++++++++++++++++++++++ projects/mtg/src/Player.cpp | 1 + projects/mtg/src/Rules.cpp | 4 +- projects/mtg/src/TargetChooser.cpp | 1 + 19 files changed, 384 insertions(+), 11 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 8127d52a1..5382844c1 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -185,6 +185,10 @@ public: { intValue = target->getToughness(); } + else if (s == "handsize") + { + intValue = target->controller()->handsize; + } else { intValue = atoi(s.c_str()); @@ -2982,6 +2986,21 @@ public: return a; } }; + +//set a players hand size +class AASetHand: public ActivatedAbilityTP +{ +public: + int hand; + + AASetHand(int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL, + int who = TargetChooser::UNSET); + int resolve(); + const char * getMenuText(); + AASetHand * clone() const; + +}; + //lifeset class AALifeSet: public ActivatedAbilityTP { diff --git a/projects/mtg/include/Credits.h b/projects/mtg/include/Credits.h index ba3e08d8e..2addc8f59 100644 --- a/projects/mtg/include/Credits.h +++ b/projects/mtg/include/Credits.h @@ -28,6 +28,8 @@ private: time_t gameLength; int isDifficultyUnlocked(DeckStats * stats); int isMomirUnlocked(); + int isStoneHewerUnlocked(); + int isHermitUnlocked(); int isEvilTwinUnlocked(); int isRandomDeckUnlocked(); int IsMoreAIDecksUnlocked(DeckStats * stats); diff --git a/projects/mtg/include/Damage.h b/projects/mtg/include/Damage.h index 66e78d867..650f00ea3 100644 --- a/projects/mtg/include/Damage.h +++ b/projects/mtg/include/Damage.h @@ -23,6 +23,7 @@ class Damageable:public Targetable protected: public: int life; + int handsize; int poisonCount; int damageCount; int preventable; diff --git a/projects/mtg/include/GameApp.h b/projects/mtg/include/GameApp.h index c4ee2caf5..ea5e9d4c8 100644 --- a/projects/mtg/include/GameApp.h +++ b/projects/mtg/include/GameApp.h @@ -45,6 +45,9 @@ enum GAME_TYPE_RANDOM2, GAME_TYPE_STORY, GAME_TYPE_DEMO, + GAME_TYPE_STONEHEWER, + GAME_TYPE_HERMIT, + #ifdef NETWORK_SUPPORT GAME_TYPE_SLAVE, #endif //NETWORK_SUPPORT diff --git a/projects/mtg/include/GameOptions.h b/projects/mtg/include/GameOptions.h index 8265052ff..7fe3b8919 100644 --- a/projects/mtg/include/GameOptions.h +++ b/projects/mtg/include/GameOptions.h @@ -82,6 +82,8 @@ public: BEGIN_AWARDS, //Options after this use the GameOptionAward struct, which includes a timestamp. DIFFICULTY_MODE_UNLOCKED = BEGIN_AWARDS, MOMIR_MODE_UNLOCKED, + STONEHEWER_MODE_UNLOCKED, + HERMIT_MODE_UNLOCKED, EVILTWIN_MODE_UNLOCKED, RANDOMDECK_MODE_UNLOCKED, AWARD_COLLECTOR, diff --git a/projects/mtg/include/MTGRules.h b/projects/mtg/include/MTGRules.h index 22059d5d7..7b19e16fd 100644 --- a/projects/mtg/include/MTGRules.h +++ b/projects/mtg/include/MTGRules.h @@ -342,6 +342,47 @@ public: virtual MTGMomirRule * clone() const; }; +//stone hewer gaint avatar mode +class MTGStoneHewerRule: public MTGAbility +{ +private: + int genRandomEquipId(int convertedCost); + static vector pool[20]; + static int initialized; + + int textAlpha; + string text; +public: + + int alreadyplayed; + MTGAllCards * collection; + MTGCardInstance * genEquip(int id); + int testDestroy(); + void Update(float dt); + void Render(); + MTGStoneHewerRule(int _id, MTGAllCards * _collection); + int receiveEvent(WEvent * event); + const char * getMenuText() + { + return "Stone Hewer"; + } + virtual ostream& toString(ostream& out) const; + virtual MTGStoneHewerRule * clone() const; +}; +//Hermit Druid avatar mode +class MTGHermitRule: public MTGAbility +{ +public: + int testDestroy(); + MTGHermitRule(int _id); + int receiveEvent(WEvent * event); + const char * getMenuText() + { + return "Hermit"; + } + virtual MTGHermitRule * clone() const; +}; +// /* LifeLink */ class MTGLifelinkRule: public MTGAbility { diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index 6d28b1571..344a0882a 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -927,13 +927,17 @@ int AIPlayer::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCardInst if (!tc) return 0; - if (tc->source->controller() != this) - { - DebugTrace("AIPLAYER: Error, was asked to chose targets but I don't own the source of the targetController\n"); - return 0; - } - //Make sure we own the decision to choose the targets - assert(tc->source->controller() == this); + //Make sure we own the decision to choose the targets + assert(tc->source->controller() == this); + if (tc->source->controller() != this) + { + gameObs->currentActionPlayer = tc->source->controller(); + //this is a hack, but if we hit this condition we are locked in a infinate loop + //so lets give the tc to its owner + //todo:find the root cause of this. + DebugTrace("AIPLAYER: Error, was asked to chose targets but I don't own the source of the targetController\n"); + return 0; + } tc->initTargets(); //cleanup the targetchooser just in case. if (!(gameObs->currentlyActing() == this)) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 2c78f1dbe..620582b71 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1352,6 +1352,45 @@ AALifer * AALifer::clone() const } +//players max hand size +AASetHand::AASetHand(int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost, + int who) : + ActivatedAbilityTP(_id, _source, _target, _cost, who), hand(hand) +{ +} + +int AASetHand::resolve() +{ + Damageable * _target = (Damageable *) getTarget(); + if (!_target) + return 0; + + Player * p = NULL; + if (_target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE) + { + p = ((MTGCardInstance *) _target)->controller(); + } + else + { + p = (Player*)_target; + } + + p->handsize = hand; + + return 1; +} + +const char * AASetHand::getMenuText() +{ + return "Set Hand Size"; +} + +AASetHand * AASetHand::clone() const +{ + AASetHand * a = NEW AASetHand(*this); + a->isClone = 1; + return a; +} //Lifeset AALifeSet::AALifeSet(int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost, diff --git a/projects/mtg/src/Credits.cpp b/projects/mtg/src/Credits.cpp index a07e5f6c8..4f891af12 100644 --- a/projects/mtg/src/Credits.cpp +++ b/projects/mtg/src/Credits.cpp @@ -132,6 +132,20 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app) goa->giveAward(); options.save(); } + else if ((unlocked = isStoneHewerUnlocked())) + { + unlockedTextureName = "stonehewer_unlocked.png"; + goa = (GameOptionAward*) &options[Options::STONEHEWER_MODE_UNLOCKED]; + goa->giveAward(); + options.save(); + } + else if ((unlocked = isHermitUnlocked())) + { + unlockedTextureName = "hermit_unlocked.png"; + goa = (GameOptionAward*) &options[Options::HERMIT_MODE_UNLOCKED]; + goa->giveAward(); + options.save(); + } else if ((unlocked = isEvilTwinUnlocked())) { unlockedTextureName = "eviltwin_unlocked.png"; @@ -338,6 +352,24 @@ int Credits::isMomirUnlocked() return 0; } +int Credits::isStoneHewerUnlocked() +{ + if (options[Options::STONEHEWER_MODE_UNLOCKED].number) + return 0; + if (int(p1->game->inPlay->countByType("equipment") + p1->opponent()->game->inPlay->countByType("equipment")) > 10) + return 1; + return 0; +} + +int Credits::isHermitUnlocked() +{ + if (options[Options::HERMIT_MODE_UNLOCKED].number) + return 0; + if (int(p1->game->inPlay->countByType("land")) < 10) + return 1; + return 0; +} + int Credits::isEvilTwinUnlocked() { if (options[Options::EVILTWIN_MODE_UNLOCKED].number) diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 3e24d6017..e5a690ccf 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -125,7 +125,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 && currentPlayer->nomaxhandsize == false) + while (currentPlayer->game->hand->nb_cards > currentPlayer->handsize && currentPlayer->nomaxhandsize == false) { WEvent * e = NEW WEventCardDiscard(currentPlayer->game->hand->cards[0]); GameObserver * game = GameObserver::GetInstance(); @@ -937,7 +937,7 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object) //Current player's hand if (currentPlayer->game->hand->hasCard(card) && currentGamePhase == Constants::MTG_PHASE_CLEANUP - && currentPlayer->game->hand->nb_cards > 7 && currentPlayer->nomaxhandsize == false) + && currentPlayer->game->hand->nb_cards > currentPlayer->handsize && currentPlayer->nomaxhandsize == false) { WEvent * e = NEW WEventCardDiscard(currentPlayer->game->hand->cards[0]); GameObserver * game = GameObserver::GetInstance(); diff --git a/projects/mtg/src/GameOptions.cpp b/projects/mtg/src/GameOptions.cpp index 0adcc7ca8..0c75280ac 100644 --- a/projects/mtg/src/GameOptions.cpp +++ b/projects/mtg/src/GameOptions.cpp @@ -68,6 +68,8 @@ const string Options::optionNames[] = { //Unlocked modes "prx_handler", "prx_rimom", + "prx_rewehenots", + "prx_timreh", "prx_eviltwin", "prx_rnddeck", "aw_collector", diff --git a/projects/mtg/src/GameStateAwards.cpp b/projects/mtg/src/GameStateAwards.cpp index 4ed0153fb..98dd1c2b7 100644 --- a/projects/mtg/src/GameStateAwards.cpp +++ b/projects/mtg/src/GameStateAwards.cpp @@ -71,6 +71,14 @@ void GameStateAwards::Start() btn = NEW WGuiButton(aw, -103, Options::MOMIR_MODE_UNLOCKED, this); listview->Add(btn); + aw = NEW WGuiAward(Options::STONEHEWER_MODE_UNLOCKED, "Stone Hewer Mode", "Won with more than 10 equipments."); + btn = NEW WGuiButton(aw, -103, Options::STONEHEWER_MODE_UNLOCKED, this); + listview->Add(btn); + + aw = NEW WGuiAward(Options::HERMIT_MODE_UNLOCKED, "Hermit Druid Mode", "Won with less than 10 lands."); + btn = NEW WGuiButton(aw, -103, Options::HERMIT_MODE_UNLOCKED, this); + listview->Add(btn); + aw = NEW WGuiAward(Options::EVILTWIN_MODE_UNLOCKED, "Evil Twin Mode", "Won with same army size."); btn = NEW WGuiButton(aw, -103, Options::EVILTWIN_MODE_UNLOCKED, this); listview->Add(btn); diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index 78c0e790f..0e0d5a9ef 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -419,6 +419,14 @@ void GameStateDuel::Update(float dt) { game->addObserver(NEW MTGMomirRule(-1, MTGCollection())); } + if (mParent->gameType == GAME_TYPE_STONEHEWER) + { + game->addObserver(NEW MTGStoneHewerRule(-1,MTGCollection())); + } + if (mParent->gameType == GAME_TYPE_HERMIT) + { + game->addObserver(NEW MTGHermitRule(-1)); + } //start of in game music code musictrack = ""; @@ -611,7 +619,8 @@ void GameStateDuel::Render() #ifdef NETWORK_SUPPORT && mParent->gameType != GAME_TYPE_SLAVE #endif //NETWORK_SUPPORT - ) + && mParent->gameType != GAME_TYPE_STONEHEWER + && mParent->gameType != GAME_TYPE_HERMIT) mFont->DrawString(_("LOADING DECKS").c_str(), 0, SCREEN_HEIGHT / 2); else { diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index db0d65804..77ced822b 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -210,6 +210,8 @@ void GameStateMenu::fillScroller() scroller->Add(_("Unlock the difficult mode for more challenging duels!")); if (!options[Options::MOMIR_MODE_UNLOCKED].number) scroller->Add(_("Interested in playing Momir Basic? You'll have to unlock it first :)")); + if (!options[Options::STONEHEWER_MODE_UNLOCKED].number) + scroller->Add(_("Love Equipment and want a real challenge? Unlock Stone Hewer Basic:)")); if (!options[Options::RANDOMDECK_MODE_UNLOCKED].number) scroller->Add(_("You haven't unlocked the random deck mode yet")); if (!options[Options::EVILTWIN_MODE_UNLOCKED].number) diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 563bdbca2..9d7e45873 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1726,6 +1726,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG return a; } + //set hand size + vector splitSetHand = parseBetween(s, "sethand:", " ", false); + if (splitSetHand.size()) + { + int hand = atoi(splitSetHand[1].c_str()); + Damageable * t = spell ? spell->getNextDamageableTarget() : NULL; + MTGAbility * a = NEW AASetHand(id, card, t, hand, NULL, who); + a->oneShot = 1; + return a; + } + //set life total vector splitLifeset = parseBetween(s, "lifeset:", " ", false); if (splitLifeset.size()) diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 053ca641d..18d0e0092 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -5,6 +5,7 @@ #include "Translate.h" #include "Subtypes.h" #include "Credits.h" +#include "AllAbilities.h" MTGEventBonus::MTGEventBonus(int _id) : MTGAbility(_id,NULL) @@ -1629,6 +1630,199 @@ MTGMomirRule * MTGMomirRule::clone() const return a; } +//stone hewer game mode +//in stonehewer when ever a creature enters the battlefield +//it enters play with a equipment choosen at random with a converted manacost +//less than or equal to the creature. +//note this can kill your creature if the equipment contains negitive toughness + +int MTGStoneHewerRule::initialized = 0; +vector MTGStoneHewerRule::pool[20]; + +MTGStoneHewerRule::MTGStoneHewerRule(int _id, MTGAllCards * _collection) : +MTGAbility(_id, NULL) +{ + collection = _collection; + if (!initialized) + { + for (size_t i = 0; i < collection->ids.size(); i++) + { + MTGCard * card = collection->collection[collection->ids[i]]; + if (card->data->hasSubtype("equipment") && (card->getRarity() != Constants::RARITY_T) && //remove tokens + card->setId != MTGSets::INTERNAL_SET //remove cards that are defined in primitives. Those are workarounds (usually tokens) and should only be used internally + ) + { + int convertedCost = card->data->getManaCost()->getConvertedCost(); + if (convertedCost > 20) + continue; + pool[convertedCost].push_back(card->getMTGId()); + } + } + initialized = 1; + } + alreadyplayed = 0; + textAlpha = 0; +} + +int MTGStoneHewerRule::receiveEvent(WEvent * event) +{ + WEventZoneChange * e = (WEventZoneChange *) event; + if (e->to == game->currentlyActing()->game->inPlay && e->card->isCreature()) + { + int eId = genRandomEquipId(e->card->getManaCost()->getConvertedCost()); + MTGCardInstance * card = genEquip(eId); + if(card) + { + game->currentlyActing()->game->temp->addCard(card); + Spell * spell = NEW Spell(card); + spell->resolve(); + spell->source->isToken = 1; + + GameObserver * g = g->GetInstance(); + for (int i = 1; i < g->mLayers->actionLayer()->mCount; i++) + { + MTGAbility * a = ((MTGAbility *) g->mLayers->actionLayer()->mObjects[i]); + AEquip * eq = dynamic_cast (a); + if (eq && eq->source == spell->source) + { + ((AEquip*)a)->unequip(); + ((AEquip*)a)->equip(e->card); + } + } + + alreadyplayed = 1; + textAlpha = 255; + text = "equipment";//for some reason if i don't set this to something it runs the risk of a string based crash. + text = spell->source->name; + SAFE_DELETE(spell); + } + return 1; + } + return 0; +} + +MTGCardInstance * MTGStoneHewerRule::genEquip(int id) +{ + if (!id) + return NULL; + Player * p = game->currentlyActing(); + MTGCard * card = collection->getCardById(id); + return NEW MTGCardInstance(card, p->game); +} + +int MTGStoneHewerRule::genRandomEquipId(int convertedCost) +{ + if (convertedCost >= 20) + convertedCost = 19; + int total_cards = 0; + int i = (WRand() % int(convertedCost+1));//+1 becuase we want to generate a random "<=" the coverted. + while (!total_cards && i >= 0) + { + DebugTrace("Converted Cost in Stone Hewer: " << i); + total_cards = pool[i].size(); + convertedCost = i; + i--; + } + if (!total_cards) + return 0; + int start = (WRand() % total_cards); + return pool[convertedCost][start]; +} + +//The StoneHewer is never destroyed +int MTGStoneHewerRule::testDestroy() +{ + return 0; +} + +void MTGStoneHewerRule::Update(float dt) +{ + if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP) + { + alreadyplayed = 0; + } + if (textAlpha) + { + textAlpha -= static_cast (200 * dt); + if (textAlpha < 0) + textAlpha = 0; + } + MTGAbility::Update(dt); +} + +void MTGStoneHewerRule::Render() +{ + if (!textAlpha) + return; + WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT); + mFont->SetScale(2 - (float) textAlpha / 130); + mFont->SetColor(ARGB(textAlpha,255,255,255)); + mFont->DrawString(text.c_str(), SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, JGETEXT_CENTER); +} + +ostream& MTGStoneHewerRule::toString(ostream& out) const +{ + out << "MTGStoneHewerRule ::: pool : " << pool << " ; initialized : " << initialized << " ; textAlpha : " << textAlpha + << " ; text " << text << " ; alreadyplayed : " << alreadyplayed + << " ; collection : " << collection << "("; + return MTGAbility::toString(out) << ")"; +} + +MTGStoneHewerRule * MTGStoneHewerRule::clone() const +{ + MTGStoneHewerRule * a = NEW MTGStoneHewerRule(*this); + a->isClone = 1; + return a; +} + +//------------------ +//Hermit druid mode places a random land from your deck into play during each of your upkeeps +MTGHermitRule::MTGHermitRule(int _id) : +MTGAbility(_id, NULL) +{ +} + +int MTGHermitRule::receiveEvent(WEvent * event) +{ + WEventPhaseChange * e = dynamic_cast(event); + if (e && e->from->id == Constants::MTG_PHASE_UNTAP) + { + MTGCardInstance * lcard = NULL; + vectorlands = vector(); + for(int i = 0; i < game->currentPlayer->game->library->nb_cards-1; i++) + { + MTGCardInstance * temp = game->currentPlayer->game->library->cards[i]; + if(temp && temp->isLand()) + lands.push_back(temp); + } + if(lands.size()) + lcard = lands[WRand() % lands.size()]; + if(lcard) + { + MTGCardInstance * copy = game->currentPlayer->game->putInZone(lcard,game->currentPlayer->game->library, game->currentPlayer->game->temp); + Spell * spell = NEW Spell(copy); + spell->resolve(); + delete spell; + } + return 1; + } + return 0; +} + +//The hermit is never destroyed +int MTGHermitRule::testDestroy() +{ + return 0; +} + +MTGHermitRule * MTGHermitRule::clone() const +{ + MTGHermitRule * a = NEW MTGHermitRule(*this); + a->isClone = 1; + return a; +} +//-------------------- + //HUDDisplay int HUDDisplay::testDestroy() { diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index 63607df47..5c0678002 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -14,6 +14,7 @@ Damageable(20) game = NULL; deckFile = file; deckFileSmall = fileSmall; + handsize = 0; manaPool = NEW ManaPool(this); nomaxhandsize = false; poisonCount = 0; diff --git a/projects/mtg/src/Rules.cpp b/projects/mtg/src/Rules.cpp index 5815c1e00..e5314fcae 100644 --- a/projects/mtg/src/Rules.cpp +++ b/projects/mtg/src/Rules.cpp @@ -579,7 +579,7 @@ Rules::Rules(string _bg) bool Rules::canChooseDeck() { - return (gamemode == GAME_TYPE_CLASSIC); + return (gamemode == GAME_TYPE_CLASSIC || gamemode == GAME_TYPE_STONEHEWER || gamemode == GAME_TYPE_HERMIT); } int Rules::load(string _filename) @@ -697,5 +697,7 @@ int Rules::strToGameMode(string s) if (s.compare("random1") == 0) return GAME_TYPE_RANDOM1; if (s.compare("random2") == 0) return GAME_TYPE_RANDOM2; if (s.compare("story") == 0) return GAME_TYPE_STORY; + if (s.compare("stonehewer") == 0) return GAME_TYPE_STONEHEWER; + if (s.compare("hermit") == 0) return GAME_TYPE_HERMIT; return GAME_TYPE_CLASSIC; } diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index f5a158b47..f283cc282 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -935,6 +935,7 @@ bool TypeTargetChooser::canTarget(Targetable * target,bool withoutProtections) MTGCardInstance * card = (MTGCardInstance *) target; for (int i = 0; i < nbtypes; i++) { + if (card->hasSubtype(types[i])) return true; if(card->getLCName().size()) {