Merge pull request #653 from kevlahnota/master

Exile Zone, Altercost and Hand modifier
This commit is contained in:
Anthony Calosa
2015-10-31 15:46:21 +08:00
48 changed files with 954 additions and 485 deletions
@@ -99,6 +99,29 @@ mana={4}{B}{B}
type=Instant
[/card]
[card]
name=Distortion Strike
target=creature
auto=1/0
auto=unblockable
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={U}
type=Sorcery
text=Target creature gets +1/+0 until end of turn and is unblockable this turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Emerge Unscathed
target=creature|mybattlefield
auto=choice name(green) transforms((,newability[protection from green])) ueot
auto=choice name(red) transforms((,newability[protection from red])) ueot
auto=choice name(blue) transforms((,newability[protection from blue])) ueot
auto=choice name(black) transforms((,newability[protection from black])) ueot
auto=choice name(white) transforms((,newability[protection from white])) ueot
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={W}
type=Instant
text=Target creature you control gains protection from the color of your choice until end of turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Feral Hydra
type=Creature
subtype=Hydra Beast
@@ -247,6 +270,14 @@ power=1
toughness=1
[/card]
[card]
name=Nomads' Assembly
auto=token(Kor Soldier,Creature Kor Soldier,1/1,white)*type:creature:mybattlefield
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={4}{W}{W}
type=Sorcery
text=Put a 1/1 white Kor Soldier creature token onto the battlefield for each creature you control. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Obsessive Search
abilities=madness
autoexile=restriction{discarded} pay({U}) name(pay U to cast) activate name(pay U to cast) castcard(normal)?name(put in graveyard) moveto(ownergraveyard)
@@ -266,6 +297,15 @@ power=3
toughness=1
[/card]
[card]
name=Prey's Vengeance
target=creature
auto=2/2
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={G}
type=Instant
text=Target creature gets +2/+2 until end of turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Psychotic Haze
abilities=madness
autoexile=restriction{discarded} pay({1}{B}) name(pay 1B to cast) activate name(pay 1B to cast) castcard(normal)?name(put in graveyard) moveto(ownergraveyard)
@@ -305,6 +345,15 @@ power=4
toughness=4
[/card]
[card]
name=Recurring Insight
target=opponent
auto=draw:type:*:targetedpersonshand controller
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={4}{U}{U}
type=Sorcery
text=Draw cards equal to the number of cards in target opponent's hand. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Sacellum Godspeaker
auto={T}:foreach(creaure[power>4]|myhand) add{G}
text={T}: Reveal any number of creature cards with power 5 or greater from your hand. Add {G} to your mana pool for each card revealed this way.
@@ -363,6 +412,15 @@ mana={G}{W}
type=Instant
[/card]
[card]
name=Staggershock
target=creature,player
auto=damage:2
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={2}{R}
type=Instant
text=Staggershock deals 2 damage to target creature or player. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Strength of Isolation
abilities=madness
autoexile=restriction{discarded} pay({W}) name(pay W to cast) activate name(pay W to cast) castcard(normal)?name(put in graveyard) moveto(ownergraveyard)
@@ -387,6 +445,33 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Surreal Memoir
auto=moverandom(instant) from(mygraveyard) to(myhand)
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={3}{R}
type=Sorcery
text=Return an instant card at random from your graveyard to your hand. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Survival Cache
auto=life:2 controller
auto=if compare(lifetotal)~morethan~compare(opponentlifetotal) then draw:1 controller
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={2}{W}
type=Sorcery
text=You gain 2 life. Then if you have more life than an opponent, draw a card. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Virulent Swipe
target=creature
auto=2/0
auto=deathtouch
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[endofturn once checkex] activate may activate castcard(restricted)]))
mana={B}
type=Instant
text=Target creature gets +2/+0 and gains deathtouch until end of turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Zombie Brute
abilities=trample
auto=foreach(zombie|myhand) counter(1/1,1)
File diff suppressed because it is too large Load Diff
@@ -3912,12 +3912,6 @@ mana={2}{U}{U}
type=Sorcery
[/card]
[card]
name=Distortion Strike
mana={U}
type=Sorcery
text=Target creature gets +1/+0 until end of turn and is unblockable this turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Divert
text=Change the target of target spell with a single target unless that spell's controller pays {2}.
mana={U}
@@ -4444,12 +4438,6 @@ toughness=1
text=Whenever another creature comes into play, you may stand up and say in a deep, booming voice "Presenting . . . " and that creature's name. If you do, put a +1/+1 counter on that creature.
[/card]
[card]
name=Emerge Unscathed
mana={W}
type=Instant
text=Target creature you control gains protection from the color of your choice until end of turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Empyrial Archangel
text=Flying, shroud -- All damage that would be dealt to you is dealt to Empyrial Archangel instead.
mana={4}{G}{W}{W}{U}
@@ -6132,15 +6120,6 @@ mana={G}
type=Instant
[/card]
[card]
name=Gnat Miser
text=Each opponent's maximum hand size is reduced by one.
mana={B}
type=Creature
subtype=Rat Shaman
power=1
toughness=1
[/card]
[card]
name=Goblin Artisans
text={T}: Flip a coin. If you win the flip, draw a card. If you lose the flip, counter target artifact spell you control that isn't the target of an ability from another creature named Goblin Artisans.
mana={R}
@@ -9849,15 +9828,6 @@ type=Artifact
text=Imprint — Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard. {3}, {T}: Put a token onto the battlefield that's a copy of the exiled card. It gains haste. Exile it at the beginning of the next end step.
[/card]
[card]
name=Minamo Scrollkeeper
text=Defender (This creature can't attack.) -- Your maximum hand size is increased by one.
mana={1}{U}
type=Creature
subtype=Human Wizard
power=2
toughness=3
[/card]
[card]
name=Minamo's Meddling
text=Counter target spell. That spell's controller reveals his or her hand, then discards each card with the same name as a card spliced onto that spell.
mana={2}{U}{U}
@@ -10865,14 +10835,6 @@ power=1
toughness=1
[/card]
[card]
name=Nomads' Assembly
auto=token(Kor Soldier,Creature Kor Soldier,1/1,white)*type:creature:mybattlefield
auto=@movedto(this|stack) from(myhand) restriction{casted(this)}:moveto(exile) and!( transforms((,newability[@each my upkeep once:may activate castcard(restricted)])) )! forever
mana={4}{W}{W}
type=Sorcery
text=Put a 1/1 white Kor Soldier creature token onto the battlefield for each creature you control. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Norn's Annex
#cant choose mana or life
mana={3}{p(W)}{p(W)}
@@ -12141,12 +12103,6 @@ mana={U}
type=Sorcery
[/card]
[card]
name=Prey's Vengeance
mana={G}
type=Instant
text=Target creature gets +2/+2 until end of turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Primal Beyond
text=As Primal Beyond enters the battlefield, you may reveal an Elemental card from your hand. If you don't, Primal Beyond enters the battlefield tapped. -- {T}: Add {1} to your mana pool. -- {T}: Add one mana of any color to your mana pool. Spend this mana only to cast Elemental spells or activate abilities of Elementals.
type=Land
@@ -12929,12 +12885,6 @@ mana={2}{G}
type=Sorcery
[/card]
[card]
name=Recurring Insight
mana={4}{U}{U}
type=Sorcery
text=Draw cards equal to the number of cards in target opponent's hand. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Recycle
text=Skip your draw step. -- Whenever you play a card, draw a card. -- Your maximum hand size is two.
mana={4}{G}{G}
@@ -15679,12 +15629,6 @@ mana={3}
type=Artifact
[/card]
[card]
name=Staggershock
mana={2}{R}
type=Instant
text=Staggershock deals 2 damage to target creature or player. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Stalking Yeti
text=When Stalking Yeti enters the battlefield, if it's on the battlefield, it deals damage equal to its power to target creature an opponent controls and that creature deals damage equal to its power to Stalking Yeti. -- {2}{S}i}: Return Stalking Yeti to its owner's hand. Activate this ability only any time you could cast a sorcery. ({S}i} can be paid with one mana from a snow permanent.)
mana={2}{R}{R}
@@ -16184,18 +16128,6 @@ power=2
toughness=1
[/card]
[card]
name=Surreal Memoir
mana={3}{R}
type=Sorcery
text=Return an instant card at random from your graveyard to your hand. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Survival Cache
mana={2}{W}
type=Sorcery
text=You gain 2 life. Then if you have more life than an opponent, draw a card. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Sutured Ghoul
text=Trample -- As Sutured Ghoul enters the battlefield, exile any number of creature cards from your graveyard. -- Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness.
mana={4}{B}{B}{B}
@@ -16691,45 +16623,18 @@ power=2
toughness=2
[/card]
[card]
name=Thought Devourer
text=Flying -- Your maximum hand size is reduced by four.
mana={2}{U}{U}
type=Creature
subtype=Beast
power=4
toughness=4
[/card]
[card]
name=Thought Dissector
text={X}, {T}: Target opponent reveals cards from the top of his or her library until an artifact card or X cards are revealed, whichever comes first. If an artifact card is revealed this way, put it onto the battlefield under your control and sacrifice Thought Dissector. Put the rest of the revealed cards into that player's graveyard.
mana={4}
type=Artifact
[/card]
[card]
name=Thought Eater
text=Flying -- Your maximum hand size is reduced by three.
mana={1}{U}
type=Creature
subtype=Beast
power=2
toughness=2
[/card]
[card]
name=Thought Hemorrhage
text=Name a nonland card. Target player reveals his or her hand. Thought Hemorrhage deals 3 damage to that player for each card with that name revealed this way. Search that player's graveyard, hand, and library for all cards with that name and exile them. Then that player shuffles his or her library.
mana={2}{B}{R}
type=Sorcery
[/card]
[card]
name=Thought Nibbler
text=Flying -- Your maximum hand size is reduced by two.
mana={U}
type=Creature
subtype=Beast
power=1
toughness=1
[/card]
[card]
name=Thought Prison
text=Imprint - When Thought Prison enters the battlefield, you may have target player reveal his or her hand. If you do, choose a nonland card from it and exile that card. -- Whenever a player casts a spell that shares a color or converted mana cost with the exiled card, Thought Prison deals 2 damage to that player.
mana={5}
@@ -17206,6 +17111,15 @@ mana={U}
type=Instant
[/card]
[card]
name=Trinisphere
auto=this(untapped) lord(*[manacost=0]|hand) altercost(colorless, +3)
auto=this(untapped) lord(*[manacost=1]|hand) altercost(colorless, +2)
auto=this(untapped) lord(*[manacost=2]|hand) altercost(colorless, +1)
text=As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast. (Additional mana in the cost may be paid with any color of mana or colorless mana. For example, a spell that would cost {1}{B} to cast costs {2}{B} to cast instead.)
mana={3}
type=Artifact
[/card]
[card]
name=Trumpeting Armodon
text={1}{G}: Target creature blocks Trumpeting Armodon this turn if able.
mana={3}{G}
@@ -17215,15 +17129,6 @@ power=3
toughness=3
[/card]
[card]
name=Trusted Advisor
text=Your maximum hand size is increased by two. -- At the beginning of your upkeep, return a blue creature you control to its owner's hand.
mana={U}
type=Creature
subtype=Human Advisor
power=1
toughness=2
[/card]
[card]
name=Truth or Tale
text=Reveal the top five cards of your library and separate them into two piles. An opponent chooses one of those piles. Put a card from the chosen pile into your hand, then put all other cards revealed this way on the bottom of your library in any order.
mana={1}{U}
@@ -17808,12 +17713,6 @@ mana={1}{R}{G}
type=Instant
[/card]
[card]
name=Virulent Swipe
mana={B}
type=Instant
text=Target creature gets +2/+0 and gains deathtouch until end of turn. Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
[/card]
[card]
name=Virulent Wound
mana={B}
type=Instant
@@ -23,6 +23,7 @@ firstmain
[PLAYER1]
inplay:Aegis of the Meek,Steppe Lynx,Savannah Lions,Courier Hawk
graveyard:Swords to Plowshares
exile:Raging Goblin
life:22
[PLAYER2]
[END]
+1
View File
@@ -16,6 +16,7 @@ Angry Mob
firstmain
[PLAYER1]
graveyard:Swords to Plowshares
exile:Angry Mob
life:25
[PLAYER2]
inplay:1373,1374,1375
+1
View File
@@ -19,6 +19,7 @@ Angry Mob
[ASSERT]
firstmain
[PLAYER1]
exile:Angry Mob
graveyard:Swords to Plowshares,Boomerang
life:24
[PLAYER2]
+1
View File
@@ -22,6 +22,7 @@ Angry Mob
[ASSERT]
firstmain
[PLAYER1]
exile:Angry Mob
life:22
[PLAYER2]
inplay:1373,1374,1375,Plains
+1
View File
@@ -25,6 +25,7 @@ Angry Mob
[ASSERT]
firstmain
[PLAYER1]
exile:Angry Mob
life:22
[PLAYER2]
inplay:1373,1374,1375,Plains
@@ -29,6 +29,7 @@ Angry Mob
[ASSERT]
firstmain
[PLAYER1]
exile:Angry Mob
life:22
[PLAYER2]
inplay:1373,1374,Plains
+1
View File
@@ -23,6 +23,7 @@ Angry Mob
[ASSERT]
firstmain
[PLAYER1]
exile:Angry Mob
inplay:Plains
graveyard:Swords to Plowshares
life:25
+1
View File
@@ -22,6 +22,7 @@ Angry Mob
firstmain
[PLAYER1]
graveyard:Swords to Plowshares,Annex,Demystify
exile:Angry Mob
life:25
[PLAYER2]
inplay:1373,1374,1375
@@ -15,4 +15,5 @@ FIRSTMAIN
graveyard:183055
manapool:{0}
[PLAYER2]
exile:184994
[END]
@@ -28,6 +28,7 @@ graveyard:1194
manapool:{0}
life:24
[PLAYER2]
exile:1366
graveyard:1367
inplay:1397
manapool:{0}
@@ -19,6 +19,7 @@ Grizzly Bears
[ASSERT]
combatattackers
[PLAYER1]
exile:Grizzly Bears
inplay:Cranial Plating,Rod of Ruin
graveyard:Swords to Plowshares
life:24
@@ -19,6 +19,7 @@ endinterruption
[ASSERT]
FIRSTMAIN
[PLAYER1]
exile:grizzly bears
graveyard:fists of ironwood
life:22
[PLAYER2]
@@ -17,6 +17,7 @@ endinterruption
[ASSERT]
FIRSTMAIN
[PLAYER1]
exile:bad moon
manapool:{0}
life:20
[PLAYER2]
@@ -26,6 +26,7 @@ secondmain
[PLAYER1]
inplay:Plains
graveyard:Swords to Plowshares
exile:Frost Giant
life:28
[PLAYER2]
graveyard:Suntail Hawk,Scryb Sprites,Raging Goblin
@@ -18,6 +18,7 @@ Jayemdae Tome
[ASSERT]
firstmain
[PLAYER1]
exile:Jayemdae Tome
graveyard:Karn's Touch,Swords to Plowshares
life:24
[PLAYER2]
+1
View File
@@ -11,6 +11,7 @@ leveler
[ASSERT]
FIRSTMAIN
[PLAYER1]
exile:swamp,mountain
inplay:leveler
[PLAYER2]
[END]
@@ -16,4 +16,5 @@ FIRSTMAIN
inplay:necrogenesis,*
manapool:{0}
[PLAYER2]
exile:1250
[END]
@@ -16,5 +16,6 @@ FIRSTMAIN
graveyard:1367
manapool:{0}
[PLAYER2]
exile:141935
life:23
[END]
@@ -25,6 +25,7 @@ next
[assert]
secondmain
[player1]
exile:fungusaur
inplay:Thelon Of Havenwood,Thallid,Deathspore Thallid,forest,swamp
[player2]
life:14
+1
View File
@@ -24,6 +24,7 @@ next
[ASSERT]
CLEANUP
[PLAYER1]
exile:Dregscape Zombie
inplay:129754
[PLAYER2]
graveyard:Grizzly Bears
+47 -32
View File
@@ -196,9 +196,9 @@ private:
else if (s == "manacost")
{
if (target->currentZone == target->controller()->game->stack)//X is 0 except if it's on the stack
intValue = target->getManaCost()->getConvertedCost() + target->castX;
intValue = target->myconvertedcost + target->castX;
else
intValue = target->getManaCost()->getConvertedCost();
intValue = target->myconvertedcost;
}
else if (s == "azorius")//devotion blue white
{
@@ -207,8 +207,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -227,8 +227,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -247,8 +247,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -267,8 +267,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -287,8 +287,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -307,8 +307,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -327,8 +327,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -347,8 +347,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -367,8 +367,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -387,8 +387,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -424,8 +424,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * p = card->getObserver()->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = zones[k];
if (tc->targetsZone(zone, card))
@@ -516,8 +516,8 @@ private:
for (int i = 0; i < 2; i++)
{
Player * p = card->getObserver()->players[i];
MTGGameZone * zones[] = { p->game->battlefield, p->game->graveyard, p->game->hand, p->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * zones[] = { p->game->battlefield, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = zones[k];
if(tc->targetsZone(zone,target))
@@ -2916,8 +2916,8 @@ public:
for (int i = 0; i < 2; i++)
{
Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = zones[k];
Value = zone->countByCanTarget(tc);
@@ -4086,6 +4086,20 @@ public:
}
};
//Modify Hand
class AModifyHand: public AbilityTP
{
public:
string hand;
AModifyHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string hand, int who = TargetChooser::UNSET);
int addToGame();
int destroy();
const string getMenuText();
AModifyHand * clone() const;
//~AModifyHand();
};
//set a players hand size
class AASetHand: public ActivatedAbilityTP
{
@@ -4913,10 +4927,11 @@ public:
bool myturn;
bool opponentturn;
bool once;
bool checkexile;
Player * abilityOwner;
APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false, bool checkexile = false);
void Update(float dt);
int resolve();
const string getMenuText();
@@ -4931,7 +4946,7 @@ public:
string sAbility;
APhaseAction * ability;
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false);
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false,bool checkexile = false);
int resolve();
const string getMenuText();
APhaseActionGeneric * clone() const;
@@ -6359,13 +6374,13 @@ class GenericPaidAbility: public ActivatedAbility
public:
MTGAbility * baseAbility;
ManaCost * optionalCost;
string newName;
string restrictions;
string baseCost;
string baseAbilityStr;
bool asAlternate;
GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL);
GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, bool asAlternate = false, ManaCost * cost = NULL);
int resolve();
const string getMenuText();
GenericPaidAbility * clone() const;
+2
View File
@@ -122,6 +122,8 @@ class GameObserver{
void gameStateBasedEffects();
void enchantmentStatus();
void Affinity();
void ComputeTrinisphere();
void RemoveTrinisphere(MTGCardInstance * card);
void addObserver(MTGAbility * observer);
bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules);
+2
View File
@@ -7,6 +7,7 @@ struct GuiAvatar;
class GuiGraveyard;
class GuiLibrary;
class GuiOpponentHand;
class GuiExile;
class GuiAvatars: public GuiLayer
{
protected:
@@ -14,6 +15,7 @@ protected:
GuiGraveyard* selfGraveyard, *opponentGraveyard;
GuiLibrary* selfLibrary, *opponentLibrary;
GuiOpponentHand *opponentHand;
GuiExile* selfExile, *opponentExile;
GuiAvatar* active;
public:
+10
View File
@@ -88,4 +88,14 @@ public:
virtual ostream& toString(ostream& out) const;
};
class GuiExile: public GuiGameZone
{
public:
Player * player;
GuiExile(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
int receiveEventPlus(WEvent*);
int receiveEventMinus(WEvent*);
virtual ostream& toString(ostream& out) const;
};
#endif // _GUISTATIC_H_
+3
View File
@@ -253,6 +253,9 @@ public:
int cardistargetted;
bool isTargetter();
int cardistargetter;
int tmodifier;
int tmodifierb;
int myconvertedcost;
void eventattacked();
void eventattackedAlone();
+3 -1
View File
@@ -234,7 +234,9 @@ class Constants
PROTECTIONFROMCOLOREDSPELLS = 116,
MYGCREATUREEXILER = 117,
OPPGCREATUREEXILER = 118,
NB_BASIC_ABILITIES = 119,
PAYZERO = 119,
TRINISPHERE = 120,
NB_BASIC_ABILITIES = 121,
RARITY_S = 'S', //Special Rarity
+1
View File
@@ -10,6 +10,7 @@
#define GUI_GRAVEYARD 3
#define GUI_LIBRARY 4
#define GUI_OPPONENTHAND 5
#define GUI_EXILE 6
#include <JGui.h>
#include "WEvent.h"
+1
View File
@@ -45,6 +45,7 @@ public:
int epic;
int initLife;
int raidcount;
int handmodifier;
vector<string> prowledTypes;
vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
+6
View File
@@ -279,6 +279,12 @@ struct WEventCardUnattached : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card-equipment attached/equipped
struct WEventCardEquipped : public WEventCardUpdate {
WEventCardEquipped(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card moves from player/opponent battlefield to player/opponent battlefield
struct WEventCardControllerChange : public WEventCardUpdate {
WEventCardControllerChange(MTGCardInstance * card);
+6 -6
View File
@@ -650,8 +650,8 @@ MTGCardInstance * AIPlayerBaka::chooseCard(TargetChooser * tc, MTGCardInstance *
}
for(int players = 0; players < 2;++players)
{
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack };
for (int j = 0; j < 5; j++)
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 6; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -1214,7 +1214,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
for (int i = 0; i < 2; i++)
{
Player * p = observer->players[i];
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay,p->game->stack };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay,p->game->stack,p->game->exile };
if(a->getActionTc()->canTarget((Targetable*)p))
{
if(a->getActionTc()->maxtargets == 1)
@@ -1225,7 +1225,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
else
potentialTargets.push_back(p);
}
for (int j = 0; j < 5; j++)
for (int j = 0; j < 6; j++)
{
MTGGameZone * zone = playerZones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -1553,8 +1553,8 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
}
}
MTGPlayerCards * playerZones = target->game;
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack };
for (int j = 0; j < 5; j++)
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 6; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
+123 -18
View File
@@ -1146,9 +1146,9 @@ AASetCoin::~AASetCoin()
//paying for an ability as an effect but as a cost
GenericPaidAbility::GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source,
Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, ManaCost * cost) :
Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, bool asAlternate, ManaCost * cost) :
ActivatedAbility(observer, id, source, cost, 0),
newName(_newName), restrictions(_castRestriction), baseCost(mayCost), baseAbilityStr(_toAdd)
newName(_newName), restrictions(_castRestriction), baseCost(mayCost), baseAbilityStr(_toAdd), asAlternate(asAlternate)
{
this->GetId();
baseAbility = NULL;
@@ -1172,6 +1172,8 @@ int GenericPaidAbility::resolve()
AbilityFactory Af(game);
vector<string> baseAbilityStrSplit = split(baseAbilityStr,'?');
vector<MTGAbility*> selection;
MTGAbility * nomenuAbility = NULL;
bool nomenu = false;
if (baseAbilityStrSplit.size() > 1)
{
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
@@ -1200,10 +1202,12 @@ int GenericPaidAbility::resolve()
}
else
{
nomenu = true;
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
baseAbility->target = target;
optionalCost = ManaCost::parseManaCost(baseCost, NULL, source);
MTGAbility * set = baseAbility->clone();
nomenuAbility = baseAbility->clone();
set->oneShot = true;
selection.push_back(set);
}
@@ -1211,10 +1215,37 @@ int GenericPaidAbility::resolve()
if (selection.size())
{
bool must = baseAbilityStrSplit.size() > 1 ? true : false;
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName);
a1->optionalCosts.push_back(NEW ManaCost(optionalCost));
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target;
a1->resolve();
//todo get increased - reduced cost if asAlternate cost to cast using castcard
if(asAlternate)
{
must = true;
//cost increase - reduce + trinisphere effect ability todo...
if(((MTGCardInstance *)target)->getIncreasedManaCost()->getConvertedCost())
optionalCost->add(((MTGCardInstance *)target)->getIncreasedManaCost());
if(((MTGCardInstance *)target)->getReducedManaCost()->getConvertedCost())
optionalCost->remove(((MTGCardInstance *)target)->getReducedManaCost());
//trinisphere effect must be hardcoded...here..
/*if(((MTGCardInstance *)target)->has(Constants::TRINISPHERE))
{
if(optionalCost->getConvertedCost() == 2)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 1);
else if(optionalCost->getConvertedCost() == 1)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 2);
else if(optionalCost->getConvertedCost() < 1)
optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 3);
}*/
}
if(nomenu && optionalCost->getConvertedCost() < 1)
{
nomenuAbility->resolve();
}
else
{
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName);
a1->optionalCosts.push_back(NEW ManaCost(optionalCost));
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target;
a1->resolve();
}
}
return 1;
}
@@ -2470,6 +2501,49 @@ AALifer * AALifer::clone() const
return NEW AALifer(*this);
}
//players modify hand size
AModifyHand::AModifyHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string hand, int who) :
AbilityTP(observer, _id, _source, _target, who), hand(hand)
{
}
int AModifyHand::addToGame()
{
Damageable * _target = (Damageable *) getTarget();
Player * p = getPlayerFromDamageable(_target);
if (!p)
return 0;
WParsedInt handmodifier(hand, NULL, source);
p->handmodifier += handmodifier.getValue();
return MTGAbility::addToGame();
}
int AModifyHand::destroy()
{
Damageable * _target = (Damageable *) getTarget();
Player * p = getPlayerFromDamageable(_target);
if (!p)
return 0;
WParsedInt handmodifier(hand, NULL, source);
p->handmodifier -= handmodifier.getValue();
return 1;
}
const string AModifyHand::getMenuText()
{
return "Modify Hand Size";
}
AModifyHand * AModifyHand::clone() const
{
return NEW AModifyHand(*this);
}
//players max hand size
AASetHand::AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost,
@@ -5092,8 +5166,8 @@ AUpkeep::~AUpkeep()
}
//A Phase based Action
APhaseAction::APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance *, string sAbility, int, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once) :
MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once)
APhaseAction::APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance *, string sAbility, int, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once, bool checkexile) :
MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once),checkexile(checkexile)
{
abilityId = _id;
abilityOwner = card->controller();
@@ -5110,6 +5184,14 @@ MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(f
void APhaseAction::Update(float dt)
{
if(checkexile)
{
if(((MTGCardInstance *)target)->next->getCurrentZone() != ((MTGCardInstance *)target)->owner->game->exile)
{
this->forceDestroy = 1;
return;
}
}
if (newPhase != currentPhase)
{
if((myturn && game->currentPlayer == source->controller())||
@@ -5186,11 +5268,11 @@ APhaseAction::~APhaseAction()
}
// the main ability
APhaseActionGeneric::APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once) :
APhaseActionGeneric::APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions, int _phase,bool forcedestroy,bool next,bool myturn,bool opponentturn,bool once, bool checkexile) :
InstantAbility(observer, _id, card, target)
{
MTGCardInstance * _target = target;
ability = NEW APhaseAction(game, _id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn,once);
ability = NEW APhaseAction(game, _id, card,_target, sAbility, restrictions, _phase,forcedestroy,next,myturn,opponentturn,once,checkexile);
}
int APhaseActionGeneric::resolve()
@@ -5238,10 +5320,13 @@ void ABlink::Update(float dt)
if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game)))
{
if (Blinked == NULL)
MTGAbility::Update(dt);
MTGCardInstance * _target = Blinked;
returnCardIntoPlay(_target);
if(Blinked->blinked)
{
if (Blinked == NULL)
MTGAbility::Update(dt);
MTGCardInstance * _target = Blinked;
returnCardIntoPlay(_target);
}
}
MTGAbility::Update(dt);
}
@@ -5272,6 +5357,7 @@ void ABlink::resolveBlink()
return;
}
_target = _target->next;
_target->blinked = true;
Blinked = _target;
if(!blinkueot && !blinkForSource)
{
@@ -5282,6 +5368,11 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL;
if(!_target->blinked)
{
this->forceDestroy = 1;
return;
}
if (!blinkhand)
Blinker = _target->controller()->game->putInZone(
_target,
@@ -5611,6 +5702,8 @@ int AEquip::equip(MTGCardInstance * equipped)
//we equip...
a->addToGame();
}
WEvent * e = NEW WEventCardEquipped(source);
game->receiveEvent(e);
return 1;
}
@@ -5708,16 +5801,28 @@ void AACastCard::Update(float dt)
this->forceDestroy = 1;
return;
}
if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
/*if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
{
processed = true;
this->forceDestroy = 1;
return;
}*/
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if(toCheck && toCheck->spellTargetType.size())
{
TargetChooserFactory tcf(game);
TargetChooser * stc = tcf.createTargetChooser(toCheck->spellTargetType,toCheck);
if (!stc->validTargetsExist()||toCheck->isToken)
{
processed = true;
this->forceDestroy = 1;
return;
}
SAFE_DELETE(stc);
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if (Spell * checkSpell = dynamic_cast<Spell*>(target))
{
toCheck = checkSpell->source;
+2 -2
View File
@@ -129,7 +129,7 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
return NULL;
if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
return NULL;
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->getManaCost()->getConvertedCost(), convertedManacost))
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
return NULL;
if (nameComparisonMode && compareName != card->name)
return NULL;
@@ -170,7 +170,7 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
match = NULL;
if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
match = NULL;
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->getManaCost()->getConvertedCost(), convertedManacost))
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
match = NULL;
if(nameComparisonMode && compareName != card->name)
match = NULL;
+240 -123
View File
@@ -225,8 +225,12 @@ void GameObserver::nextGamePhase()
if (mCurrentGamePhase == MTG_PHASE_AFTER_EOT)
{
int handmodified = 0;
handmodified = currentPlayer->handsize+currentPlayer->handmodifier;
//Auto Hand cleaning, in case the player didn't do it himself
while (currentPlayer->game->hand->nb_cards > currentPlayer->handsize && currentPlayer->nomaxhandsize == false)
if(handmodified < 0)
handmodified = 0;
while (currentPlayer->game->hand->nb_cards > handmodified && currentPlayer->nomaxhandsize == false)
{
WEvent * e = NEW WEventCardDiscard(currentPlayer->game->hand->cards[0]);
receiveEvent(e);
@@ -518,12 +522,13 @@ bool GameObserver::operator==(const GameObserver& aGame)
{
error++;
}
MTGGameZone * aZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * aZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile };
MTGGameZone * thisZones[] = { players[i]->game->graveyard,
players[i]->game->library,
players[i]->game->hand,
players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
players[i]->game->inPlay,
players[i]->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = aZones[j];
if (zone->nb_cards != thisZones[j]->nb_cards)
@@ -595,16 +600,16 @@ void GameObserver::gameStateBasedEffects()
/////////////////////////////////////
for (int d = 0; d < 2; d++)
{
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library };
for (int k = 0; k < 4; k++)
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile };
for (int k = 0; k < 5; k++)
{
MTGGameZone * zone = dzones[k];
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
{
for (int c = zone->nb_cards - 1; c >= 0; c--)
{
zone->cards[c]->cardistargetted = 0;
zone->cards[c]->cardistargetter = 0;
zone->cards[c]->cardistargetted = 0;
zone->cards[c]->cardistargetter = 0;
}
}
}//check for losers if its GAMEOVER clear the stack to allow gamestateeffects to continue
@@ -877,8 +882,12 @@ void GameObserver::gameStateBasedEffects()
enchantmentStatus();
/////////////////////////////
// Check affinity on a card//
// plus modify costs //
/////////////////////////////
Affinity();
//trinisphere? buggy...
//ComputeTrinisphere();
//end trinisphere
/////////////////////////////////////
// Check colored statuses on cards //
/////////////////////////////////////
@@ -953,46 +962,142 @@ void GameObserver::enchantmentStatus()
void GameObserver::Affinity()
{
for (int i = 0; i < 2; i++)
for (int dd = 0; dd < 2; dd++)
{
MTGGameZone * zone = players[i]->game->hand;
for (int k = zone->nb_cards - 1; k >= 0; k--)
MTGGameZone * dzones[] = { players[dd]->game->graveyard, players[dd]->game->hand, players[dd]->game->library, players[dd]->game->exile };
for (int kk = 0; kk < 4; kk++)
{
MTGCardInstance * card = zone->cards[k];
if (!card)
continue;
MTGGameZone * zone = dzones[kk];
for (int cc = zone->nb_cards - 1; cc >= 0; cc--)
{//start
MTGCardInstance * card = zone->cards[cc];
if (!card)
continue;
int color = 0;
string type = "";
//only do any of the following if a card with the stated ability is in your hand.
ManaCost * original = NEW ManaCost();
original->copy(card->model->data->getManaCost());
//have to run alter cost before affinity or the 2 cancel each other out.
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
{
if(card->getIncreasedManaCost()->getConvertedCost())
original->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
original->remove(card->getReducedManaCost());
card->getManaCost()->copy(original);
if(card->getManaCost()->extraCosts)
int color = 0;
string type = "";
//only do any of the following if a card with the stated ability is in your hand.
ManaCost * original = NEW ManaCost();
ManaCost * alternate = NEW ManaCost();
original->copy(card->model->data->getManaCost());
alternate->copy(card->model->data->getManaCost()->getAlternative());
if (card->has(Constants::PAYZERO))
original = ManaCost::parseManaCost("{0}",NULL,card);//can't figure out 2 or more alternative...
//have to run alter cost before affinity or the 2 cancel each other out.
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
{
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
if(card->getIncreasedManaCost()->getConvertedCost())
{
card->getManaCost()->extraCosts->costs[i]->setSource(card);
original->add(card->getIncreasedManaCost());
for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++)
{
if (card->getManaCost()->getAlternative())
{
alternate->add(kc,card->getIncreasedManaCost()->getCost(kc));
}
}
}
if(card->getReducedManaCost()->getConvertedCost())
{
original->remove(card->getReducedManaCost());
for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++)
{
if (card->getManaCost()->getAlternative())
{
alternate->remove(kc,card->getReducedManaCost()->getCost(kc));
}
}
}
if(card->getManaCost())
card->getManaCost()->copy(original);
if(card->getManaCost()->getAlternative())
card->getManaCost()->setAlternative(alternate);
if(card->getManaCost()->extraCosts)
{
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
{
card->getManaCost()->extraCosts->costs[i]->setSource(card);
}
}
}
}
int reducem = 0;
bool resetCost = false;
for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
{
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
if(newAff)
int reducem = 0;
bool resetCost = false;
for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
{
if(!resetCost)
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
if(newAff)
{
resetCost = true;
if(!resetCost)
{
resetCost = true;
card->getManaCost()->copy(original);
if(card->getManaCost()->extraCosts)
{
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
{
card->getManaCost()->extraCosts->costs[i]->setSource(card);
}
}
}
TargetChooserFactory tf(this);
TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL);
for (int w = 0; w < 2; ++w)
{
Player *p = this->players[w];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
for (int k = 0; k < 6; k++)
{
MTGGameZone * z = zones[k];
if (tcn->targetsZone(z))
{
reducem += z->countByCanTarget(tcn);
}
}
}
SAFE_DELETE(tcn);
ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString);
for(int j = 0; j < reducem; j++)
card->getManaCost()->remove(removingCost);
SAFE_DELETE(removingCost);
}
}
if(card->has(Constants::AFFINITYARTIFACTS)||
card->has(Constants::AFFINITYFOREST)||
card->has(Constants::AFFINITYGREENCREATURES)||
card->has(Constants::AFFINITYISLAND)||
card->has(Constants::AFFINITYMOUNTAIN)||
card->has(Constants::AFFINITYPLAINS)||
card->has(Constants::AFFINITYSWAMP)){
if (card->has(Constants::AFFINITYARTIFACTS))
{
type = "artifact";
}
else if (card->has(Constants::AFFINITYSWAMP))
{
type = "swamp";
}
else if (card->has(Constants::AFFINITYMOUNTAIN))
{
type = "mountain";
}
else if (card->has(Constants::AFFINITYPLAINS))
{
type = "plains";
}
else if (card->has(Constants::AFFINITYISLAND))
{
type = "island";
}
else if (card->has(Constants::AFFINITYFOREST))
{
type = "forest";
}
else if (card->has(Constants::AFFINITYGREENCREATURES))
{
color = 1;
type = "creature";
}
card->getManaCost()->copy(original);
if(card->getManaCost()->extraCosts)
{
@@ -1001,97 +1106,103 @@ void GameObserver::Affinity()
card->getManaCost()->extraCosts->costs[i]->setSource(card);
}
}
}
TargetChooserFactory tf(this);
TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL);
for (int w = 0; w < 2; ++w)
{
Player *p = this->players[w];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
for (int k = 0; k < 6; k++)
int reduce = 0;
if(card->has(Constants::AFFINITYGREENCREATURES))
{
MTGGameZone * z = zones[k];
if (tcn->targetsZone(z))
{
reducem += z->countByCanTarget(tcn);
}
TargetChooserFactory tf(this);
TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL);
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
SAFE_DELETE(tc);
}
else
{
reduce = card->controller()->game->battlefield->countByType(type);
}
for(int i = 0; i < reduce;i++)
{
if(card->getManaCost()->getCost(color) > 0)
card->getManaCost()->remove(color,1);
}
}
SAFE_DELETE(original);
}//end
}
}
}
void GameObserver::ComputeTrinisphere()
{
for (int td = 0; td < 2; td++)
{
MTGGameZone * dzones[] = { players[td]->game->graveyard, players[td]->game->hand, players[td]->game->library, players[td]->game->exile };
for (int tk = 0; tk < 4; tk++)
{
MTGGameZone * zone = dzones[tk];
for (int ct = zone->nb_cards - 1; ct >= 0; ct--)
{
if(zone->cards[ct]->has(Constants::TRINISPHERE))
{
if(zone->cards[ct]->getManaCost()->getConvertedCost() == 2)
{
zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1);
zone->cards[ct]->tmodifier = 1;
}
else if(zone->cards[ct]->getManaCost()->getConvertedCost() == 1)
{
zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 2);
zone->cards[ct]->tmodifier = 2;
}
else if(zone->cards[ct]->getManaCost()->getConvertedCost() < 1)
{
zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 3);
zone->cards[ct]->tmodifier = 3;
}
if(zone->cards[ct]->getManaCost()->getAlternative())
{
ManaCost * currentAlternate = NEW ManaCost();
currentAlternate->copy(zone->cards[ct]->getManaCost()->getAlternative());
if(zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() == 2)
zone->cards[ct]->tmodifierb = 1;
else if(zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() == 1)
zone->cards[ct]->tmodifierb = 2;
else if(zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() < 1)
zone->cards[ct]->tmodifierb = 3;
currentAlternate->add(Constants::MTG_COLOR_ARTIFACT, zone->cards[ct]->tmodifierb);
zone->cards[ct]->getManaCost()->setAlternative(currentAlternate);
}
}
else
RemoveTrinisphere(zone->cards[ct]);
if(zone->cards[ct]->getManaCost()->extraCosts)
{
for(unsigned int i = 0; i < zone->cards[ct]->getManaCost()->extraCosts->costs.size();i++)
{
zone->cards[ct]->getManaCost()->extraCosts->costs[i]->setSource(zone->cards[ct]);
}
SAFE_DELETE(tcn);
ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString);
for(int j = 0; j < reducem; j++)
card->getManaCost()->remove(removingCost);
SAFE_DELETE(removingCost);
}
}
if(card->has(Constants::AFFINITYARTIFACTS)||
card->has(Constants::AFFINITYFOREST)||
card->has(Constants::AFFINITYGREENCREATURES)||
card->has(Constants::AFFINITYISLAND)||
card->has(Constants::AFFINITYMOUNTAIN)||
card->has(Constants::AFFINITYPLAINS)||
card->has(Constants::AFFINITYSWAMP)){
if (card->has(Constants::AFFINITYARTIFACTS))
{
type = "artifact";
}
else if (card->has(Constants::AFFINITYSWAMP))
{
type = "swamp";
}
else if (card->has(Constants::AFFINITYMOUNTAIN))
{
type = "mountain";
}
else if (card->has(Constants::AFFINITYPLAINS))
{
type = "plains";
}
else if (card->has(Constants::AFFINITYISLAND))
{
type = "island";
}
else if (card->has(Constants::AFFINITYFOREST))
{
type = "forest";
}
else if (card->has(Constants::AFFINITYGREENCREATURES))
{
color = 1;
type = "creature";
}
card->getManaCost()->copy(original);
if(card->getManaCost()->extraCosts)
{
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
{
card->getManaCost()->extraCosts->costs[i]->setSource(card);
}
}
int reduce = 0;
if(card->has(Constants::AFFINITYGREENCREATURES))
{
TargetChooserFactory tf(this);
TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL);
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
SAFE_DELETE(tc);
}
else
{
reduce = card->controller()->game->battlefield->countByType(type);
}
for(int i = 0; i < reduce;i++)
{
if(card->getManaCost()->getCost(color) > 0)
card->getManaCost()->remove(color,1);
}
}
SAFE_DELETE(original);
}
}
}
void GameObserver::RemoveTrinisphere(MTGCardInstance * card)
{
if(card->has(Constants::TRINISPHERE))
return;
if(card->tmodifier)
{
card->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, card->tmodifier);
card->tmodifier = 0;
}
if(card->getManaCost()->getAlternative() && card->tmodifierb)
{
ManaCost * newalternate = NEW ManaCost();
newalternate->copy(card->getManaCost()->getAlternative());
newalternate->remove(Constants::MTG_COLOR_ARTIFACT, card->tmodifierb);
card->getManaCost()->setAlternative(newalternate);
card->tmodifierb = 0;
}
}
void GameObserver::Render()
{
if(mLayers)
@@ -1134,6 +1245,8 @@ void GameObserver::ButtonPressed(PlayGuiObject * target)
}
else if (GuiGraveyard* graveyard = dynamic_cast<GuiGraveyard*>(target))
graveyard->toggleDisplay();
else if (GuiExile* exile = dynamic_cast<GuiExile*>(target))
exile->toggleDisplay();
//opponenthand
else if (GuiOpponentHand* opponentHand = dynamic_cast<GuiOpponentHand*>(target))
if (opponentHand->showCards)
@@ -1255,6 +1368,7 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
{
Player * clickedPlayer = NULL;
int toReturn = 0;
int handmodified = 0;
MTGGameZone* zone = NULL;
size_t index = 0;
MTGCardInstance* backup = NULL;
@@ -1372,8 +1486,11 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
}
//Current player's hand
handmodified = currentPlayer->handsize+currentPlayer->handmodifier;
if(handmodified < 0)
handmodified = 0;
if (currentPlayer->game->hand->hasCard(card) && mCurrentGamePhase == MTG_PHASE_CLEANUP
&& currentPlayer->game->hand->nb_cards > currentPlayer->handsize && currentPlayer->nomaxhandsize == false)
&& currentPlayer->game->hand->nb_cards > handmodified && currentPlayer->nomaxhandsize == false)
{
WEvent * e = NEW WEventCardDiscard(currentPlayer->game->hand->cards[0]);
receiveEvent(e);
+31 -13
View File
@@ -14,26 +14,34 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
self->zoom = 0.9f;
Add(selfGraveyard = NEW GuiGraveyard(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 1, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 5 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
//myexile
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 30, false, mpDuelLayers->getRenderedPlayer(), this));
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f;
//opponenthandveiw button
Add(opponentHand = NEW GuiOpponentHand(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
//opponentExile
Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponenthandveiwends
//opponentGraveyard
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentHand
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentLibrary
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
observer->getCardSelector()->Add(self);
observer->getCardSelector()->Add(selfGraveyard);
observer->getCardSelector()->Add(selfExile);
observer->getCardSelector()->Add(selfLibrary);
observer->getCardSelector()->Add(opponent);
observer->getCardSelector()->Add(opponentGraveyard);
observer->getCardSelector()->Add(opponentExile);
observer->getCardSelector()->Add(opponentLibrary);
observer->getCardSelector()->Add(opponentHand);
selfGraveyard->alpha = selfLibrary->alpha = opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
selfGraveyard->alpha = selfExile->alpha = opponentExile->alpha = selfLibrary->alpha = opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
}
float GuiAvatars::LeftBoundarySelf()
@@ -50,15 +58,15 @@ void GuiAvatars::Activate(PlayGuiObject* c)
c->zoom = 1.2f;
c->mHasFocus = true;
if ((opponentGraveyard == c) || (opponentLibrary == c) || (opponent == c) || (opponentHand == c))
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentLibrary == c) || (opponent == c) || (opponentHand == c))
{
opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 128.0f;
opponentGraveyard->alpha = opponentExile->alpha = opponentLibrary->alpha = opponentHand->alpha = 128.0f;
active = opponent;
opponent->zoom = 1.2f;
}
else if ((selfGraveyard == c) || (selfLibrary == c) || (self == c))
else if ((selfGraveyard == c) || (selfExile == c) || (selfLibrary == c) || (self == c))
{
selfGraveyard->alpha = selfLibrary->alpha = 128.0f;
selfGraveyard->alpha = selfExile->alpha = selfLibrary->alpha = 128.0f;
self->zoom = 1.0f;
active = self;
}
@@ -69,15 +77,15 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
{
c->zoom = 1.0;
c->mHasFocus = false;
if ((opponentGraveyard == c) || (opponentLibrary == c) || (opponentHand == c) || (opponent == c))
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentLibrary == c) || (opponentHand == c) || (opponent == c))
{
opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
opponentGraveyard->alpha = opponentExile->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
opponent->zoom = 0.9f;
active = NULL;
}
else if ((selfGraveyard == c) || (selfLibrary == c) || (self == c))
else if ((selfGraveyard == c) || (selfExile == c) || (selfLibrary == c) || (self == c))
{
selfGraveyard->alpha = selfLibrary->alpha = 0;
selfGraveyard->alpha = selfExile->alpha = selfLibrary->alpha = 0;
self->zoom = 0.5f;
active = NULL;
}
@@ -85,13 +93,15 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
int GuiAvatars::receiveEventPlus(WEvent* e)
{
return selfGraveyard->receiveEventPlus(e) | opponentGraveyard->receiveEventPlus(e) | opponentHand->receiveEventPlus(e);
return selfGraveyard->receiveEventPlus(e) | selfExile->receiveEventPlus(e) | opponentExile->receiveEventPlus(e) | opponentGraveyard->receiveEventPlus(e) | opponentHand->receiveEventPlus(e);
}
int GuiAvatars::receiveEventMinus(WEvent* e)
{
selfGraveyard->receiveEventMinus(e);
selfExile->receiveEventMinus(e);
opponentGraveyard->receiveEventMinus(e);
opponentExile->receiveEventMinus(e);
opponentHand->receiveEventMinus(e);
return 1;
}
@@ -104,8 +114,12 @@ bool GuiAvatars::CheckUserInput(JButton key)
return true;
if (selfGraveyard->CheckUserInput(key))
return true;
if (selfExile->CheckUserInput(key))
return true;
if (opponentGraveyard->CheckUserInput(key))
return true;
if (opponentExile->CheckUserInput(key))
return true;
if (opponentHand->CheckUserInput(key))
return true;
if (selfLibrary->CheckUserInput(key))
@@ -120,8 +134,10 @@ void GuiAvatars::Update(float dt)
self->Update(dt);
opponent->Update(dt);
selfGraveyard->Update(dt);
selfExile->Update(dt);
opponentHand->Update(dt);
opponentGraveyard->Update(dt);
opponentExile->Update(dt);
selfLibrary->Update(dt);
opponentLibrary->Update(dt);
}
@@ -133,10 +149,12 @@ void GuiAvatars::Render()
float h = 54;
if (opponent == active)
{
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+20 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h * opponent->actZ, ARGB(200,0,0,0));
}
else if (self == active)
{
r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h-28 * self->actZ, 24 * self->actZ, h+28 * self->actZ, ARGB(200,0,0,0));
r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h * self->actZ, w * self->actZ, h * self->actZ, ARGB(200,0,0,0));
}
GuiLayer::Render();
+2
View File
@@ -412,6 +412,8 @@ int GuiPlay::receiveEventPlus(WEvent * e)
Replace();
else if (dynamic_cast<WEventCardUnattached*> (e))
Replace();
else if (dynamic_cast<WEventCardEquipped*> (e))
Replace();
else if (dynamic_cast<WEventCardControllerChange*> (e))
Replace();
Replace();
+60 -2
View File
@@ -164,7 +164,10 @@ void GuiGameZone::Render()
JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID);
float scale = defaultHeight / quad->mHeight;
quad->SetColor(ARGB((int)(actA),255,255,255));
if(type == GUI_EXILE)
{
quad->SetColor(ARGB((int)(actA),255,240,255));
}
JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ);
float x0 = actX;
@@ -182,7 +185,16 @@ void GuiGameZone::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[11];
int mAlpha = (int) (actA);
sprintf(buffer, "%i", zone->nb_cards);
/*if(type == GUI_GRAVEYARD)
sprintf(buffer, "%i\ng", zone->nb_cards);
else if(type == GUI_LIBRARY)
sprintf(buffer, "%i\nl", zone->nb_cards);
else if(type == GUI_OPPONENTHAND)
sprintf(buffer, "%i\nh", zone->nb_cards);
else if(type == GUI_EXILE)
sprintf(buffer, "%i\ne", zone->nb_cards);
else*/
sprintf(buffer, "%i", zone->nb_cards);
mFont->SetColor(ARGB(mAlpha,0,0,0));
mFont->DrawString(buffer, x0 + 1, actY + 1);
if (actA > 120)
@@ -298,6 +310,52 @@ ostream& GuiGraveyard::toString(ostream& out) const
return out << "GuiGraveyard :::";
}
GuiExile::GuiExile(float x, float y, bool hasFocus, Player * player, GuiAvatars* parent) :
GuiGameZone(x, y, hasFocus, player->game->exile, parent), player(player)
{
type = GUI_EXILE;
}
int GuiExile::receiveEventPlus(WEvent* e)
{
if (WEventZoneChange* event = dynamic_cast<WEventZoneChange*>(e))
if (event->to == zone)
{
CardView* t;
if (event->card->view)
t = NEW CardView(CardView::nullZone, event->card, *(event->card->view));
else
t = NEW CardView(CardView::nullZone, event->card, x, y);
t->x = x + Width / 2;
t->y = y + Height / 2;
t->zoom = 0.6f;
t->alpha = 0;
cards.push_back(t);
return 1;
}
return 0;
}
int GuiExile::receiveEventMinus(WEvent* e)
{
if (WEventZoneChange* event = dynamic_cast<WEventZoneChange*>(e))
if (event->from == zone)
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
if (event->card->previous == (*it)->card)
{
CardView* cv = *it;
cards.erase(it);
zone->owner->getObserver()->mTrash->trash(cv);
return 1;
}
return 0;
}
ostream& GuiExile::toString(ostream& out) const
{
return out << "GuiExile :::";
}
//opponenthand begins
GuiOpponentHand::GuiOpponentHand(float x, float y, bool hasFocus, Player * player, GuiAvatars* parent) :
GuiGameZone(x, y, hasFocus, player->game->hand, parent), player(player)
+38 -10
View File
@@ -310,6 +310,21 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
return 0;
}
}
check = restriction[i].find("rebound");
if(check != string::npos)
{
int count = 0;
for(unsigned int k = 0; k < player->game->stack->cardsSeenThisTurn.size(); k++)
{
MTGCardInstance * stackCard = player->game->stack->cardsSeenThisTurn[k];
if(stackCard->next && stackCard->next == card && card->previousZone == card->controller()->game->hand)
count++;
if(stackCard == card && card->previousZone == card->controller()->game->hand)
count++;
}
if(!count)
return 0;
}
check = restriction[i].find("morbid");
if(check != string::npos)
{
@@ -558,8 +573,8 @@ int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option)
{
if (player && player != observer->players[i])
continue;
MTGGameZone * zones[] = { observer->players[i]->game->inPlay, observer->players[i]->game->graveyard, observer->players[i]->game->hand };
for (int k = 0; k < 3; k++)
MTGGameZone * zones[] = { observer->players[i]->game->inPlay, observer->players[i]->game->graveyard, observer->players[i]->game->hand, observer->players[i]->game->exile };
for (int k = 0; k < 4; k++)
{
for (int j = zones[k]->nb_cards - 1; j >= 0; j--)
{
@@ -1064,6 +1079,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGGameZone * dest)
{
size_t found;
bool asAlternate = false;
trim(s);
//TODO This block redundant with calling function
if (!card && spell)
@@ -1073,7 +1089,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGCardInstance * target = card->target;
if (!target)
target = card;
//pay and castcard?
if(s.find("castcard(restricted") != string::npos && (s.find("pay(") != string::npos || s.find("pay[[") != string::npos))
asAlternate = true;
//MTG Specific rules
//adds the bonus credit system
found = s.find("bonusrule");
@@ -1571,7 +1589,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
vector<string> splitMayPay = parseBetween(s, "pay(", ")", true);
if(splitMayPay.size())
{
GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPay[1],storedPayString);
GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPay[1],storedPayString,asAlternate);
a->oneShot = 1;
a->canBeInterrupted = false;
return a;
@@ -2076,7 +2094,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
vector<string> splitMayPaysub = parseBetween(s, "pay[[","]]", true);
if (splitMayPaysub.size())
{
GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPaysub[1],storedPayString);
GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPaysub[1],storedPayString,asAlternate);
a->oneShot = 1;
a->canBeInterrupted = false;
return a;
@@ -2565,6 +2583,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//modify hand size - reduce maximum or increase
vector<string> splitHandMod = parseBetween(s, "hmodifer:", " ", false);
if (splitHandMod.size())
{
Damageable * t = spell ? spell->getNextDamageableTarget() : NULL;
MTGAbility * a = NEW AModifyHand(observer, id, card, t, splitHandMod[1], who);
return a;
}
//set hand size
vector<string> splitSetHand = parseBetween(s, "sethand:", " ", false);
if (splitSetHand.size())
@@ -3412,6 +3439,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
bool opponentturn = (s1.find("my") == string::npos);
bool myturn = (s1.find("opponent") == string::npos);
bool sourceinPlay = (s1.find("sourceinplay") != string::npos);
bool checkexile = (s1.find("checkex") != string::npos);
bool next = (s1.find("next") == string::npos); //Why is this one the opposite of the two others? That's completely inconsistent
bool once = (s1.find("once") != string::npos);
@@ -3420,7 +3448,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
_target = spell->getNextCardTarget();
if(!_target)
_target = target;
return NEW APhaseActionGeneric(observer, id, card,_target, trim(splitActions[2]), restrictions, phase,sourceinPlay,next,myturn,opponentturn,once);
return NEW APhaseActionGeneric(observer, id, card,_target, trim(splitActions[2]), restrictions, phase,sourceinPlay,next,myturn,opponentturn,once,checkexile);
}
MTGAbility * AbilityFactory::parseChooseActionAbility(string s,MTGCardInstance * card,Spell *,MTGCardInstance * target, int, int id)
@@ -5257,8 +5285,8 @@ void ListMaintainerAbility::updateTargets()
for (int i = 0; i < 2; i++)
{
Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack };
for (int k = 0; k < 5; k++)
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
for (int k = 0; k < 6; k++)
{
MTGGameZone * zone = zones[k];
if (canTarget(zone))
@@ -5329,8 +5357,8 @@ void ListMaintainerAbility::checkTargets()
for (int i = 0; i < 2; i++)
{
Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack };
for (int k = 0; k < 5; k++)
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
for (int k = 0; k < 6; k++)
{
MTGGameZone * zone = zones[k];
if (canTarget(zone))
+3
View File
@@ -65,6 +65,9 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
LKItoughness = toughness;
cardistargetted = 0;
cardistargetter = 0;
tmodifier = 0;
tmodifierb = 0;
myconvertedcost = getManaCost()->getConvertedCost();
}
MTGCardInstance * MTGCardInstance::createSnapShot()
+3 -1
View File
@@ -147,7 +147,9 @@ const char* Constants::MTGBasicAbilities[] = {
"madness",
"protectionfromcoloredspells",
"mygcreatureexiler",
"oppgcreatureexiler"
"oppgcreatureexiler",
"payzero",
"trinisphere"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+9
View File
@@ -1289,6 +1289,10 @@ ostream& operator<<(ostream& out, const MTGPlayerCards& z)
out << "hand=";
out << *(z.hand) << endl;
}
if(z.removedFromGame->cards.size()) {
out << "exile=";
out << *(z.hand) << endl;
}
return out;
}
@@ -1321,6 +1325,11 @@ bool MTGPlayerCards::parseLine(const string& s)
battlefield->parseLine(s.substr(limiter+1));
return true;
}
else if (areaS.compare("removedfromgame") == 0 || areaS.compare("exile") == 0)
{
removedFromGame->parseLine(s.substr(limiter+1));
return true;
}
}
return false;
+1
View File
@@ -35,6 +35,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
drawCounter = 0;
epic = 0;
raidcount = 0;
handmodifier = 0;
prowledTypes.clear();
doesntEmpty = NEW ManaCost();
poolDoesntEmpty = NEW ManaCost();
+9 -7
View File
@@ -79,8 +79,8 @@ MTGCardInstance * Rules::getCardByMTGId(GameObserver* g, int mtgid)
for (int i = 0; i < 2; i++)
{
Player * p = g->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard };
for (int j = 0; j < 4; j++)
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -340,9 +340,10 @@ MTGDeck * Rules::buildDeck(int playerId)
MTGGameZone * loadedPlayerZones[] = { initState.playerData[playerId].player->game->graveyard,
initState.playerData[playerId].player->game->library,
initState.playerData[playerId].player->game->hand,
initState.playerData[playerId].player->game->inPlay };
initState.playerData[playerId].player->game->inPlay,
initState.playerData[playerId].player->game->exile };
for (int j = 0; j < 4; j++)
for (int j = 0; j < 5; j++)
{
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{
@@ -412,12 +413,13 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
{
p->mAvatarName = initState.playerData[i].player->mAvatarName;
}
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile };
MTGGameZone * loadedPlayerZones[] = { initState.playerData[i].player->game->graveyard,
initState.playerData[i].player->game->library,
initState.playerData[i].player->game->hand,
initState.playerData[i].player->game->inPlay };
for (int j = 0; j < 4; j++)
initState.playerData[i].player->game->inPlay,
initState.playerData[i].player->game->exile };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
+4
View File
@@ -739,6 +739,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
{
return NEW CardTargetChooser(observer, card->storedSourceCard, card, zones, nbzones);
}
else if (typeName.compare("abilitycontroller") == 0)
{
return NEW PlayerTargetChooser(observer, card, 1, card->storedSourceCard->controller());
}
else
{
tc = NEW TypeTargetChooser(observer, typeName.c_str(), zones, nbzones, card, maxtargets, other, targetMin);
+12 -9
View File
@@ -46,8 +46,8 @@ MTGCardInstance * TestSuiteAI::getCard(string action)
for (int i = 0; i < 2; i++)
{
Player * p = observer->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard };
for (int j = 0; j < 4; j++)
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->removedFromGame };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++)
@@ -394,12 +394,13 @@ void TestSuiteGame::assertGame()
error++;
}
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->removedFromGame };
MTGGameZone * endstateZones[] = { endState.players[i]->game->graveyard,
endState.players[i]->game->library,
endState.players[i]->game->hand,
endState.players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
endState.players[i]->game->inPlay,
endState.players[i]->game->removedFromGame };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = playerZones[j];
if (zone->nb_cards != endstateZones[j]->nb_cards)
@@ -853,12 +854,13 @@ void TestSuiteGame::initGame()
stringstream stream;
stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
p->getRandomGenerator()->loadRandValues(stream.str());
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->removedFromGame };
MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,
initState.players[i]->game->library,
initState.players[i]->game->hand,
initState.players[i]->game->inPlay };
for (int j = 0; j < 4; j++)
initState.players[i]->game->inPlay,
initState.players[i]->game->removedFromGame };
for (int j = 0; j < 5; j++)
{
MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
@@ -910,9 +912,10 @@ MTGPlayerCards * TestSuiteGame::buildDeck(Player* player, int playerId)
MTGGameZone * loadedPlayerZones[] = { initState.players[playerId]->game->graveyard,
initState.players[playerId]->game->library,
initState.players[playerId]->game->hand,
initState.players[playerId]->game->removedFromGame,
initState.players[playerId]->game->inPlay };
for (int j = 0; j < 4; j++)
for (int j = 0; j < 5; j++)
{
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
{
+11
View File
@@ -165,6 +165,11 @@ WEventCardUnattached::WEventCardUnattached(MTGCardInstance * card) :
{
}
WEventCardEquipped::WEventCardEquipped(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
WEventCardUpdate(card)
{
@@ -324,6 +329,12 @@ Targetable * WEventCardUnattached::getTarget(int target)
return NULL;
}
Targetable * WEventCardEquipped::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventCardControllerChange::getTarget(int target)
{
if (target) return card;