- Added the possibility to narrow a spell/ability target according to color,tapped status, attacker/blocker, abilities...
- Changed the games phase system to become a phaseRing. This allows to add cards that have an impact on the phases, such as stasis
- Added a few cards
- Fixed a (windows) bug in gatherer tool
- Adding stdint.h for VC++ (see wikipedia->stdint.h)
- deleting the compiled PSP lib to avoid confusion. People who work from the sourcehave to compile the lib by themselves.
This commit is contained in:
wagic.the.homebrew
2008-11-09 04:28:03 +00:00
parent 45f3d6fe6e
commit 01d2110e8d
34 changed files with 849 additions and 233 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+179 -2
View File
@@ -86,6 +86,20 @@ subtype=Wall
toughness=4 toughness=4
[/card] [/card]
[card] [card]
text=Flying (This creature can't be blocked except by creatures with flying or reach.) When Angel of Mercy comes into play, you gain 3 life.
abilities=flying
auto=gainlife:3
id=129465
name=Angel of Mercy
rarity=U
color=White
type=Creature
mana={4}{W}
power=3
subtype=Angel
toughness=3
[/card]
[card]
text=Flying (This creature can't be blocked except by creatures with flying or reach.) Other black creatures get +1/+1. Nonblack creatures get -1/-1. text=Flying (This creature can't be blocked except by creatures with flying or reach.) Other black creatures get +1/+1. Nonblack creatures get -1/-1.
abilities=Legendary, flying abilities=Legendary, flying
id=106525 id=106525
@@ -99,6 +113,17 @@ subtype=Vampire
toughness=3 toughness=3
[/card] [/card]
[card] [card]
text=Destroy target tapped creature.
target=creature[tapped]
auto=destroy
id=135194
name=Assassinate
rarity=C
color=Black
type=Sorcery
mana={2}{B}
[/card]
[card]
text=Flash (You may play this spell any time you could play an instant.) First strike (This creature deals combat damage before creatures without first strike.) text=Flash (You may play this spell any time you could play an instant.) First strike (This creature deals combat damage before creatures without first strike.)
abilities=flash,first strike abilities=flash,first strike
id=136279 id=136279
@@ -219,6 +244,17 @@ type=Sorcery
mana={2}{G}{G} mana={2}{G}{G}
[/card] [/card]
[card] [card]
text=Destroy target green or white creature.
target=creature[green;white]
auto=destroy
id=129910
name=Deathmark
rarity=U
color=Black
type=Sorcery
mana={B}
[/card]
[card]
text=Destroy target artifact or land. text=Destroy target artifact or land.
target=artifact,land target=artifact,land
auto=destroy auto=destroy
@@ -316,6 +352,18 @@ subtype=Beast
toughness=7 toughness=7
[/card] [/card]
[card] [card]
text=Essence Drain deals 3 damage to target creature or player and you gain 3 life.
target=creature,player
auto=damage:3
auto=gainlife:3
id=135191
name=Essence Drain
rarity=C
color=Black
type=Sorcery
mana={4}{B}
[/card]
[card]
text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature has fear. (It can't be blocked except by artifact creatures and/or black creatures.) text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature has fear. (It can't be blocked except by artifact creatures and/or black creatures.)
id=129544 id=129544
target=creature target=creature
@@ -328,6 +376,19 @@ mana={B}{B}
subtype=Aura subtype=Aura
[/card] [/card]
[card] [card]
text={T}: Femeref Archers deals 4 damage to target attacking creature with flying.
auto={T}:damage:4 target(creature[attacking;flying])
id=135186
name=Femeref Archers
rarity=U
color=Green
type=Creature
mana={2}{G}
power=2
subtype=Human Archer
toughness=2
[/card]
[card]
text=Other Soldier creatures get +1/+1 and have first strike. (They deal combat damage before creatures without first strike.) text=Other Soldier creatures get +1/+1 and have first strike. (They deal combat damage before creatures without first strike.)
id=135258 id=135258
auto=lord(soldier) 1/1 first strike auto=lord(soldier) 1/1 first strike
@@ -530,6 +591,19 @@ subtype=Bear
toughness=2 toughness=2
[/card] [/card]
[card] [card]
text={2}: Target blue or red creature gets +1/+0 until end of turn.
auto={2}:1/0 target(creature[blue;red])
id=130995
name=Hate Weaver
rarity=U
color=Black
type=Creature
mana={1}{B}
power=2
subtype=Zombie Wizard
toughness=1
[/card]
[card]
text= text=
id=129591 id=129591
name=Hill Giant name=Hill Giant
@@ -836,6 +910,19 @@ type=Instant
mana={3}{G} mana={3}{G}
[/card] [/card]
[card] [card]
text={2}: Target red or white creature gains trample until end of turn. (If it would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.)
auto={2}:trample target(creature[red;white])
id=130996
name=Might Weaver
rarity=U
color=Green
type=Creature
mana={1}{G}
power=2
subtype=Human Wizard
toughness=1
[/card]
[card]
text={2}, {T}: Target player puts the top two cards of his or her library into his or her graveyard. text={2}, {T}: Target player puts the top two cards of his or her library into his or her graveyard.
id=129643 id=129643
alias=1126 alias=1126
@@ -974,6 +1061,20 @@ mana={3}{U}{U}
subtype=Aura subtype=Aura
[/card] [/card]
[card] [card]
text=When Phyrexian Rager comes into play, you draw a card and you lose 1 life.
auto=draw:1
auto=life:-1
id=135189
name=Phyrexian Rager
rarity=C
color=Black
type=Creature
mana={2}{B}
power=2
subtype=Horror
toughness=2
[/card]
[card]
text=Swampwalk (This creature is unblockable as long as defending player controls a Swamp.) text=Swampwalk (This creature is unblockable as long as defending player controls a Swamp.)
abilities=swampwalk abilities=swampwalk
id=129678 id=129678
@@ -1040,6 +1141,19 @@ subtype=Human Wizard
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text={2}: Target black or green creature gains haste until end of turn. (It can attack and {T} this turn.)
auto={2}:haste target(creature[green;black])
id=130997
name=Rage Weaver
rarity=U
color=Red
type=Creature
mana={1}{R}
power=2
subtype=Human Wizard
toughness=1
[/card]
[card]
text=Haste (This creature can attack and {T} as soon as it comes under your control.) text=Haste (This creature can attack and {T} as soon as it comes under your control.)
abilities=haste abilities=haste
id=129688 id=129688
@@ -1100,8 +1214,19 @@ subtype=Rat
toughness=2 toughness=2
[/card] [/card]
[card] [card]
text=You gain 3 life. Draw a card.
auto=life:3
auto=draw:1
id=132089
name=Reviving Dose
rarity=C
color=White
type=Instant
mana={2}{W}
[/card]
[card]
text=Target blocking creature gets +7/+7 until end of turn. text=Target blocking creature gets +7/+7 until end of turn.
target=creature target=creature[blocking]
auto=:7/7 auto=:7/7
id=130552 id=130552
name=Righteousness name=Righteousness
@@ -1326,6 +1451,19 @@ subtype=Cat Knight
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text={2}: Target white or black creature gains flying until end of turn. (It can't be blocked except by creatures with flying or reach.)
auto={2}:flying target(creature[white;black])
id=130998
name=Sky Weaver
rarity=U
color=Blue
type=Creature
mana={1}{U}
power=2
subtype=Metathran Wizard
toughness=1
[/card]
[card]
text=Destroy target artifact. Draw a card. text=Destroy target artifact. Draw a card.
target=artifact target=artifact
auto=destroy auto=destroy
@@ -1388,6 +1526,32 @@ mana={W}
subtype=Aura subtype=Aura
[/card] [/card]
[card] [card]
text={2}: Target green or blue creature gets +0/+1 until end of turn.
auto={2}:0/1 target(creature[green;blue])
id=130999
name=Spirit Weaver
rarity=U
color=White
type=Creature
mana={1}{W}
power=2
subtype=Human Wizard
toughness=1
[/card]
[card]
text={7}{W}: You gain 5 life.
auto={7}{W}:life:5
id=130385
name=Starlight Invoker
rarity=U
color=White
type=Creature
mana={1}{W}
power=1
subtype=Human Cleric Mutant
toughness=3
[/card]
[card]
text=Vigilance (Attacking doesn't cause this creature to tap.) text=Vigilance (Attacking doesn't cause this creature to tap.)
abilities=vigilance abilities=vigilance
id=132111 id=132111
@@ -1478,7 +1642,7 @@ mana={2}{W}
[/card] [/card]
[card] [card]
text=Destroy target nonartifact, nonblack creature. It can't be regenerated. text=Destroy target nonartifact, nonblack creature. It can't be regenerated.
target=creature target=creature[-artifact;-black]
alias=1182 alias=1182
id=135199 id=135199
name=Terror name=Terror
@@ -1561,6 +1725,19 @@ subtype=Bat
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text=When Venerable Monk comes into play, you gain 2 life.
auto=life:2
id=129786
name=Venerable Monk
rarity=C
color=White
type=Creature
mana={2}{W}
power=2
subtype=Human Monk Cleric
toughness=2
[/card]
[card]
text=Defender, flying (This creature can't attack, and it can block creatures with flying.) text=Defender, flying (This creature can't attack, and it can block creatures with flying.)
abilities=defender,flying abilities=defender,flying
id=135274 id=135274
-156
View File
@@ -49,18 +49,6 @@ subtype=Merfolk Wizard
toughness=3 toughness=3
[/card] [/card]
[card] [card]
text=Flying (This creature can't be blocked except by creatures with flying or reach.) When Angel of Mercy comes into play, you gain 3 life.
id=129465
name=Angel of Mercy
rarity=U
color=White
type=Creature
mana={4}{W}
power=3
subtype=Angel
toughness=3
[/card]
[card]
text=Whenever a creature comes into play under your control, you gain life equal to its toughness. text=Whenever a creature comes into play under your control, you gain life equal to its toughness.
id=129710 id=129710
name=Angelic Chorus name=Angelic Chorus
@@ -101,15 +89,6 @@ subtype=Wizard
toughness=4 toughness=4
[/card] [/card]
[card] [card]
text=Destroy target tapped creature.
id=135194
name=Assassinate
rarity=C
color=Black
type=Sorcery
mana={2}{B}
[/card]
[card]
text=Gain control of target Aura that's attached to a permanent. Attach it to another permanent it can enchant. text=Gain control of target Aura that's attached to a permanent. Attach it to another permanent it can enchant.
id=130976 id=130976
name=Aura Graft name=Aura Graft
@@ -520,15 +499,6 @@ type=Sorcery
mana={2}{R} mana={2}{R}
[/card] [/card]
[card] [card]
text=Destroy target green or white creature.
id=129910
name=Deathmark
rarity=U
color=Black
type=Sorcery
mana={B}
[/card]
[card]
text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature doesn't untap during its controller's untap step. text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature doesn't untap during its controller's untap step.
id=129521 id=129521
name=Dehydration name=Dehydration
@@ -695,15 +665,6 @@ subtype=Elf Shaman
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text=Essence Drain deals 3 damage to target creature or player and you gain 3 life.
id=135191
name=Essence Drain
rarity=C
color=Black
type=Sorcery
mana={4}{B}
[/card]
[card]
text=Return all creatures to their owners' hands. text=Return all creatures to their owners' hands.
id=129541 id=129541
name=Evacuation name=Evacuation
@@ -721,18 +682,6 @@ color=Land
type=Land type=Land
[/card] [/card]
[card] [card]
text={T}: Femeref Archers deals 4 damage to target attacking creature with flying.
id=135186
name=Femeref Archers
rarity=U
color=Green
type=Creature
mana={2}{G}
power=2
subtype=Human Archer
toughness=2
[/card]
[card]
text=When Festering Goblin is put into a graveyard from play, target creature gets -1/-1 until end of turn. text=When Festering Goblin is put into a graveyard from play, target creature gets -1/-1 until end of turn.
id=129546 id=129546
name=Festering Goblin name=Festering Goblin
@@ -902,18 +851,6 @@ type=Instant
mana={X}{W} mana={X}{W}
[/card] [/card]
[card] [card]
text={2}: Target blue or red creature gets +1/+0 until end of turn.
id=130995
name=Hate Weaver
rarity=U
color=Black
type=Creature
mana={1}{B}
power=2
subtype=Zombie Wizard
toughness=1
[/card]
[card]
text=Target opponent puts the cards from his or her hand on top of his or her library. Search that player's library for that many cards. The player puts those cards into his or her hand, then shuffles his or her library. text=Target opponent puts the cards from his or her hand on top of his or her library. Search that player's library for that many cards. The player puts those cards into his or her hand, then shuffles his or her library.
id=135255 id=135255
name=Head Games name=Head Games
@@ -1249,18 +1186,6 @@ type=Sorcery
mana={X}{2}{B} mana={X}{2}{B}
[/card] [/card]
[card] [card]
text={2}: Target red or white creature gains trample until end of turn. (If it would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.)
id=130996
name=Might Weaver
rarity=U
color=Green
type=Creature
mana={1}{G}
power=2
subtype=Human Wizard
toughness=1
[/card]
[card]
text=Change the text of target permanent by replacing all instances of one color word with another or one basic land type with another. (For example, you may change "nonblack creature" to "nongreen creature" or "forestwalk" to "islandwalk." This effect doesn't end at end of turn.) text=Change the text of target permanent by replacing all instances of one color word with another or one basic land type with another. (For example, you may change "nonblack creature" to "nongreen creature" or "forestwalk" to "islandwalk." This effect doesn't end at end of turn.)
id=129644 id=129644
name=Mind Bend name=Mind Bend
@@ -1468,18 +1393,6 @@ subtype=Illusion Warrior
toughness=2 toughness=2
[/card] [/card]
[card] [card]
text=When Phyrexian Rager comes into play, you draw a card and you lose 1 life.
id=135189
name=Phyrexian Rager
rarity=C
color=Black
type=Creature
mana={2}{B}
power=2
subtype=Horror
toughness=2
[/card]
[card]
text={2}, {T}, Sacrifice a creature: Draw a card. text={2}, {T}, Sacrifice a creature: Draw a card.
id=135281 id=135281
name=Phyrexian Vault name=Phyrexian Vault
@@ -1590,18 +1503,6 @@ subtype=Dryad
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text={2}: Target black or green creature gains haste until end of turn. (It can attack and {T} this turn.)
id=130997
name=Rage Weaver
rarity=U
color=Red
type=Creature
mana={1}{R}
power=2
subtype=Human Wizard
toughness=1
[/card]
[card]
text=Search your library for a basic land card and put that card into play tapped. Then shuffle your library. text=Search your library for a basic land card and put that card into play tapped. Then shuffle your library.
id=129690 id=129690
name=Rampant Growth name=Rampant Growth
@@ -1671,15 +1572,6 @@ type=Instant
mana={1}{U} mana={1}{U}
[/card] [/card]
[card] [card]
text=You gain 3 life. Draw a card.
id=132089
name=Reviving Dose
rarity=C
color=White
type=Instant
mana={2}{W}
[/card]
[card]
text=Flying (This creature can't be blocked except by creatures with flying or reach.) At the beginning of your upkeep, you may return target creature card from your graveyard to play. text=Flying (This creature can't be blocked except by creatures with flying or reach.) At the beginning of your upkeep, you may return target creature card from your graveyard to play.
id=106384 id=106384
name=Reya Dawnbringer name=Reya Dawnbringer
@@ -1906,18 +1798,6 @@ type=Sorcery
mana={3}{U} mana={3}{U}
[/card] [/card]
[card] [card]
text={2}: Target white or black creature gains flying until end of turn. (It can't be blocked except by creatures with flying or reach.)
id=130998
name=Sky Weaver
rarity=U
color=Blue
type=Creature
mana={1}{U}
power=2
subtype=Metathran Wizard
toughness=1
[/card]
[card]
text={T}: You may put a land card from your hand into play. Play this ability only any time you could play a sorcery. text={T}: You may put a land card from your hand into play. Play this ability only any time you could play a sorcery.
id=135182 id=135182
name=Skyshroud Ranger name=Skyshroud Ranger
@@ -2013,18 +1893,6 @@ subtype=Zombie Mercenary
toughness=2 toughness=2
[/card] [/card]
[card] [card]
text={2}: Target green or blue creature gets +0/+1 until end of turn.
id=130999
name=Spirit Weaver
rarity=U
color=White
type=Creature
mana={1}{W}
power=2
subtype=Human Wizard
toughness=1
[/card]
[card]
text=Spitting Earth deals damage equal to the number of Mountains you control to target creature. text=Spitting Earth deals damage equal to the number of Mountains you control to target creature.
id=136509 id=136509
name=Spitting Earth name=Spitting Earth
@@ -2070,18 +1938,6 @@ subtype=Antelope Beast
toughness=4 toughness=4
[/card] [/card]
[card] [card]
text={7}{W}: You gain 5 life.
id=130385
name=Starlight Invoker
rarity=U
color=White
type=Creature
mana={1}{W}
power=1
subtype=Human Cleric Mutant
toughness=3
[/card]
[card]
text=You can't play creature spells. text=You can't play creature spells.
id=135235 id=135235
name=Steel Golem name=Steel Golem
@@ -2383,18 +2239,6 @@ subtype=Vedalken Wizard
toughness=2 toughness=2
[/card] [/card]
[card] [card]
text=When Venerable Monk comes into play, you gain 2 life.
id=129786
name=Venerable Monk
rarity=C
color=White
type=Creature
mana={2}{W}
power=2
subtype=Human Monk Cleric
toughness=2
[/card]
[card]
text=At the beginning of each upkeep, put a 1/1 green Saproling creature token into play under your control. text=At the beginning of each upkeep, put a 1/1 green Saproling creature token into play under your control.
id=129788 id=129788
name=Verdant Force name=Verdant Force
+1 -2
View File
@@ -1346,6 +1346,7 @@ mana={2}{R}{R}
[/card] [/card]
[card] [card]
text={2}{G}{T}: Untap target creature. text={2}{G}{T}: Untap target creature.
auto={2}{G}{T}:untap target(creature)
id=2566 id=2566
name=Fyndhorn Brownie name=Fyndhorn Brownie
auto={2}{G}{T}:untap target(creature) auto={2}{G}{T}:untap target(creature)
@@ -1446,5 +1447,3 @@ rarity=R
type=Artifact type=Artifact
mana={3} mana={3}
[/card] [/card]
#End of file
+13 -3
View File
@@ -1712,7 +1712,7 @@ mana={W}{W}
[card] [card]
text=Target blocking creature gets +7/+7 until end of turn. text=Target blocking creature gets +7/+7 until end of turn.
auto=:7/7 auto=:7/7
target=creature target=creature[blocking]
id=1363 id=1363
name=Righteousness name=Righteousness
rarity=R rarity=R
@@ -1742,6 +1742,7 @@ mana={4}
[/card] [/card]
[card] [card]
text={T}: Destroy target tapped creature. text={T}: Destroy target tapped creature.
auto={T}:destroy target(creature[tapped])
id=1175 id=1175
name=Royal Assassin name=Royal Assassin
rarity=R rarity=R
@@ -1938,6 +1939,15 @@ type=Instant
mana={X}{U} mana={X}{U}
[/card] [/card]
[card] [card]
text=Players skip their untap steps. At the beginning of your upkeep, sacrifice Stasis unless you pay {U}.
id=1225
name=Stasis
rarity=R
color=Blue
type=Enchantment
mana={1}{U}
[/card]
[card]
text=Enchant artifact You control enchanted artifact. text=Enchant artifact You control enchanted artifact.
target=artifact target=artifact
id=1226 id=1226
@@ -2023,12 +2033,12 @@ subtype=Mountain Forest
[/card] [/card]
[card] [card]
text=Destroy target nonartifact, nonblack creature. It can't be regenerated. text=Destroy target nonartifact, nonblack creature. It can't be regenerated.
target=creature target=creature[-black;-artifact]
id=1182 id=1182
name=Terror name=Terror
rarity=C rarity=C
type=Instant type=Instant
mana={1}{B} mana={0}
[/card] [/card]
[card] [card]
text=As The Rack comes into play, choose an opponent. At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand. text=As The Rack comes into play, choose an opponent. At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
-9
View File
@@ -528,15 +528,6 @@ subtype=Sorceress
toughness=1 toughness=1
[/card] [/card]
[card] [card]
text=Players skip their untap steps. At the beginning of your upkeep, sacrifice Stasis unless you pay {U}.
id=1225
name=Stasis
rarity=R
color=Blue
type=Enchantment
mana={1}{U}
[/card]
[card]
text={T}: Target creature you control with toughness less than Stone Giant's power gains flying until end of turn. At end of turn, destroy that creature. text={T}: Target creature you control with toughness less than Stone Giant's power gains flying until end of turn. At end of turn, destroy that creature.
id=1320 id=1320
name=Stone Giant name=Stone Giant
+1
View File
@@ -42,6 +42,7 @@ resurrection.txt
rootwalla.txt rootwalla.txt
shivan_hellkite.txt shivan_hellkite.txt
shock.txt shock.txt
stasis.txt
terror.txt terror.txt
volcanic_island.txt volcanic_island.txt
white_knight1.txt white_knight1.txt
-1
View File
@@ -1 +0,0 @@
+35
View File
@@ -0,0 +1,35 @@
#Stasis : will my grizzly bears attack twice, or will they stay untapped ?
[INIT]
COMBATATTACKERS
[PLAYER1]
inplay: 1250,1225
[PLAYER2]
[DO]
1250
eot
eot
#untap player 1
next
#draw
next
#main 1
next
#combat begins
next
#attackers
1250
next
#blockers
next
#damages
next
#combat end
[ASSERT]
COMBATEND
[PLAYER1]
inplay:1250
graveyard:1225
manapool:{0}
[PLAYER2]
life:18
[END]
+232
View File
@@ -0,0 +1,232 @@
// 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_ ]
+2 -2
View File
@@ -36,7 +36,7 @@ public:
virtual ~AIPlayer(); virtual ~AIPlayer();
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0); virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
virtual int chooseTarget(TargetChooser * tc = NULL); virtual int chooseTarget(TargetChooser * tc = NULL);
virtual int Act(); virtual int Act(float dt);
int isAI(){return 1;}; int isAI(){return 1;};
}; };
@@ -49,7 +49,7 @@ protected:
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type); MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
public: public:
AIPlayerBaka(MTGPlayerCards * _deck, char * deckFile); AIPlayerBaka(MTGPlayerCards * _deck, char * deckFile);
virtual int Act(); virtual int Act(float dt);
void initTimer(); void initTimer();
}; };
+55
View File
@@ -449,6 +449,13 @@ public:
//That means the player has to choose one. although that is perfect for cards such as birds of paradise or badlands, //That means the player has to choose one. although that is perfect for cards such as birds of paradise or badlands,
other solutions need to be provided for abilities that add mana (ex: mana flare) other solutions need to be provided for abilities that add mana (ex: mana flare)
*/ */
/*
Currently the mana is added to the pool AFTER the animation
This is VERY BAD, since we don't have any control on the duration of the animation. This can lead to bugs with
the AI, who is expecting to have the mana in its manapool right after clicking the land card !!!
The sum of "dt" has to be 0.25 for the mana to be in the manapool currently
*/
class AManaProducer: public MTGAbility{ class AManaProducer: public MTGAbility{
protected: protected:
ManaCost * cost; ManaCost * cost;
@@ -2643,6 +2650,54 @@ public:
} }
}; };
//Stasis
class AStasis:public ActivatedAbility{
public:
int paidThisTurn;
AStasis(int _id, MTGCardInstance * card):ActivatedAbility(_id,card, NEW ManaCost(),1,0){
paidThisTurn = 1;
cost->add(MTG_COLOR_BLUE,1);
}
void Update(float dt){
//Upkeep Cost
if (newPhase !=currentPhase){
if (newPhase == MTG_PHASE_UPKEEP){
paidThisTurn = 0;
}else if (!paidThisTurn && newPhase > MTG_PHASE_UPKEEP && game->currentPlayer==source->controller() ){
game->currentPlayer->game->putInGraveyard(source);
paidThisTurn = 1;
}
}
//Stasis Effect
for (int i = 0; i < 2; i++){
game->phaseRing->removePhase(MTG_PHASE_UNTAP,game->players[i]);
}
//Parent Class Method Call
ActivatedAbility::Update(dt);
}
int isReactingToClick(MTGCardInstance * card){
return (!paidThisTurn && currentPhase == MTG_PHASE_UPKEEP && ActivatedAbility::isReactingToClick(card));
}
int resolve(){
paidThisTurn = 1;
return 1;
}
int destroy(){
for (int i = 0; i < 2; i++){
game->phaseRing->addPhaseBefore(MTG_PHASE_UNTAP,game->players[i],MTG_PHASE_UPKEEP,game->players[i]);
}
return 1;
}
};
//--------------Addon Abra------------------ //--------------Addon Abra------------------
//ShieldOfTheAge //ShieldOfTheAge
class AShieldOfTheAge: public TargetAbility{ class AShieldOfTheAge: public TargetAbility{
+6 -1
View File
@@ -8,10 +8,15 @@ A Filter/Mask system for Card Instances to find cards matching specific settings
#include "MTGCardInstance.h" #include "MTGCardInstance.h"
#include "MTGGameZones.h" #include "MTGGameZones.h"
#define CD_OR 1
#define CD_AND 2
class CardDescriptor: public MTGCardInstance{ class CardDescriptor: public MTGCardInstance{
protected: protected:
MTGCardInstance * match_or(MTGCardInstance * card);
MTGCardInstance * match_and(MTGCardInstance * card);
public: public:
int mode;
int init(); int init();
CardDescriptor(); CardDescriptor();
MTGCardInstance * match(MTGCardInstance * card); MTGCardInstance * match(MTGCardInstance * card);
+2
View File
@@ -8,6 +8,7 @@
#include "PlayGuiObject.h" #include "PlayGuiObject.h"
#include "DuelLayers.h" #include "DuelLayers.h"
#include "TargetChooser.h" #include "TargetChooser.h"
#include "PhaseRing.h"
#define MAX_GAME_OBSERVERS 500 #define MAX_GAME_OBSERVERS 500
@@ -33,6 +34,7 @@ class GameObserver{
int targetListIsSet(MTGCardInstance * card); int targetListIsSet(MTGCardInstance * card);
public: public:
PhaseRing * phaseRing;
int cancelCurrentAction(); int cancelCurrentAction();
int currentGamePhase; int currentGamePhase;
int oldGamePhase; int oldGamePhase;
+21 -15
View File
@@ -16,6 +16,8 @@
static char MTGColorChars[] = {'x','g','u','r','b','w','l'}; static char MTGColorChars[] = {'x','g','u','r','b','w','l'};
static const char * MTGColorStrings[] = {"artifact", "green", "blue", "red", "black", "white", "land"};
static int _r[7] = {75, 20, 20, 200,50,255,128}; static int _r[7] = {75, 20, 20, 200,50,255,128};
static int _g[7] = {30, 140, 30, 15, 50,255,128}; static int _g[7] = {30, 140, 30, 15, 50,255,128};
static int _b[7] = {20, 0, 140,15, 50,255,128}; static int _b[7] = {20, 0, 140,15, 50,255,128};
@@ -37,20 +39,22 @@ static int _b[7] = {20, 0, 140,15, 50,255,128};
#define MTG_PHASE_UNTAP 0 #define MTG_PHASE_BEFORE_BEGIN 0
#define MTG_PHASE_UPKEEP 1 #define MTG_PHASE_UNTAP 1
#define MTG_PHASE_DRAW 2 #define MTG_PHASE_UPKEEP 2
#define MTG_PHASE_FIRSTMAIN 3 #define MTG_PHASE_DRAW 3
#define MTG_PHASE_COMBATBEGIN 4 #define MTG_PHASE_FIRSTMAIN 4
#define MTG_PHASE_COMBATATTACKERS 5 #define MTG_PHASE_COMBATBEGIN 5
#define MTG_PHASE_COMBATBLOCKERS 6 #define MTG_PHASE_COMBATATTACKERS 6
#define MTG_PHASE_COMBATDAMAGE 7 #define MTG_PHASE_COMBATBLOCKERS 7
#define MTG_PHASE_COMBATEND 8 #define MTG_PHASE_COMBATDAMAGE 8
#define MTG_PHASE_SECONDMAIN 9 #define MTG_PHASE_COMBATEND 9
#define MTG_PHASE_ENDOFTURN 10 #define MTG_PHASE_SECONDMAIN 10
#define MTG_PHASE_EOT 10 #define MTG_PHASE_ENDOFTURN 11
#define MTG_PHASE_CLEANUP 11 #define MTG_PHASE_EOT 11
#define MTG_PHASE_CLEANUP 12
#define MTG_PHASE_AFTER_EOT 13
#define NB_MTG_PHASES 14
#define TRAMPLE 0 #define TRAMPLE 0
#define FORESTWALK 1 #define FORESTWALK 1
@@ -145,6 +149,7 @@ static const char * MTGBasicAbilities[] = {
static const char *MTGPhaseNames[] = static const char *MTGPhaseNames[] =
{ {
"---",
"Untap", "Untap",
"Upkeep", "Upkeep",
"Draw", "Draw",
@@ -156,7 +161,8 @@ static const char *MTGPhaseNames[] =
"Combat ends", "Combat ends",
"Main phase 2", "Main phase 2",
"End of turn", "End of turn",
"cleanup" "cleanup",
"---"
}; };
+1 -1
View File
@@ -30,7 +30,7 @@ class Player: public Damageable, public Targetable{
ManaCost * getManaPool(); ManaCost * getManaPool();
int manaBurn(); int manaBurn();
void cleanupPhase(); void cleanupPhase();
virtual int Act(){return 0;}; virtual int Act(float dt){return 0;};
virtual int isAI(){return 0;}; virtual int isAI(){return 0;};
Player * opponent(); Player * opponent();
int getId(); int getId();
+9
View File
@@ -18,6 +18,7 @@ class MTGGameZone;
class Player; class Player;
class Damageable; class Damageable;
class Targetable; class Targetable;
class CardDescriptor;
@@ -96,6 +97,14 @@ public:
virtual int canTarget(Targetable * targe); virtual int canTarget(Targetable * targe);
}; };
class DescriptorTargetChooser:public TargetZoneChooser{
public:
CardDescriptor * cd;
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1);
DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZone ** _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1);
virtual int canTarget(Targetable * target);
};
class SpellTargetChooser:public TargetChooser{ class SpellTargetChooser:public TargetChooser{
public: public:
+3 -2
View File
@@ -47,6 +47,7 @@ public:
}; };
class TestSuite{ class TestSuite{
public: public:
float timerLimit;
int currentAction; int currentAction;
TestSuiteState initState; TestSuiteState initState;
TestSuiteState endState; TestSuiteState endState;
@@ -72,9 +73,9 @@ public:
class TestSuiteAI:public AIPlayer{ class TestSuiteAI:public AIPlayer{
public: public:
TestSuite * suite; TestSuite * suite;
int timer; float timer;
TestSuiteAI(MTGAllCards * collection,TestSuite * suite, int playerId); TestSuiteAI(MTGAllCards * collection,TestSuite * suite, int playerId);
virtual int Act(); virtual int Act(float dt);
virtual int displayStack(){return 1;} virtual int displayStack(){return 1;}
}; };
+2 -2
View File
@@ -27,7 +27,7 @@ MTGCardInstance * AIPlayer::chooseCard(TargetChooser * tc, MTGCardInstance * sou
return NULL; return NULL;
} }
int AIPlayer::Act(){ int AIPlayer::Act(float dt){
GameObserver * gameObs = GameObserver::GetInstance(); GameObserver * gameObs = GameObserver::GetInstance();
if (gameObs->currentPlayer == this){ if (gameObs->currentPlayer == this){
gameObs->userRequestNextGamePhase(); gameObs->userRequestNextGamePhase();
@@ -486,7 +486,7 @@ void AIPlayerBaka::initTimer(){
timer = 20; timer = 20;
} }
int AIPlayerBaka::Act(){ int AIPlayerBaka::Act(float dt){
GameObserver * gameObs = GameObserver::GetInstance(); GameObserver * gameObs = GameObserver::GetInstance();
int currentGamePhase = gameObs->getCurrentGamePhase(); int currentGamePhase = gameObs->getCurrentGamePhase();
+79 -2
View File
@@ -3,30 +3,107 @@
CardDescriptor::CardDescriptor(): MTGCardInstance(){ CardDescriptor::CardDescriptor(): MTGCardInstance(){
init(); init();
mode = CD_AND;
} }
int CardDescriptor::init(){ int CardDescriptor::init(){
return MTGCardInstance::init(); return MTGCardInstance::init();
} }
MTGCardInstance * CardDescriptor::match(MTGCardInstance * card){ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card){
int found = 1;
for (int i = 0; i< nb_types; i++){
found = 0;
if (card->hasSubtype(types[i])){
found = 1;
break;
}
}
if (!found) return NULL;
for (int i = 0; i< MTG_NB_COLORS; i++){
found = 0;
if (colors[i] == 1 && card->hasColor(i)){
found = 1;
break;
}
}
if (!found) return NULL;
return card;
}
MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card){
#ifdef WIN32
OutputDebugString("Match AND\n");
#endif
MTGCardInstance * match = card; MTGCardInstance * match = card;
for (int i = 0; i< nb_types; i++){ for (int i = 0; i< nb_types; i++){
if (!card->hasSubtype(types[i])){ if (!card->hasSubtype(types[i])){
#ifdef WIN32
OutputDebugString(card->name.c_str());
OutputDebugString("Subtype No Match\n");
#endif
match = NULL; match = NULL;
} }
} }
for (int i = 0; i< MTG_NB_COLORS; i++){ for (int i = 0; i< MTG_NB_COLORS; i++){
if ((colors[i] == 1 && !card->hasColor(i))||(colors[i] == -1 && card->hasColor(i))){ if ((colors[i] == 1 && !card->hasColor(i))||(colors[i] == -1 && card->hasColor(i))){
match = NULL; match = NULL;
#ifdef WIN32
OutputDebugString(card->name.c_str());
OutputDebugString("Color No Match\n");
#endif
} }
} }
return match;
}
MTGCardInstance * CardDescriptor::match(MTGCardInstance * card){
MTGCardInstance * match = card;
if (mode == CD_AND){
match = match_and(card);
}else{
match=match_or(card);
}
//Abilities
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
if ((basicAbilities[j] == 1 && !card->basicAbilities[j]) || (basicAbilities[j] == -1 && card->basicAbilities[j])){
match = NULL;
}
}
if ((tapped == -1 && card->isTapped()) || (tapped == 1 && !card->isTapped())){ if ((tapped == -1 && card->isTapped()) || (tapped == 1 && !card->isTapped())){
match = NULL; match = NULL;
} }
if (attacker == 1){
if ((int)defenser == 1){
if (!card->attacker && !card->defenser) match = NULL;
}else{
if (!card->attacker) match = NULL;
}
}else if (attacker == -1){
if ((int)defenser == -1){
if (card->attacker || card->defenser) match = NULL;
}else{
if (card->attacker) match = NULL;
}
}else{
if ((int)defenser == -1){
if (card->defenser) match = NULL;
}else if ((int)defenser == 1){
if (!card->defenser) match = NULL;
}else{
// we don't care about the attack/blocker state
}
}
return match; return match;
} }
+19 -7
View File
@@ -48,6 +48,7 @@ GameObserver::GameObserver(Player * _players[], int _nb_players){
cardWaitingForTargets = NULL; cardWaitingForTargets = NULL;
reaction = 0; reaction = 0;
gameOver = NULL; gameOver = NULL;
phaseRing = NEW PhaseRing(_players,_nb_players);
} }
void GameObserver::setGamePhaseManager(MTGGamePhase * _phases){ void GameObserver::setGamePhaseManager(MTGGamePhase * _phases){
@@ -73,11 +74,21 @@ void GameObserver::nextPlayer(){
currentPlayerId = (currentPlayerId+1)%nbPlayers; currentPlayerId = (currentPlayerId+1)%nbPlayers;
currentPlayer = players[currentPlayerId]; currentPlayer = players[currentPlayerId];
currentActionPlayer = currentPlayer; currentActionPlayer = currentPlayer;
currentPlayer->canPutLandsIntoPlay = 1; //TODO more useful function
} }
void GameObserver::nextGamePhase(){ void GameObserver::nextGamePhase(){
currentGamePhase++; phaseRing->forward();
Phase * cPhase = phaseRing->getCurrentPhase();
currentGamePhase = cPhase->id;
if (currentPlayer != cPhase->player) nextPlayer();
//init begin of turn
if (currentGamePhase == MTG_PHASE_BEFORE_BEGIN){
cleanupPhase();
currentPlayer->canPutLandsIntoPlay = 1;
mLayers->actionLayer()->Update(0);
return nextGamePhase();
}
//manaBurn //manaBurn
if (currentGamePhase == MTG_PHASE_UNTAP || if (currentGamePhase == MTG_PHASE_UNTAP ||
currentGamePhase == MTG_PHASE_FIRSTMAIN || currentGamePhase == MTG_PHASE_FIRSTMAIN ||
@@ -88,21 +99,20 @@ void GameObserver::nextGamePhase(){
currentPlayer->manaBurn(); currentPlayer->manaBurn();
} }
//Next Player ? //After End of turn
if (currentGamePhase > MTG_PHASE_CLEANUP){ if (currentGamePhase == MTG_PHASE_AFTER_EOT){
//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 > 7){ while(currentPlayer->game->hand->nb_cards > 7){
currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]); currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]);
} }
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn; mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
nextPlayer(); mLayers->actionLayer()->Update(0);
currentGamePhase = MTG_PHASE_UNTAP; return nextGamePhase();
} }
//Phase Specific actions //Phase Specific actions
switch(currentGamePhase){ switch(currentGamePhase){
case MTG_PHASE_UNTAP: case MTG_PHASE_UNTAP:
cleanupPhase();
untapPhase(); untapPhase();
break; break;
case MTG_PHASE_DRAW: case MTG_PHASE_DRAW:
@@ -137,6 +147,7 @@ void GameObserver::startGame(int shuffle, int draw){
for (i=0; i<nbPlayers; i++){ for (i=0; i<nbPlayers; i++){
players[i]->game->initGame(shuffle, draw); players[i]->game->initGame(shuffle, draw);
} }
phaseRing->goToPhase(MTG_PHASE_FIRSTMAIN, players[0]);
currentGamePhase = MTG_PHASE_FIRSTMAIN; currentGamePhase = MTG_PHASE_FIRSTMAIN;
} }
@@ -158,6 +169,7 @@ GameObserver::~GameObserver(){
LOG("==Destroying GameObserver=="); LOG("==Destroying GameObserver==");
SAFE_DELETE(targetChooser); SAFE_DELETE(targetChooser);
SAFE_DELETE(mLayers); SAFE_DELETE(mLayers);
SAFE_DELETE(phaseRing);
LOG("==GameObserver Destroyed=="); LOG("==GameObserver Destroyed==");
} }
+1 -1
View File
@@ -132,7 +132,7 @@ void GuiLayers::Update(float dt, Player * currentPlayer){
} }
} }
if (isAI){ if (isAI){
currentPlayer->Act(); currentPlayer->Act(dt);
} }
} }
+8 -7
View File
@@ -223,8 +223,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
continue; continue;
} }
//gainlife //gain/lose life
found = s.find("gainlife"); found = s.find("life");
if (found != string::npos){ if (found != string::npos){
unsigned int start = s.find(":",found); unsigned int start = s.find(":",found);
unsigned int end = s.find(" ",start); unsigned int end = s.find(" ",start);
@@ -861,11 +861,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
MTGPlayerCards * zones = game->currentlyActing()->game; MTGPlayerCards * zones = game->currentlyActing()->game;
zones->putInZone(card->target,zones->graveyard,zones->hand); zones->putInZone(card->target,zones->graveyard,zones->hand);
} }
case 1175: //Royal Assassin
{
game->addObserver(NEW ARoyalAssassin(_id, card));
break;
}
case 1176: //Sacrifice case 1176: //Sacrifice
{ {
ASacrifice * ability = NEW ASacrifice(_id, card, card->target); ASacrifice * ability = NEW ASacrifice(_id, card, card->target);
@@ -1215,6 +1210,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
} }
break; break;
} }
case 1225: //Stasis
{
game->addObserver(NEW AStasis(_id, card));
break;
}
case 1367: //Sword to Plowshares case 1367: //Sword to Plowshares
{ {
card->target->controller()->life+= card->target->power; card->target->controller()->life+= card->target->power;
+1 -5
View File
@@ -12,10 +12,6 @@ MTGGamePhase::MTGGamePhase(int id):ActionElement(id){
void MTGGamePhase::Render(){ void MTGGamePhase::Render(){
/*if (animation){
RenderMessageBackground(10, 100);
mFont->DrawString(MTGPhaseNames[currentState], SCREEN_WIDTH_F/2, 30, JGETEXT_CENTER);
}*/
} }
@@ -37,7 +33,7 @@ void MTGGamePhase::Update(float dt){
if (animation > 0){ if (animation > 0){
fprintf(stderr, "animation = %f", animation); fprintf(stderr, "animation = %f", animation);
animation -= 0.05; animation -= dt *5 ;
}else{ }else{
activeState = INACTIVE; activeState = INACTIVE;
animation = 0; animation = 0;
+1 -1
View File
@@ -306,7 +306,7 @@ void MTGGuiPlay::RenderPhaseBar(){
int currentPhase = game->getCurrentGamePhase(); int currentPhase = game->getCurrentGamePhase();
for (int i=0; i < 12; i++){ for (int i=0; i < 12; i++){
int index = 2*i + 1 ; int index = 2*i + 1 ;
if (i==currentPhase){ if (i==currentPhase-1){
index-=1; index-=1;
} }
renderer->RenderQuad(phaseIcons[index], 200 + 14*i,0,0,0.5,0.5); renderer->RenderQuad(phaseIcons[index], 200 + 14*i,0,0,0.5,0.5);
+146 -4
View File
@@ -1,6 +1,6 @@
#include "../include/debug.h" #include "../include/debug.h"
#include "../include/TargetChooser.h" #include "../include/TargetChooser.h"
#include "../include/CardDescriptor.h"
#include "../include/MTGGameZones.h" #include "../include/MTGGameZones.h"
#include "../include/GameObserver.h" #include "../include/GameObserver.h"
#include "../include/Subtypes.h" #include "../include/Subtypes.h"
@@ -75,8 +75,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[1]= game->players[1]->game->inPlay; zones[1]= game->players[1]->game->inPlay;
} }
TypeTargetChooser * tc = NULL; TargetChooser * tc = NULL;
int maxtargets = 1; int maxtargets = 1;
CardDescriptor * cd = NULL;
while(s1.size()){ while(s1.size()){
found = s1.find(","); found = s1.find(",");
@@ -88,11 +89,118 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
typeName = s1; typeName = s1;
s1 = ""; s1 = "";
} }
//Advanced cards caracteristics ?
found = typeName.find("[");
if (found != string::npos){
int nbminuses = 0;
int end = typeName.find("]");
#ifdef WIN32
OutputDebugString("Advanced Attributes 1 \n");
#endif
string attributes = typeName.substr(found+1,end-found-1);
#ifdef WIN32
OutputDebugString(attributes.c_str());
OutputDebugString("\n");
#endif
cd = NEW CardDescriptor();
while(attributes.size()){
int found2 = attributes.find(";");
string attribute;
if (found2 != string::npos){
attribute = attributes.substr(0,found2);
attributes = attributes.substr(found2+1);
}else{
attribute = attributes;
attributes = "";
}
int minus = 0;
if (attribute[0] == '-'){
#ifdef WIN32
OutputDebugString("MINUS\n");
#endif
minus = 1;
nbminuses++;
}
#ifdef WIN32
OutputDebugString(attribute.c_str());
OutputDebugString("\n");
#endif
//Attacker
if (attribute.find("attacking") != string::npos){
if (minus){
cd->attacker = -1;
}else{
cd->attacker = 1;
}
//Blocker
}else if (attribute.find("blocking") != string::npos){
if (minus){
cd->defenser = (MTGCardInstance *)-1; //Oh yeah, that's ugly....
}else{
cd->defenser = (MTGCardInstance *)1;
}
//Tapped, untapped
}else if (attribute.find("tapped") != string::npos){
if (minus){
cd->tapped = -1;
}else{
cd->tapped = 1;
}
}else{
int attributefound = 0;
//Colors
for (int cid = 0; cid < MTG_NB_COLORS; cid++){
if (attribute.find(MTGColorStrings[cid]) != string::npos){
attributefound = 1;
if (minus){
cd->colors[cid] = -1;
}else{
cd->colors[cid] = 1;
}
}
}
if (!attributefound){
//Abilities
for (int j = 0; j < NB_BASIC_ABILITIES; j++){
if (attribute.find(MTGBasicAbilities[j]) != string::npos){
attributefound = 1;
if (minus){
cd->basicAbilities[j] = -1;
}else{
cd->basicAbilities[j] = 1;
}
}
}
}
}
}
if (nbminuses < 2){
#ifdef WIN32
OutputDebugString("Switching to OR\n");
#endif
cd->mode = CD_OR;
}
typeName = typeName.substr(0,found);
}
//X targets allowed ? //X targets allowed ?
if (typeName.at(typeName.length()-1) == 's'){ if (typeName.at(typeName.length()-1) == 's'){
typeName = typeName.substr(0,typeName.length()-1); typeName = typeName.substr(0,typeName.length()-1);
maxtargets = -1; maxtargets = -1;
} }
if (cd){
if (!tc){
if (typeName.compare("*")!=0) cd->setSubtype(typeName);
tc = NEW DescriptorTargetChooser(cd,zones,nbzones,card,maxtargets);
#ifdef WIN32
OutputDebugString("Advanced Attributes 2 \n");
#endif
}else{
return NULL;
}
}else{
if (!tc){ if (!tc){
if (typeName.compare("*")==0){ if (typeName.compare("*")==0){
return NEW TargetZoneChooser(zones, nbzones,card, maxtargets); return NEW TargetZoneChooser(zones, nbzones,card, maxtargets);
@@ -100,10 +208,11 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
tc = NEW TypeTargetChooser(typeName.c_str(), zones, nbzones, card,maxtargets); tc = NEW TypeTargetChooser(typeName.c_str(), zones, nbzones, card,maxtargets);
} }
}else{ }else{
tc->addType(typeName.c_str()); ((TypeTargetChooser *)tc)->addType(typeName.c_str());
tc->maxtargets = maxtargets; tc->maxtargets = maxtargets;
} }
} }
}
return tc; return tc;
} }
} }
@@ -275,8 +384,41 @@ int TypeTargetChooser::canTarget(Targetable * target ){
return 0; return 0;
} }
/** /**
Choose a creature anywhere. This is actually not enough as a zone should be selected A Target Chooser associated to a Card Descriptor object, for fine tuning of targets description
**/
DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){
GameObserver * game = GameObserver::GetInstance();
MTGGameZone * default_zones[] = {game->players[0]->game->inPlay, game->players[1]->game->inPlay};
init(default_zones,2);
cd = _cd;
}
DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZone ** _zones, int nbzones, MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){
GameObserver * game = GameObserver::GetInstance();
if (nbzones == 0){
MTGGameZone * default_zones[] = {game->players[0]->game->inPlay, game->players[1]->game->inPlay};
init(default_zones,2);
}else{
init(_zones, nbzones);
}
cd = _cd;
}
int DescriptorTargetChooser::canTarget(Targetable * target){
if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target;
if (!TargetZoneChooser::canTarget(card)) return 0;
if (cd->match(card)) return 1;
}
return 0;
}
/**
Choose a creature
**/ **/
CreatureTargetChooser::CreatureTargetChooser( MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){ CreatureTargetChooser::CreatureTargetChooser( MTGCardInstance * card, int _maxtargets):TargetZoneChooser(card, _maxtargets){
+17 -3
View File
@@ -41,11 +41,14 @@ Interruptible * TestSuite::getActionByMTGId(int mtgid){
return NULL; return NULL;
} }
int TestSuiteAI::Act(){ int TestSuiteAI::Act(float dt){
GameObserver * g = GameObserver::GetInstance(); GameObserver * g = GameObserver::GetInstance();
g->gameOver = NULL; // Prevent draw rule from losing the game g->gameOver = NULL; // Prevent draw rule from losing the game
timer++; timer+= dt;
if (timer < 20) return 1; char buf[4096];
sprintf(buf, "%f\n", timer);
OutputDebugString (buf);
if (timer < suite->timerLimit) return 1;
timer = 0; timer = 0;
string action = suite->getNextAction(); string action = suite->getNextAction();
if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this){ if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this){
@@ -193,9 +196,19 @@ MTGPlayerCards * TestSuite::buildDeck(MTGAllCards * collection, int playerId){
} }
void TestSuite::initGame(){ void TestSuite::initGame(){
//The first test runs slowly, the other ones run faster.
//This way a human can see what happens when testing a specific file,
// or go faster when it comes to the whole test suite.
//Warning, putting this value too low (< 0.25) will give unexpected results
if (!timerLimit){
timerLimit = 0.3;
}else{
timerLimit = 0.26;
}
//Put the GameObserver in the initial state //Put the GameObserver in the initial state
GameObserver * g = GameObserver::GetInstance(); GameObserver * g = GameObserver::GetInstance();
OutputDebugString("Init Game\n"); OutputDebugString("Init Game\n");
g->phaseRing->goToPhase(initState.phase, g->players[0]);
g->currentGamePhase = initState.phase; g->currentGamePhase = initState.phase;
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
Player * p = g->players[i]; Player * p = g->players[i];
@@ -296,6 +309,7 @@ int TestSuite::assertGame(){
} }
TestSuite::TestSuite(const char * filename){ TestSuite::TestSuite(const char * filename){
timerLimit = 0;
std::ifstream file(filename); std::ifstream file(filename);
std::string s; std::string s;
nbfiles = 0; nbfiles = 0;
+8
View File
@@ -412,6 +412,10 @@
RelativePath=".\src\OptionItem.cpp" RelativePath=".\src\OptionItem.cpp"
> >
</File> </File>
<File
RelativePath=".\src\PhaseRing.cpp"
>
</File>
<File <File
RelativePath=".\src\Player.cpp" RelativePath=".\src\Player.cpp"
> >
@@ -685,6 +689,10 @@
RelativePath=".\include\OptionItem.h" RelativePath=".\include\OptionItem.h"
> >
</File> </File>
<File
RelativePath=".\include\PhaseRing.h"
>
</File>
<File <File
RelativePath=".\include\Player.h" RelativePath=".\include\Player.h"
> >
Binary file not shown.
@@ -51,7 +51,7 @@ def fetchImage(id, filename):
os.mkdir(setinfo['abbrev']) os.mkdir(setinfo['abbrev'])
else: else:
assert os.path.isdir(setinfo['abbrev']) assert os.path.isdir(setinfo['abbrev'])
f = open(setinfo['abbrev'] + "/" + filename, 'w') f = open(setinfo['abbrev'] + "/" + filename, 'wb')
f.write(pic.read()) f.write(pic.read())
f.close() f.close()
Binary file not shown.