diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 2a80f218e..322d335c7 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -29396,7 +29396,7 @@ type=Instant [/card] [card] name=Dismiss into Dream -auto=lord(creature|opponentbattlefield) transforms((Illusion,newability[while(restriction{cardistargeted}) sacrifice])) +auto=lord(creature|opponentbattlefield) transforms((Illusion,newability[@targeted(this):sacrifice])) text=Enchantment. -- Each creature your opponents control is an Illusion in addition to its other types and has "When this creature becomes the target of a spell or ability, sacrifice it." mana={6}{U} type=Enchantment @@ -36811,8 +36811,7 @@ subtype=Aura [/card] [card] name=Evil Twin -auto=may copy NotATarget(creature) -auto=while(restriction{copiedacard}) transforms((,newability[{U}{B}{T}:destroy target(creature[share!name!])])) forever +auto=may copy NotATarget(creature) and!( transforms((,newability[{U}{B}{T}:destroy target(creature[share!name!])])) forever )! text=You may have Evil Twin enter the battlefield as a copy of any creature on the battlefield except it gains "{U}{B}, {T}: Destroy target creature with the same name as this creature." mana={2}{U}{B} type=Creature @@ -42891,7 +42890,7 @@ toughness=2 [/card] [card] name=Frost Walker -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=When Frost Walker becomes the target of a spell or ability, sacrifice it. mana={1}{U} type=Creature @@ -45593,8 +45592,7 @@ toughness=1 [/card] [card] name=Gigantoplasm -auto=may copy NotATarget(creature) -auto=while(restriction{copiedacard}) {X}:name(Base X) transforms((,setpower=X,settoughness=X)) ueot +auto=may copy NotATarget(creature) and!( {X}:name(Base X) transforms((,setpower=X,settoughness=X)) ueot )! text=You may have Gigantoplasm enter the battlefield as a copy of any creature on the battlefield except it gains "{X}: This creature has base power and toughness X/X." mana={3}{U} type=Creature @@ -48238,7 +48236,7 @@ toughness=2 [card] name=Gossamer Phantasm abilities=flying -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=Flying -- When Gossamer Phantasm becomes the target of a spell or ability, sacrifice it. mana={1}{U} type=Creature @@ -56001,7 +55999,7 @@ toughness=4 [card] name=Illusionary Servant abilities=flying -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=Flying -- When Illusionary Servant becomes the target of a spell or ability, sacrifice it. mana={1}{U}{U} type=Creature @@ -71355,8 +71353,7 @@ toughness=2 [/card] [card] name=Mercurial Pretender -auto=may copy NotATarget(creature) -auto=while(restriction{copiedacard}) transforms((,newability[{2}{U}{U}:moveto(ownerhand)])) forever +auto=may copy NotATarget(creature) and!( transforms((,newability[{2}{U}{U}:moveto(ownerhand)])) forever )! text=You may have Mercurial Pretender enter the battlefield as a copy of any creature you control except it gains "{2}{U}{U}: Return this creature to its owner's hand." mana={4}{U} type=Creature @@ -83979,7 +83976,7 @@ toughness=1 [card] name=Phantasmal Abomination abilities=defender -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=Defender -- When Phantasmal Abomination becomes the target of a spell or ability, sacrifice it. mana={1}{U}{U} type=Creature @@ -83989,7 +83986,7 @@ toughness=5 [/card] [card] name=Phantasmal Bear -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=When Phantasmal Bear becomes the target of a spell or ability, sacrifice it. mana={U} type=Creature @@ -84000,7 +83997,7 @@ toughness=2 [card] name=Phantasmal Dragon abilities=flying -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=Flying -- When Phantasmal Dragon becomes the target of a spell or ability, sacrifice it. mana={2}{U}{U} type=Creature @@ -84032,8 +84029,7 @@ toughness=1 [/card] [card] name=Phantasmal Image -auto=may copy NotATarget(creature) -auto=while(restriction{copiedacard}) transforms((Illusion,newability[while(restriction{cardistargeted}) sacrifice])) forever +auto=may copy NotATarget(creature) and!( transforms((Illusion,newability[@targeted(this):sacrifice])) forever )! 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 @@ -84104,7 +84100,7 @@ toughness=2 [/card] [card] name=Phantom Beast -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=When Phantom Beast becomes the target of a spell or ability, sacrifice it. mana={3}{U} type=Creature @@ -87302,8 +87298,7 @@ type=Sorcery [/card] [card] name=Progenitor Mimic -auto=may copy NotATarget(creature) -auto=while(restriction{copiedacard}) transforms((,newability[@each my upkeep:all(this) ifnot cantargetcard(*[token]) then clone])) forever +auto=may copy NotATarget(creature) and!( transforms((,newability[@each my upkeep:all(this) ifnot cantargetcard(*[token]) then clone])) forever )! text=You may have Progenitor Mimic enter the battlefield as a copy of any creature on the battlefield except it gains "At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature." mana={4}{G}{U} type=Creature @@ -104645,7 +104640,7 @@ type=Instant [/card] [card] name=Skulking Fugitive -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=When Skulking Fugitive becomes the target of a spell or ability, sacrifice it. mana={2}{B} type=Creature @@ -104656,7 +104651,7 @@ toughness=4 [card] name=Skulking Ghost abilities=flying -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=Flying -- When Skulking Ghost becomes the target of a spell or ability, sacrifice it. mana={1}{B} type=Creature @@ -104667,7 +104662,7 @@ toughness=1 [card] name=Skulking Knight abilities=flanking -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=Flanking (Whenever a creature without flanking blocks this creature, the blocking creature gets -1/-1 until end of turn.) -- When Skulking Knight becomes the target of a spell or ability, sacrifice it. mana={2}{B} type=Creature @@ -115539,7 +115534,7 @@ type=Artifact [/card] [card] name=Tar Pit Warrior -auto=while(restriction{cardistargeted}) sacrifice +auto=@targeted(this):sacrifice text=When Tar Pit Warrior becomes the target of a spell or ability, sacrifice it. mana={2}{B} type=Creature @@ -125811,8 +125806,7 @@ toughness=4 [/card] [card] name=Vesuva -auto=may copy notatarget(land) -auto=while(restriction{copiedacard}) tap(noevent) +auto=may copy notatarget(land) and!( tap(noevent) )! text=You may have Vesuva enter the battlefield tapped as a copy of any land on the battlefield. type=Land [/card] diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index bd11ac26c..5ed82919d 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3848,6 +3848,7 @@ public: spell->source->isToken = 1; spell->source->fresh = 1; spell->source->entersBattlefield = 1; + spell->source->tokCard = spell->source->clone(); if(spell->source->getMTGId() == 0) {//fix missing art: if token creator is put inside ability$!!$ who, then try to get the stored source card if(((MTGCardInstance*)source)->storedSourceCard) diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index c4af0024c..58ae7c1e8 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -121,6 +121,7 @@ public: Player * previousController; MTGGameZone * getCurrentZone(); MTGGameZone * previousZone; + MTGCardInstance * tokCard; MTGCardInstance * previous; MTGCardInstance * next; MTGAbility * TokenAndAbility; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 2de381334..4e1a4a7ab 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1550,10 +1550,13 @@ int AACopier::resolve() bool tokencopied = false; if(_target->isToken || (_target->isACopier && _target->hasCopiedToken)) tokencopied = true; - - if(tokencopied && !_target->isACopier) + /*this solves one thing.. if you copy a nontoken card with dragon breath attached that gives haste*/ + source->hasCopiedToken = tokencopied; + /*since we look for the real card it will not copy granted haste ability however for token we copy all*/ + /*but how to do backup for token so we just copy the backup???*/ + if(tokencopied && !_target->isACopier && !_target->getMTGId()) { - source->copy(_target); + source->copy(_target->tokCard); //if the token doesn't have cda/dynamic pt then allow this... if(!_target->isCDA) { @@ -1578,7 +1581,6 @@ int AACopier::resolve() source->copy(_target); } source->isACopier = true; - source->hasCopiedToken = tokencopied; source->copiedID = _target->copiedID; if(_target->isMorphed) { @@ -1607,7 +1609,7 @@ int AACopier::resolve() TokenandAbilityClone->addToGame(); } } - if(source->isACopier) + if(source) { source->GrantedAndAbility = andAbility; AbilityFactory af(game); @@ -4102,12 +4104,23 @@ int AACloner::resolve() if (!_target) return 0; - // Use id of the card to have the same image as the original - MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId())); + MTGCard * clone = NULL; - // If its a copier and copied a token then copy what it is - if(_target->isACopier && _target->hasCopiedToken) - clone = _target; + if(_target->isToken || _target->hasCopiedToken) + { + if(_target->getMTGId() > 0)//not generated token + clone = MTGCollection()->getCardById(_target->getMTGId()); + else + { + clone = _target->tokCard; + clone->data = _target->tokCard;//?wtf + } + } + else + clone = MTGCollection()->getCardById(_target->copiedID); + + if(!clone) + source = _target; Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller(); @@ -4134,6 +4147,8 @@ int AACloner::resolve() spell->source->entersBattlefield = 1; spell->source->model = spell->source; spell->source->model->data = spell->source; + spell->source->tokCard = spell->source->clone(); + spell->source->TokenAndAbility = _target->TokenAndAbility;//token andAbility //if the token doesn't have cda/dynamic pt then allow this... if((_target->isToken) && (!_target->isCDA)) { @@ -4165,11 +4180,11 @@ int AACloner::resolve() { spell->source->addType(*it); } - if(_target->TokenAndAbility) + if(spell->source->TokenAndAbility) {//the source copied a token with andAbility - MTGAbility * TokenandAbilityClone = _target->TokenAndAbility->clone(); + MTGAbility * TokenandAbilityClone = spell->source->TokenAndAbility->clone(); TokenandAbilityClone->target = spell->source; - if(_target->TokenAndAbility->oneShot) + if(spell->source->TokenAndAbility->oneShot) { TokenandAbilityClone->resolve(); SAFE_DELETE(TokenandAbilityClone); diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 08bb48643..48e9fbf70 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1149,7 +1149,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder MTGCard * fcard = MTGCollection()->getCardByName(kcard->name); quad = WResourceManager::Instance()->RetrieveCard(fcard); } - if (kcard && kcard->hasCopiedToken) + if (kcard && kcard->hasCopiedToken && !quad.get()) { MTGCard * tcard = MTGCollection()->getCardById(abs(kcard->copiedID)); quad = thumb ? WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_THUMB, 1, abs(kcard->copiedID)) diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 3357e42a8..ab0acdcb3 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -99,11 +99,20 @@ void MTGCardInstance::copy(MTGCardInstance * card) MTGCard * source = NULL; if(card->isToken || card->hasCopiedToken) { - source = card; + if(card->getMTGId() > 0)//not generated token + source = MTGCollection()->getCardById(card->getMTGId()); + else + { + source = card->tokCard; + source->data = card->tokCard;//?wtf + } } else source = MTGCollection()->getCardById(card->copiedID); + if(!source) + source = card; + CardPrimitive * data = source->data; basicAbilities = data->basicAbilities; types.clear();//reset types.. fix copying man lands... the copier becomes an unanimated land... @@ -135,6 +144,7 @@ void MTGCardInstance::copy(MTGCardInstance * card) origpower = card->origpower;//for flip origtoughness = card->origtoughness;//for flip TokenAndAbility = card->TokenAndAbility;//token andAbility + tokCard = card->tokCard; //Now this is dirty... int backupid = mtgid; @@ -288,6 +298,7 @@ void MTGCardInstance::initMTGCI() owner = NULL; counters = NEW Counters(this); previousZone = NULL; + tokCard = NULL; previous = NULL; next = NULL; TokenAndAbility = NULL;