diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index acf05465d..8edcf050d 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -1,7 +1,7 @@ grade=borderline #Bordeline Primitives Pack for Wagic the Homebrew. #Please keep these card alphabetized, and try to have the "name=" line at the top of each card -#I sorted this programmatically - Thanks to Vitty85 24-07-2023 +#I sorted this programmatically - Thanks to Vitty85 25-07-2023 [card] name=+2 Mace auto={3}:equip @@ -18701,7 +18701,7 @@ name=Contamination auto=upcost[{S(creature|mybattlefield)}] sacrifice auto=lord(land) loseabilities auto=lord(land) losesubtypesof(land) -auto=lord(land) transforms((Swamp)) +auto=lord(land) transforms((,newability[{T}:add{B}])) text=At the beginning of your upkeep, sacrifice Contamination unless you sacrifice a creature. -- If a land is tapped for mana, it produces {B} instead of any other type and amount. mana={2}{B} type=Enchantment @@ -18907,7 +18907,7 @@ toughness=2 [/card] [card] name=Corpsejack Menace -auto=@counteradded(1/1) from(creature|battlefield) except(Corpsejack Menace):may target(creature[counter{1/1.1}]|Battlefield) counter(1/1) notrg +auto=@totalcounteradded(1/1) from(creature|battlefield) duplicate(all):ability$!name(Double the counter) donothing!$ controller text=If one or more +1/+1 counters would be placed on a creature you control, twice that many +1/+1 counters are placed on it instead. mana={2}{B}{G} type=Creature @@ -22478,7 +22478,7 @@ toughness=2 [/card] [card] name=Deep Water -auto={U}:name(All lands produce blue mana) ueot loseabilities && losesubtypesof(land) && transforms((island)) target(land|mybattlefield) +auto={U}:name(All lands produce blue mana) transforms((,newability[lord(land|mybattlefield) loseabilities],newability[lord(land|mybattlefield) losesubtypesof(land)],newability[lord(land|mybattlefield) transforms((,newability[{T}:add{U}]))])) ueot text={U}: Until end of turn, if you tap a land you control for mana, it produces {U} instead of any other type. mana={U}{U} type=Enchantment @@ -25063,7 +25063,7 @@ type=Sorcery [card] name=Doubling Season auto=@tokencreated(*|myBattlefield):name(Double the token) all(trigger) clone options(notrigger) -auto=@counteradded(duplicateAll) from(*|myBattlefield):ability$!name(Double the counter) donothing!$ controller +auto=@totalcounteradded(1/1) from(*|myBattlefield) duplicate(all) nocost:ability$!name(Double the counter) donothing!$ controller text=If an effect would put one or more tokens onto the battlefield under your control, it puts twice that many of those tokens onto the battlefield instead. -- If an effect would place one or more counters on a permanent you control, it places twice that many of those counters on that permanent instead. mana={4}{G} type=Enchantment @@ -37247,8 +37247,8 @@ type=Instant [/card] [card] name=Generous Patron -auto=target(creature) counter(1/1) -auto=@counteradded(any) from(creature|opponentbattlefield):may draw:1 controller +auto=may name(Put 1/1 counters) target(creature) counter(1/1) +auto=@totalcounteradded(any) from(creature|opponentbattlefield):may name(Draw a card) draw:1 controller text=When Generous Patron enters the battlefield, support 2. (Put a +1/+1 counter on each of up to two other target creatures.) -- Whenever you put one or more counters on a creature you don't control, draw a card. mana={2}{G} type=Creature @@ -43466,7 +43466,7 @@ toughness=3 [/card] [card] name=Harvest Mage -auto={G}{T}{D(*|myhand)}:lord(land|mybattlefield) transforms((,newability[producecolor:land],newability[producecolor:green],newability[producecolor:blue],newability[producecolor:red],newability[producecolor:black],newability[producecolor:white])) ueot +auto={G}{T}{D(*|myhand)}:name(Lands produce any color) transforms((,newability[lord(land|mybattlefield) loseabilities],newability[lord(land|mybattlefield) losesubtypesof(land)],newability[lord(land|mybattlefield) transforms((,newability[{T}:add{G}],newability[{T}:add{R}],newability[{T}:add{U}],newability[{T}:add{B}],newability[{T}:add{W}]))])) ueot text={G}, {T}, Discard a card: Until end of turn, if you tap a land for mana, it produces one mana of a color of your choice instead of any other type and amount. mana={G} type=Creature @@ -46951,8 +46951,9 @@ type=Artifact [/card] [card] name=Idol of Oblivion -auto={T}:draw:1 restriction{thisturn(*[token]|mybattlefield)~morethan~0} -auto={8}{T}{S}:token(Eldrazi,Creature Eldrazi,10/10,colorless) +auto=if type(*[token&fresh]|mybattlefield)~morethan~0 then name(Gain ability)name(Gain ability) transforms((,newability[{T}:name(Draw a card) name(Draw a card) draw:1 controller])) ueot +auto=@movedto(*[token]|mybattlefield):name(Gain ability) transforms((,newability[{T}:name(Draw a card) name(Draw a card) draw:1 controller])) ueot +auto={8}{T}{S}:name(Create eldrazi) token(Eldrazi,Creature Eldrazi,10/10) text={T}: Draw a card. Activate this ability only if you created a token this turn. -- {8}, {T}, Sacrifice Idol of Oblivion: Create a 10/10 colorless Eldrazi creature token. mana={2} type=Artifact @@ -47040,8 +47041,8 @@ type=Instant [card] name=Ignite the Future flashback={7}{R} -auto=ifnot gravecast then all(*[zpos<=3]|mylibrary) moveto(exile) and!( transforms((,newability[canplayfromexile uent])) uent )! -auto=if gravecast then all(*[zpos<=3]|mylibrary) moveto(exile) and!( transforms((,newability[canplayfromexile uent],newability[zerocast uent])) uent )! +auto=ifnot gravecast then all(*[zpos<=3]|mylibrary) moveto(myexile) and!( transforms((,newability[canplayfromexile uent])) uent )! +auto=if gravecast then all(*[zpos<=3]|mylibrary) moveto(myexile) and!( transforms((,newability[canplayfromexile uent],newability[zerocast uent])) uent )! text=Exile the top three cards of your library. Until the end of your next turn, you may play those cards. If this spell was cast from a graveyard, you may play cards this way without paying their mana costs. -- Flashback {7}{R} (You may cast this card from your graveyard for its flashback cost. Then exile it.) mana={3}{R} type=Sorcery @@ -47703,9 +47704,9 @@ toughness=1 [/card] [card] name=Imprisoned in the Moon -target=*[creature;land;planeswalker]|battlefield +target=creature,land,planeswalker auto=loseabilities -auto=transforms((removetypes,newability[becomes(Land)],newability[{T}:add{1}])) forever +auto=teach(*) transforms((removeallsubtypes,removeallcolors,newability[becomes(Land)],newability[{T}:add{C}])) text=Enchant creature, land, or planeswalker -- Enchanted permanent is a colorless land with "{T}: Add {C} to your mana pool" and loses all other card types and abilities. mana={2}{U} type=Enchantment @@ -47713,7 +47714,7 @@ subtype=Aura [/card] [card] name=Improbable Alliance -auto=_SECOND_DRAW_create(Faerie:creature Faerie:1/1:blue:flying) +auto=_SECOND_DRAW_ name(Create faerie) token(Faerie,Creature Faerie,1/1,blue,flying) auto={4}{U}{R}:_LOOT_ text=Whenever you draw your second card each turn, create a 1/1 blue Faerie creature token with flying. -- {4}{U}{R}: Draw a card, then discard a card. mana={U}{R} @@ -48095,7 +48096,7 @@ type=Sorcery [card] name=Inevitable End target=creature -auto=teach(creature) @each controller upkeep:upcost[{S(creature|myBattlefield)}] sacrifice +auto=teach(creature) transforms((,newability[@each my upkeep:name(Sacrifice a creature) target(creature|myBattlefield) sacrifice])) text=Enchant creature -- Enchanted creature has "At the beginning of your upkeep, sacrifice a creature." mana={2}{B} type=Enchantment @@ -48150,9 +48151,9 @@ subtype=Aura [card] name=Infernal Darkness auto=cumulativeupcost[{B}{L:1}] sacrifice -auto=all(land|battlefield) loseabilities && all(land|battlefield) losesubtypesof(land) && all(land|battlefield) transforms((swamp)) ueot -auto=@each untap:all(land|battlefield) loseabilities && all(land|battlefield) losesubtypesof(land) && all(land|battlefield) transforms((swamp)) ueot -auto=@movedTo(land|battlefield):all(trigger[to]) loseabilities && all(trigger[to]) losesubtypesof(land) && all(trigger[to]) transforms((swamp)) ueot +auto=lord(land) loseabilities +auto=lord(land) losesubtypesof(land) +auto=lord(land) transforms((,newability[{T}:add{B}])) text=Cumulative upkeep-Pay {B} and 1 life. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.) -- If a land is tapped for mana, it produces {B} instead of any other type. mana={2}{B}{B} type=Enchantment @@ -49175,8 +49176,7 @@ toughness=3 [/card] [card] name=Intuition -auto=target(*|mylibrary) moveto(myhand) -auto=ability$!name(Put in graveyard) name(Put in graveyard) target(<2>*|opponentlibrary) moveto(opponentgraveyard)!$ opponent +auto=name(Search first card) target(*|mylibrary) moveto(myhand) and!( transforms((tobeint,newability[name(Search second card) target(*|mylibrary) moveto(myhand) and!( transforms((tobeint,newability[name(Search third card) target(*|mylibrary) moveto(myhand) and!( transforms((tobeint,newability[shuffle],newability[ability$!name(Put in graveyard) name(Put in graveyard) target(tobeint|opponenthand) moveto(opponentgraveyard) and!( all(other tobeint|opponenthand) losesatype(tobeint) )!!$ opponent])) ueot )!])) ueot )!])) ueot )! text=Search your library for any three cards and reveal them. Target opponent chooses one. Put that card into your hand and the rest into your graveyard. Then shuffle your library. mana={2}{U} type=Instant @@ -50186,7 +50186,7 @@ subtype=Plains Island [card] name=Isareth the Awakener abilities=deathtouch -auto=_ATTACKING_pay({2}) target(creature[manacost<=2]|mygraveyard) moveto(mybattlefield) +auto=_ATTACKING_may name(Pay and return) pay({x}) name(Pay and return) transforms((,newability[name(Pay and return) target(creature[manacost=x]|mygraveyard) moveto(mybattlefield) and!( transforms((,newability[counter(0/0.1.Corpse)],newability[exiledeath])) forever )!])) forever text=Deathtouch -- Whenever Isareth the Awakener attacks, you may pay {X}. When you do, return target creature card with mana value X from your graveyard to the battlefield with a corpse counter on it. If that creature would leave the battlefield, exile it instead of putting it anywhere else. mana={1}{B}{B} type=Legendary Creature @@ -50230,7 +50230,9 @@ type=Legendary Instant [/card] [card] name=Island Sanctuary -auto=replacedraw turnlimited ability$!name(Choose one) choice name(Skip draw and become unattackable) lord(creature[-flying;-islandwalk]|opponentBattlefield) cantattack uynt _ choice name(Draw card) draw:1 noreplace controller!$ controller +auto=replacedraw turnlimited ability$!name(Choose one) choice name(Skip draw and become unattackable) all(Island Sanctuary[-unattackable]|mybattlefield) becomes(unattackable) forever _ choice name(Draw card) draw:1 noreplace controller!$ controller +auto=this(cantargetcard(*[unattackable]|*) transforms((,newability[lord(creature[-flying]|opponentBattlefield) cantattack],newability[lord(creature[-islandwalk]|opponentBattlefield) cantattack])) +auto=@each opponent end:name(Effect ends) losesatype(unattackable) text=If you would draw a card during your draw step, instead you may skip that draw. If you do, until your next turn, you can't be attacked except by creatures with flying and/or islandwalk. mana={1}{W} type=Enchantment @@ -69806,7 +69808,7 @@ type=Legendary Artifact [/card] [card] name=Pale Moon -auto=emblem transforms((,newability[lord(land[-basic]|battlefield) transforms((,newability[loseabilities],newability[{T}:name(Add colorless) add{C}]))])) ueot +auto=emblem transforms((,newability[lord(land[-basic]|battlefield) transforms((,newability[loseabilities],newability[losesubtypesof(land)],newability[{T}:name(Add colorless) add{C}]))])) ueot text=Until end of turn, if a player taps a nonbasic land for mana, it produces colorless mana instead of any other type. mana={1}{U} type=Instant @@ -73273,7 +73275,7 @@ type=Sorcery name=Primal Vigor auto=@tokencreated(*|myBattlefield):name(Double the token) all(trigger) clone options(notrigger) auto=@tokencreated(*|opponentBattlefield):name(Double the token) all(trigger) clone options(notrigger) and!( transforms((,newability[moveto(opponentBattlefield)])) forever )! -auto=@counteradded(1/1) from(creature|battlefield) except(Primal Vigor):may counter(1/1) target(creature[counter{1/1.1}]|Battlefield) +auto=@totalcounteradded(1/1) from(creature|battlefield) duplicate(all):ability$!name(Double the counter) donothing!$ controller text=If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead. -- If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead. mana={4}{G} type=Enchantment @@ -74249,7 +74251,9 @@ type=Sorcery [/card] [card] name=Pulse of Llanowar -auto=all(land[basic]|mybattlefield) transforms((,newability[producecolor:land],newability[producecolor:green],newability[producecolor:blue],newability[producecolor:red],newability[producecolor:black],newability[producecolor:white])) forever +auto=lord(land[basic]|mybattlefield) loseabilities +auto=lord(land[basic]|mybattlefield) losesubtypesof(land) +auto=lord(land[basic]|mybattlefield) transforms((,newability[{T}:add{G}],newability[{T}:add{R}],newability[{T}:add{U}],newability[{T}:add{B}],newability[{T}:add{W}])) text=If a basic land you control is tapped for mana, it produces mana of a color of your choice instead of any other type. mana={3}{G} type=Enchantment @@ -79547,8 +79551,9 @@ type=Sorcery [card] name=Ritual of Subdual auto=cumulativeupcost[{2}] sacrifice -auto=all(land|mybattlefield) loseabilities && transforms((,newability[producecolor:land])) forever -auto=all(land|opponentbattlefield) loseabilities && transforms((,newability[producecolor:land])) forever +auto=lord(land|battlefield) loseabilities +auto=lord(land|battlefield) losesubtypesof(land) +auto=lord(land|battlefield) transforms((,newability[{T}:name(Add colorless) add{C}])) text=Cumulative upkeep {2} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.) -- If a land is tapped for mana, it produces colorless mana instead of any other type. mana={4}{G}{G} type=Enchantment @@ -82982,7 +82987,7 @@ auto=@movedTo(mytgt|sideboard) from(battlefield):all(this) moveTo(mySideboard) auto=@movedTo(mytgt|commandzone) from(battlefield):all(this) moveTo(myCommandzone) auto={9999}:equip other={3}{G} name(Mutate) -auto=if paid(alternative) then if compare(mutations)~equalto~0 then choice name(Mutate Over) name(Mutate Over) name(Mutate Over) target(other creature[-human]|mybattlefield) mutateover +auto=if paid(alternative) then if compare(mutations)~equalto~0 then choice name(Mutate Over) name(Mutate Over) name(Mutate Over) target(other creature[-human]|mybattlefield) mutateover auto=if paid(alternative) then if compare(mutations)~equalto~0 then choice name(Mutate Over) name(Mutate Under) name(Mutate Under) target(other creature[-human]|mybattlefield) mutateunder auto=@mutated(this):name(Destroy and create token) target(*[-creature]|battlefield) destroy and!( transforms((,newability[token(Beast Saw) controller])) oneshot )! auto=@mutated(mytgt):name(Destroy and create token) target(*[-creature]|battlefield) destroy and!( transforms((,newability[token(Beast Saw) controller])) oneshot )! @@ -106785,7 +106790,7 @@ toughness=0 [/card] [card] name=Vizier of Remedies -auto=@totalcounteradded(-1/-1) from(creature|myBattlefield):name(That many minus one) all(trigger[from]) name(That many minus one) counter(-1/-1,-1) +auto=@totalcounteradded(-1/-1) from(creature|myBattlefield):name(That many minus one) all(trigger[from]) name(That many minus one) counter(-1/-1,-1) notrg text=If one or more -1/-1 counters would be put on a creature you control, that many -1/-1 counters minus one are put on it instead. mana={1}{W} type=Creature @@ -107365,14 +107370,14 @@ toughness=6 [card] name=Vorinclex, Monstrous Raider abilities=trample,haste -auto=@totalcounteradded(duplicateAll) from(*|myBattlefield):ability$!name(Double the counters) donothing!$ controller -auto=@totalcounteradded(halfAll) from(*|opponentbattlefield):ability$!name(Half the counters) donothing!$ controller -auto=@energizedof(player) duplicate(All):ability$!name(Double the counters) donothing!$ controller -auto=@energizedfoeof(player) half(All):ability$!name(Half the counters) donothing!$ controller -auto=@poisonedof(player) half(All):ability$!name(Half the counters) donothing!$ controller -auto=@poisonedfoeof(player) duplicate(All):ability$!name(Double the counters) donothing!$ controller -auto=@experiencedof(player) duplicate(All):ability$!name(Double the counters) donothing!$ controller -auto=@experiencedfoeof(player) half(All):ability$!name(Half the counters) donothing!$ controller +auto=@totalcounteradded(any) from(*|myBattlefield) duplicate(all) except(*|opponentzones):ability$!name(Double the counters) donothing!$ controller +auto=@totalcounteradded(any) from(*|opponentbattlefield) half(all) except(*|myzones):ability$!name(Half the counters) donothing!$ controller +auto=@energizedof(player) duplicate(all):ability$!name(Double the counters) donothing!$ controller +auto=@energizedfoeof(player) half(all):ability$!name(Half the counters) donothing!$ controller +auto=@poisonedof(player) half(all):ability$!name(Half the counters) donothing!$ controller +auto=@poisonedfoeof(player) duplicate(all):ability$!name(Double the counters) donothing!$ controller +auto=@experiencedof(player) duplicate(all):ability$!name(Double the counters) donothing!$ controller +auto=@experiencedfoeof(player) half(all):ability$!name(Half the counters) donothing!$ controller text=Trample, haste -- If you would put one or more counters on a permanent or player, put twice that many of each of those kinds of counters on that permanent or player instead. -- If an opponent would put one or more counters on a permanent or player, they put half that many of each of those kinds of counters on that permanent or player instead, rounded down. mana={4}{G}{G} type=Legendary Creature diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 9e763e0f3..6f9b8cd1f 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -1,6 +1,6 @@ #Primitives Pack for Wagic the Homebrew. #Please keep these card alphabetized, and try to have the "name=" line at the top of each card -#I sorted this programmatically so the other comments are removed except for AUTO_DEFINE - Vitty85 24-07-2023 +#I sorted this programmatically so the other comments are removed except for AUTO_DEFINE - Vitty85 25-07-2023 [card] name=Abandon Reason target=creature @@ -24482,7 +24482,16 @@ type=Land [/card] [card] name=Crypt Rats -auto={X:black}:damage:X all(creature) && damage:X all(player) +auto={B}:name(X=1) damage:1 all(creature|battlefield) && damage:1 all(player) +auto={B}{B}:name(X=2) damage:2 all(creature|battlefield) && damage:2 all(player) +auto={B}{B}{B}:name(X=3) damage:3 all(creature|battlefield) && damage:3 all(player) +auto={B}{B}{B}{B}:name(X=4) damage:4 all(creature|battlefield) && damage:4 all(player) +auto={B}{B}{B}{B}{B}:name(X=5) damage:5 all(creature|battlefield) && damage:5 all(player) +auto={B}{B}{B}{B}{B}{B}:name(X=6) damage:6 all(creature|battlefield) && damage:6 all(player) +auto={B}{B}{B}{B}{B}{B}{B}:name(X=7) damage:7 all(creature|battlefield) && damage:7 all(player) +auto={B}{B}{B}{B}{B}{B}{B}{B}:name(X=8) damage:8 all(creature|battlefield) && damage:8 all(player) +auto={B}{B}{B}{B}{B}{B}{B}{B}{B}:name(X=9) damage:9 all(creature|battlefield) && damage:9 all(player) +auto={B}{B}{B}{B}{B}{B}{B}{B}{B}{B}{X:black}:name(X>=10) damage:Xplus10plusend all(creature|battlefield) && damage:Xplus10plusend all(player) text={X}: Crypt Rats deals X damage to each creature and each player. Spend only black mana this way. mana={2}{B} type=Creature @@ -29106,7 +29115,8 @@ toughness=2 [card] name=Devoted Druid auto={T}:add{G} -auto={0}:name(Put counter and untap) transforms((,newability[counter(-1/-1)],newability[untap])) oneshot +#auto={0}:name(Put counter and untap) transforms((,newability[counter(-1/-1)],newability[untap])) oneshot +auto={C(-1/-1,1)}:name(Put counter and untap) untap text={T}: Add {G} to your mana pool. -- Put a -1/-1 counter on Devoted Druid: Untap Devoted Druid. mana={1}{G} type=Creature diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 491b8a778..ea3391dfd 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -746,8 +746,8 @@ class TrplayerProliferated: public Trigger { public: bool thiscontroller, thisopponent; - MTGCardInstance * proliferateException; //added exception to avid a proliferation loop (eg. Tekuthal, Inquiry Dominus) - TrplayerProliferated(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool thiscontroller = false, bool thisopponent = false, MTGCardInstance * proliferateException = NULL) : + TargetChooser * proliferateException; //added exception to avid a proliferation loop (eg. Tekuthal, Inquiry Dominus) + TrplayerProliferated(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false, bool thiscontroller = false, bool thisopponent = false, TargetChooser * proliferateException = NULL) : Trigger(observer, id, source, once, tc), thiscontroller(thiscontroller), thisopponent(thisopponent), proliferateException(proliferateException) { } @@ -756,7 +756,7 @@ class TrplayerProliferated: public Trigger { WEventplayerProliferated * e = dynamic_cast (event); if (!e) return 0; - if (proliferateException && e->source && !strcmp(proliferateException->data->name.c_str(), e->source->data->name.c_str())) return 0; //If the source of proliferation it's the exception card it doesn't have effect (loop avoidance); + if (proliferateException && proliferateException->canTarget(e->source)) return 0; //If the source of proliferation belongs to exception it doesn't have effect (loop avoidance); if (!tc->canTarget(e->player)) return 0; if(thiscontroller) if(e->player != source->controller()) @@ -1485,8 +1485,8 @@ class TrLifeGained: public Trigger bool sourceUntapped, thiscontroller, thisopponent; bool limitOnceATurn; int triggeredTurn; - MTGCardInstance * gainException; //added exception to avid a gainlife loop (eg. Angels of Vitality) - TrLifeGained(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, TargetChooser * fromTc = NULL, int type = 0, bool sourceUntapped = false, bool once = false, bool thiscontroller = false, bool thisopponent = false, bool limitOnceATurn = false, MTGCardInstance * gainException = NULL) : + TargetChooser * gainException; //added exception to avid a gainlife loop + TrLifeGained(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, TargetChooser * fromTc = NULL, int type = 0, bool sourceUntapped = false, bool once = false, bool thiscontroller = false, bool thisopponent = false, bool limitOnceATurn = false, TargetChooser * gainException = NULL) : Trigger(observer, id, source, once , tc), fromTc(fromTc), type(type), sourceUntapped(sourceUntapped), thiscontroller(thiscontroller), thisopponent(thisopponent), limitOnceATurn(limitOnceATurn), gainException(gainException) { triggeredTurn = -1; @@ -1503,7 +1503,7 @@ class TrLifeGained: public Trigger if (!tc->canTarget(e->player)) return 0; //if (fromTc && !fromTc->canTarget(e->player)) return 0; if (fromTc && !fromTc->canTarget(e->source)) return 0; //Now it's possible to specify if a source can trigger or not the event of life gain - if (gainException && e->source && !strcmp(gainException->data->name.c_str(), e->source->data->name.c_str())) return 0; //If the source of life gain it's the exception card don't gain life (loop avoidance); + if (gainException && gainException->canTarget(e->source)) return 0; //If the source of life gain belongs to exception it doesn't have effect (loop avoidance); if (type == 1 && (e->amount > 0)) return 0; if (type == 0 && (e->amount < 0)) return 0; if(thiscontroller) @@ -1618,8 +1618,8 @@ class TrCounter: public Trigger bool duplicate; bool limitOnceATurn; int triggeredTurn; - MTGCardInstance * counterException; //added exception to avid a counter loop (eg. Doubling Season) - TrCounter(GameObserver* observer, int id, MTGCardInstance * source, Counter * counter, TargetChooser * tc, int type = 0, bool once = false, bool duplicate = false, bool limitOnceATurn = false, MTGCardInstance * counterException = NULL) : + TargetChooser * counterException; //added exception to avid a counter loop (eg. Doubling Season) + TrCounter(GameObserver* observer, int id, MTGCardInstance * source, Counter * counter, TargetChooser * tc, int type = 0, bool once = false, bool duplicate = false, bool limitOnceATurn = false, TargetChooser * counterException = NULL) : Trigger(observer, id, source, once, tc), counter(counter), type(type), duplicate(duplicate), limitOnceATurn(limitOnceATurn), counterException(counterException) { triggeredTurn = -1; @@ -1633,7 +1633,7 @@ class TrCounter: public Trigger return 0; if (type == 0 && !e->removed) return 0; if (type == 1 && !e->added) return 0; - if (counterException && e->source && !strcmp(counterException->data->name.c_str(), e->source->data->name.c_str())) return 0; //If the source of counter gain/loss it's the exception card it doesn't have effect (loop avoidance); + if (counterException && counterException->canTarget(e->source)) return 0; //If the source of counter gain/loss belongs to exception it doesn't have effect (loop avoidance); if (counter && !(e->power == counter->power && e->toughness == counter->toughness && e->name == counter->name)) return 0; if (tc && !tc->canTarget(e->targetCard)) return 0; if (duplicate){ @@ -1668,11 +1668,12 @@ class TrTotalCounter: public Trigger bool duplicate; bool half; int plus; + bool nocost; //added to avoid trigger on counter cost payment (eg. Doubling Season) bool limitOnceATurn; int triggeredTurn; - MTGCardInstance * counterException; //added exception to avid a counter loop (eg. Doubling Season) - TrTotalCounter(GameObserver* observer, int id, MTGCardInstance * source, Counter * counter, TargetChooser * tc, int type = 0, bool once = false, bool duplicate = false, bool half = false, int plus = 0, bool limitOnceATurn = false, MTGCardInstance * counterException = NULL) : - Trigger(observer, id, source, once, tc), counter(counter), type(type), duplicate(duplicate), half(half), plus(plus), limitOnceATurn(limitOnceATurn), counterException(counterException) + TargetChooser * counterException; //added exception to avid a counter loop. + TrTotalCounter(GameObserver* observer, int id, MTGCardInstance * source, Counter * counter, TargetChooser * tc, int type = 0, bool once = false, bool duplicate = false, bool half = false, int plus = 0, bool nocost = false, bool limitOnceATurn = false, TargetChooser * counterException = NULL) : + Trigger(observer, id, source, once, tc), counter(counter), type(type), duplicate(duplicate), half(half), plus(plus), nocost(nocost), limitOnceATurn(limitOnceATurn), counterException(counterException) { triggeredTurn = -1; } @@ -1685,7 +1686,8 @@ class TrTotalCounter: public Trigger return 0; if (type == 0 && !e->removed) return 0; if (type == 1 && !e->added) return 0; - if (counterException && e->source && !strcmp(counterException->data->name.c_str(), e->source->data->name.c_str())) return 0; //If the source of counter gain/loss it's the exception card it doesn't have effect (loop avoidance); + if (nocost && e->iscost) return 0; + if (counterException && counterException->canTarget(e->source)) return 0; //If the source of counter gain/loss belongs to exception it doesn't have effect (loop avoidance); if (counter && !(e->power == counter->power && e->toughness == counter->toughness && e->name == counter->name)) return 0; if (tc && !tc->canTarget(e->targetCard)) return 0; if (plus > 0){ @@ -5409,10 +5411,12 @@ class ATransformer: public MTGAbility list oldtypes; vector dontremove; bool removemc; + bool removeAllColors; bool addNewColors; bool remove; bool removeCreatureSubtypes; bool removeTypes; + bool removeAllSubtypes; string menu; string newpower; diff --git a/projects/mtg/include/WEvent.h b/projects/mtg/include/WEvent.h index 4df869d95..89c806afb 100644 --- a/projects/mtg/include/WEvent.h +++ b/projects/mtg/include/WEvent.h @@ -78,8 +78,9 @@ struct WEventTotalCounters : public WEvent { bool added; bool removed; int totalamount; + bool iscost; MTGCardInstance * source; - WEventTotalCounters(Counters *counter,string name,int power, int toughness,bool added = false, bool removed = false, int totalamount = 0, MTGCardInstance * source = NULL); + WEventTotalCounters(Counters *counter,string name,int power, int toughness,bool added = false, bool removed = false, int totalamount = 0, bool iscost = false, MTGCardInstance * source = NULL); using WEvent::getTarget; virtual Targetable * getTarget(int target); }; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 8625089f3..a83c29530 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2796,7 +2796,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M } if (!noevent) { - WEvent * w = NEW WEventTotalCounters(_target->counters, name.c_str(), power, toughness, true, false, totalcounters, source); + WEvent * w = NEW WEventTotalCounters(_target->counters, name.c_str(), power, toughness, true, false, totalcounters, false, source); dynamic_cast(w)->targetCard = _target->counters->target; _target->getObserver()->receiveEvent(w); } @@ -2812,7 +2812,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M } if (!noevent) { - WEvent * e = NEW WEventTotalCounters(_target->counters, name.c_str(), power, toughness, false, true, totalcounters, source); + WEvent * e = NEW WEventTotalCounters(_target->counters, name.c_str(), power, toughness, false, true, totalcounters, false, source); dynamic_cast(e)->targetCard = _target->counters->target; _target->getObserver()->receiveEvent(e); } @@ -7826,10 +7826,12 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou myCurrentTurn = 1000; //this subkeyword adds a color without removing the existing colors. removemc = (sabilities.find("removemc") != string::npos); + removeAllColors = (sabilities.find("removeallcolors") != string::npos); addNewColors = (sabilities.find("newcolors") != string::npos); remove = (stypes.find("removealltypes") != string::npos); removeCreatureSubtypes = (stypes.find("removecreaturesubtypes") != string::npos); removeTypes = (stypes.find("removetypes") != string::npos); + removeAllSubtypes = (stypes.find("removeallsubtypes") != string::npos); if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos) { @@ -7894,13 +7896,28 @@ int ATransformer::addToGame() if(!addNewColors) _target->setColor(0, 1); } - + if (removeAllColors) + { + for (it = oldcolors.begin(); it != oldcolors.end(); it++) + { + _target->removeColor(*it); + } + } if (removeTypes) { //remove the main types from a card, ie: hidden enchantment cycle. for (int i = 0; i < Subtypes::LAST_TYPE; ++ i) _target->removeType(i,1); } + else if (removeAllSubtypes) + { + //remove all the types from a card without removing official supertypes (e.g. Imprisoned in the Moon) + for (it = oldtypes.begin(); it != oldtypes.end(); it++) + { + if(*it != Subtypes::TYPE_LEGENDARY && *it != Subtypes::TYPE_BASIC && *it != Subtypes::TYPE_SNOW && *it != Subtypes::TYPE_WORLD) + _target->removeType(*it); + } + } else if (remove) { for (it = oldtypes.begin(); it != oldtypes.end(); it++) @@ -8133,7 +8150,7 @@ int ATransformer::destroy() { for (unsigned int i = 0;i < newAbilities[_target].size(); i++) { - // The mutated cards probably cause a double free error and a crash in Wagic, so for now they have been exluded... + // The mutated cards probably cause a double free error and a crash, so for now they have been exluded... if(newAbilities[_target].at(i) && !_target->mutation && _target->currentZone != _target->owner->game->library && !(_target->name == "" && (UYNT || UENT))) { newAbilities[_target].at(i)->forceDestroy = 1; @@ -8145,7 +8162,7 @@ int ATransformer::destroy() newAbilities.erase(_target); } } - if (remove || removeCreatureSubtypes) + if (remove || removeCreatureSubtypes || removeAllSubtypes) { for (it = oldtypes.begin(); it != oldtypes.end(); it++) { @@ -8691,7 +8708,7 @@ int AProduceMana::produce() { if(ManaDescription == "selectmana") { - //I tried menu ability and vector to have a shorter code but it crashes wagic at end of turn... + //I tried menu ability and vector to have a shorter code but it crashes at end of turn... //The may ability on otherhand works but the ability is cumulative... //This must be wrapped on menuability so we can use it on successions... AManaProducer *ap0 = NEW AManaProducer(game, game->mLayers->actionLayer()->getMaxId(), source, source->controller(), ManaCost::parseManaCost(mana[0],NULL,source), NULL, 0,"",false); diff --git a/projects/mtg/src/CardDescriptor.cpp b/projects/mtg/src/CardDescriptor.cpp index 454194f7e..e2e9301da 100644 --- a/projects/mtg/src/CardDescriptor.cpp +++ b/projects/mtg/src/CardDescriptor.cpp @@ -472,6 +472,7 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) if (count) match = NULL; } + if (CDcanProduceC == 1) { int count = card->canproduceMana(Constants::MTG_COLOR_ARTIFACT) + card->canproduceMana(Constants::MTG_COLOR_WASTE); @@ -519,24 +520,27 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) { match = NULL; } - if ((isLeveler == -1 && card->isLeveler) || (isLeveler == 1 && !card->isLeveler)) - { - match = NULL; - } - if ((CDenchanted == -1 && card->enchanted) || (CDenchanted == 1 && !card->enchanted)) - { - match = NULL; - } - if ((CDdamaged == -1 && card->wasDealtDamage > 0) || (CDdamaged == 1 && card->wasDealtDamage == 0)) - { - match = NULL; - } - if ((CDdamager == -1 && (card->damageToOpponent > 0 || card->damageToController > 0 || card->damageToCreature > 0)) - || (CDdamager == 1 && !(card->damageToOpponent > 0 || card->damageToController > 0 || card->damageToCreature > 0))) - { - match = NULL; - } + if ((isLeveler == -1 && card->isLeveler) || (isLeveler == 1 && !card->isLeveler)) + { + match = NULL; + } + + if ((CDenchanted == -1 && card->enchanted) || (CDenchanted == 1 && !card->enchanted)) + { + match = NULL; + } + + if ((CDdamaged == -1 && card->wasDealtDamage > 0) || (CDdamaged == 1 && card->wasDealtDamage == 0)) + { + match = NULL; + } + + if ((CDdamager == -1 && (card->damageToOpponent > 0 || card->damageToController > 0 || card->damageToCreature > 0)) + || (CDdamager == 1 && !(card->damageToOpponent > 0 || card->damageToController > 0 || card->damageToCreature > 0))) + { + match = NULL; + } if(CDopponentDamaged == -1 || CDopponentDamaged == 1 || CDcontrollerDamaged == -1 || CDcontrollerDamaged == 1) { @@ -556,10 +560,12 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card) match = NULL; } } - if ((isToken == -1 && card->isToken) || (isToken == 1 && !card->isToken)) - { - match = NULL; - } + + if ((isToken == -1 && card->isToken) || (isToken == 1 && !card->isToken)) + { + match = NULL; + } + if (attacker == 1) { if (defenser == &AnyCard) diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index 66261a796..f523cd9d4 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -1560,12 +1560,18 @@ int CounterCost::doPay() if (!target) return 0; + //Add counters as a cost if (counter->nb >= 0) - { //Add counters as a cost + { + int totalcounters = 0; for (int i = 0; i < counter->nb; i++) - {//send no event because its a cost not an effect... for doubling season - target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness, true); + { + target->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness); + totalcounters++; } + WEvent * w = NEW WEventTotalCounters(target->counters, counter->name.c_str(), counter->power, counter->toughness, true, false, totalcounters, true, source); + dynamic_cast(w)->targetCard = target->counters->target; + target->getObserver()->receiveEvent(w); if (tc) tc->initTargets(); target = NULL; @@ -1575,10 +1581,15 @@ int CounterCost::doPay() //remove counters as a cost if (hasCounters) { + int totalcounters = 0; for (int i = 0; i < -counter->nb; i++) { target->counters->removeCounter(counter->name.c_str(), counter->power, counter->toughness); + totalcounters++; } + WEvent * w = NEW WEventTotalCounters(target->counters, counter->name.c_str(), counter->power, counter->toughness, false, true, totalcounters, true, source); + dynamic_cast(w)->targetCard = target->counters->target; + target->getObserver()->receiveEvent(w); hasCounters = 0; if (tc) tc->initTargets(); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 6342eaeef..e73958f4e 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1519,7 +1519,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "proliferateof", card)){ TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify an exception in order to avoid proliferation loop (eg. Tekuthal, Inquiry Dominus) if(exception) - return NEW TrplayerProliferated(observer, id, card, tc, once, true, false, exception->source); + return NEW TrplayerProliferated(observer, id, card, tc, once, true, false, exception); else return NEW TrplayerProliferated(observer, id, card, tc, once, true, false); } @@ -1528,7 +1528,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "proliferatefoeof", card)){ TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify an exception in order to avoid proliferation loop (eg. Tekuthal, Inquiry Dominus) if(exception) - return NEW TrplayerProliferated(observer, id, card, tc, once, false, true, exception->source); + return NEW TrplayerProliferated(observer, id, card, tc, once, false, true, exception); else return NEW TrplayerProliferated(observer, id, card, tc, once, false, true); } @@ -1769,9 +1769,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "lifeof", card)) { TargetChooser *fromTc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop (eg. Angels of Vitality) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop. if(exception) - return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped, once, true, false, limitOnceATurn, exception->source); + return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped, once, true, false, limitOnceATurn, exception); else return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped, once, true, false, limitOnceATurn); } @@ -1780,9 +1780,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "lifefoeof", card)) { TargetChooser *fromTc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop (eg. Angels of Vitality) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop. if(exception) - return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped,once, false, true, limitOnceATurn, exception->source); + return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped,once, false, true, limitOnceATurn, exception); else return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped,once, false, true, limitOnceATurn); } @@ -1791,9 +1791,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "lifed", card)) { TargetChooser *fromTc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop (eg. Angels of Vitality) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop. if(exception) - return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped, once, false, false, limitOnceATurn, exception->source); + return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped, once, false, false, limitOnceATurn, exception); else return NEW TrLifeGained(observer, id, card, tc, fromTc, 0, sourceUntapped, once, false, false, limitOnceATurn); } @@ -1802,9 +1802,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "lifelostof", card)) { TargetChooser *fromTc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop (eg. Angels of Vitality) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop. if(exception) - return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, true, false, limitOnceATurn, exception->source); + return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, true, false, limitOnceATurn, exception); else return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, true, false, limitOnceATurn); } @@ -1813,9 +1813,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "lifelostfoeof", card)) { TargetChooser *fromTc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop (eg. Angels of Vitality) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop. if(exception) - return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, false, true, limitOnceATurn,exception->source); + return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, false, true, limitOnceATurn,exception); else return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, false, true, limitOnceATurn); } @@ -1824,9 +1824,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if (TargetChooser * tc = parseSimpleTC(s, "lifeloss", card)) { TargetChooser *fromTc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop (eg. Angels of Vitality) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a life gain/loss card exception in order to avoid life gain loop. if(exception) - return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, false, false, limitOnceATurn, exception->source); + return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, false, false, limitOnceATurn, exception); else return NEW TrLifeGained(observer, id, card, tc, fromTc, 1, sourceUntapped, once, false, false, limitOnceATurn); } @@ -1849,6 +1849,7 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell { vectorsplitCounter = parseBetween(s,"totalcounteradded(",")"); Counter * counter = NULL; + bool nocost = false; bool duplicate = false; bool half = false; int plus = 0; @@ -1862,24 +1863,27 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell plus = 4; else if(s.find("plus(5)") != string::npos) plus = 5; - else if(s.find("(duplicateall)") != string::npos) + else if(s.find("duplicate(all)") != string::npos) duplicate = true; - else if(s.find("(halfall)") != string::npos) + else if(s.find("half(all)") != string::npos) half = true; - else if(s.find("(any)") == string::npos) + if(s.find("(any)") == string::npos) counter = parseCounter(splitCounter[1],card,NULL); + if(s.find("nocost") != string::npos) + nocost = true; TargetChooser * tc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop (eg. Doubling Season) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop. if(exception) - return NEW TrTotalCounter(observer, id, card, counter, tc, 1, once, duplicate, half, plus, limitOnceATurn, exception->source); + return NEW TrTotalCounter(observer, id, card, counter, tc, 1, once, duplicate, half, plus, nocost, limitOnceATurn, exception); else - return NEW TrTotalCounter(observer, id, card, counter, tc, 1, once, duplicate, half, plus, limitOnceATurn); + return NEW TrTotalCounter(observer, id, card, counter, tc, 1, once, duplicate, half, plus, nocost, limitOnceATurn); } if (s.find("totalcounterremoved(") != string::npos) { vectorsplitCounter = parseBetween(s,"totalcounterremoved(",")"); Counter * counter = NULL; + bool nocost = false; bool duplicate = false; bool half = false; int plus = 0; @@ -1893,18 +1897,20 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell plus = 4; else if(s.find("plus(5)") != string::npos) plus = 5; - else if(s.find("(duplicateall)") != string::npos) + else if(s.find("duplicate(all)") != string::npos) duplicate = true; - else if(s.find("(halfall)") != string::npos) + else if(s.find("half(all)") != string::npos) half = true; - else if(s.find("(any)") == string::npos) + if(s.find("(any)") == string::npos) counter = parseCounter(splitCounter[1],card,NULL); + if(s.find("nocost") != string::npos) + nocost = true; TargetChooser * tc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop (eg. Doubling Season) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop. if(exception) - return NEW TrTotalCounter(observer, id, card, counter, tc, 0, once, duplicate, half, plus, limitOnceATurn, exception->source); + return NEW TrTotalCounter(observer, id, card, counter, tc, 0, once, duplicate, half, plus, nocost, limitOnceATurn, exception); else - return NEW TrTotalCounter(observer, id, card, counter, tc, 0, once, duplicate, half, plus, limitOnceATurn); + return NEW TrTotalCounter(observer, id, card, counter, tc, 0, once, duplicate, half, plus, nocost, limitOnceATurn); } if (s.find("counteradded(") != string::npos) @@ -1912,14 +1918,14 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell vectorsplitCounter = parseBetween(s,"counteradded(",")"); Counter * counter = NULL; bool duplicate = false; - if(s.find("(duplicateall)") != string::npos) + if(s.find("duplicate(all)") != string::npos) duplicate = true; - else if(s.find("(any)") == string::npos) + if(s.find("(any)") == string::npos) counter = parseCounter(splitCounter[1],card,NULL); TargetChooser * tc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop (eg. Doubling Season) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop. if(exception) - return NEW TrCounter(observer, id, card, counter, tc, 1, once, duplicate, limitOnceATurn, exception->source); + return NEW TrCounter(observer, id, card, counter, tc, 1, once, duplicate, limitOnceATurn, exception); else return NEW TrCounter(observer, id, card, counter, tc, 1, once, duplicate, limitOnceATurn); } @@ -1929,14 +1935,14 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell vectorsplitCounter = parseBetween(s,"counterremoved(",")"); Counter * counter = NULL; bool duplicate = false; - if(s.find("(duplicateall)") != string::npos) + if(s.find("duplicate(all)") != string::npos) duplicate = true; - else if(s.find("(any)") == string::npos) + if(s.find("(any)") == string::npos) counter = parseCounter(splitCounter[1],card,NULL); TargetChooser * tc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop (eg. Doubling Season) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop. if(exception) - return NEW TrCounter(observer, id, card, counter, tc, 0, once, duplicate, limitOnceATurn, exception->source); + return NEW TrCounter(observer, id, card, counter, tc, 0, once, duplicate, limitOnceATurn, exception); else return NEW TrCounter(observer, id, card, counter, tc, 0, once, duplicate, limitOnceATurn); } @@ -1948,9 +1954,9 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell if(s.find("(any)") == string::npos) counter = parseCounter(splitCounter[1],card,NULL); TargetChooser * tc = parseSimpleTC(s, "from", card); - TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop (eg. Doubling Season) + TargetChooser *exception = parseSimpleTC(s, "except", card); // Added a new keyword except to specify a counter add/remove exception in order to avoid counter loop. if(exception) - return NEW TrCounter(observer, id, card, counter, tc, 2, once, false, limitOnceATurn, exception->source); + return NEW TrCounter(observer, id, card, counter, tc, 2, once, false, limitOnceATurn, exception); else return NEW TrCounter(observer, id, card, counter, tc, 2, once, false, limitOnceATurn); } diff --git a/projects/mtg/src/WEvent.cpp b/projects/mtg/src/WEvent.cpp index 738e42d23..3b93845bd 100644 --- a/projects/mtg/src/WEvent.cpp +++ b/projects/mtg/src/WEvent.cpp @@ -48,8 +48,8 @@ WEvent(),counter(counter),name(name),power(power),toughness(toughness),added(add { } -WEventTotalCounters::WEventTotalCounters(Counters *counter, string name, int power, int toughness, bool added, bool removed, int totalamount, MTGCardInstance* source) : -WEvent(),counter(counter),name(name),power(power),toughness(toughness),added(added),removed(removed),totalamount(totalamount),source(source) +WEventTotalCounters::WEventTotalCounters(Counters *counter, string name, int power, int toughness, bool added, bool removed, int totalamount, bool iscost, MTGCardInstance* source) : +WEvent(),counter(counter),name(name),power(power),toughness(toughness),added(added),removed(removed),totalamount(totalamount),iscost(iscost),source(source) { }