From 60f6c683a39d00f488afcf2e608ea78c9c03fd57 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 25 Jan 2017 18:29:27 +0800 Subject: [PATCH] test fix equipment also added some primitive fixes, added macro for fabricate --- .../mtg/bin/Res/sets/primitives/_macros.txt | 3 +++ projects/mtg/bin/Res/sets/primitives/mtg.txt | 24 ++++++++++--------- projects/mtg/bin/Res/test/Living_Death.txt | 10 ++++---- projects/mtg/bin/Res/test/haunting_echoes.txt | 2 ++ projects/mtg/src/AllAbilities.cpp | 2 +- projects/mtg/src/GameObserver.cpp | 13 +++++++--- 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/_macros.txt b/projects/mtg/bin/Res/sets/primitives/_macros.txt index ec9a18def..19458678a 100644 --- a/projects/mtg/bin/Res/sets/primitives/_macros.txt +++ b/projects/mtg/bin/Res/sets/primitives/_macros.txt @@ -12,3 +12,6 @@ # Basic Landcycling #AUTO_DEFINE __BASIC_LANDCYCLING__($cost) $cost{cycle}:name(basic landcycling) moveTo(myhand) target(land[basic]|mylibrary) +# Fabricate +#AUTO_DEFINE _FABRICATE_($c) transforms((,newability[choice counter(1/1.$c)],newability[choice makecardt(Servo:Artifact Creature Servo:1/1)*$c])) ueot + diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 26ce93b85..4fd835989 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -8530,8 +8530,7 @@ toughness=1 [/card] [card] name=Barbarian Outcast -auto=aslongas(swamp|myBattlefield) moveTo(mygraveyard) <1 -auto=@movedTo(swamp|graveyard,exile,library,hand) from(myBattlefield):aslongas(swamp|myBattlefield) moveTo(mygraveyard) <1 +auto=aslongas(swamp|myBattlefield) all(this) sacrifice while <1 text=When you control no Swamps, sacrifice Barbarian Outcast. mana={1}{R} type=Creature @@ -22178,7 +22177,7 @@ toughness=2 [card] name=Covetous Dragon abilities=flying -auto=aslongas(artifact|myBattlefield) sacrifice <1 +auto=aslongas(artifact|myBattlefield) all(this) sacrifice while <1 text=Flying -- When you control no artifacts, sacrifice Covetous Dragon. mana={4}{R} type=Creature @@ -50629,8 +50628,9 @@ toughness=2 [/card] [card] name=Haunting Echoes -auto=all(*[-basic]|opponentgraveyard) transforms((,newability[moveTo(exile) all(*[share!name!]|mylibrary)])) ueot -auto=moveTo(exile) all(*[-basic]|opponentgraveyard) +target=player +auto=all(*[-basic]|targetedpersonsgraveyard) transforms((,newability[moveTo(exile) all(*[share!name!]|mylibrary)])) ueot +auto=moveTo(exile) all(*[-basic]|targetedpersonsgraveyard) text=Exile all cards from target player's graveyard other than basic land cards. For each card exiled this way, search that player's library for all cards with the same name as that card and exile them. Then that player shuffles his or her library. mana={3}{B}{B} type=Sorcery @@ -66368,7 +66368,7 @@ type=Instant [/card] [card] name=Lurebound Scarecrow -auto=chooseacolor aslongas(*[chosencolor]|myBattlefield) sacrifice <1 chooseend +auto=chooseacolor aslongas(*[chosencolor]|myBattlefield) all(this) sacrifice while <1 chooseend text=As Lurebound Scarecrow enters the battlefield, choose a color. -- When you control no permanents of the chosen color, sacrifice Lurebound Scarecrow. mana={3} type=Artifact Creature @@ -82327,7 +82327,8 @@ toughness=1 [/card] [card] name=Phantasmal Image -auto=may copy NotATarget(creature) and!( transforms((Illusion,newability[@targeted(this):sacrifice])) forever )! +auto=may copy NotATarget(creature) and!( transforms((Illusion)) forever )! +auto=@targeted(this):sacrifice text=You may have Phantasmal Image enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it gains "When this creature becomes the target of a spell or ability, sacrifice it." mana={1}{U} type=Creature @@ -98380,7 +98381,8 @@ type=Land [card] name=Serendib Djinn abilities=flying -auto=@each my upkeep:transforms((,newability[target(land|myBattlefield) sacrifice],newability[@sacrificed(island|mybattlefield) restriction{myUpkeepOnly}:damage:3 controller])) ueot +auto=@each my upkeep:notatarget(land|mybattlefield) sacrifice and!(if cantargetcard(island|nonbattlezone) then damage:3 controller)! +auto=aslongas(land|myBattlefield) all(this) sacrifice while <1 text=Flying -- At the beginning of your upkeep, sacrifice a land. If you sacrifice an Island this way, Serendib Djinn deals 3 damage to you. -- When you control no lands, sacrifice Serendib Djinn. mana={2}{U}{U} type=Creature @@ -112387,7 +112389,7 @@ type=Instant [card] name=Sylvan Primordial abilities=reach -auto=name(destroy) target(*[-creature]|opponentbattlefield) transforms((,newability[@movedTo(this|graveyard) from(battlefield):ability$!notatarget(forest|mylibrary) moveto(mybattlefield) and!(tap(noevent))!!$ opponent],newability[destroy])) +auto=target(*[-creature]|opponentbattlefield) destroy and!(if cantargetcard(*[-creature]|nonbattlezone) then choice notatarget(forest|mylibrary) moveto(mybattlefield) and!(tap(noevent))! )! text=Reach -- When Sylvan Primordial enters the battlefield, for each opponent, destroy target noncreature permanent that player controls. For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library. mana={5}{G}{G} type=Creature @@ -125411,7 +125413,7 @@ toughness=2 [card] name=Voodoo Doll auto=@each my upkeep:counter(0/0,1,Pin) -auto=@each my endofturn sourcenottap:thisforeach(counter{0/0.1.Pin}) damage:1 controller +auto=this(counter{0/0.1.Pin}>0) transforms((,newability[@each my endofturn sourcenottap:damage:counter{0%0.1.Pin} controller && destroy all(this)])) auto=this(counter{0/0.1.Pin}<1) {0}{T}:damage:0 target(creature,player) auto=this(counter{0/0.1.Pin}=) {2}{T}:damage:1 target(creature,player) auto=this(counter{0/0.2.Pin}=) {4}{T}:damage:2 target(creature,player) @@ -128009,7 +128011,7 @@ toughness=* [/card] [card] name=Werewolf Ransacker -auto=target(artifact) transforms((,newability[destroy],newability[damage:3 controller])) forever +auto=may target(artifact) destroy and!(if cantargetcard(artifact|nonbattlezone) then damage:3 targetcontroller)! auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Afflicted Deserter) text=Whenever this creature transforms into Werewolf Ransacker, you may destroy target artifact. If that artifact is put into a graveyard this way, Werewolf Ransacker deals 3 damage to that artifact's controller. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Werewolf Ransacker. type=Creature diff --git a/projects/mtg/bin/Res/test/Living_Death.txt b/projects/mtg/bin/Res/test/Living_Death.txt index 3b9e017e0..08df0f185 100644 --- a/projects/mtg/bin/Res/test/Living_Death.txt +++ b/projects/mtg/bin/Res/test/Living_Death.txt @@ -2,7 +2,7 @@ [INIT] FIRSTMAIN [PLAYER1] -graveyard:Krosan Cloudscraper, Dragonlord Kolaghan, Clone +graveyard:109684, Dragonlord Kolaghan, 370622 hand:Living Death manapool:{2}{B}{B}{B} [PLAYER2] @@ -15,8 +15,8 @@ choice 0 next #attack next -Clone -Krosan Cloudscraper +370622 +109684 #block next #damage @@ -26,8 +26,8 @@ eot [ASSERT] UNTAP [PLAYER1] -inplay:Krosan Cloudscraper, Clone +inplay:109684, 370622 graveyard:Dragonlord Kolaghan, Living Death [PLAYER2] life:1 -[END] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/haunting_echoes.txt b/projects/mtg/bin/Res/test/haunting_echoes.txt index 20974ef6b..eb60d60e1 100644 --- a/projects/mtg/bin/Res/test/haunting_echoes.txt +++ b/projects/mtg/bin/Res/test/haunting_echoes.txt @@ -10,6 +10,8 @@ graveyard:White Knight,Glorious Anthem library:White Knight,Glorious Anthem,Grizzly Bears [DO] Haunting Echoes +choice 0 +p2 next goto firstmain [ASSERT] diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 934574e54..01a99c442 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -7795,7 +7795,7 @@ const string AEquip::getMenuText() int AEquip::testDestroy() { if (source->target && !game->isInPlay(source->target)) - unequip(); + //unequip();//testfix for equipment when the card it equip moves to other battlefield if (!game->connectRule) { if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true)) diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index faa755e69..6c987a84e 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -773,9 +773,9 @@ void GameObserver::gameStateBasedEffects() //////////////////////////////////////////////////// //Unattach Equipments that dont have valid targets// //////////////////////////////////////////////////// - if ((card->target) && card->hasType(Subtypes::TYPE_EQUIPMENT)) + if (!card->isCreature() && card->hasType(Subtypes::TYPE_EQUIPMENT)) { - if(card->target && isInPlay(card->target) && (card->target)->protectedAgainst(card))//protection from quality + if(isInPlay(card)) { for (size_t i = 1; i < mLayers->actionLayer()->mObjects.size(); i++) { @@ -783,7 +783,14 @@ void GameObserver::gameStateBasedEffects() AEquip * eq = dynamic_cast (a); if (eq && eq->source == card) { - ((AEquip*)a)->unequip(); + if(card->target)//unattach equipments from cards that has protection from quality ex. protection from artifacts + { + if((card->target)->protectedAgainst(card)) + ((AEquip*)a)->unequip(); + } + if(card->controller()) + ((AEquip*)a)->getActionTc()->Owner = card->controller(); + //fix for equip ability when the equipment changed controller... } } }