From 37642c1f782ace9e95d2ec2ba558685cdef24bd0 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 10 Mar 2017 14:14:02 +0800 Subject: [PATCH 1/5] rageform rageform, lightform & cloudform support. withenchant is for only these cards... --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 26 +++++++++++++++++++ .../bin/Res/sets/primitives/unsupported.txt | 18 ------------- projects/mtg/include/AllAbilities.h | 11 ++++++++ projects/mtg/src/MTGAbility.cpp | 5 +++- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index b4f55af60..a1577fab4 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -20917,6 +20917,15 @@ power=0 toughness=1 [/card] [card] +name=Cloudform +auto=withenchant manifest all(*[zpos=1]|mylibrary) +auto=teach(creature) flying +auto=teach(creature) opponentshroud +text=When Cloudform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Cloudform to it. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.) -- Enchanted creature has flying and hexproof. +mana={1}{U}{U} +type=Enchantment +[/card] +[card] name=Cloudgoat Ranger auto=token(Kithkin Soldier,Creature Kithkin Soldier,1/1,white)*3 auto={T(kithkin|myBattlefield)}{T(kithkin|myBattlefield)}{T(kithkin|myBattlefield)}:2/0 && flying @@ -67018,6 +67027,15 @@ power=2 toughness=2 [/card] [card] +name=Lightform +auto=withenchant manifest all(*[zpos=1]|mylibrary) +auto=teach(creature) flying +auto=teach(creature) lifelink +text=When Lightform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Lightform to it. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.) -- Enchanted creature has flying and lifelink. +mana={1}{W}{W} +type=Enchantment +[/card] +[card] name=Lighthouse Chronologist auto={U}:counter(0/0,1,Level) asSorcery auto=this(counter{0/0.4.Level}) 1/1 @@ -91112,6 +91130,14 @@ power=2 toughness=3 [/card] [card] +name=Rageform +auto=withenchant manifest all(*[zpos=1]|mylibrary) +auto=teach(creature) double strike +text=When Rageform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Rageform to it. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.) -- Enchanted creature has double strike. (It deals both first-strike and regular combat damage.) +mana={2}{R}{R} +type=Enchantment +[/card] +[card] name=Ragemonger auto=lord(minotaur|mycastingzone) altercost(black,-1) auto=lord(minotaur|mycastingzone) altercost(red,-1) diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 79f2415c4..80163d7c7 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -2425,12 +2425,6 @@ power=2 toughness=2 [/card] [card] -name=Cloudform -text=When Cloudform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Cloudform to it. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.) -- Enchanted creature has flying and hexproof. -mana={1}{U}{U} -type=Enchantment -[/card] -[card] name=Coalition Flag text=Enchant creature you control -- Enchanted creature is a Flagbearer. -- While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least one Flagbearer on the battlefield if able. mana={W} @@ -8623,12 +8617,6 @@ mana={2}{W}{W} type=Enchantment [/card] [card] -name=Lightform -text=When Lightform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Lightform to it. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.) -- Enchanted creature has flying and lifelink. -mana={1}{W}{W} -type=Enchantment -[/card] -[card] name=Lightning Reflexes text=You may cast Lightning Reflexes as though it had flash. If you cast it any time a sorcery couldn't have been cast, the controller of the permanent it becomes sacrifices it at the beginning of the next cleanup step. -- Enchant creature -- Enchanted creature gets +1/+0 and has first strike. mana={1}{R} @@ -12109,12 +12097,6 @@ mana={4}{PR} type=Artifact [/card] [card] -name=Rageform -text=When Rageform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Rageform to it. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.) -- Enchanted creature has double strike. (It deals both first-strike and regular combat damage.) -mana={2}{R}{R} -type=Enchantment -[/card] -[card] name=Raging River text=Whenever one or more creatures you control attack, each defending player divides all creatures without flying he or she controls into a "left" pile and a "right" pile. Then, for each attacking creature you control, choose "left" or "right." That creature can't be blocked this combat except by creatures with flying and creatures in a pile with the chosen label. mana={R}{R} diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 5ecb0240b..3e700223e 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -7074,12 +7074,14 @@ public: class AManifest: public InstantAbility { public: + bool withenchant; MTGAbility * andAbility; AManifest(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) : InstantAbility(observer, _id, _source) { target = _target; andAbility = NULL; + withenchant = false; } int resolve() @@ -7150,6 +7152,15 @@ public: andAbilityClone->addToGame(); } } + if(withenchant) + { + if(source->hasType(Subtypes::TYPE_ENCHANTMENT)) + { + source->target = copy; + source->spellTargetType = "creature"; + source->addType("aura"); + } + } } return 1; } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 746de1d19..997edf751 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2898,7 +2898,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG //manifest found = s.find("manifest"); if (found != string::npos) - { + {//for cloudform, rageform and lightform + bool withenchant = s.find("withenchant") != string::npos; MTGAbility * a = NEW AManifest(observer, id, card, target); a->oneShot = 1; if(storedAndAbility.size()) @@ -2907,6 +2908,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG storedAndAbility.clear(); ((AManifest*)a)->andAbility = parseMagicLine(stored, id, spell, card); } + if(withenchant) + ((AManifest*)a)->withenchant = true; return a; } From 8f61b590f827742a4a851052984469de717e34f9 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 10 Mar 2017 19:24:39 +0800 Subject: [PATCH 2/5] Hide Action stack if there's a menu object --- projects/mtg/include/AllAbilities.h | 2 +- projects/mtg/src/ActionStack.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 3e700223e..136e62143 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -6555,7 +6555,7 @@ public: const string getMenuText() { - return "phase alter"; + return "Phase Alter"; } APhaseAlter * clone() const diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index e74ea7033..b79f4868b 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -96,7 +96,7 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string JRenderer * renderer = JRenderer::GetInstance(); bool hiddenview = aType == MTGAbility::HIDDENVIEW?true:false; - if (!targetQuad) + if (!targetQuad && !mytargetsQuad.size()) { /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); @@ -1040,6 +1040,9 @@ void ActionStack::Update(float dt) if (getCurrentTutorial() && (observer->players[0]->isHuman() || observer->players[1]->isHuman() ) ) return; + if (observer->mLayers->actionLayer()->menuObject || observer->LPWeffect) + return;//dont do any of this if a menuobject exist. + askIfWishesToInterrupt = NULL; //modal = 0; From 31814bda373d2a1dd4a809143952fabeafdf4cdb Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 10 Mar 2017 19:24:49 +0800 Subject: [PATCH 3/5] sort filter --- projects/mtg/src/WGui.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/mtg/src/WGui.cpp b/projects/mtg/src/WGui.cpp index f2f1758bf..0e52c499d 100644 --- a/projects/mtg/src/WGui.cpp +++ b/projects/mtg/src/WGui.cpp @@ -2177,9 +2177,19 @@ void WGuiFilterItem::updateValue() else if (filterType == FILTER_BASIC) { char buf[512]; + vector baString; for (int i = 0; i < Constants::NB_BASIC_ABILITIES; i++) + {//remove some others + if(i != 119 || i != 120 || i != 135 || i != 136 || i != 137 || i != 139 || i != 140 || i != 141 || i != 143 + || i != 144 || i != 145 || i != 146 || i != 147 || i != 148 || i != 149 || i != 150 + || i != 151 || i != 152 || i != 153 || i != 154) + baString.push_back(Constants::MTGBasicAbilities[i]); + } + //sort + sort(baString.begin(),baString.end()); + for (unsigned int i = 0; i < baString.size(); i++) { - string s = Constants::MTGBasicAbilities[i]; + string s = baString[i]; sprintf(buf, "a:%s;", s.c_str()); s[0] = toupper(s[0]); mParent->addArg(s, buf); From d9bd6bbb32988f48a2f923e7a3df5cf0d37e8f89 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 10 Mar 2017 19:25:54 +0800 Subject: [PATCH 4/5] cascade, cascade --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 13 ++++++++++++- .../mtg/bin/Res/sets/primitives/unsupported.txt | 9 --------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index a1577fab4..b5b8f5431 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -34337,7 +34337,7 @@ toughness=3 name=Eldrazi Horror power=3 toughness=2 -type=creature eldrazi horror +type=Creature Eldrazi Horror color=colorless [/card] [card] @@ -69520,6 +69520,17 @@ mana={1}{B}{G} type=Sorcery [/card] [card] +name=Maelstrom Wanderer +auto=emblem transforms((,newability[aslongas(Maelstrom Wanderer|mybattlefield) lord(creature|mybattlefield) haste])) forever dontremove +autostack=if casted(this) then activate choice cascade:plibrarycount && activate choice cascade:plibrarycount +text=Creatures you control have haste. -- Cascade, cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order. Then do it again.) +mana={5}{U}{R}{G} +type=Legendary Creature +subtype=Elemental +power=7 +toughness=5 +[/card] +[card] name=Maga, Traitor to Mortals auto=counter(1/1,X) && life:-X opponent text=Maga, Traitor to Mortals enters the battlefield with X +1/+1 counters on it. -- When Maga enters the battlefield, target player loses life equal to the number of +1/+1 counters on it. diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 80163d7c7..e2bd26d26 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -8894,15 +8894,6 @@ power=1 toughness=1 [/card] [card] -name=Maelstrom Wanderer -text=Creatures you control have haste. -- Cascade, cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order. Then do it again.) -mana={5}{U}{R}{G} -type=Legendary Creature -subtype=Elemental -power=7 -toughness=5 -[/card] -[card] name=Mages' Contest text=You and target spell's controller bid life. You start the bidding with a bid of 1. In turn order, each player may top the high bid. The bidding ends if the high bid stands. The high bidder loses life equal to the high bid. If you win the bidding, counter that spell. mana={1}{R}{R} From 5f2fbb370c085e7caa1bdbc3caf7fc39635292ba Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sat, 11 Mar 2017 07:57:54 +0800 Subject: [PATCH 5/5] fix --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 2 +- projects/mtg/src/MTGGameZones.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index b5b8f5431..89a8b1d46 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -38438,7 +38438,7 @@ toughness=3 [card] name=Faerie Macabre abilities=flying -autohand={S}:target(other *|graveyard) moveTo(exile) +autohand={discard}:target(other *|graveyard) moveTo(exile) text=Flying -- Discard Faerie Macabre: Exile up to two target cards from graveyards. mana={1}{B}{B} type=Creature diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 70c9aea9b..15e774161 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -569,13 +569,13 @@ MTGGameZone::~MTGGameZone() //cause crashes for generated cards using castcard named card...??? test fix for now if(cards[i]->previous) { - cards[i]->previous = NULL; delete cards[i]->previous; + cards[i]->previous = NULL; } if(cards[i]) { - cards[i] = NULL; delete cards[i]; + cards[i] = NULL; } } cards.clear();