From dfd07615060a78af9db6b0e65ad6e6d5786c075f Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sun, 7 Aug 2016 09:59:59 +0800 Subject: [PATCH 1/2] Corrected cards reported from forums --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 028ff879d..cfbf2f357 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -6145,7 +6145,7 @@ name=Atarka, World Render abilities=flying,trample auto=lord(dragon|mybattlefield) transforms((,newability[@combat(attacking) source(this):double strike ueot])) text=Flying,trample. -- Whenever a Dragon you control attacks, it gains double strike until end of turn. -mana={5}{R}}{G} +mana={5}{R}{G} type=Legendary Creature subtype=Dragon power=6 @@ -28155,7 +28155,7 @@ name=Domri Rade auto=counter(0/0,3,loyalty) auto={C(0/0,1,Loyalty)}:name(+1: Reveal) reveal:1 optionone target(creature|reveal)moveto(myhand) optiononeend optiontwo name(Put Back On Top) target(<1>*|reveal) moveto(mylibrary) optiontwoend revealend auto={C(0/0,-2,Loyalty)}:name(-2: Fight) target(creature|mybattlefield) transforms((,newability[target(creature) dynamicability])) ueot -auto={C(0/0,-7,Loyalty)}:name(-7: emblem) emblem transforms((,newability[lord(creature|mybattlefield)doublestrike],newability[lord(creature|mybattlefield)trample],newability[lord(creature|mybattlefield)hexproof],newability[lord(creature|mybattlefield)haste])) forever dontremove +auto={C(0/0,-7,Loyalty)}:name(-7: emblem) emblem transforms((,newability[lord(creature|mybattlefield)double strike],newability[lord(creature|mybattlefield)trample],newability[lord(creature|mybattlefield)hexproof],newability[lord(creature|mybattlefield)haste])) forever dontremove text=+1: Look at the top card of your library. If it's a creature card, you may reveal it and put it into your hand. -- -2: Target creature you control fights another target creature. -- -7: You get an emblem with "Creatures you control have double strike, trample, hexproof, and haste." mana={1}{R}{G} type=Planeswalker @@ -29668,7 +29668,7 @@ toughness=4 name=Drogskol Reaver abilities=flying,double strike,lifelink auto=@lifeof(player):draw:1 controller -text=Flying, doublestrike, lifelink -- Whenever you gain life, draw a card. +text=Flying, double strike, lifelink -- Whenever you gain life, draw a card. mana={5}{W}{U} type=Creature subtype=Spirit @@ -33405,7 +33405,7 @@ text=First strike -- When Enlistment Officer enters the battlefield, reveal the mana={3}{W} type=Creature subtype=Human Soldier -abilities=firststrike +abilities=first strike power=2 toughness=3 [/card] @@ -59005,7 +59005,7 @@ auto=@combat(attacking) source(dragon|mybattlefield):all(creature|mybattlefield) other={3}{R}{B} name(Dash) auto=if paid(alternative) then transforms((,newability[haste],newability[phaseaction[endofturn sourceinplay] moveto(ownerhand) all(this)])) forever text=Flying. -- Whenever a Dragon you control attacks, creatures you control get +1/+0 until end of turn. -- Dash {3}{B}{R} (You may cast this spell for its dash cost. If you do, it gains haste, and it's returned from the battlefield to its owner's hand at the beginning of the next end step.) -mana={3}{B}}{R} +mana={3}{B}{R} type=Legendary Creature subtype=Dragon power=4 @@ -72894,9 +72894,9 @@ toughness=1 name=Needle Spires auto={t}:add{w} auto={t}:add{r} -auto={1}{B}{G}:all(this) transforms((Elemental Creature,setpower=2,settoughness=1,red,white,doublestrike)) ueot +auto={1}{B}{G}:all(this) transforms((Elemental Creature,setpower=2,settoughness=1,red,white,double strike)) ueot auto=tap(noevent) -text=Needle Spires enters the battlefield tapped. -- {T}: Add {R} or {W} to your mana pool. -- {2}{R}{W}: Needle Spires becomes a 2/1 red and white Elemental creature with doublestrike until end of turn. It's still a land. +text=Needle Spires enters the battlefield tapped. -- {T}: Add {R} or {W} to your mana pool. -- {2}{R}{W}: Needle Spires becomes a 2/1 red and white Elemental creature with double strike until end of turn. It's still a land. type=Land [/card] [card] @@ -75757,7 +75757,7 @@ name=Ojutai, Soul of Winter abilities=flying,vigilance auto=@combat(attacking) source(dragon|mybattlefield):name(tap & Freeze) target(*[-land]|opponentbattlefield) transforms((,newability[tap],newability[frozen])) uynt text=Flying, vigilance. -- Whenever a Dragon you control attacks, Tap target nonland permament your opponents control. It doesn't untap during its controller's next untap step. -mana={5}{W}}{U} +mana={5}{W}{U} type=Legendary Creature subtype=Dragon power=5 @@ -87107,9 +87107,9 @@ toughness=4 [/card] [card] name=Resolute Blademaster -auto=choice all(creature|mybattlefield) doublestrike ueot -auto=@movedTo(ally|myBattlefield):all(creature|mybattlefield) doublestrike ueot -text=Rally ? Whenever Resolute Blademaster or another Ally enters the battlefield under your control, creatures you control gain doublestrike until end of turn. +auto=choice all(creature|mybattlefield) double strike ueot +auto=@movedTo(ally|myBattlefield):all(creature|mybattlefield) double strike ueot +text=Rally ? Whenever Resolute Blademaster or another Ally enters the battlefield under your control, creatures you control gain double strike until end of turn. mana={3}{R}{W} type=Creature subtype=Human Soldier Ally @@ -92002,7 +92002,7 @@ type=Sorcery [/card] [card] name=Savageborn Hydra -abilities=doublestrike +abilities=double strike auto=counter(1/1,X) auto={1}{RG}:counter(1/1,1) asSorcery text=Double strike. -- Savageborn Hydra enters the battlefield with X +1/+1 counters on it. -- {1}{R/G}: Put a +1/+1 counter on Savageborn Hydra. Activate this ability only any time you could play a sorcery. From 807874ce5dffc9ed7ae81c41d764a93d2dba063e Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sun, 7 Aug 2016 10:15:11 +0800 Subject: [PATCH 2/2] add andAbility support for AACopier the granted ability must exists only if you copy a card, if you don't copy any card, the source doesn't have any granted abillities. --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 13 ++++------- projects/mtg/include/AllAbilities.h | 1 + projects/mtg/src/AllAbilities.cpp | 23 ++++++++++++++++---- projects/mtg/src/CardGui.cpp | 2 +- projects/mtg/src/MTGAbility.cpp | 8 +++++++ 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index cfbf2f357..f4407f707 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -2601,8 +2601,7 @@ type=Instant [card] name=Altered Ego abilities=nofizzle -auto=copy target(creature) -auto=counter(1/1,X) +auto=may copy target(creature) and!( counter(1/1,X) )! text=Altered Ego can't be countered. -- You may have Altered Ego enter the battlefield as a copy of any creature on the battlefield, except it enters with X additional +1/+1 counters on it. mana={X}{2}{G}{U} type=Creature @@ -67273,8 +67272,7 @@ toughness=2 [/card] [card] name=Mercurial Pretender -auto=may copy NotATarget(creature) -auto=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 @@ -79169,9 +79167,7 @@ toughness=1 [/card] [card] name=Phantasmal Image -auto=transforms((Illusion)) -auto=transforms((,newability[@targeted(this):sacrifice])) forever -auto=may copy NotATarget(creature) +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 @@ -82297,8 +82293,7 @@ type=Sorcery [/card] [card] name=Progenitor Mimic -auto=transforms((,newability[@each my upkeep:all(this) ifnot cantargetcard(*[token]) then clone])) forever -auto=may copy NotATarget(creature) +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 diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index fde01edc7..b7ebae78f 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1911,6 +1911,7 @@ public: class AACopier: public ActivatedAbility { public: + MTGAbility * andAbility; AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); int resolve(); const string getMenuText(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 667396db5..afddfa39f 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1453,6 +1453,7 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M ActivatedAbility(observer, _id, _source, _cost, 0) { target = _target; + andAbility = NULL; } int AACopier::resolve() @@ -1505,9 +1506,23 @@ int AACopier::resolve() } if(_target->TokenAndAbility) {//the source copied a token with andAbility - MTGAbility * andAbilityClone = _target->TokenAndAbility->clone(); - andAbilityClone->target = source; + MTGAbility * TokenandAbilityClone = _target->TokenAndAbility->clone(); + TokenandAbilityClone->target = source; if(_target->TokenAndAbility->oneShot) + { + TokenandAbilityClone->resolve(); + SAFE_DELETE(TokenandAbilityClone); + } + else + { + TokenandAbilityClone->addToGame(); + } + } + if(andAbility) + { + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = source; + if(andAbility->oneShot) { andAbilityClone->resolve(); SAFE_DELETE(andAbilityClone); @@ -3968,10 +3983,10 @@ int AACloner::resolve() } } list::iterator it; - for (it = awith.begin(); it != awith.end(); it++) + /*for (it = awith.begin(); it != awith.end(); it++) {//there must be a layer of temporary abilities and original abilities spell->source->basicAbilities[*it] = 1; - } + }*/ for (it = colors.begin(); it != colors.end(); it++) { spell->source->setColor(*it); diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 729994f49..55c27478a 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1224,7 +1224,7 @@ void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool nobor alphabeta->SetHotSpot(static_cast (alphabeta->mWidth / 2), static_cast (alphabeta->mHeight / 2)); float myscale = pos.actZ * 254 / alphabeta->mHeight; alphabeta->SetColor(ARGB((int)pos.actA,255,255,255)); - renderer->RenderQuad(alphabeta.get(), x, pos.actY, pos.actT, myscale, myscale); + renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale); } } } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 66b0bb004..54771954b 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2518,6 +2518,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG { MTGAbility * a = NEW AACopier(observer, id, card, target); a->oneShot = 1; + a->canBeInterrupted = false; + //andability + if(storedAndAbility.size()) + { + string stored = storedAndAbility; + storedAndAbility.clear(); + ((AACopier*)a)->andAbility = parseMagicLine(stored, id, spell, card); + } return a; }