diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 749f8cfc8..9846b9f5c 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -1962,7 +1962,7 @@ toughness=1 [/card] [card] name=Arc-Slogger -auto={R}{z}{z}{z}{z}{z}{z}{z}{z}{z}{z}:damage:2 target(creature,player) +auto={R}{l2e}{l2e}{l2e}{l2e}{l2e}{l2e}{l2e}{l2e}{l2e}{l2e}:damage:2 target(creature,player) text={R}, Exile the top ten cards of your library: Arc-Slogger deals 2 damage to target creature or player. mana={3}{R}{R} type=Creature @@ -24387,7 +24387,7 @@ name=Imperial Mask text=When Imperial Mask enters the battlefield, if it's not a token, each of your teammates puts a token that's a copy of Imperial Mask onto the battlefield. -- You can't be the target of spells or abilities your opponents control. mana={4}{W} type=Enchantment -subtype=controllershroud +abilities=controllershroud [/card] [card] name=Imperial Recruiter @@ -25229,7 +25229,7 @@ name=Ivory Mask text=You have shroud. (You can't be the target of spells or abilities.) mana={2}{W}{W} type=Enchantment -subtype=playershroud +abilities=playershroud [/card] [card] name=Ivory Tower @@ -28634,7 +28634,7 @@ toughness=3 [/card] [card] name=Leashling -auto={q(*|myhand)}:moveTo(myhand) +auto={4l(*|myhand)}:moveTo(myhand) text=Put a card in your hand on top of your library: Return Leashling to its owner's hand. mana={6} type=Artifact Creature @@ -28827,7 +28827,7 @@ auto=all(*[-land]|myhand) flash text=If Leyline of Anticipation is in your opening hand, you may begin the game with it on the battlefield. -- You may cast nonland cards as though they had flash. (You may cast them any time you could cast an instant.) mana={u}{u}{2} type=enchantment -subtype=leyline +abilities=leyline [/card] [card] name=Leyline of the Meek @@ -28835,7 +28835,7 @@ auto=lord(*[token]) 1/1 text=If Leyline of the Meek is in your opening hand, you may begin the game with it on the battlefield. -- Creature tokens get +1/+1. mana={w}{w}{2} type=enchantment -subtype=leyline +abilities=leyline [/card] [card] name=Leyline of Vitality @@ -28844,14 +28844,14 @@ auto=@movedTo(creature|mybattlefield):life:1 text=If Leyline of Vitality is in your opening hand, you may begin the game with it on the battlefield. -- Creatures you control get +0/+1. -- Whenever a creature enters the battlefield under your control, you gain 1 life. mana={2}{G}{G} type=Enchantment -subtype=Leyline +abilities=leyline [/card] [card] name=Leyline of Sanctity text=If Leyline of Sanctity is in your opening hand, you may begin the game with it on the battlefield. -- You can't be the target of spells or abilities your opponents control. mana={2}{W}{W} type=Enchantment -subtype=Leyline controllershroud +abilities=leyline,controllershroud [/card] [card] name=Leyline of Singularity @@ -28859,7 +28859,7 @@ auto=lord(*[-land]) transforms(Legendary) text=If Leyline of Singularity is in your opening hand, you may begin the game with it on the battlefield. -- All nonland permanents are legendary. mana={2}{U}{U} type=Enchantment -subtype=Leyline +abilities=leyline [/card] [card] name=Leyline of the Void @@ -28867,7 +28867,7 @@ auto=@movedTo(*|graveyard):all(trigger) moveTo(exile) text=If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield. -- If a card would be put into an opponent's graveyard from anywhere, exile it instead. mana={2}{B}{B} type=Enchantment -subtype=Leyline +abilities=leyline [/card] [card] name=Lhurgoyf @@ -41867,7 +41867,7 @@ toughness=1 [/card] [card] name=Royal Herbalist -auto={2}{Z}:life:1 +auto={2}{l2e}:life:1 text={2}, Exile the top card of your library: You gain 1 life. mana={W} type=Creature @@ -48158,11 +48158,11 @@ toughness=1 [/card] [card] name=Spirit of the Hearth -abilities=flying +abilities=flying,controllershroud text=Flying -- You can't be the target of spells or abilities your opponents control. mana={4}{W}{W} type=Creature -subtype=Cat Spirit controllershroud +subtype=Cat Spirit power=4 toughness=5 [/card] @@ -54106,7 +54106,8 @@ name=True Believer text=You have shroud. (You can't be the target of spells or abilities.) mana={W}{W} type=Creature -subtype=Human Cleric playershroud +subtype=Human Cleric +abilities=playershroud power=2 toughness=2 [/card] @@ -58097,7 +58098,7 @@ toughness=3 [/card] [card] name=Whirling Catapult -auto={2}{Z}{Z}:damage:1 all(creature[flying]) && damage:1 all(player) +auto={2}{l2e}{l2e}:damage:1 all(creature[flying]) && damage:1 all(player) text={2}, Exile the top two cards of your library: Whirling Catapult deals 1 damage to each creature with flying and each player. mana={4} type=Artifact diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index c13f6116d..4572f560b 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -103,38 +103,41 @@ class Constants HORSEMANSHIP = 45, CANTREGEN = 46, ONEBLOCKER = 47, - INFECT = 48, - POISONTOXIC = 49, - POISONTWOTOXIC = 50, - POISONTHREETOXIC = 51, - PHANTOM = 52, - WILTING = 53, - VIGOR = 54, - CHANGELING = 55, - ABSORB = 56,//this need to be coded for players too "If a source would deal damage" - TREASON = 57, - UNEARTH = 58, - CANTLOSE = 59, - CANTLIFELOSE = 60, - CANTMILLLOSE = 61, + INFECT = 48, + POISONTOXIC = 49, + POISONTWOTOXIC = 50, + POISONTHREETOXIC = 51, + PHANTOM = 52, + WILTING = 53, + VIGOR = 54, + CHANGELING = 55, + ABSORB = 56,//this need to be coded for players too "If a source would deal damage" + TREASON = 57, + UNEARTH = 58, + CANTLOSE = 59, + CANTLIFELOSE = 60, + CANTMILLLOSE = 61, CANTCASTCREATURE = 62, - CANTCAST = 63, + CANTCAST = 63, CANTCASTTWO = 64, - STORM = 65, - BOTHCANTCAST = 66, - BOTHNOCREATURE = 67, - ONLYONEBOTH = 68, + STORM = 65, + BOTHCANTCAST = 66, + BOTHNOCREATURE = 67, + ONLYONEBOTH = 68, AFFINITYARTIFACTS = 69, - AFFINITYPLAINS = 70, + AFFINITYPLAINS = 70, AFFINITYFOREST = 71, AFFINITYISLAND = 72, AFFINITYMOUNTAIN = 73, AFFINITYSWAMP = 74, AFFINITYGREENCREATURES = 75, - CANTWIN = 76, - NOMAXHAND = 77, + CANTWIN = 76, + NOMAXHAND = 77, + LEYLINE = 78, + PLAYERSHROUD = 79, + CONTROLLERSHROUD = 80, - NB_BASIC_ABILITIES = 78, + NB_BASIC_ABILITIES = 81, RARITY_S = 'S', //Special Rarity diff --git a/projects/mtg/include/MTGGameZones.h b/projects/mtg/include/MTGGameZones.h index a38df039f..b1be348d7 100644 --- a/projects/mtg/include/MTGGameZones.h +++ b/projects/mtg/include/MTGGameZones.h @@ -81,7 +81,8 @@ class MTGGameZone { void cleanupPhase(); int countByType(const char * value); MTGCardInstance * findByName(string name); - int hasType(const char * value); + int hasAbility(int ability); //returns 1 if one of the cards in the zone has the ability, 0 otherwise + int hasType(const char * value); //returns 1 if one of the cards in the zone has the type, 0 otherwise void setOwner(Player * player); MTGCardInstance * lastCardDrawn; static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source, MTGCardInstance * target); diff --git a/projects/mtg/src/MTGDefinitions.cpp b/projects/mtg/src/MTGDefinitions.cpp index 7b2fe4cdc..cb1dd2d84 100644 --- a/projects/mtg/src/MTGDefinitions.cpp +++ b/projects/mtg/src/MTGDefinitions.cpp @@ -86,6 +86,9 @@ const char* Constants::MTGBasicAbilities[] = { "affinitygreencreatures", "cantwin", "nomaxhand", +"leyline", +"playershroud", +"controllershroud", }; diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 79da0fae4..f00b1b6d6 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -328,6 +328,15 @@ int MTGGameZone::hasType(const char * value){ return 0; } +int MTGGameZone::hasAbility(int ability){ + for (int i=0; i<(nb_cards); i++) { + if (cards[i]->basicAbilities[ability]){ + return 1; + } + } + return 0; +} + void MTGGameZone::cleanupPhase(){ for (int i=0; i<(nb_cards); i++) diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index b463b5805..3b994dbbd 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -15,12 +15,12 @@ int cardsinhand = game->players[0]->game->hand->nb_cards; Player * player = game->currentlyActing(); Player * currentPlayer = game->currentPlayer; if (!player->game->hand->hasCard(card)) return 0; - if ((game->turn < 1) && (cardsinhand != 0) && (card->hasType("leyline")) + if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[Constants::LEYLINE]) && game->currentGamePhase == Constants::MTG_PHASE_FIRSTMAIN && game->players[0]->game->graveyard->nb_cards == 0 && game->players[0]->game->exile->nb_cards == 0){ Player * p = game->currentPlayer; - if (card->hasType("leyline")){ + if (card->basicAbilities[Constants::LEYLINE]){ MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->temp); Spell * spell = NEW Spell(copy); spell->resolve(); diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index 8d2662ff2..bce886c0d 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -75,30 +75,32 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan manaCost->addExtraCost(NEW TapTargetCost(tc)); } break; - case 's': //Sacrifice - manaCost->addExtraCost(NEW SacrificeCost(tc)); + case 's': + if (value == "s2l") { //Send To Library Cost (move from anywhere to Library) + manaCost->addExtraCost(NEW ToLibraryCost(tc)); + } else { //Sacrifice + manaCost->addExtraCost(NEW SacrificeCost(tc)); + } break; case 'e': //Exile manaCost->addExtraCost(NEW ExileTargetCost(tc)); break; - case 'h': //bounce + case 'h': //bounce (move to Hand) manaCost->addExtraCost(NEW BounceTargetCost(tc)); break; - case 'l': //Life cost - manaCost->addExtraCost(NEW LifeCost(tc)); + case 'l': + if (value == "l2e") { //Mill to exile yourself as a cost (Library 2 Exile) + manaCost->addExtraCost(NEW MillExileCost(tc)); + } else { //Life cost + manaCost->addExtraCost(NEW LifeCost(tc)); + } break; case 'd': //DiscardRandom cost manaCost->addExtraCost(NEW DiscardRandomCost(tc)); break; - case 'q': //Hand To Library Cost - manaCost->addExtraCost(NEW ToLibraryCost(tc)); - break; case 'm': //Mill yourself as a cost manaCost->addExtraCost(NEW MillCost(tc)); break; - case 'z': //Mill to exile yourself as a cost - manaCost->addExtraCost(NEW MillExileCost(tc)); - break; case 'c': //Counters { size_t counter_start = value.find("("); diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index aed1b0ac0..a0d601936 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -689,9 +689,9 @@ PlayerTargetChooser::PlayerTargetChooser(MTGCardInstance * card, int _maxtargets } bool PlayerTargetChooser::canTarget(Targetable * target){ -if (source && targetter && (targetter->controller() != targetter->controller()->opponent()) && (targetter->controller()->opponent()->game->inPlay->hasType("controllershroud")) && targetter->controller() != target) return false; -if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->opponent()->game->inPlay->hasType("playershroud")) && targetter->controller()->opponent() == target) return false; -if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->game->inPlay->hasType("playershroud")) && targetter->controller()== target) return false; +if (source && targetter && (targetter->controller() != targetter->controller()->opponent()) && (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD)) && targetter->controller() != target) return false; +if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD)) && targetter->controller()->opponent() == target) return false; +if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD)) && targetter->controller()== target) return false; return (target->typeAsTarget() == TARGET_PLAYER) && (!p || p == (Player*)target); } @@ -703,9 +703,9 @@ if (source && targetter && (targetter->controller() == targetter->controller()) /*Damageable Target */ bool DamageableTargetChooser::canTarget(Targetable * target){ -if (source && targetter && (targetter->controller() != targetter->controller()->opponent()) && (targetter->controller()->opponent()->game->inPlay->hasType("controllershroud")) && targetter->controller() != target) return false; -if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->opponent()->game->inPlay->hasType("playershroud")) && targetter->controller()->opponent() == target) return false; -if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->game->inPlay->hasType("playershroud")) && targetter->controller()== target) return false; +if (source && targetter && (targetter->controller() != targetter->controller()->opponent()) && (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::CONTROLLERSHROUD)) && targetter->controller() != target) return false; +if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->opponent()->game->inPlay->hasAbility(Constants::PLAYERSHROUD)) && targetter->controller()->opponent() == target) return false; +if (source && targetter && (targetter->controller() == targetter->controller()) && (targetter->controller()->game->inPlay->hasAbility(Constants::PLAYERSHROUD)) && targetter->controller()== target) return false; if (target->typeAsTarget() == TARGET_PLAYER){ return true; }