From 406f68ac5b040d7201b8808c4ce716b44f612c12 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Mon, 9 Nov 2015 19:04:31 +0800 Subject: [PATCH] Overload Cards the alias is for the Overload Check and Alternate Cost Restriction... ???Bestow??? --- projects/mtg/bin/Res/rules/Blitzkrieg.txt | 2 + projects/mtg/bin/Res/rules/hermit.txt | 2 + projects/mtg/bin/Res/rules/mtg.txt | 3 +- projects/mtg/bin/Res/sets/primitives/mtg.txt | 152 ++++++++++++++++++ .../bin/Res/sets/primitives/unsupported.txt | 72 --------- projects/mtg/include/MTGAbility.h | 2 + projects/mtg/include/MTGCardInstance.h | 2 +- projects/mtg/include/MTGRules.h | 15 +- projects/mtg/include/ManaCost.h | 4 +- projects/mtg/src/ActionStack.cpp | 6 + projects/mtg/src/MTGAbility.cpp | 14 +- projects/mtg/src/MTGGameZones.cpp | 2 +- projects/mtg/src/MTGRules.cpp | 63 +++++++- 13 files changed, 259 insertions(+), 80 deletions(-) diff --git a/projects/mtg/bin/Res/rules/Blitzkrieg.txt b/projects/mtg/bin/Res/rules/Blitzkrieg.txt index 7e534542e..38ac460df 100644 --- a/projects/mtg/bin/Res/rules/Blitzkrieg.txt +++ b/projects/mtg/bin/Res/rules/Blitzkrieg.txt @@ -13,6 +13,8 @@ auto=flashbackrule auto=retracerule auto=suspendrule auto=morphrule +auto=payzerorule +auto=overloadrule auto=attackrule auto=blockrule auto=combattriggerrule diff --git a/projects/mtg/bin/Res/rules/hermit.txt b/projects/mtg/bin/Res/rules/hermit.txt index ab454866d..6bd9d460a 100644 --- a/projects/mtg/bin/Res/rules/hermit.txt +++ b/projects/mtg/bin/Res/rules/hermit.txt @@ -12,6 +12,8 @@ auto=flashbackrule auto=retracerule auto=suspendrule auto=morphrule +auto=payzerorule +auto=overloadrule auto=attackrule auto=blockrule auto=combattriggerrule diff --git a/projects/mtg/bin/Res/rules/mtg.txt b/projects/mtg/bin/Res/rules/mtg.txt index 38f2f9b84..eec78cfb1 100644 --- a/projects/mtg/bin/Res/rules/mtg.txt +++ b/projects/mtg/bin/Res/rules/mtg.txt @@ -16,7 +16,8 @@ auto=flashbackrule auto=retracerule auto=suspendrule auto=morphrule -auto=playfromgraveyardrule +auto=payzerorule +auto=overloadrule auto=attackrule auto=blockrule auto=combattriggerrule diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index fd72dec5b..3dc75140d 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -10933,6 +10933,17 @@ power=2 toughness=1 [/card] [card] +name=Blustersquall +alias=110000 +other={3}{U} name(Overload) +target=creature|opponentbattlefield +auto=overload tap all(creature|opponentbattlefield) +auto=paidmana tap +text=Tap target creature you don't control. -- Overload {3}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={U} +type=Instant +[/card] +[card] name=Boa Constrictor auto={T}:3/3 text={T}: Boa Constrictor gets +3/+3 until end of turn. @@ -16254,6 +16265,19 @@ mana={G} type=Sorcery [/card] [card] +name=Chemister's Trick +alias=110000 +other={3}{U}{R} name(Overload) +target=creature|opponentbattlefield +auto=paidmana -2/0 +auto=paidmana mustattack +auto=overload -2/0 all(creature|opponentbattlefield) +auto=overload mustattack all(creature|opponentbattlefield) +text=Target creature you don't control gets -2/-0 until end of turn and attacks this turn if able. -- Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={U}{R} +type=Instant +[/card] +[card] name=Chief of the Edge auto=lord(other warrior|myBattlefield) 1/0 text=Other Warrior creatures you control get +1/+0. @@ -19374,6 +19398,18 @@ mana={3}{U}{U} type=Instant [/card] [card] +name=Counterflux +alias=110000 +other={1}{U}{U}{R} name(Overload) +abilities=nofizzle +target=*|opponentstack +auto=paidmana fizzle +auto=overload fizzle all(*|opponentstack) +text=Counterflux can't be countered by spells or abilities. -- Counter target spell you don't control. -- Overload {1}{U}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={U}{U}{R} +type=Instant +[/card] +[card] name=Counterintelligence target=creature auto=moveTo(ownerhand) @@ -21170,6 +21206,17 @@ mana={3}{B} type=Instant [/card] [card] +name=Cyclonic Rift +alias=110000 +other={6}{U} name(Overload) +target=*[-land]|opponentbattlefield +auto=overload moveto(ownerhand) all(*[-land]|opponentbattlefield) +auto=paidmana moveto(ownerhand) +text=Return target nonland permanent you don't control to its owner's hand. -- Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={1}{U} +type=Instant +[/card] +[card] name=Cyclopean Mummy auto=@movedTo(this|graveyard) from(battlefield):moveto(exile) text=When Cyclopean Mummy dies, exile Cyclopean Mummy. @@ -25946,6 +25993,17 @@ mana={1}{U} type=Instant [/card] [card] +name=Downsize +alias=110000 +other={2}{U} name(Overload) +target=creature|opponentbattlefield +auto=overload -4/0 all(creature|opponentbattlefield) +auto=paidmana -4/0 +text=Target creature you don't control gets -4/-0 until end of turn. -- Overload {2}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={U} +type=Instant +[/card] +[card] name=Dowsing Shaman auto={2}{G}{T}:moveTo(myhand) target(enchantment|mygraveyard) text={2}{G}, {T}: Return target enchantment card from your graveyard to your hand. @@ -28225,6 +28283,17 @@ type=Enchantment subtype=Aura [/card] [card] +name=Dynacharge +alias=110000 +other={2}{R} name(Overload) +target=creature|mybattlefield +auto=paidmana 2/0 +auto=overload all(creature|mybattlefield) 2/0 +text=Target creature you control gets +2/+0 until end of turn. -- Overload {2}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={R} +type=Instant +[/card] +[card] name=Dystopia auto=cumulativeupcost[{L}] sacrifice auto=@each opponent upkeep:ability$!name(sacrifice) notatarget(creature[green;white]|mybattlefield) sacrifice !$ opponent @@ -28974,6 +29043,17 @@ power=1 toughness=1 [/card] [card] +name=Electrickery +alias=110000 +other={1}{R} name(Overload) +target=creature|opponentbattlefield +auto=paidmana damage:1 +auto=overload damage:1 all(creature|opponentbattlefield) +text=Electrickery deals 1 damage to target creature you don't control. -- Overload {1}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={R} +type=Instant +[/card] +[card] name=Electrolyze target=creature,player auto=damage:1 @@ -63401,6 +63481,30 @@ power=4 toughness=4 [/card] [card] +name=Mizzium Mortars +alias=110000 +other={3}{R}{R}{R} name(Overload) +target=creature|opponentbattlefield +auto=paidmana damage:4 +auto=overload damage:4 all(creature|opponentbattlefield) +text=Mizzium Mortars deals 4 damage to target creature you don't control. -- Overload {3}{R}{R}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={1}{R} +type=Sorcery +[/card] +[card] +name=Mizzium Skin +alias=110000 +other={1}{U} name(Overload) +target=creature|mybattlefield +auto=paidmana 0/1 +auto=paidmana opponentshroud +auto=overload all(creature|mybattlefield) 0/1 +auto=overload all(creature|mybattlefield) opponentshroud +text=Target creature you control gets +0/+1 and gains hexproof until end of turn. -- Overload {1}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={U} +type=Instant +[/card] +[card] name=Mnemonic Nexus auto=moveto(opponentlibrary) all(*|opponentgraveyard) && shuffle opponent auto=moveto(mylibrary) all(*|mygraveyard) && shuffle controller @@ -96955,6 +97059,17 @@ power=3 toughness=4 [/card] [card] +name=Street Spasm +alias=110000 +other={X}{X}{R}{R} name(Overload) +target=creature[-flying]|opponentbattlefield +auto=paidmana damage:X +auto=overload damage:XX all(creature[-flying]|opponentbattlefield) +text=Street Spasm deals X damage to target creature without flying you don't control. -- Overload {X}{X}{R}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={X}{R} +type=Instant +[/card] +[card] name=Streetbreaker Wurm mana={3}{R}{G} type=Creature @@ -100365,6 +100480,19 @@ mana={U}{U}{U} type=Instant [/card] [card] +name=Teleportal +alias=110000 +other={3}{U}{R} name(Overload) +target=creature|mybattlefield +auto=paidmana 1/0 +auto=paidmana unblockable +auto=overload all(creature|mybattlefield) 1/0 +auto=overload all(creature|mybattlefield) unblockable +text=Target creature you control gets +1/+0 until end of turn and is unblockable this turn. -- Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={U}{R} +type=Sorcery +[/card] +[card] name=Telethopter auto={T(creature|myBattlefield)}:flying text=Tap an untapped creature you control: Telethopter gains flying until end of turn. @@ -107662,6 +107790,17 @@ type=Enchantment subtype=Aura [/card] [card] +name=Vandalblast +alias=110000 +other={4}{R} name(Overload) +target=artifact|opponentbattlefield +auto=overload destroy all(artifact|opponentbattlefield) +auto=paidmana destroy +text=Destroy target artifact you don't control. -- Overload {4}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={R} +type=Sorcery +[/card] +[card] name=Vanguard of Brimaz abilities=vigilance auto=@targeted(this) from(*[instant;sorcery;enchantment]|myhand,mygraveyard):token(Cat Soldier,Creature Cat Soldier,1/1,white,vigilance) controller @@ -112353,6 +112492,19 @@ mana={4} type=Artifact [/card] [card] +name=Weapon Surge +alias=110000 +other={1}{R} name(Overload) +target=creature|mybattlefield +auto=paidmana 1/0 +auto=paidmana first strike +auto=overload all(creature|mybattlefield) 1/0 +auto=overload all(creature|mybattlefield) first strike +text=Target creature you control gets +1/+0 and gains first strike until end of turn. -- Overload {1}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") +mana={R} +type=Instant +[/card] +[card] name=Weathered Wayfarer auto={W}{T}:moveTo(myhand) target(land|mylibrary) restriction{type(land|opponentbattlefield)~morethan~type(land|mybattlefield)} text={W}, {T}: Search your library for a land card, reveal it, and put it into your hand. Then shuffle your library. Activate this ability only if an opponent controls more lands than you. diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 2ad1ef6c6..565840ba0 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -1304,12 +1304,6 @@ type=Enchantment text=Each noncreature, non-Equipment artifact is an Equipment with equip {X} and "Equipped creature gets +X/+0," where X is that artifact's converted mana cost. [/card] [card] -name=Blustersquall -text=Tap target creature you don't control. -- Overload {3}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={U} -type=Instant -[/card] -[card] name=Boar Umbra mana={2}{G} type=Enchantment @@ -2380,12 +2374,6 @@ type=Enchantment text=Whenever any spell is played, counter that spell if each player, other than the caster and his or her teammates, agrees to choose and discard a card. Those players must discard those cards after agreeing. Checks and Balances may be played only in a game with three or more players. [/card] [card] -name=Chemister's Trick -text=Target creature you don't control gets -2/-0 until end of turn and attacks this turn if able. -- Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={U}{R} -type=Instant -[/card] -[card] name=Chicken Egg mana={1}{R} type=Summon — Egg @@ -2995,12 +2983,6 @@ mana={U}{U} type=Enchantment [/card] [card] -name=Counterflux -text=Counterflux can't be countered by spells or abilities. -- Counter target spell you don't control. -- Overload {1}{U}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={U}{U}{R} -type=Instant -[/card] -[card] name=Countryside Crusher text=At the beginning of your upkeep, reveal the top card of your library. If it's a land card, put it into your graveyard and repeat this process. -- Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher. mana={1}{R}{R} @@ -3300,12 +3282,6 @@ mana={2}{G}{G} type=Enchantment [/card] [card] -name=Cyclonic Rift -text=Return target nonland permanent you don't control to its owner's hand. -- Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={1}{U} -type=Instant -[/card] -[card] name=Cyclopean Giant text=When Cyclopean Giant is put into a graveyard from the battlefield, target land becomes a Swamp. Exile Cyclopean Giant. mana={2}{B}{B} @@ -4071,12 +4047,6 @@ mana={3}{B} // {2}{G} type=Sorcery // Sorcery [/card] [card] -name=Downsize -text=Target creature you don't control gets -4/-0 until end of turn. -- Overload {2}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={U} -type=Instant -[/card] -[card] name=Draco text=Domain - Draco costs {2} less to cast for each basic land type among lands you control. -- Flying -- Domain - At the beginning of your upkeep, sacrifice Draco unless you pay {1}0}. This cost is reduced by {2} for each basic land type among lands you control. mana={16} @@ -4278,12 +4248,6 @@ power=1 toughness=1 [/card] [card] -name=Dynacharge -text=Target creature you control gets +2/+0 until end of turn. -- Overload {2}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={R} -type=Instant -[/card] -[card] name=Echo Chamber text={4}, {T}: An opponent chooses target creature he or she controls. Put a token that's a copy of that creature onto the battlefield. That token gains haste until end of turn. Exile the token at the beginning of the next end step. Activate this ability only any time you could cast a sorcery. mana={4} @@ -4334,12 +4298,6 @@ type=Land text={T}: Add {1} to your mana pool. {T}: Add {2} to your mana pool. Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi. [/card] [card] -name=Electrickery -text=Electrickery deals 1 damage to target creature you don't control. -- Overload {1}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={R} -type=Instant -[/card] -[card] name=Electropotence text=Whenever a creature enters the battlefield under your control, you may pay {2}{R}. If you do, that creature deals damage equal to its power to target creature or player. mana={2}{R} @@ -10075,18 +10033,6 @@ mana={1}{U}{U} type=Sorcery [/card] [card] -name=Mizzium Mortars -text=Mizzium Mortars deals 4 damage to target creature you don't control. -- Overload {3}{R}{R}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={1}{R} -type=Sorcery -[/card] -[card] -name=Mizzium Skin -text=Target creature you control gets +0/+1 and gains hexproof until end of turn. -- Overload {1}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={U} -type=Instant -[/card] -[card] name=Mizzium Transreliquat text={3}: Mizzium Transreliquat becomes a copy of target artifact until end of turn. -- {1}{U}{R}: Mizzium Transreliquat becomes a copy of target artifact and gains this ability. mana={3} @@ -15879,12 +15825,6 @@ type=Enchantment subtype=Aura [/card] [card] -name=Street Spasm -text=Street Spasm deals X damage to target creature without flying you don't control. -- Overload {X}{X}{R}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={X}{R} -type=Instant -[/card] -[card] name=Strength of the Tajuru text=Multikicker {1} (You may pay an additional {1} any number of times as you cast this spell.) -- Choose target creature, then choose another target creature for each time Strength of the Tajuru was kicked. Put X +1/+1 counters on each of them. mana={X}{G}{G} @@ -16368,12 +16308,6 @@ mana={U} type=Enchantment [/card] [card] -name=Teleportal -text=Target creature you control gets +1/+0 until end of turn and is unblockable this turn. -- Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={U}{R} -type=Sorcery -[/card] -[card] name=Telling Time text=Look at the top three cards of your library. Put one of those cards into your hand, one on top of your library, and one on the bottom of your library. mana={1}{U} @@ -17394,12 +17328,6 @@ power=3 toughness=3 [/card] [card] -name=Vandalblast -text=Destroy target artifact you don't control. -- Overload {4}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -mana={R} -type=Sorcery -[/card] -[card] name=Vanguard's Shield text=Equipped creature gets +0/+3 and can block an additional creature. -- Equip {3} ({3}: Attach to target creature you control. Equip only as a sorcery.) mana={2} diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index 70d6344b9..d71d822f2 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -214,6 +214,8 @@ public: PUT_INTO_PLAY_WITH_KICKER = 31, STANDARD_FIZZLER = 32, PAYZERO_COST = 33, + OVERLOAD_COST = 34, + BESTOW_COST = 35, }; }; diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 8c1882e91..f5b5cdc5e 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -55,7 +55,7 @@ public: Pos* view; int X; int castX; - int alternateCostPaid[ManaCost::MANA_PAID_WITH_SUSPEND + 1]; + int alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW + 1]; int paymenttype; int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */ int frozen; diff --git a/projects/mtg/include/MTGRules.h b/projects/mtg/include/MTGRules.h index 19fc9775c..7f95e8cb6 100644 --- a/projects/mtg/include/MTGRules.h +++ b/projects/mtg/include/MTGRules.h @@ -101,7 +101,7 @@ class MTGAlternativeCostRule: public PermanentAbility { protected: int isReactingToClick(MTGCardInstance * card, ManaCost * mana, ManaCost *alternateManaCost); - int reactToClick(MTGCardInstance * card, ManaCost * alternateManaCost, int paymentType = ManaCost::MANA_PAID); + int reactToClick(MTGCardInstance * card, ManaCost * alternateManaCost, int paymentType = ManaCost::MANA_PAID, bool overload = false); string alternativeName; public: int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); @@ -192,6 +192,19 @@ public: virtual MTGPayZeroRule * clone() const; }; +class MTGOverloadRule: public MTGAlternativeCostRule +{ +public: + int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); + int reactToClick(MTGCardInstance * card); + virtual ostream& toString(ostream& out) const; + MTGOverloadRule(GameObserver* observer, int _id); + const string getMenuText() + { + return "Overload"; + } + virtual MTGOverloadRule * clone() const; +}; class MTGSuspendRule: public MTGAlternativeCostRule { diff --git a/projects/mtg/include/ManaCost.h b/projects/mtg/include/ManaCost.h index bdc3868ab..21a6a2c99 100644 --- a/projects/mtg/include/ManaCost.h +++ b/projects/mtg/include/ManaCost.h @@ -48,7 +48,9 @@ public: MANA_PAID_WITH_RETRACE = 6, MANA_PAID_WITH_MORPH = 7, MANA_PAID_WITH_SUSPEND = 8, - MANA_PAID_WITH_OTHERCOST = 9 + MANA_PAID_WITH_OVERLOAD = 9, + MANA_PAID_WITH_BESTOW = 10, + MANA_PAID_WITH_OTHERCOST = 11 }; ExtraCosts * extraCosts; diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 88de3027b..47bf7ae8a 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -303,6 +303,12 @@ bool Spell::FullfilledAlternateCost(const int &costType) case ManaCost::MANA_PAID_WITH_SUSPEND: hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_SUSPEND); break; + case ManaCost::MANA_PAID_WITH_OVERLOAD: + hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_OVERLOAD); + break; + case ManaCost::MANA_PAID_WITH_BESTOW: + hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_BESTOW); + break; } return hasFullfilledAlternateCost; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index bcb131764..99cb4744b 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -39,7 +39,9 @@ const string kAlternateCostKeywords[] = "flashback", "retrace", "facedown", - "suspended" + "suspended", + "overload", + "bestow" }; const int kAlternateCostIds[] = { @@ -51,7 +53,9 @@ const int kAlternateCostIds[] = ManaCost::MANA_PAID_WITH_FLASHBACK, ManaCost::MANA_PAID_WITH_RETRACE, ManaCost::MANA_PAID_WITH_MORPH, - ManaCost::MANA_PAID_WITH_SUSPEND + ManaCost::MANA_PAID_WITH_SUSPEND, + ManaCost::MANA_PAID_WITH_OVERLOAD, + ManaCost::MANA_PAID_WITH_BESTOW }; //Used for "dynamic ability" parsing @@ -1162,6 +1166,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG observer->addObserver(NEW MTGPayZeroRule(observer, -1)); return NULL; } + found = s.find("overloadrule"); + if(found != string::npos) + { + observer->addObserver(NEW MTGOverloadRule(observer, -1)); + return NULL; + } //this rule handles attacking ability during attacker phase found = s.find("attackrule"); if(found != string::npos) diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index f74227a18..5fe7fcddd 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -546,7 +546,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy copy->kicked = card->kicked; copy->storedCard = card->storedCard; copy->storedSourceCard = card->storedSourceCard; - for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++) + for (int i = 0; i < ManaCost::MANA_PAID_WITH_BESTOW +1; i++) copy->alternateCostPaid[i] = card->alternateCostPaid[i]; //stupid bug with tokens... diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index d2bd12990..88c31a78c 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -632,6 +632,8 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * return 0; if ((game->currentlyActing()->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (game->currentlyActing()->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE))) return 0; + if (card->alias == 110000) + return 0;//overload has its own rule return isReactingToClick( card, mana, alternateCost ); } @@ -693,12 +695,17 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card) return reactToClick(card, alternateCost, ManaCost::MANA_PAID_WITH_ALTERNATIVE); } -int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType){ +int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType, bool overload){ Player * player = game->currentlyActing(); ManaPool * playerMana = player->getManaPool(); //this handles extra cost payments at the moment a card is played. + if(overload) + card->spellTargetType = ""; + else if(card->model->data->spellTargetType.size()) + card->spellTargetType = card->model->data->spellTargetType; + assert(alternateCost); if (alternateCost->isExtraPaymentSet() ) { @@ -1210,6 +1217,60 @@ MTGPayZeroRule * MTGPayZeroRule::clone() const return NEW MTGPayZeroRule(*this); } +MTGOverloadRule::MTGOverloadRule(GameObserver* observer, int _id) : +MTGAlternativeCostRule(observer, _id) +{ + aType = MTGAbility::OVERLOAD_COST; +} + +int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) +{ + Player * player = game->currentlyActing(); + ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative()); + if(card->getIncreasedManaCost()->getConvertedCost()) + cost->add(card->getIncreasedManaCost()); + if(card->getReducedManaCost()->getConvertedCost()) + cost->remove(card->getReducedManaCost()); + + if (card->isLand()) + return 0; + if (card->alias != 110000) + return 0; + if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card)) + return 0; + if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card))||(!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card))) + return 0; + + return MTGAlternativeCostRule::isReactingToClick(card, mana, cost); +} + +int MTGOverloadRule::reactToClick(MTGCardInstance * card) +{ + if (!isReactingToClick(card)) + return 0; + + ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative()); + if(card->getIncreasedManaCost()->getConvertedCost()) + cost->add(card->getIncreasedManaCost()); + if(card->getReducedManaCost()->getConvertedCost()) + cost->remove(card->getReducedManaCost()); + + card->paymenttype = MTGAbility::OVERLOAD_COST; + + return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID_WITH_OVERLOAD, true); +} + +ostream& MTGOverloadRule::toString(ostream& out) const +{ + out << "MTGOverloadRule ::: ("; + return MTGAbility::toString(out) << ")"; +} + +MTGOverloadRule * MTGOverloadRule::clone() const +{ + return NEW MTGOverloadRule(*this); +} + /////////////////////////////////////////////////////////////////////////////////////////////////// bool MTGAttackRule::select(Target* t)