diff --git a/projects/mtg/bin/Res/sets/CHK/_cards.dat b/projects/mtg/bin/Res/sets/CHK/_cards.dat index 616c6ae1b..73caad342 100644 --- a/projects/mtg/bin/Res/sets/CHK/_cards.dat +++ b/projects/mtg/bin/Res/sets/CHK/_cards.dat @@ -62,7 +62,7 @@ rarity=R [/card] [card] id=77925 -id=129767 +alias=129767 target=creature[-legendary] auto=haste auto=untap diff --git a/projects/mtg/bin/Res/sets/MRQ/_cards.dat b/projects/mtg/bin/Res/sets/MRQ/_cards.dat index 4a41a4e28..086f7ebe1 100644 --- a/projects/mtg/bin/Res/sets/MRQ/_cards.dat +++ b/projects/mtg/bin/Res/sets/MRQ/_cards.dat @@ -149,15 +149,6 @@ mana={1}{G}{G} type=Enchantment [/card] [card] -text=Whenever a creature attacks you, it gets -1/-0 until end of turn. -id=19745 -name=Briar Patch -auto=lord(creature[attacking]|opponentinplay) -1/0 -rarity=U -type=Enchantment -mana={1}{G}{G} -[/card] -[card] text=Search target opponent's library for a creature card and put that card into play under your control. Then that player shuffles his or her library. target=creature|opponentLibrary auto=moveTo(myInplay) diff --git a/projects/mtg/bin/Res/sets/RV/_cards.dat b/projects/mtg/bin/Res/sets/RV/_cards.dat index d6795a1b5..15935cdf1 100644 --- a/projects/mtg/bin/Res/sets/RV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RV/_cards.dat @@ -198,6 +198,7 @@ mana={1} [card] text=Enchant creature Enchanted creature has protection from black. This effect doesn't remove Black Ward. target=creature +auto=protection from black id=1331 name=Black Ward rarity=U @@ -227,6 +228,7 @@ mana={U} [card] text=Enchant creature Enchanted creature has protection from blue. This effect doesn't remove Blue Ward. target=creature +auto=protection from blue id=1333 name=Blue Ward rarity=U @@ -945,6 +947,7 @@ toughness=2 [card] text=Enchant creature Enchanted creature has protection from green. This effect doesn't remove Green Ward. target=creature +auto=protection from green id=1346 name=Green Ward rarity=U @@ -1753,6 +1756,7 @@ mana={R} [card] text=Enchant creature Enchanted creature has protection from red. This effect doesn't remove Red Ward. target=creature +auto=protection from red id=1359 name=Red Ward rarity=U @@ -2526,6 +2530,7 @@ toughness=2 [card] text=Enchant creature Enchanted creature has protection from white. This effect doesn't remove White Ward. target=creature +auto=protection from white id=1371 name=White Ward rarity=U diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 1722e8b37..686bdde54 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1251,44 +1251,6 @@ class AStandardRegenerate:public ActivatedAbility{ } }; -/*Gives protection to a target */ -class AProtectionFrom:public MTGAbility{ - public: - CardDescriptor * cd; - void initProtection(){ - ((MTGCardInstance *)target)->addProtection(cd); - } - - AProtectionFrom(int _id, MTGCardInstance * _source, MTGCardInstance * _target, CardDescriptor * _cd):MTGAbility(_id, _source, _target),cd(_cd){ - initProtection(); - } - AProtectionFrom(int _id, MTGCardInstance * _source, MTGCardInstance * _target, int color):MTGAbility(_id, _source, _target){ - cd = NEW CardDescriptor(); - cd->colors[color] = 1; - initProtection(); - } - - int destroy(){ - ((MTGCardInstance *)target)->removeProtection(cd); - return 1; - } - - ~AProtectionFrom(){ - delete(cd); - } - - virtual ostream& toString(ostream& out) const - { - out << "AProtectionFrom ::: cd : " << cd - << " ("; - return MTGAbility::toString(out) << ")"; - } - AProtectionFrom * clone() const{ - AProtectionFrom * a = NEW AProtectionFrom(*this); - a->isClone = 1; - return a; - } -}; //Aura Enchantments that provide controller of target life or damages at a given phase of their turn class ARegularLifeModifierAura:public MTGAbility{ diff --git a/projects/mtg/src/DuelLayers.cpp b/projects/mtg/src/DuelLayers.cpp index 8f5dbba14..dd40464cd 100644 --- a/projects/mtg/src/DuelLayers.cpp +++ b/projects/mtg/src/DuelLayers.cpp @@ -34,7 +34,7 @@ void DuelLayers::init(){ //3 Game MTGGuiPlay * play = NEW MTGGuiPlay(4, GameObserver::GetInstance()); - Add(NEW GuiPhaseBar(GameObserver::GetInstance())); + //Add(NEW GuiPhaseBar(GameObserver::GetInstance())); Add(mActionStack); Add(mDamageResolver); Add(actionLayer); @@ -44,22 +44,22 @@ void DuelLayers::init(){ ActionStack * DuelLayers::stackLayer(){ - return ((ActionStack *) (objects[1])); + return ((ActionStack *) (objects[0])); } DamageResolverLayer * DuelLayers::combatLayer(){ - return ((DamageResolverLayer *) (objects[2])); + return ((DamageResolverLayer *) (objects[1])); } ActionLayer * DuelLayers::actionLayer(){ - return ((ActionLayer *) (objects[3])); + return ((ActionLayer *) (objects[2])); } MTGGuiHand * DuelLayers::handLayer(){ - return ((MTGGuiHand *) (objects[4])); + return ((MTGGuiHand *) (objects[3])); } MTGGuiPlay * DuelLayers::playLayer(){ - return ((MTGGuiPlay *) (objects[5])); + return ((MTGGuiPlay *) (objects[4])); } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 852ae52a4..193342711 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1409,31 +1409,11 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } break; } - case 1331: //Black Ward - { - game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_BLACK)); - break; - } - case 1333: //Blue Ward - { - game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_BLUE)); - break; - } case 1238: //Cockatrice { game->addObserver(NEW AOldSchoolDeathtouch(_id,card)); break; } - case 1346: //Green Ward - { - game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_GREEN)); - break; - } - case 1359: //Red Ward - { - game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_RED)); - break; - } case 1362: //Reverse polarity { ActionStack * as = game->mLayers->stackLayer(); @@ -1475,11 +1455,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } break; } - case 1371: //White Ward - { - game->addObserver(NEW AProtectionFrom( _id,card, card->target, Constants::MTG_COLOR_WHITE)); - break; - } //Addons Legends case 1427: //Abomination (does not work make the game crash) @@ -1762,29 +1737,18 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ - /* Erwan - 2008/11/13: We want to get rid of these basicAbility things. + /* We want to get rid of these basicAbility things. * basicAbilities themselves are alright, but creating new object depending on them is dangerous * The main reason is that classes that add an ability to a card do NOT create these objects, and therefore do NOT * Work. - * For example, setting LIFELINK for a creature is not enough right now... + * For example, setting EXALTED for a creature is not enough right now... * It shouldn't be necessary to add an object. State based abilities could do the trick */ - - for (int i=Constants::PROTECTIONGREEN; i <= Constants::PROTECTIONWHITE; i++){ - if (card->basicAbilities[i]){ - game->addObserver(NEW AProtectionFrom(_id, card, card, i - Constants::PROTECTIONGREEN + Constants::MTG_COLOR_GREEN)); - } - } - if (card->basicAbilities[Constants::EXALTED]){ game->addObserver(NEW AExalted(_id, card)); } - if (card->basicAbilities[Constants::DOESNOTUNTAP]){ - game->addObserver(NEW UntapBlocker(_id, card)); - } - // Tested works the first r10 did not function because of the mistake in the array of the definition if (card->basicAbilities[Constants::FORESTHOME]){ game->addObserver(NEW AStrongLandLinkCreature(_id, card, "forest")); diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 25107a442..3d9a0f18d 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -567,6 +567,12 @@ int MTGCardInstance::removeProtection(CardDescriptor * cd, int erase){ } int MTGCardInstance::protectedAgainst(MTGCardInstance * card){ + //Basic protections + for (int i=Constants::PROTECTIONGREEN; i <= Constants::PROTECTIONWHITE; i++){ + if (basicAbilities[i] && card->hasColor( i - Constants::PROTECTIONGREEN + Constants::MTG_COLOR_GREEN )) return 1; + } + + //General protections for (int i = 0; i < nbprotections ; i++){ if (protections[i]->match(card)) return 1; } diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 88ebc9ca4..86472a13e 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -369,14 +369,10 @@ MTGCardInstance * MTGInPlay::getNextAttacker(MTGCardInstance * previous){ void MTGInPlay::untapAll(){ int i; for (i = 0; i < nb_cards; i ++){ - cards[i]->setUntapping(); - if (cards[i]->getUntapBlockers()->isEmpty()){ -#if defined (WIN32) || defined (LINUX) - char buf[4096]; - sprintf(buf, "Can untap %s\n", cards[i]->getName()); - OutputDebugString(buf); -#endif - cards[i]->attemptUntap(); + MTGCardInstance * card = cards[i]; + card->setUntapping(); + if (!card->basicAbilities[Constants::DOESNOTUNTAP] && card->getUntapBlockers()->isEmpty()){ + card->attemptUntap(); } } }