diff --git a/projects/mtg/bin/Res/sets/ARN/_cards.dat b/projects/mtg/bin/Res/sets/ARN/_cards.dat index 74117e956..e9c9c63b1 100644 --- a/projects/mtg/bin/Res/sets/ARN/_cards.dat +++ b/projects/mtg/bin/Res/sets/ARN/_cards.dat @@ -79,7 +79,7 @@ rarity=U mana={1} type=Artifact Creature subtype=Construct -auto={1}:untap +auto={1}:untap myUpkeepOnly power=1 toughness=3 abilities=doesnotuntap diff --git a/projects/mtg/bin/Res/sets/RV/_cards.dat b/projects/mtg/bin/Res/sets/RV/_cards.dat index 6aaad2356..d3d24a37f 100644 --- a/projects/mtg/bin/Res/sets/RV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RV/_cards.dat @@ -251,7 +251,7 @@ type=Sorcery [card] text=Brass Man doesn't untap during your untap step. At the beginning of your upkeep, you may pay {1}. If you do, untap Brass Man. id=1099 -auto={1}:untap myTurnOnly +auto={1}:untap myUpkeepOnly name=Brass Man rarity=U mana={1} diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index fe9ff40c3..b7e704604 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -116,6 +116,7 @@ borderland_behemoth.txt bottle_gnomes.txt bottle_gnomes2.txt brass_man.txt +brass_man_i161.txt cage_of_hands.txt Call_to_Heel_1.txt Call_to_Heel_2.txt diff --git a/projects/mtg/bin/Res/test/bugs/brass_man_i161.txt b/projects/mtg/bin/Res/test/brass_man_i161.txt similarity index 51% rename from projects/mtg/bin/Res/test/bugs/brass_man_i161.txt rename to projects/mtg/bin/Res/test/brass_man_i161.txt index 4f6e9ebfc..80f7ad0c3 100644 --- a/projects/mtg/bin/Res/test/bugs/brass_man_i161.txt +++ b/projects/mtg/bin/Res/test/brass_man_i161.txt @@ -1,13 +1,9 @@ #NAME: Brass Man untapping #DESC: Brass Man can untap outside of Upkeep. -#DESC: To test this, we try to untap him in -#DESC: secondmain and then cast Assassinate -#DESC: on him (which should destroy him if -#DESC: he's still tapped, which he should be). [INIT] combatattackers [PLAYER1] -inplay:Brass Man,Island,Swamp,Plains,Forest +inplay:Brass Man,Swamp,Plains,Forest hand:Assassinate [PLAYER2] life:20 @@ -17,10 +13,9 @@ next next next next -Island +Swamp Brass Man choice 0 -Swamp Plains Forest Assassinate @@ -28,8 +23,7 @@ Brass Man [ASSERT] secondmain [PLAYER1] -inplay:Island,Swamp,Plains,Forest -hand: +inplay:Swamp,Plains,Forest graveyard:Brass Man,Assassinate [PLAYER2] life:19 diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index 9d249fee6..525417b13 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -103,7 +103,22 @@ class ActivatedAbility:public MTGAbility{ enum { NO_RESTRICTION = 0, PLAYER_TURN_ONLY = 1, - AS_SORCERY = 2 + AS_SORCERY = 2, + MY_BEFORE_BEGIN = 3, + MY_UNTAP = 4, + MY_UPKEEP = 5, + MY_DRAW = 6, + MY_FIRSTMAIN = 7, + MY_COMBATBEGIN = 8, + MY_COMBATATTACKERS = 9, + MY_COMBATBLOCKERS = 10, + MY_COMBATDAMAGE = 11, + MY_COMBATEND = 12, + MY_SECONDMAIN = 13, + MY_ENDOFTURN = 14, + MY_EOT = 15, + MY_CLEANUP = 16, + MY_AFTER_EOT = 17, }; int restrictions; int needsTapping; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 4da61af11..400f09cbd 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -146,6 +146,19 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell int AbilityFactory::parseRestriction(string s){ if (s.find("myturnonly") != string::npos) return ActivatedAbility::PLAYER_TURN_ONLY; if (s.find("assorcery") != string::npos) return ActivatedAbility::AS_SORCERY; + + size_t found = s.find("my"); + if (found !=string::npos){ + for (int i = 0; i < Constants::NB_MTG_PHASES; i++){ + string toFind = "my"; + toFind.append(Constants::MTGPhaseCodeNames[i]).append("only"); + found = s.find(toFind); + if (found != string::npos){ + return ActivatedAbility::MY_BEFORE_BEGIN + i; + } + } + } + return ActivatedAbility::NO_RESTRICTION; } @@ -1722,6 +1735,10 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana) if (cPhase != Constants::MTG_PHASE_FIRSTMAIN && cPhase != Constants::MTG_PHASE_SECONDMAIN) return 0; break; } + if (restrictions>= MY_BEFORE_BEGIN && restrictions <= MY_AFTER_EOT){ + if (player != game->currentPlayer) return 0; + if (cPhase != restrictions - MY_BEFORE_BEGIN + Constants::MTG_PHASE_BEFORE_BEGIN) return 0; + } if (card == source && source->controller()==player && (!needsTapping || (!source->isTapped() && !source->hasSummoningSickness()))){ if (!cost) return 1;