Merge branch 'cmake' of https://github.com/WagicProject/wagic into cmake

This commit is contained in:
xawotihs
2015-11-04 22:33:26 +01:00
55 changed files with 996 additions and 739 deletions
+1 -1
View File
@@ -3,4 +3,4 @@
url = https://github.com/madler/zlib url = https://github.com/madler/zlib
[submodule "thirdparty/SDL2"] [submodule "thirdparty/SDL2"]
path = thirdparty/SDL2 path = thirdparty/SDL2
url = https://github.com/emscripten-ports/SDL2.git url = https://github.com/spurious/SDL-mirror.git
+3 -3
View File
@@ -99,7 +99,7 @@ WAGIC_OPTION(BUILD_PNG "build png from source" (WIN32 OR APPLE OR PSP OR
WAGIC_OPTION(BUILD_UNZIP "build unzip from source" ON) WAGIC_OPTION(BUILD_UNZIP "build unzip from source" ON)
WAGIC_OPTION(BUILD_TINYXML "build tinyxml from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN)) WAGIC_OPTION(BUILD_TINYXML "build tinyxml from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN))
WAGIC_OPTION(BUILD_ZIPFS "build zipfs from source" ON) WAGIC_OPTION(BUILD_ZIPFS "build zipfs from source" ON)
WAGIC_OPTION(BUILD_SDL2 "build SDL2 from source" (backend_sdl AND (UNIX OR WIN32 OR ANDROID OR EMSCRIPTEN))) WAGIC_OPTION(BUILD_SDL2 "build SDL2 from source" (backend_sdl AND (UNIX OR WIN32 OR ANDROID) AND (NOT EMSCRIPTEN)))
#project options #project options
if(ANDROID) if(ANDROID)
@@ -138,6 +138,8 @@ include(FindOrBuild)
if(PSP) if(PSP)
FindOrBuildPSPSDK() FindOrBuildPSPSDK()
include(platforms/psp/configure.cmake) include(platforms/psp/configure.cmake)
elseif(EMSCRIPTEN)
include(platforms/emscripten/configure.cmake)
elseif(WIN32) elseif(WIN32)
include(platforms/win/configure.cmake) include(platforms/win/configure.cmake)
elseif(APPLE) elseif(APPLE)
@@ -146,8 +148,6 @@ elseif(UNIX)
include(platforms/unix/configure.cmake) include(platforms/unix/configure.cmake)
elseif(ANDROID) elseif(ANDROID)
include(platforms/android/configure.cmake) include(platforms/android/configure.cmake)
elseif(EMSCRIPTEN)
include(platforms/emscripten/configure.cmake)
endif() endif()
#set backend dependend configurations #set backend dependend configurations
+4
View File
@@ -17,6 +17,7 @@ skip_tags: true
#---------------------------------# #---------------------------------#
environment: environment:
DXSDK_DIR: C:\Program Files (x86)\Microsoft DirectX SDK
GH_TOKEN: GH_TOKEN:
secure: dYnBDQkiY5oVjIlswzBX9BJigNtBGXgGlp1tK3XbHzrDEDrs2vaKD5m+Oz5OSz1C secure: dYnBDQkiY5oVjIlswzBX9BJigNtBGXgGlp1tK3XbHzrDEDrs2vaKD5m+Oz5OSz1C
@@ -27,6 +28,9 @@ install:
- "C:/Python27/Scripts/pip.exe install pyjavaproperties" - "C:/Python27/Scripts/pip.exe install pyjavaproperties"
- "C:/Python27/Scripts/pip.exe install github3.py" - "C:/Python27/Scripts/pip.exe install github3.py"
- git submodule update --init --recursive - git submodule update --init --recursive
- cd thirdparty/SDL2
- git checkout release-2.0.3
- cd ../..
#---------------------------------# #---------------------------------#
# build configuration # # build configuration #
+5 -3
View File
@@ -1,3 +1,5 @@
set_target_properties(wagic PROPERTIES LINK_FLAGS "-s USE_SDL=2") set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -std=c++11")
set(CMAKE_CXX_FLAGS "-s USE_SDL=2") set(CMAKE_EXECUTABLE_SUFFIX ".html")
set(CMAKE_EXECUTABLE_SUFFIX ".html") add_definitions(-DLINUX)
add_definitions(-DUSERDIR=".wagic")
add_definitions(-DRESDIR="Res")
@@ -99,6 +99,29 @@ mana={4}{B}{B}
type=Instant type=Instant
[/card] [/card]
[card] [card]
name=Distortion Strike
target=creature
auto=1/0
auto=unblockable
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[my upkeep 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[my upkeep 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 name=Feral Hydra
type=Creature type=Creature
subtype=Hydra Beast subtype=Hydra Beast
@@ -247,6 +270,14 @@ power=1
toughness=1 toughness=1
[/card] [/card]
[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[my upkeep 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 name=Obsessive Search
abilities=madness 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) 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 toughness=1
[/card] [/card]
[card] [card]
name=Prey's Vengeance
target=creature
auto=2/2
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[my upkeep 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 name=Psychotic Haze
abilities=madness 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) 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 toughness=4
[/card] [/card]
[card] [card]
name=Recurring Insight
target=opponent
auto=draw:type:*:targetedpersonshand controller
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[my upkeep 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 name=Sacellum Godspeaker
auto={T}:foreach(creaure[power>4]|myhand) add{G} 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. 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 type=Instant
[/card] [/card]
[card] [card]
name=Staggershock
target=creature,player
auto=damage:2
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[my upkeep 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 name=Strength of Isolation
abilities=madness 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) 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 subtype=Aura
[/card] [/card]
[card] [card]
name=Surreal Memoir
auto=moverandom(instant) from(mygraveyard) to(myhand)
auto=if rebound then transforms((,newability[moveto(exile)],newability[phaseaction[my upkeep 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[my upkeep 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[my upkeep 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 name=Zombie Brute
abilities=trample abilities=trample
auto=foreach(zombie|myhand) counter(1/1,1) 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 type=Sorcery
[/card] [/card]
[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 name=Divert
text=Change the target of target spell with a single target unless that spell's controller pays {2}. text=Change the target of target spell with a single target unless that spell's controller pays {2}.
mana={U} 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. 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]
[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 name=Empyrial Archangel
text=Flying, shroud -- All damage that would be dealt to you is dealt to Empyrial Archangel instead. text=Flying, shroud -- All damage that would be dealt to you is dealt to Empyrial Archangel instead.
mana={4}{G}{W}{W}{U} mana={4}{G}{W}{W}{U}
@@ -6132,15 +6120,6 @@ mana={G}
type=Instant type=Instant
[/card] [/card]
[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 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. 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} 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. 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]
[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 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. 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} mana={2}{U}{U}
@@ -10865,14 +10835,6 @@ power=1
toughness=1 toughness=1
[/card] [/card]
[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 name=Norn's Annex
#cant choose mana or life #cant choose mana or life
mana={3}{p(W)}{p(W)} mana={3}{p(W)}{p(W)}
@@ -12141,12 +12103,6 @@ mana={U}
type=Sorcery type=Sorcery
[/card] [/card]
[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 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. 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 type=Land
@@ -12929,12 +12885,6 @@ mana={2}{G}
type=Sorcery type=Sorcery
[/card] [/card]
[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 name=Recycle
text=Skip your draw step. -- Whenever you play a card, draw a card. -- Your maximum hand size is two. text=Skip your draw step. -- Whenever you play a card, draw a card. -- Your maximum hand size is two.
mana={4}{G}{G} mana={4}{G}{G}
@@ -15679,12 +15629,6 @@ mana={3}
type=Artifact type=Artifact
[/card] [/card]
[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 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.) 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} mana={2}{R}{R}
@@ -16184,18 +16128,6 @@ power=2
toughness=1 toughness=1
[/card] [/card]
[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 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. 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} mana={4}{B}{B}{B}
@@ -16691,45 +16623,18 @@ power=2
toughness=2 toughness=2
[/card] [/card]
[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 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. 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} mana={4}
type=Artifact type=Artifact
[/card] [/card]
[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 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. 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} mana={2}{B}{R}
type=Sorcery type=Sorcery
[/card] [/card]
[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 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. 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} mana={5}
@@ -17206,6 +17111,15 @@ mana={U}
type=Instant type=Instant
[/card] [/card]
[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 name=Trumpeting Armodon
text={1}{G}: Target creature blocks Trumpeting Armodon this turn if able. text={1}{G}: Target creature blocks Trumpeting Armodon this turn if able.
mana={3}{G} mana={3}{G}
@@ -17215,15 +17129,6 @@ power=3
toughness=3 toughness=3
[/card] [/card]
[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 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. 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} mana={1}{U}
@@ -17808,12 +17713,6 @@ mana={1}{R}{G}
type=Instant type=Instant
[/card] [/card]
[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 name=Virulent Wound
mana={B} mana={B}
type=Instant type=Instant
@@ -23,6 +23,7 @@ firstmain
[PLAYER1] [PLAYER1]
inplay:Aegis of the Meek,Steppe Lynx,Savannah Lions,Courier Hawk inplay:Aegis of the Meek,Steppe Lynx,Savannah Lions,Courier Hawk
graveyard:Swords to Plowshares graveyard:Swords to Plowshares
exile:Raging Goblin
life:22 life:22
[PLAYER2] [PLAYER2]
[END] [END]
+1
View File
@@ -16,6 +16,7 @@ Angry Mob
firstmain firstmain
[PLAYER1] [PLAYER1]
graveyard:Swords to Plowshares graveyard:Swords to Plowshares
exile:Angry Mob
life:25 life:25
[PLAYER2] [PLAYER2]
inplay:1373,1374,1375 inplay:1373,1374,1375
+1
View File
@@ -19,6 +19,7 @@ Angry Mob
[ASSERT] [ASSERT]
firstmain firstmain
[PLAYER1] [PLAYER1]
exile:Angry Mob
graveyard:Swords to Plowshares,Boomerang graveyard:Swords to Plowshares,Boomerang
life:24 life:24
[PLAYER2] [PLAYER2]
+1
View File
@@ -22,6 +22,7 @@ Angry Mob
[ASSERT] [ASSERT]
firstmain firstmain
[PLAYER1] [PLAYER1]
exile:Angry Mob
life:22 life:22
[PLAYER2] [PLAYER2]
inplay:1373,1374,1375,Plains inplay:1373,1374,1375,Plains
+1
View File
@@ -25,6 +25,7 @@ Angry Mob
[ASSERT] [ASSERT]
firstmain firstmain
[PLAYER1] [PLAYER1]
exile:Angry Mob
life:22 life:22
[PLAYER2] [PLAYER2]
inplay:1373,1374,1375,Plains inplay:1373,1374,1375,Plains
@@ -29,6 +29,7 @@ Angry Mob
[ASSERT] [ASSERT]
firstmain firstmain
[PLAYER1] [PLAYER1]
exile:Angry Mob
life:22 life:22
[PLAYER2] [PLAYER2]
inplay:1373,1374,Plains inplay:1373,1374,Plains
+1
View File
@@ -23,6 +23,7 @@ Angry Mob
[ASSERT] [ASSERT]
firstmain firstmain
[PLAYER1] [PLAYER1]
exile:Angry Mob
inplay:Plains inplay:Plains
graveyard:Swords to Plowshares graveyard:Swords to Plowshares
life:25 life:25
+1
View File
@@ -22,6 +22,7 @@ Angry Mob
firstmain firstmain
[PLAYER1] [PLAYER1]
graveyard:Swords to Plowshares,Annex,Demystify graveyard:Swords to Plowshares,Annex,Demystify
exile:Angry Mob
life:25 life:25
[PLAYER2] [PLAYER2]
inplay:1373,1374,1375 inplay:1373,1374,1375
@@ -15,4 +15,5 @@ FIRSTMAIN
graveyard:183055 graveyard:183055
manapool:{0} manapool:{0}
[PLAYER2] [PLAYER2]
exile:184994
[END] [END]
@@ -28,6 +28,7 @@ graveyard:1194
manapool:{0} manapool:{0}
life:24 life:24
[PLAYER2] [PLAYER2]
exile:1366
graveyard:1367 graveyard:1367
inplay:1397 inplay:1397
manapool:{0} manapool:{0}
@@ -19,6 +19,7 @@ Grizzly Bears
[ASSERT] [ASSERT]
combatattackers combatattackers
[PLAYER1] [PLAYER1]
exile:Grizzly Bears
inplay:Cranial Plating,Rod of Ruin inplay:Cranial Plating,Rod of Ruin
graveyard:Swords to Plowshares graveyard:Swords to Plowshares
life:24 life:24
@@ -19,6 +19,7 @@ endinterruption
[ASSERT] [ASSERT]
FIRSTMAIN FIRSTMAIN
[PLAYER1] [PLAYER1]
exile:grizzly bears
graveyard:fists of ironwood graveyard:fists of ironwood
life:22 life:22
[PLAYER2] [PLAYER2]
@@ -17,6 +17,7 @@ endinterruption
[ASSERT] [ASSERT]
FIRSTMAIN FIRSTMAIN
[PLAYER1] [PLAYER1]
exile:bad moon
manapool:{0} manapool:{0}
life:20 life:20
[PLAYER2] [PLAYER2]
@@ -26,6 +26,7 @@ secondmain
[PLAYER1] [PLAYER1]
inplay:Plains inplay:Plains
graveyard:Swords to Plowshares graveyard:Swords to Plowshares
exile:Frost Giant
life:28 life:28
[PLAYER2] [PLAYER2]
graveyard:Suntail Hawk,Scryb Sprites,Raging Goblin graveyard:Suntail Hawk,Scryb Sprites,Raging Goblin
@@ -18,6 +18,7 @@ Jayemdae Tome
[ASSERT] [ASSERT]
firstmain firstmain
[PLAYER1] [PLAYER1]
exile:Jayemdae Tome
graveyard:Karn's Touch,Swords to Plowshares graveyard:Karn's Touch,Swords to Plowshares
life:24 life:24
[PLAYER2] [PLAYER2]
+1
View File
@@ -11,6 +11,7 @@ leveler
[ASSERT] [ASSERT]
FIRSTMAIN FIRSTMAIN
[PLAYER1] [PLAYER1]
exile:swamp,mountain
inplay:leveler inplay:leveler
[PLAYER2] [PLAYER2]
[END] [END]
@@ -16,4 +16,5 @@ FIRSTMAIN
inplay:necrogenesis,* inplay:necrogenesis,*
manapool:{0} manapool:{0}
[PLAYER2] [PLAYER2]
exile:1250
[END] [END]
@@ -16,5 +16,6 @@ FIRSTMAIN
graveyard:1367 graveyard:1367
manapool:{0} manapool:{0}
[PLAYER2] [PLAYER2]
exile:141935
life:23 life:23
[END] [END]
@@ -25,6 +25,7 @@ next
[assert] [assert]
secondmain secondmain
[player1] [player1]
exile:fungusaur
inplay:Thelon Of Havenwood,Thallid,Deathspore Thallid,forest,swamp inplay:Thelon Of Havenwood,Thallid,Deathspore Thallid,forest,swamp
[player2] [player2]
life:14 life:14
+1
View File
@@ -24,6 +24,7 @@ next
[ASSERT] [ASSERT]
CLEANUP CLEANUP
[PLAYER1] [PLAYER1]
exile:Dregscape Zombie
inplay:129754 inplay:129754
[PLAYER2] [PLAYER2]
graveyard:Grizzly Bears graveyard:Grizzly Bears
-232
View File
@@ -1,232 +0,0 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#if (_MSC_VER < 1300) && defined(__cplusplus)
extern "C++" {
#endif
# include <wchar.h>
#if (_MSC_VER < 1300) && defined(__cplusplus)
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_STDINT_H_ ]
+47 -32
View File
@@ -196,9 +196,9 @@ private:
else if (s == "manacost") else if (s == "manacost")
{ {
if (target->currentZone == target->controller()->game->stack)//X is 0 except if it's on the stack 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 else
intValue = target->getManaCost()->getConvertedCost(); intValue = target->myconvertedcost;
} }
else if (s == "azorius")//devotion blue white else if (s == "azorius")//devotion blue white
{ {
@@ -207,8 +207,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -227,8 +227,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -247,8 +247,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -267,8 +267,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -287,8 +287,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -307,8 +307,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -327,8 +327,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -347,8 +347,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -367,8 +367,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -387,8 +387,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * dp = card->getObserver()->players[i]; Player * dp = card->getObserver()->players[i];
MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library }; MTGGameZone * dzones[] = { dp->game->inPlay, dp->game->graveyard, dp->game->hand, dp->game->library, dp->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (dtc->targetsZone(zone, card)&&dp == card->controller()) if (dtc->targetsZone(zone, card)&&dp == card->controller())
@@ -424,8 +424,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = card->getObserver()->players[i]; Player * p = card->getObserver()->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library }; MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if (tc->targetsZone(zone, card)) if (tc->targetsZone(zone, card))
@@ -516,8 +516,8 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = card->getObserver()->players[i]; Player * p = card->getObserver()->players[i];
MTGGameZone * zones[] = { p->game->battlefield, p->game->graveyard, p->game->hand, p->game->library }; MTGGameZone * zones[] = { p->game->battlefield, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if(tc->targetsZone(zone,target)) if(tc->targetsZone(zone,target))
@@ -2916,8 +2916,8 @@ public:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = game->players[i]; Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library }; MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile };
for (int k = 0; k < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
Value = zone->countByCanTarget(tc); 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 //set a players hand size
class AASetHand: public ActivatedAbilityTP class AASetHand: public ActivatedAbilityTP
{ {
@@ -4913,10 +4927,11 @@ public:
bool myturn; bool myturn;
bool opponentturn; bool opponentturn;
bool once; bool once;
bool checkexile;
Player * abilityOwner; Player * abilityOwner;
APhaseAction(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase = 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); void Update(float dt);
int resolve(); int resolve();
const string getMenuText(); const string getMenuText();
@@ -4931,7 +4946,7 @@ public:
string sAbility; string sAbility;
APhaseAction * ability; APhaseAction * ability;
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase = 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(); int resolve();
const string getMenuText(); const string getMenuText();
APhaseActionGeneric * clone() const; APhaseActionGeneric * clone() const;
@@ -6359,13 +6374,13 @@ class GenericPaidAbility: public ActivatedAbility
public: public:
MTGAbility * baseAbility; MTGAbility * baseAbility;
ManaCost * optionalCost; ManaCost * optionalCost;
string newName; string newName;
string restrictions; string restrictions;
string baseCost; string baseCost;
string baseAbilityStr; 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(); int resolve();
const string getMenuText(); const string getMenuText();
GenericPaidAbility * clone() const; GenericPaidAbility * clone() const;
+2
View File
@@ -122,6 +122,8 @@ class GameObserver{
void gameStateBasedEffects(); void gameStateBasedEffects();
void enchantmentStatus(); void enchantmentStatus();
void Affinity(); void Affinity();
void ComputeTrinisphere();
void RemoveTrinisphere(MTGCardInstance * card);
void addObserver(MTGAbility * observer); void addObserver(MTGAbility * observer);
bool removeObserver(ActionElement * observer); bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules); void startGame(GameType, Rules * rules);
+2
View File
@@ -7,6 +7,7 @@ struct GuiAvatar;
class GuiGraveyard; class GuiGraveyard;
class GuiLibrary; class GuiLibrary;
class GuiOpponentHand; class GuiOpponentHand;
class GuiExile;
class GuiAvatars: public GuiLayer class GuiAvatars: public GuiLayer
{ {
protected: protected:
@@ -14,6 +15,7 @@ protected:
GuiGraveyard* selfGraveyard, *opponentGraveyard; GuiGraveyard* selfGraveyard, *opponentGraveyard;
GuiLibrary* selfLibrary, *opponentLibrary; GuiLibrary* selfLibrary, *opponentLibrary;
GuiOpponentHand *opponentHand; GuiOpponentHand *opponentHand;
GuiExile* selfExile, *opponentExile;
GuiAvatar* active; GuiAvatar* active;
public: public:
+10
View File
@@ -88,4 +88,14 @@ public:
virtual ostream& toString(ostream& out) const; 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_ #endif // _GUISTATIC_H_
+3
View File
@@ -253,6 +253,9 @@ public:
int cardistargetted; int cardistargetted;
bool isTargetter(); bool isTargetter();
int cardistargetter; int cardistargetter;
int tmodifier;
int tmodifierb;
int myconvertedcost;
void eventattacked(); void eventattacked();
void eventattackedAlone(); void eventattackedAlone();
+3 -1
View File
@@ -234,7 +234,9 @@ class Constants
PROTECTIONFROMCOLOREDSPELLS = 116, PROTECTIONFROMCOLOREDSPELLS = 116,
MYGCREATUREEXILER = 117, MYGCREATUREEXILER = 117,
OPPGCREATUREEXILER = 118, OPPGCREATUREEXILER = 118,
NB_BASIC_ABILITIES = 119, PAYZERO = 119,
TRINISPHERE = 120,
NB_BASIC_ABILITIES = 121,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
+1
View File
@@ -10,6 +10,7 @@
#define GUI_GRAVEYARD 3 #define GUI_GRAVEYARD 3
#define GUI_LIBRARY 4 #define GUI_LIBRARY 4
#define GUI_OPPONENTHAND 5 #define GUI_OPPONENTHAND 5
#define GUI_EXILE 6
#include <JGui.h> #include <JGui.h>
#include "WEvent.h" #include "WEvent.h"
+1
View File
@@ -45,6 +45,7 @@ public:
int epic; int epic;
int initLife; int initLife;
int raidcount; int raidcount;
int handmodifier;
vector<string> prowledTypes; vector<string> prowledTypes;
vector<MTGCardInstance*>curses; vector<MTGCardInstance*>curses;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL); 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); 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 //event when card moves from player/opponent battlefield to player/opponent battlefield
struct WEventCardControllerChange : public WEventCardUpdate { struct WEventCardControllerChange : public WEventCardUpdate {
WEventCardControllerChange(MTGCardInstance * card); WEventCardControllerChange(MTGCardInstance * card);
+6 -6
View File
@@ -650,8 +650,8 @@ MTGCardInstance * AIPlayerBaka::chooseCard(TargetChooser * tc, MTGCardInstance *
} }
for(int players = 0; players < 2;++players) for(int players = 0; players < 2;++players)
{ {
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack }; MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 5; j++) for (int j = 0; j < 6; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = observer->players[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()->canTarget((Targetable*)p))
{ {
if(a->getActionTc()->maxtargets == 1) if(a->getActionTc()->maxtargets == 1)
@@ -1225,7 +1225,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
else else
potentialTargets.push_back(p); potentialTargets.push_back(p);
} }
for (int j = 0; j < 5; j++) for (int j = 0; j < 6; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (int k = 0; k < zone->nb_cards; k++) 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; MTGPlayerCards * playerZones = target->game;
MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack }; MTGGameZone * zones[] = { playerZones->hand, playerZones->library, playerZones->inPlay, playerZones->graveyard,playerZones->stack,playerZones->exile };
for (int j = 0; j < 5; j++) for (int j = 0; j < 6; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) 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 //paying for an ability as an effect but as a cost
GenericPaidAbility::GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, 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), 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(); this->GetId();
baseAbility = NULL; baseAbility = NULL;
@@ -1172,6 +1172,8 @@ int GenericPaidAbility::resolve()
AbilityFactory Af(game); AbilityFactory Af(game);
vector<string> baseAbilityStrSplit = split(baseAbilityStr,'?'); vector<string> baseAbilityStrSplit = split(baseAbilityStr,'?');
vector<MTGAbility*> selection; vector<MTGAbility*> selection;
MTGAbility * nomenuAbility = NULL;
bool nomenu = false;
if (baseAbilityStrSplit.size() > 1) if (baseAbilityStrSplit.size() > 1)
{ {
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source); baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
@@ -1200,10 +1202,12 @@ int GenericPaidAbility::resolve()
} }
else else
{ {
nomenu = true;
baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source); baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source);
baseAbility->target = target; baseAbility->target = target;
optionalCost = ManaCost::parseManaCost(baseCost, NULL, source); optionalCost = ManaCost::parseManaCost(baseCost, NULL, source);
MTGAbility * set = baseAbility->clone(); MTGAbility * set = baseAbility->clone();
nomenuAbility = baseAbility->clone();
set->oneShot = true; set->oneShot = true;
selection.push_back(set); selection.push_back(set);
} }
@@ -1211,10 +1215,37 @@ int GenericPaidAbility::resolve()
if (selection.size()) if (selection.size())
{ {
bool must = baseAbilityStrSplit.size() > 1 ? true : false; bool must = baseAbilityStrSplit.size() > 1 ? true : false;
MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName); //todo get increased - reduced cost if asAlternate cost to cast using castcard
a1->optionalCosts.push_back(NEW ManaCost(optionalCost)); if(asAlternate)
game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target; {
a1->resolve(); 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(asAlternate && 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; return 1;
} }
@@ -2470,6 +2501,49 @@ AALifer * AALifer::clone() const
return NEW AALifer(*this); 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 //players max hand size
AASetHand::AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost, AASetHand::AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost,
@@ -5092,8 +5166,8 @@ AUpkeep::~AUpkeep()
} }
//A Phase based Action //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) : 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) MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(forcedestroy),next(next),myturn(myturn),opponentturn(opponentturn),once(once),checkexile(checkexile)
{ {
abilityId = _id; abilityId = _id;
abilityOwner = card->controller(); abilityOwner = card->controller();
@@ -5110,6 +5184,14 @@ MTGAbility(observer, _id, card),sAbility(sAbility), phase(_phase),forcedestroy(f
void APhaseAction::Update(float dt) 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 (newPhase != currentPhase)
{ {
if((myturn && game->currentPlayer == source->controller())|| if((myturn && game->currentPlayer == source->controller())||
@@ -5186,11 +5268,11 @@ APhaseAction::~APhaseAction()
} }
// the main ability // 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) InstantAbility(observer, _id, card, target)
{ {
MTGCardInstance * _target = 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() int APhaseActionGeneric::resolve()
@@ -5238,10 +5320,13 @@ void ABlink::Update(float dt)
if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game))) if ((blinkueot && currentPhase == MTG_PHASE_ENDOFTURN) || (blinkForSource && !source->isInPlay(game)))
{ {
if (Blinked == NULL) if(Blinked->blinked)
MTGAbility::Update(dt); {
MTGCardInstance * _target = Blinked; if (Blinked == NULL)
returnCardIntoPlay(_target); MTGAbility::Update(dt);
MTGCardInstance * _target = Blinked;
returnCardIntoPlay(_target);
}
} }
MTGAbility::Update(dt); MTGAbility::Update(dt);
} }
@@ -5272,6 +5357,7 @@ void ABlink::resolveBlink()
return; return;
} }
_target = _target->next; _target = _target->next;
_target->blinked = true;
Blinked = _target; Blinked = _target;
if(!blinkueot && !blinkForSource) if(!blinkueot && !blinkForSource)
{ {
@@ -5282,6 +5368,11 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) { void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL; MTGCardInstance * Blinker = NULL;
if(!_target->blinked)
{
this->forceDestroy = 1;
return;
}
if (!blinkhand) if (!blinkhand)
Blinker = _target->controller()->game->putInZone( Blinker = _target->controller()->game->putInZone(
_target, _target,
@@ -5611,6 +5702,8 @@ int AEquip::equip(MTGCardInstance * equipped)
//we equip... //we equip...
a->addToGame(); a->addToGame();
} }
WEvent * e = NEW WEventCardEquipped(source);
game->receiveEvent(e);
return 1; return 1;
} }
@@ -5708,16 +5801,28 @@ void AACastCard::Update(float dt)
this->forceDestroy = 1; this->forceDestroy = 1;
return; 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; processed = true;
this->forceDestroy = 1; this->forceDestroy = 1;
return; return;
} }
SAFE_DELETE(stc);
} }
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if (Spell * checkSpell = dynamic_cast<Spell*>(target)) if (Spell * checkSpell = dynamic_cast<Spell*>(target))
{ {
toCheck = checkSpell->source; toCheck = checkSpell->source;
+2 -2
View File
@@ -129,7 +129,7 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
return NULL; return NULL;
if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness)) if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
return NULL; return NULL;
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->getManaCost()->getConvertedCost(), convertedManacost)) if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
return NULL; return NULL;
if (nameComparisonMode && compareName != card->name) if (nameComparisonMode && compareName != card->name)
return NULL; return NULL;
@@ -170,7 +170,7 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
match = NULL; match = NULL;
if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness)) if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness))
match = NULL; match = NULL;
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->getManaCost()->getConvertedCost(), convertedManacost)) if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
match = NULL; match = NULL;
if(nameComparisonMode && compareName != card->name) if(nameComparisonMode && compareName != card->name)
match = NULL; match = NULL;
+240 -123
View File
@@ -225,8 +225,12 @@ void GameObserver::nextGamePhase()
if (mCurrentGamePhase == MTG_PHASE_AFTER_EOT) 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 //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]); WEvent * e = NEW WEventCardDiscard(currentPlayer->game->hand->cards[0]);
receiveEvent(e); receiveEvent(e);
@@ -518,12 +522,13 @@ bool GameObserver::operator==(const GameObserver& aGame)
{ {
error++; 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, MTGGameZone * thisZones[] = { players[i]->game->graveyard,
players[i]->game->library, players[i]->game->library,
players[i]->game->hand, players[i]->game->hand,
players[i]->game->inPlay }; players[i]->game->inPlay,
for (int j = 0; j < 4; j++) players[i]->game->exile };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = aZones[j]; MTGGameZone * zone = aZones[j];
if (zone->nb_cards != thisZones[j]->nb_cards) if (zone->nb_cards != thisZones[j]->nb_cards)
@@ -595,16 +600,16 @@ void GameObserver::gameStateBasedEffects()
///////////////////////////////////// /////////////////////////////////////
for (int d = 0; d < 2; d++) 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 }; 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 < 4; k++) for (int k = 0; k < 5; k++)
{ {
MTGGameZone * zone = dzones[k]; MTGGameZone * zone = dzones[k];
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
{ {
for (int c = zone->nb_cards - 1; c >= 0; c--) for (int c = zone->nb_cards - 1; c >= 0; c--)
{ {
zone->cards[c]->cardistargetted = 0; zone->cards[c]->cardistargetted = 0;
zone->cards[c]->cardistargetter = 0; zone->cards[c]->cardistargetter = 0;
} }
} }
}//check for losers if its GAMEOVER clear the stack to allow gamestateeffects to continue }//check for losers if its GAMEOVER clear the stack to allow gamestateeffects to continue
@@ -877,8 +882,12 @@ void GameObserver::gameStateBasedEffects()
enchantmentStatus(); enchantmentStatus();
///////////////////////////// /////////////////////////////
// Check affinity on a card// // Check affinity on a card//
// plus modify costs //
///////////////////////////// /////////////////////////////
Affinity(); Affinity();
//trinisphere? buggy...
//ComputeTrinisphere();
//end trinisphere
///////////////////////////////////// /////////////////////////////////////
// Check colored statuses on cards // // Check colored statuses on cards //
///////////////////////////////////// /////////////////////////////////////
@@ -953,46 +962,142 @@ void GameObserver::enchantmentStatus()
void GameObserver::Affinity() void GameObserver::Affinity()
{ {
for (int i = 0; i < 2; i++) for (int dd = 0; dd < 2; dd++)
{ {
MTGGameZone * zone = players[i]->game->hand; MTGGameZone * dzones[] = { players[dd]->game->graveyard, players[dd]->game->hand, players[dd]->game->library, players[dd]->game->exile };
for (int k = zone->nb_cards - 1; k >= 0; k--) for (int kk = 0; kk < 4; kk++)
{ {
MTGCardInstance * card = zone->cards[k]; MTGGameZone * zone = dzones[kk];
if (!card) for (int cc = zone->nb_cards - 1; cc >= 0; cc--)
continue; {//start
MTGCardInstance * card = zone->cards[cc];
if (!card)
continue;
int color = 0; int color = 0;
string type = ""; string type = "";
//only do any of the following if a card with the stated ability is in your hand. //only do any of the following if a card with the stated ability is in your hand.
ManaCost * original = NEW ManaCost(); ManaCost * original = NEW ManaCost();
original->copy(card->model->data->getManaCost()); ManaCost * alternate = NEW ManaCost();
//have to run alter cost before affinity or the 2 cancel each other out. original->copy(card->model->data->getManaCost());
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost()) alternate->copy(card->model->data->getManaCost()->getAlternative());
{ if (card->has(Constants::PAYZERO))
if(card->getIncreasedManaCost()->getConvertedCost()) original = ManaCost::parseManaCost("{0}",NULL,card);//can't figure out 2 or more alternative...
original->add(card->getIncreasedManaCost()); //have to run alter cost before affinity or the 2 cancel each other out.
if(card->getReducedManaCost()->getConvertedCost()) if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
original->remove(card->getReducedManaCost());
card->getManaCost()->copy(original);
if(card->getManaCost()->extraCosts)
{ {
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;
int reducem = 0; bool resetCost = false;
bool resetCost = false; for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
{
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
if(newAff)
{ {
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); card->getManaCost()->copy(original);
if(card->getManaCost()->extraCosts) if(card->getManaCost()->extraCosts)
{ {
@@ -1001,97 +1106,103 @@ void GameObserver::Affinity()
card->getManaCost()->extraCosts->costs[i]->setSource(card); card->getManaCost()->extraCosts->costs[i]->setSource(card);
} }
} }
} int reduce = 0;
TargetChooserFactory tf(this); if(card->has(Constants::AFFINITYGREENCREATURES))
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]; TargetChooserFactory tf(this);
if (tcn->targetsZone(z)) TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL);
{ reduce = card->controller()->game->battlefield->countByCanTarget(tc);
reducem += z->countByCanTarget(tcn); 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() void GameObserver::Render()
{ {
if(mLayers) if(mLayers)
@@ -1134,6 +1245,8 @@ void GameObserver::ButtonPressed(PlayGuiObject * target)
} }
else if (GuiGraveyard* graveyard = dynamic_cast<GuiGraveyard*>(target)) else if (GuiGraveyard* graveyard = dynamic_cast<GuiGraveyard*>(target))
graveyard->toggleDisplay(); graveyard->toggleDisplay();
else if (GuiExile* exile = dynamic_cast<GuiExile*>(target))
exile->toggleDisplay();
//opponenthand //opponenthand
else if (GuiOpponentHand* opponentHand = dynamic_cast<GuiOpponentHand*>(target)) else if (GuiOpponentHand* opponentHand = dynamic_cast<GuiOpponentHand*>(target))
if (opponentHand->showCards) if (opponentHand->showCards)
@@ -1255,6 +1368,7 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
{ {
Player * clickedPlayer = NULL; Player * clickedPlayer = NULL;
int toReturn = 0; int toReturn = 0;
int handmodified = 0;
MTGGameZone* zone = NULL; MTGGameZone* zone = NULL;
size_t index = 0; size_t index = 0;
MTGCardInstance* backup = NULL; MTGCardInstance* backup = NULL;
@@ -1372,8 +1486,11 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
} }
//Current player's hand //Current player's hand
handmodified = currentPlayer->handsize+currentPlayer->handmodifier;
if(handmodified < 0)
handmodified = 0;
if (currentPlayer->game->hand->hasCard(card) && mCurrentGamePhase == MTG_PHASE_CLEANUP 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]); WEvent * e = NEW WEventCardDiscard(currentPlayer->game->hand->cards[0]);
receiveEvent(e); receiveEvent(e);
+31 -13
View File
@@ -14,26 +14,34 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
self->zoom = 0.9f; 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(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)); 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)); Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f; opponent->zoom = 0.9f;
//opponenthandveiw button //opponentExile
Add(opponentHand = NEW GuiOpponentHand(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this)); false, mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponenthandveiwends //opponentGraveyard
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false, Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); 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, Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this)); mpDuelLayers->getRenderedPlayerOpponent(), this));
observer->getCardSelector()->Add(self); observer->getCardSelector()->Add(self);
observer->getCardSelector()->Add(selfGraveyard); observer->getCardSelector()->Add(selfGraveyard);
observer->getCardSelector()->Add(selfExile);
observer->getCardSelector()->Add(selfLibrary); observer->getCardSelector()->Add(selfLibrary);
observer->getCardSelector()->Add(opponent); observer->getCardSelector()->Add(opponent);
observer->getCardSelector()->Add(opponentGraveyard); observer->getCardSelector()->Add(opponentGraveyard);
observer->getCardSelector()->Add(opponentExile);
observer->getCardSelector()->Add(opponentLibrary); observer->getCardSelector()->Add(opponentLibrary);
observer->getCardSelector()->Add(opponentHand); 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() float GuiAvatars::LeftBoundarySelf()
@@ -50,15 +58,15 @@ void GuiAvatars::Activate(PlayGuiObject* c)
c->zoom = 1.2f; c->zoom = 1.2f;
c->mHasFocus = true; 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; active = opponent;
opponent->zoom = 1.2f; 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; self->zoom = 1.0f;
active = self; active = self;
} }
@@ -69,15 +77,15 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
{ {
c->zoom = 1.0; c->zoom = 1.0;
c->mHasFocus = false; 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; opponent->zoom = 0.9f;
active = NULL; 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; self->zoom = 0.5f;
active = NULL; active = NULL;
} }
@@ -85,13 +93,15 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
int GuiAvatars::receiveEventPlus(WEvent* e) 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) int GuiAvatars::receiveEventMinus(WEvent* e)
{ {
selfGraveyard->receiveEventMinus(e); selfGraveyard->receiveEventMinus(e);
selfExile->receiveEventMinus(e);
opponentGraveyard->receiveEventMinus(e); opponentGraveyard->receiveEventMinus(e);
opponentExile->receiveEventMinus(e);
opponentHand->receiveEventMinus(e); opponentHand->receiveEventMinus(e);
return 1; return 1;
} }
@@ -104,8 +114,12 @@ bool GuiAvatars::CheckUserInput(JButton key)
return true; return true;
if (selfGraveyard->CheckUserInput(key)) if (selfGraveyard->CheckUserInput(key))
return true; return true;
if (selfExile->CheckUserInput(key))
return true;
if (opponentGraveyard->CheckUserInput(key)) if (opponentGraveyard->CheckUserInput(key))
return true; return true;
if (opponentExile->CheckUserInput(key))
return true;
if (opponentHand->CheckUserInput(key)) if (opponentHand->CheckUserInput(key))
return true; return true;
if (selfLibrary->CheckUserInput(key)) if (selfLibrary->CheckUserInput(key))
@@ -120,8 +134,10 @@ void GuiAvatars::Update(float dt)
self->Update(dt); self->Update(dt);
opponent->Update(dt); opponent->Update(dt);
selfGraveyard->Update(dt); selfGraveyard->Update(dt);
selfExile->Update(dt);
opponentHand->Update(dt); opponentHand->Update(dt);
opponentGraveyard->Update(dt); opponentGraveyard->Update(dt);
opponentExile->Update(dt);
selfLibrary->Update(dt); selfLibrary->Update(dt);
opponentLibrary->Update(dt); opponentLibrary->Update(dt);
} }
@@ -133,10 +149,12 @@ void GuiAvatars::Render()
float h = 54; float h = 54;
if (opponent == active) 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)); r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h * opponent->actZ, ARGB(200,0,0,0));
} }
else if (self == active) 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)); 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(); GuiLayer::Render();
+2
View File
@@ -412,6 +412,8 @@ int GuiPlay::receiveEventPlus(WEvent * e)
Replace(); Replace();
else if (dynamic_cast<WEventCardUnattached*> (e)) else if (dynamic_cast<WEventCardUnattached*> (e))
Replace(); Replace();
else if (dynamic_cast<WEventCardEquipped*> (e))
Replace();
else if (dynamic_cast<WEventCardControllerChange*> (e)) else if (dynamic_cast<WEventCardControllerChange*> (e))
Replace(); Replace();
Replace(); Replace();
+60 -2
View File
@@ -164,7 +164,10 @@ void GuiGameZone::Render()
JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID); JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID);
float scale = defaultHeight / quad->mHeight; float scale = defaultHeight / quad->mHeight;
quad->SetColor(ARGB((int)(actA),255,255,255)); 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); JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ);
float x0 = actX; float x0 = actX;
@@ -182,7 +185,16 @@ void GuiGameZone::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[11]; char buffer[11];
int mAlpha = (int) (actA); 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->SetColor(ARGB(mAlpha,0,0,0));
mFont->DrawString(buffer, x0 + 1, actY + 1); mFont->DrawString(buffer, x0 + 1, actY + 1);
if (actA > 120) if (actA > 120)
@@ -298,6 +310,52 @@ ostream& GuiGraveyard::toString(ostream& out) const
return out << "GuiGraveyard :::"; 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 //opponenthand begins
GuiOpponentHand::GuiOpponentHand(float x, float y, bool hasFocus, Player * player, GuiAvatars* parent) : GuiOpponentHand::GuiOpponentHand(float x, float y, bool hasFocus, Player * player, GuiAvatars* parent) :
GuiGameZone(x, y, hasFocus, player->game->hand, parent), player(player) 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; 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"); check = restriction[i].find("morbid");
if(check != string::npos) if(check != string::npos)
{ {
@@ -558,8 +573,8 @@ int AbilityFactory::countCards(TargetChooser * tc, Player * player, int option)
{ {
if (player && player != observer->players[i]) if (player && player != observer->players[i])
continue; continue;
MTGGameZone * zones[] = { observer->players[i]->game->inPlay, observer->players[i]->game->graveyard, observer->players[i]->game->hand }; 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 < 3; k++) for (int k = 0; k < 4; k++)
{ {
for (int j = zones[k]->nb_cards - 1; j >= 0; j--) 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) MTGGameZone * dest)
{ {
size_t found; size_t found;
bool asAlternate = false;
trim(s); trim(s);
//TODO This block redundant with calling function //TODO This block redundant with calling function
if (!card && spell) if (!card && spell)
@@ -1073,7 +1089,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGCardInstance * target = card->target; MTGCardInstance * target = card->target;
if (!target) if (!target)
target = card; 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 //MTG Specific rules
//adds the bonus credit system //adds the bonus credit system
found = s.find("bonusrule"); 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); vector<string> splitMayPay = parseBetween(s, "pay(", ")", true);
if(splitMayPay.size()) 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->oneShot = 1;
a->canBeInterrupted = false; a->canBeInterrupted = false;
return a; return a;
@@ -2076,7 +2094,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
vector<string> splitMayPaysub = parseBetween(s, "pay[[","]]", true); vector<string> splitMayPaysub = parseBetween(s, "pay[[","]]", true);
if (splitMayPaysub.size()) 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->oneShot = 1;
a->canBeInterrupted = false; a->canBeInterrupted = false;
return a; return a;
@@ -2565,6 +2583,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a; 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 //set hand size
vector<string> splitSetHand = parseBetween(s, "sethand:", " ", false); vector<string> splitSetHand = parseBetween(s, "sethand:", " ", false);
if (splitSetHand.size()) if (splitSetHand.size())
@@ -3412,6 +3439,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
bool opponentturn = (s1.find("my") == string::npos); bool opponentturn = (s1.find("my") == string::npos);
bool myturn = (s1.find("opponent") == string::npos); bool myturn = (s1.find("opponent") == string::npos);
bool sourceinPlay = (s1.find("sourceinplay") != 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 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); bool once = (s1.find("once") != string::npos);
@@ -3420,7 +3448,7 @@ MTGAbility * AbilityFactory::parsePhaseActionAbility(string s,MTGCardInstance *
_target = spell->getNextCardTarget(); _target = spell->getNextCardTarget();
if(!_target) if(!_target)
_target = 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) 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = game->players[i]; Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack }; 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 < 5; k++) for (int k = 0; k < 6; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if (canTarget(zone)) if (canTarget(zone))
@@ -5329,8 +5357,8 @@ void ListMaintainerAbility::checkTargets()
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = game->players[i]; Player * p = game->players[i];
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack }; 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 < 5; k++) for (int k = 0; k < 6; k++)
{ {
MTGGameZone * zone = zones[k]; MTGGameZone * zone = zones[k];
if (canTarget(zone)) if (canTarget(zone))
+3
View File
@@ -65,6 +65,9 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
LKItoughness = toughness; LKItoughness = toughness;
cardistargetted = 0; cardistargetted = 0;
cardistargetter = 0; cardistargetter = 0;
tmodifier = 0;
tmodifierb = 0;
myconvertedcost = getManaCost()->getConvertedCost();
} }
MTGCardInstance * MTGCardInstance::createSnapShot() MTGCardInstance * MTGCardInstance::createSnapShot()
+3 -1
View File
@@ -147,7 +147,9 @@ const char* Constants::MTGBasicAbilities[] = {
"madness", "madness",
"protectionfromcoloredspells", "protectionfromcoloredspells",
"mygcreatureexiler", "mygcreatureexiler",
"oppgcreatureexiler" "oppgcreatureexiler",
"payzero",
"trinisphere"
}; };
map<string,int> Constants::MTGBasicAbilitiesMap; map<string,int> Constants::MTGBasicAbilitiesMap;
+9
View File
@@ -1289,6 +1289,10 @@ ostream& operator<<(ostream& out, const MTGPlayerCards& z)
out << "hand="; out << "hand=";
out << *(z.hand) << endl; out << *(z.hand) << endl;
} }
if(z.removedFromGame->cards.size()) {
out << "exile=";
out << *(z.hand) << endl;
}
return out; return out;
} }
@@ -1321,6 +1325,11 @@ bool MTGPlayerCards::parseLine(const string& s)
battlefield->parseLine(s.substr(limiter+1)); battlefield->parseLine(s.substr(limiter+1));
return true; return true;
} }
else if (areaS.compare("removedfromgame") == 0 || areaS.compare("exile") == 0)
{
removedFromGame->parseLine(s.substr(limiter+1));
return true;
}
} }
return false; return false;
+1
View File
@@ -35,6 +35,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
drawCounter = 0; drawCounter = 0;
epic = 0; epic = 0;
raidcount = 0; raidcount = 0;
handmodifier = 0;
prowledTypes.clear(); prowledTypes.clear();
doesntEmpty = NEW ManaCost(); doesntEmpty = NEW ManaCost();
poolDoesntEmpty = 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++) for (int i = 0; i < 2; i++)
{ {
Player * p = g->players[i]; Player * p = g->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard }; MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->exile };
for (int j = 0; j < 4; j++) for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) 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, MTGGameZone * loadedPlayerZones[] = { initState.playerData[playerId].player->game->graveyard,
initState.playerData[playerId].player->game->library, initState.playerData[playerId].player->game->library,
initState.playerData[playerId].player->game->hand, 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++) 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; 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, MTGGameZone * loadedPlayerZones[] = { initState.playerData[i].player->game->graveyard,
initState.playerData[i].player->game->library, initState.playerData[i].player->game->library,
initState.playerData[i].player->game->hand, initState.playerData[i].player->game->hand,
initState.playerData[i].player->game->inPlay }; initState.playerData[i].player->game->inPlay,
for (int j = 0; j < 4; j++) initState.playerData[i].player->game->exile };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++) for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
+28 -14
View File
@@ -19,6 +19,10 @@
#include <iostream> #include <iostream>
#include <math.h> #include <math.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#if (defined FORCE_GLES) #if (defined FORCE_GLES)
#undef GL_ES_VERSION_2_0 #undef GL_ES_VERSION_2_0
#undef GL_VERSION_2_0 #undef GL_VERSION_2_0
@@ -101,7 +105,7 @@ class SdlApp
public: /* For easy interfacing with JGE static functions */ public: /* For easy interfacing with JGE static functions */
bool Running; bool Running;
SDL_Window* window; SDL_Window* window;
SDL_GLContext gl_context; SDL_GLContext gl_context;
SDL_Rect viewPort; SDL_Rect viewPort;
Uint32 lastMouseUpTime; Uint32 lastMouseUpTime;
Uint32 lastFingerDownTime; Uint32 lastFingerDownTime;
@@ -112,10 +116,27 @@ public: /* For easy interfacing with JGE static functions */
int mMouseDownX; int mMouseDownX;
int mMouseDownY; int mMouseDownY;
static SdlApp* sInstance;
public: public:
SdlApp() : Running(true), window(NULL), gl_context(NULL), lastMouseUpTime(0), lastFingerDownTime(0), mMouseDownX(0), mMouseDownY(0) SdlApp() : Running(true), window(NULL), gl_context(NULL), lastMouseUpTime(0), lastFingerDownTime(0), mMouseDownX(0), mMouseDownY(0)
{ {
sInstance = this;
}
static void OneIter()
{
SDL_Event Event;
if (g_engine)
{
for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x)
{
if(!g_engine->IsPaused())
sInstance->OnEvent(&Event);
}
if(!g_engine->IsPaused())
sInstance->OnUpdate();
}
} }
int OnExecute() int OnExecute()
@@ -125,22 +146,14 @@ public:
return -1; return -1;
} }
SDL_Event Event; #ifdef __EMSCRIPTEN__
emscripten_set_main_loop(OneIter, 60, 1);
#else
while(Running) while(Running)
{ {
if (g_engine) OneIter();
{
for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x)
{
if(!g_engine->IsPaused())
OnEvent(&Event);
}
if(!g_engine->IsPaused())
OnUpdate();
}
} }
#endif
OnCleanup(); OnCleanup();
return 0; return 0;
@@ -280,6 +293,7 @@ public:
SDL_Quit(); SDL_Quit();
} }
}; };
SdlApp* SdlApp::sInstance = 0;
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] = static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
{ {
+4
View File
@@ -739,6 +739,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
{ {
return NEW CardTargetChooser(observer, card->storedSourceCard, card, zones, nbzones); 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 else
{ {
tc = NEW TypeTargetChooser(observer, typeName.c_str(), zones, nbzones, card, maxtargets, other, targetMin); tc = NEW TypeTargetChooser(observer, typeName.c_str(), zones, nbzones, card, maxtargets, other, targetMin);
+12 -9
View File
@@ -50,8 +50,8 @@ MTGCardInstance * TestSuiteAI::getCard(string action)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Player * p = observer->players[i]; Player * p = observer->players[i];
MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard }; MTGGameZone * zones[] = { p->game->library, p->game->hand, p->game->inPlay, p->game->graveyard, p->game->removedFromGame };
for (int j = 0; j < 4; j++) for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++) for (int k = 0; k < zone->nb_cards; k++)
@@ -398,12 +398,13 @@ void TestSuiteGame::assertGame()
error++; 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, MTGGameZone * endstateZones[] = { endState.players[i]->game->graveyard,
endState.players[i]->game->library, endState.players[i]->game->library,
endState.players[i]->game->hand, endState.players[i]->game->hand,
endState.players[i]->game->inPlay }; endState.players[i]->game->inPlay,
for (int j = 0; j < 4; j++) endState.players[i]->game->removedFromGame };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
if (zone->nb_cards != endstateZones[j]->nb_cards) if (zone->nb_cards != endstateZones[j]->nb_cards)
@@ -857,12 +858,13 @@ void TestSuiteGame::initGame()
stringstream stream; stringstream stream;
initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream); initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
p->getRandomGenerator()->loadRandValues(stream.str()); 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, MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,
initState.players[i]->game->library, initState.players[i]->game->library,
initState.players[i]->game->hand, initState.players[i]->game->hand,
initState.players[i]->game->inPlay }; initState.players[i]->game->inPlay,
for (int j = 0; j < 4; j++) initState.players[i]->game->removedFromGame };
for (int j = 0; j < 5; j++)
{ {
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++) for (size_t k = 0; k < loadedPlayerZones[j]->cards.size(); k++)
@@ -914,9 +916,10 @@ MTGPlayerCards * TestSuiteGame::buildDeck(Player* player, int playerId)
MTGGameZone * loadedPlayerZones[] = { initState.players[playerId]->game->graveyard, MTGGameZone * loadedPlayerZones[] = { initState.players[playerId]->game->graveyard,
initState.players[playerId]->game->library, initState.players[playerId]->game->library,
initState.players[playerId]->game->hand, initState.players[playerId]->game->hand,
initState.players[playerId]->game->removedFromGame,
initState.players[playerId]->game->inPlay }; 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++) 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) : WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
WEventCardUpdate(card) WEventCardUpdate(card)
{ {
@@ -324,6 +329,12 @@ Targetable * WEventCardUnattached::getTarget(int target)
return NULL; return NULL;
} }
Targetable * WEventCardEquipped::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventCardControllerChange::getTarget(int target) Targetable * WEventCardControllerChange::getTarget(int target)
{ {
if (target) return card; if (target) return card;