Pulled down update for SDL2

This commit is contained in:
xawotihs
2016-05-29 18:01:51 +02:00
80 changed files with 2006 additions and 1195 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ environment:
# scripts that run after cloning repository # scripts that run after cloning repository
install: install:
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py') - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py')
- "C:/Python27/python.exe C:/get-pip.py" - "C:/Python27/python.exe C:/get-pip.py"
- "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"
@@ -13,6 +13,8 @@ auto=flashbackrule
auto=retracerule auto=retracerule
auto=suspendrule auto=suspendrule
auto=morphrule auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule auto=attackrule
auto=blockrule auto=blockrule
auto=combattriggerrule auto=combattriggerrule
+2
View File
@@ -12,6 +12,8 @@ auto=flashbackrule
auto=retracerule auto=retracerule
auto=suspendrule auto=suspendrule
auto=morphrule auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule auto=attackrule
auto=blockrule auto=blockrule
auto=combattriggerrule auto=combattriggerrule
+2 -1
View File
@@ -16,7 +16,8 @@ auto=flashbackrule
auto=retracerule auto=retracerule
auto=suspendrule auto=suspendrule
auto=morphrule auto=morphrule
auto=playfromgraveyardrule auto=payzerorule
auto=overloadrule
auto=attackrule auto=attackrule
auto=blockrule auto=blockrule
auto=combattriggerrule auto=combattriggerrule
@@ -69,6 +69,16 @@ mana={B}
type=Sorcery type=Sorcery
[/card] [/card]
[card] [card]
name=Cemetery Puca
text=Whenever a creature is put into a graveyard from the battlefield, you may pay {1}. If you do, Cemetery Puca becomes a copy of that creature and gains this ability.
auto=@movedto(creature|graveyard) from(battlefield):all(trigger[from]) pay[[{1}]] copy
mana={1}{UB}{UB}
type=Creature
subtype=Shapeshifter
power=1
toughness=2
[/card]
[card]
name=Cinder Seer name=Cinder Seer
auto={2}{r}{t}:target(creature,Player) damage:type:*[red]:myhand auto={2}{r}{t}:target(creature,Player) damage:type:*[red]:myhand
text={2}{R}, {T}: Reveal any number of red cards in your hand. Cinder Seer deals X damage to target creature or player, where X is the number of cards revealed this way. text={2}{R}, {T}: Reveal any number of red cards in your hand. Cinder Seer deals X damage to target creature or player, where X is the number of cards revealed this way.
@@ -89,6 +99,16 @@ mana={1}{B}{G}
type=Instant type=Instant
[/card] [/card]
[card] [card]
name=Cryptoplasm
auto=@each my upkeep:may copy target(other creature|battlefield)
text=At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
mana={1}{U}{U}
type=Creature
subtype=Shapeshifter
power=2
toughness=2
[/card]
[card]
name=Dark Withering name=Dark Withering
abilities=madness abilities=madness
autoexile=restriction{discarded} pay({B}) name(pay B to cast) activate name(pay B to cast) castcard(normal)?name(put in graveyard) moveto(ownergraveyard) autoexile=restriction{discarded} pay({B}) name(pay B to cast) activate name(pay B to cast) castcard(normal)?name(put in graveyard) moveto(ownergraveyard)
@@ -99,6 +119,16 @@ mana={4}{B}{B}
type=Instant type=Instant
[/card] [/card]
[card] [card]
name=Dimir Doppelganger
auto={1}{U}{B}:target(creature|graveyard) moveto(exile) and!(copy)!
text={1}{U}{B}: Exile target creature card from a graveyard. Dimir Doppelganger becomes a copy of that card and gains this ability.
mana={1}{U}{B}
type=Creature
subtype=Shapeshifter
power=0
toughness=2
[/card]
[card]
name=Distortion Strike name=Distortion Strike
target=creature target=creature
auto=1/0 auto=1/0
@@ -462,6 +492,23 @@ 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.) 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]
[card] [card]
name=Thespian's Stage
auto={T}:Add{1}
auto={2}{T}:copy target(land|battlefield)
text={T}: Add {1} to your mana pool. -- {2}, {T}: Thespian's Stage becomes a copy of target land and gains this ability.
type=Land
[/card]
[card]
name=Unstable Shapeshifter
auto=@movedto(other creature|battlefield):all(trigger[from]) copy
text=Whenever another creature enters the battlefield, Unstable Shapeshifter becomes a copy of that creature and gains this ability.
mana={3}{U}
type=Creature
subtype=Shapeshifter
power=0
toughness=1
[/card]
[card]
name=Virulent Swipe name=Virulent Swipe
target=creature target=creature
auto=2/0 auto=2/0
File diff suppressed because it is too large Load Diff
@@ -224,12 +224,6 @@ mana={1}{U}
type=Instant type=Instant
[/card] [/card]
[card] [card]
name=Aluren
text=Any player may play creature cards with converted mana cost 3 or less without paying their mana cost and as though they had flash.
mana={2}{G}{G}
type=Enchantment
[/card]
[card]
name=Amber Prison name=Amber Prison
text=You may choose not to untap Amber Prison during your untap step. -- {4}, {T}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped. text=You may choose not to untap Amber Prison during your untap step. -- {4}, {T}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped.
mana={4} mana={4}
@@ -1223,6 +1217,7 @@ text=Blazing Salvo deals 3 damage to target creature unless that creature's cont
mana={R} mana={R}
type=Instant type=Instant
[/card] [/card]
#blazing torch is source of damage but the equipped creature has the activated ability... weird
[card] [card]
name=Blazing Torch name=Blazing Torch
text=Equipped creature can't be blocked by Vampires or Zombies. -- Equipped creature has "{T}, Sacrifice Blazing Torch: Blazing Torch deals 2 damage to target creature or player." -- Equip {1} text=Equipped creature can't be blocked by Vampires or Zombies. -- Equipped creature has "{T}, Sacrifice Blazing Torch: Blazing Torch deals 2 damage to target creature or player." -- Equip {1}
@@ -1309,12 +1304,6 @@ type=Enchantment
text=Each noncreature, non-Equipment artifact is an Equipment with equip {X} and "Equipped creature gets +X/+0," where X is that artifact's converted mana cost. text=Each noncreature, non-Equipment artifact is an Equipment with equip {X} and "Equipped creature gets +X/+0," where X is that artifact's converted mana cost.
[/card] [/card]
[card] [card]
name=Blustersquall
text=Tap target creature you don't control. -- Overload {3}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={U}
type=Instant
[/card]
[card]
name=Boar Umbra name=Boar Umbra
mana={2}{G} mana={2}{G}
type=Enchantment type=Enchantment
@@ -2385,12 +2374,6 @@ type=Enchantment
text=Whenever any spell is played, counter that spell if each player, other than the caster and his or her teammates, agrees to choose and discard a card. Those players must discard those cards after agreeing. Checks and Balances may be played only in a game with three or more players. text=Whenever any spell is played, counter that spell if each player, other than the caster and his or her teammates, agrees to choose and discard a card. Those players must discard those cards after agreeing. Checks and Balances may be played only in a game with three or more players.
[/card] [/card]
[card] [card]
name=Chemister's Trick
text=Target creature you don't control gets -2/-0 until end of turn and attacks this turn if able. -- Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={U}{R}
type=Instant
[/card]
[card]
name=Chicken Egg name=Chicken Egg
mana={1}{R} mana={1}{R}
type=Summon — Egg type=Summon — Egg
@@ -3000,12 +2983,6 @@ mana={U}{U}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Counterflux
text=Counterflux can't be countered by spells or abilities. -- Counter target spell you don't control. -- Overload {1}{U}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={U}{U}{R}
type=Instant
[/card]
[card]
name=Countryside Crusher name=Countryside Crusher
text=At the beginning of your upkeep, reveal the top card of your library. If it's a land card, put it into your graveyard and repeat this process. -- Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher. text=At the beginning of your upkeep, reveal the top card of your library. If it's a land card, put it into your graveyard and repeat this process. -- Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher.
mana={1}{R}{R} mana={1}{R}{R}
@@ -3305,12 +3282,6 @@ mana={2}{G}{G}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Cyclonic Rift
text=Return target nonland permanent you don't control to its owner's hand. -- Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={1}{U}
type=Instant
[/card]
[card]
name=Cyclopean Giant name=Cyclopean Giant
text=When Cyclopean Giant is put into a graveyard from the battlefield, target land becomes a Swamp. Exile Cyclopean Giant. text=When Cyclopean Giant is put into a graveyard from the battlefield, target land becomes a Swamp. Exile Cyclopean Giant.
mana={2}{B}{B} mana={2}{B}{B}
@@ -3954,6 +3925,7 @@ subtype=Djinn
power=3 power=3
toughness=5 toughness=5
[/card] [/card]
#needs alias borderline
[card] [card]
name=Djinn of Wishes name=Djinn of Wishes
text=Flying -- Djinn of Wishes enters the battlefield with three wish counters on it. -- {2}{U}{U}, Remove a wish counter from Djinn of Wishes: Reveal the top card of your library. You may play that card without paying its mana cost. If you don't, exile it. text=Flying -- Djinn of Wishes enters the battlefield with three wish counters on it. -- {2}{U}{U}, Remove a wish counter from Djinn of Wishes: Reveal the top card of your library. You may play that card without paying its mana cost. If you don't, exile it.
@@ -4075,12 +4047,6 @@ mana={3}{B} // {2}{G}
type=Sorcery // Sorcery type=Sorcery // Sorcery
[/card] [/card]
[card] [card]
name=Downsize
text=Target creature you don't control gets -4/-0 until end of turn. -- Overload {2}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={U}
type=Instant
[/card]
[card]
name=Draco name=Draco
text=Domain - Draco costs {2} less to cast for each basic land type among lands you control. -- Flying -- Domain - At the beginning of your upkeep, sacrifice Draco unless you pay {1}0}. This cost is reduced by {2} for each basic land type among lands you control. text=Domain - Draco costs {2} less to cast for each basic land type among lands you control. -- Flying -- Domain - At the beginning of your upkeep, sacrifice Draco unless you pay {1}0}. This cost is reduced by {2} for each basic land type among lands you control.
mana={16} mana={16}
@@ -4282,12 +4248,6 @@ power=1
toughness=1 toughness=1
[/card] [/card]
[card] [card]
name=Dynacharge
text=Target creature you control gets +2/+0 until end of turn. -- Overload {2}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={R}
type=Instant
[/card]
[card]
name=Echo Chamber name=Echo Chamber
text={4}, {T}: An opponent chooses target creature he or she controls. Put a token that's a copy of that creature onto the battlefield. That token gains haste until end of turn. Exile the token at the beginning of the next end step. Activate this ability only any time you could cast a sorcery. text={4}, {T}: An opponent chooses target creature he or she controls. Put a token that's a copy of that creature onto the battlefield. That token gains haste until end of turn. Exile the token at the beginning of the next end step. Activate this ability only any time you could cast a sorcery.
mana={4} mana={4}
@@ -4338,12 +4298,6 @@ type=Land
text={T}: Add {1} to your mana pool. {T}: Add {2} to your mana pool. Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi. text={T}: Add {1} to your mana pool. {T}: Add {2} to your mana pool. Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi.
[/card] [/card]
[card] [card]
name=Electrickery
text=Electrickery deals 1 damage to target creature you don't control. -- Overload {1}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={R}
type=Instant
[/card]
[card]
name=Electropotence name=Electropotence
text=Whenever a creature enters the battlefield under your control, you may pay {2}{R}. If you do, that creature deals damage equal to its power to target creature or player. text=Whenever a creature enters the battlefield under your control, you may pay {2}{R}. If you do, that creature deals damage equal to its power to target creature or player.
mana={2}{R} mana={2}{R}
@@ -4768,11 +4722,6 @@ power=1
toughness=2 toughness=2
[/card] [/card]
[card] [card]
name=Exotic Orchard
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
type=Land
[/card]
[card]
name=Experiment Kraj name=Experiment Kraj
text=Experiment Kraj has all activated abilities of each other creature with a +1/+1 counter on it. -- {T}: Put a +1/+1 counter on target creature. text=Experiment Kraj has all activated abilities of each other creature with a +1/+1 counter on it. -- {T}: Put a +1/+1 counter on target creature.
mana={2}{G}{G}{U}{U} mana={2}{G}{G}{U}{U}
@@ -4991,12 +4940,6 @@ type=Enchantment
subtype=Aura subtype=Aura
[/card] [/card]
[card] [card]
name=Fellwar Stone
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
mana={2}
type=Artifact
[/card]
[card]
name=Feral Contest name=Feral Contest
text=Put a +1/+1 counter on target creature you control. Another target creature blocks it this turn if able. text=Put a +1/+1 counter on target creature you control. Another target creature blocks it this turn if able.
mana={3}{G} mana={3}{G}
@@ -6866,15 +6809,6 @@ power=1
toughness=1 toughness=1
[/card] [/card]
[card] [card]
name=Harvester Druid
text={T}: Add to your mana pool one mana of any color that a land you control could produce.
mana={1}{G}
type=Creature
subtype=Human Druid
power=1
toughness=1
[/card]
[card]
name=Hatred name=Hatred
text=As an additional cost to cast Hatred, pay X life. -- Target creature gets +X/+0 until end of turn. text=As an additional cost to cast Hatred, pay X life. -- Target creature gets +X/+0 until end of turn.
mana={3}{B}{B} mana={3}{B}{B}
@@ -8742,6 +8676,7 @@ text=Look at the top five cards of your library. You may reveal any number of cr
mana={2}{G} mana={2}{G}
type=Sorcery type=Sorcery
[/card] [/card]
#needs alias borderline
[card] [card]
name=Leaf-Crowned Elder name=Leaf-Crowned Elder
text=Kinship - At the beginning of your upkeep, you may look at the top card of your library. If it shares a creature type with Leaf-Crowned Elder, you may reveal it. If you do, you may play that card without paying its mana cost. text=Kinship - At the beginning of your upkeep, you may look at the top card of your library. If it shares a creature type with Leaf-Crowned Elder, you may reveal it. If you do, you may play that card without paying its mana cost.
@@ -9863,6 +9798,7 @@ text=Each opponent reveals cards from the top of his or her library until he or
mana={X}{U}{B} mana={X}{U}{B}
type=Sorcery type=Sorcery
[/card] [/card]
#needs alias
[card] [card]
name=Mind's Desire name=Mind's Desire
text=Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost. (If it has X in its mana cost, X is 0.) -- Storm (When you cast this spell, copy it for each spell cast before it this turn.) text=Shuffle your library. Then exile the top card of your library. Until end of turn, you may play that card without paying its mana cost. (If it has X in its mana cost, X is 0.) -- Storm (When you cast this spell, copy it for each spell cast before it this turn.)
@@ -10097,18 +10033,6 @@ mana={1}{U}{U}
type=Sorcery type=Sorcery
[/card] [/card]
[card] [card]
name=Mizzium Mortars
text=Mizzium Mortars deals 4 damage to target creature you don't control. -- Overload {3}{R}{R}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={1}{R}
type=Sorcery
[/card]
[card]
name=Mizzium Skin
text=Target creature you control gets +0/+1 and gains hexproof until end of turn. -- Overload {1}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={U}
type=Instant
[/card]
[card]
name=Mizzium Transreliquat name=Mizzium Transreliquat
text={3}: Mizzium Transreliquat becomes a copy of target artifact until end of turn. -- {1}{U}{R}: Mizzium Transreliquat becomes a copy of target artifact and gains this ability. text={3}: Mizzium Transreliquat becomes a copy of target artifact until end of turn. -- {1}{U}{R}: Mizzium Transreliquat becomes a copy of target artifact and gains this ability.
mana={3} mana={3}
@@ -11075,6 +10999,7 @@ text=Look at the top three cards of your library, then put them back in any orde
mana={1}{U} mana={1}{U}
type=Sorcery type=Sorcery
[/card] [/card]
#needs alias
[card] [card]
name=Omen Machine name=Omen Machine
mana={6} mana={6}
@@ -12498,6 +12423,7 @@ text=Pyrotechnics deals 4 damage divided as you choose among any number of targe
mana={4}{R} mana={4}{R}
type=Sorcery type=Sorcery
[/card] [/card]
#anyzone is basic for now and used for cdaactive
[card] [card]
name=Qasali Ambusher name=Qasali Ambusher
text=Reach -- If a creature is attacking you and you control a Forest and a Plains, you may cast Qasali Ambusher without paying its mana cost and as though it had flash. text=Reach -- If a creature is attacking you and you control a Forest and a Plains, you may cast Qasali Ambusher without paying its mana cost and as though it had flash.
@@ -12615,15 +12541,6 @@ mana={1}{U}
type=Sorcery type=Sorcery
[/card] [/card]
[card] [card]
name=Quirion Explorer
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
mana={1}{G}
type=Creature
subtype=Elf Druid Scout
power=1
toughness=1
[/card]
[card]
name=R&D's Secret Lair name=R&D's Secret Lair
mana= mana=
type=Legendary Land type=Legendary Land
@@ -12812,6 +12729,7 @@ mana={2}{U}
type=Enchantment type=Enchantment
subtype=Aura subtype=Aura
[/card] [/card]
#needs suspend ability not suspend activated ability
[card] [card]
name=Reality Strobe name=Reality Strobe
text=Return target permanent to its owner's hand. Exile Reality Strobe with three time counters on it. -- Suspend 3 - {2}{U} (Rather than cast this card from your hand, you may pay {2}{U} and exile it with three time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.) text=Return target permanent to its owner's hand. Exile Reality Strobe with three time counters on it. -- Suspend 3 - {2}{U} (Rather than cast this card from your hand, you may pay {2}{U} and exile it with three time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.)
@@ -12923,11 +12841,6 @@ mana={4}
type=Artifact type=Artifact
[/card] [/card]
[card] [card]
name=Reflecting Pool
text={T}: Add to your mana pool one mana of any type that a land you control could produce.
type=Land
[/card]
[card]
name=Refraction Trap name=Refraction Trap
text=If an opponent cast a red instant or sorcery spell this turn, you may pay {W} rather than pay Refraction Trap's mana cost. -- Prevent the next 3 damage that a source of your choice would deal to you and/or permanents you control this turn. If damage is prevented this way, Refraction Trap deals that much damage to target creature or player. text=If an opponent cast a red instant or sorcery spell this turn, you may pay {W} rather than pay Refraction Trap's mana cost. -- Prevent the next 3 damage that a source of your choice would deal to you and/or permanents you control this turn. If damage is prevented this way, Refraction Trap deals that much damage to target creature or player.
mana={3}{W} mana={3}{W}
@@ -13490,6 +13403,7 @@ subtype=Elemental
power=3 power=3
toughness=2 toughness=2
[/card] [/card]
#seems possible
[card] [card]
name=Roiling Horror name=Roiling Horror
text=Roiling Horror's power and toughness are each equal to your life total minus the life total of an opponent with the most life. -- Suspend X - {X}{B}{B}{B}. X can't be 0. (Rather than cast this card from your hand, you may pay {X}{B}{B}{B} and exile it with X time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost. It has haste.) -- Whenever a time counter is removed from Roiling Horror while it's exiled, target player loses 1 life and you gain 1 life. text=Roiling Horror's power and toughness are each equal to your life total minus the life total of an opponent with the most life. -- Suspend X - {X}{B}{B}{B}. X can't be 0. (Rather than cast this card from your hand, you may pay {X}{B}{B}{B} and exile it with X time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost. It has haste.) -- Whenever a time counter is removed from Roiling Horror while it's exiled, target player loses 1 life and you gain 1 life.
@@ -13939,6 +13853,7 @@ subtype=Giant Warrior
power=4 power=4
toughness=5 toughness=5
[/card] [/card]
#modded ingest
[card] [card]
name=Scalpelexis name=Scalpelexis
text=Flying (This creature can't be blocked except by creatures with flying or reach.) -- Whenever Scalpelexis deals combat damage to a player, that player exiles the top four cards of his or her library. If two or more of those cards have the same name, repeat this process. text=Flying (This creature can't be blocked except by creatures with flying or reach.) -- Whenever Scalpelexis deals combat damage to a player, that player exiles the top four cards of his or her library. If two or more of those cards have the same name, repeat this process.
@@ -14093,6 +14008,7 @@ text=Look at the top X cards of target opponent's library. Exile one of those ca
mana={X}{U}{B} mana={X}{U}{B}
type=Sorcery type=Sorcery
[/card] [/card]
#moverandom?
[card] [card]
name=Search for Survivors name=Search for Survivors
text=Reorder your graveyard at random. An opponent chooses a card at random in your graveyard. If it's a creature card, put it onto the battlefield. Otherwise, exile it. text=Reorder your graveyard at random. An opponent chooses a card at random in your graveyard. If it's a creature card, put it onto the battlefield. Otherwise, exile it.
@@ -14480,6 +14396,7 @@ mana={3}{U}
type=Instant type=Instant
subtype=Arcane subtype=Arcane
[/card] [/card]
#phaseactionmulti?
[card] [card]
name=Shifty Doppelganger name=Shifty Doppelganger
text={3}{U}, Exile Shifty Doppelganger: You may put a creature card from your hand onto the battlefield. If you do, that creature gains haste until end of turn. At the beginning of the next end step, sacrifice that creature. If you do, return Shifty Doppelganger to the battlefield. text={3}{U}, Exile Shifty Doppelganger: You may put a creature card from your hand onto the battlefield. If you do, that creature gains haste until end of turn. At the beginning of the next end step, sacrifice that creature. If you do, return Shifty Doppelganger to the battlefield.
@@ -14944,6 +14861,7 @@ type=Enchantment
subtype=Aura subtype=Aura
text=Enchant creature Enchanted creature gets +1/+1 and has "Whenever this creature deals damage to an opponent, you may draw a card." Totem armor (If enchanted creature would be destroyed, instead remove all damage from it and destroy this Aura.) text=Enchant creature Enchanted creature gets +1/+1 and has "Whenever this creature deals damage to an opponent, you may draw a card." Totem armor (If enchanted creature would be destroyed, instead remove all damage from it and destroy this Aura.)
[/card] [/card]
#manaflashback rule
[card] [card]
name=Snapcaster Mage name=Snapcaster Mage
abilities=flash abilities=flash
@@ -15565,6 +15483,7 @@ subtype=Monger
power=3 power=3
toughness=3 toughness=3
[/card] [/card]
#needs alias
[card] [card]
name=Squandered Resources name=Squandered Resources
text=Sacrifice a land: Add to your mana pool one mana of any type the sacrificed land could produce. text=Sacrifice a land: Add to your mana pool one mana of any type the sacrificed land could produce.
@@ -15906,12 +15825,6 @@ type=Enchantment
subtype=Aura subtype=Aura
[/card] [/card]
[card] [card]
name=Street Spasm
text=Street Spasm deals X damage to target creature without flying you don't control. -- Overload {X}{X}{R}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={X}{R}
type=Instant
[/card]
[card]
name=Strength of the Tajuru name=Strength of the Tajuru
text=Multikicker {1} (You may pay an additional {1} any number of times as you cast this spell.) -- Choose target creature, then choose another target creature for each time Strength of the Tajuru was kicked. Put X +1/+1 counters on each of them. text=Multikicker {1} (You may pay an additional {1} any number of times as you cast this spell.) -- Choose target creature, then choose another target creature for each time Strength of the Tajuru was kicked. Put X +1/+1 counters on each of them.
mana={X}{G}{G} mana={X}{G}{G}
@@ -16209,27 +16122,12 @@ power=2
toughness=2 toughness=2
[/card] [/card]
[card] [card]
name=Sylvok Explorer
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
mana={1}{G}
type=Creature
subtype=Human Druid
power=1
toughness=1
[/card]
[card]
name=Symbol Status name=Symbol Status
mana={2}{G}{G} mana={2}{G}{G}
type=Sorcery type=Sorcery
text=Put a 1/1 colorless Expansion-Symbol creature token into play for each different expansion symbol among permanents you control. text=Put a 1/1 colorless Expansion-Symbol creature token into play for each different expansion symbol among permanents you control.
[/card] [/card]
[card] [card]
name=Syncopate
text=Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
mana={X}{U}
type=Instant
[/card]
[card]
name=Synod Artificer name=Synod Artificer
text={X}, {T}: Tap X target noncreature artifacts. -- {X}, {T}: Untap X target noncreature artifacts. text={X}, {T}: Tap X target noncreature artifacts. -- {X}, {T}: Untap X target noncreature artifacts.
mana={2}{U} mana={2}{U}
@@ -16410,12 +16308,6 @@ mana={U}
type=Enchantment type=Enchantment
[/card] [/card]
[card] [card]
name=Teleportal
text=Target creature you control gets +1/+0 until end of turn and is unblockable this turn. -- Overload {3}{U}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={U}{R}
type=Sorcery
[/card]
[card]
name=Telling Time name=Telling Time
text=Look at the top three cards of your library. Put one of those cards into your hand, one on top of your library, and one on the bottom of your library. text=Look at the top three cards of your library. Put one of those cards into your hand, one on top of your library, and one on the bottom of your library.
mana={1}{U} mana={1}{U}
@@ -16490,15 +16382,6 @@ type=Planeswalker
subtype=Tezzeret subtype=Tezzeret
[/card] [/card]
[card] [card]
name=Thada Adel, Acquisitor
text=Islandwalk -- Whenever Thada Adel, Acquisitor deals combat damage to a player, search that player's library for an artifact card and exile it. Then that player shuffles his or her library. Until end of turn, you may play that card.
mana={1}{U}{U}
type=Legendary Creature
subtype=Merfolk Rogue
power=2
toughness=2
[/card]
[card]
name=Thalakos Dreamsower name=Thalakos Dreamsower
text=Shadow (This creature can block or be blocked by only creatures with shadow.) -- You may choose not to untap Thalakos Dreamsower during your untap step. -- Whenever Thalakos Dreamsower deals damage to an opponent, tap target creature. That creature doesn't untap during its controller's untap step for as long as Thalakos Dreamsower remains tapped. text=Shadow (This creature can block or be blocked by only creatures with shadow.) -- You may choose not to untap Thalakos Dreamsower during your untap step. -- Whenever Thalakos Dreamsower deals damage to an opponent, tap target creature. That creature doesn't untap during its controller's untap step for as long as Thalakos Dreamsower remains tapped.
mana={2}{U} mana={2}{U}
@@ -17284,17 +17167,6 @@ mana={2}{U}
type=Sorcery type=Sorcery
[/card] [/card]
[card] [card]
name=Undead Alchemist
auto=@combatdamaged(player) from(zombie|mybattlefield):deplete:thatmuch opponent && life:thatmuch opponent
auto=@movedTo(creature|opponentgraveyard) from(opponentlibrary):token(Zombie,Creature Zombie,2/2,black)
text=If a Zombie you control would deal combat damage to a player, instead that player puts that many cards from the top of his or her library into his or her graveyard. -- Whenever a creature card is put into an opponent's graveyard from his or her library, exile that card and put a 2/2 black Zombie creature token onto the battlefield.
mana={3}{U}
type=Creature
subtype=Zombie
power=4
toughness=2
[/card]
[card]
name=Undercity Informer name=Undercity Informer
text={1}, Sacrifice a creature: Target player reveals cards from the top of his or her library until he or she reveals a land card, then puts those cards into his or her graveyard. text={1}, Sacrifice a creature: Target player reveals cards from the top of his or her library until he or she reveals a land card, then puts those cards into his or her graveyard.
mana={2}{B} mana={2}{B}
@@ -17456,12 +17328,6 @@ power=3
toughness=3 toughness=3
[/card] [/card]
[card] [card]
name=Vandalblast
text=Destroy target artifact you don't control. -- Overload {4}{R} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.")
mana={R}
type=Sorcery
[/card]
[card]
name=Vanguard's Shield name=Vanguard's Shield
text=Equipped creature gets +0/+3 and can block an additional creature. -- Equip {3} ({3}: Attach to target creature you control. Equip only as a sorcery.) text=Equipped creature gets +0/+3 and can block an additional creature. -- Equip {3} ({3}: Attach to target creature you control. Equip only as a sorcery.)
mana={2} mana={2}
+114 -4
View File
@@ -668,6 +668,116 @@ private:
{ {
intValue = target->controller()->handsize; intValue = target->controller()->handsize;
} }
else if (s == "olandg")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller()->opponent() && amp->output->hasColor(1))
intValue = 1;
}//end
}
else if (s == "olandu")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller()->opponent() && amp->output->hasColor(2))
intValue = 1;
}//end
}
else if (s == "olandr")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller()->opponent() && amp->output->hasColor(3))
intValue = 1;
}//end
}
else if (s == "olandb")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller()->opponent() && amp->output->hasColor(4))
intValue = 1;
}//end
}
else if (s == "olandw")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller()->opponent() && amp->output->hasColor(5))
intValue = 1;
}//end
}
else if (s == "plandg")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller() && amp->output->hasColor(1))
intValue = 1;
}//end
}
else if (s == "plandu")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller() && amp->output->hasColor(2))
intValue = 1;
}//end
}
else if (s == "plandr")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller() && amp->output->hasColor(3))
intValue = 1;
}//end
}
else if (s == "plandb")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller() && amp->output->hasColor(4))
intValue = 1;
}//end
}
else if (s == "plandw")
{
intValue = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
{//start
MTGAbility * a = ((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i]);
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
if (amp && amp->source->isLand() && amp->source->controller() == target->controller() && amp->output->hasColor(5))
intValue = 1;
}//end
}
else if (s == "controllerturn")//intvalue = 1 if its your turn this(variable{controllerturn}) else if (s == "controllerturn")//intvalue = 1 if its your turn this(variable{controllerturn})
{ {
intValue = 0; intValue = 0;
@@ -850,12 +960,12 @@ private:
else if (s == "morethanfourcards") else if (s == "morethanfourcards")
{ {
if(card->playerTarget) if(card->playerTarget)
{//blackvise {//blackvise
intValue = 0; intValue = 0;
if ((card->playerTarget->game->hand->nb_cards - 4)>0) if ((card->playerTarget->game->hand->nb_cards - 4)>0)
intValue = (card->playerTarget->game->hand->nb_cards - 4); intValue = (card->playerTarget->game->hand->nb_cards - 4);
} }
else else
{//viseling {//viseling
intValue = 0; intValue = 0;
if ((card->controller()->opponent()->game->hand->nb_cards - 4)>0) if ((card->controller()->opponent()->game->hand->nb_cards - 4)>0)
@@ -1196,7 +1306,7 @@ public:
class TrcardDrawn: public Trigger class TrcardDrawn: public Trigger
{ {
public: public:
bool thiscontroller, thisopponent; bool thiscontroller, thisopponent;
TrcardDrawn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false, bool thiscontroller = false, bool thisopponent = false) : TrcardDrawn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false, bool thiscontroller = false, bool thisopponent = false) :
Trigger(observer, id, source,once, tc),thiscontroller(thiscontroller),thisopponent(thisopponent) Trigger(observer, id, source,once, tc),thiscontroller(thiscontroller),thisopponent(thisopponent)
{ {
@@ -4611,7 +4721,7 @@ public:
vector<int> dontremove; vector<int> dontremove;
bool addNewColors; bool addNewColors;
bool remove; bool remove;
bool removeCreatureSubtypes; bool removeCreatureSubtypes;
bool removeTypes; bool removeTypes;
string menu; string menu;
+25 -25
View File
@@ -21,18 +21,18 @@ private:
string mText; string mText;
float mX; float mX;
float mY; float mY;
float mTitleResetWidth; float mTitleResetWidth;
string mDescription; string mDescription;
static float mYOffset; static float mYOffset;
float mScrollerOffset; float mScrollerOffset;
DeckMetaData *mMetaData; DeckMetaData *mMetaData;
string mImageFilename; string mImageFilename;
void checkUserClick(); void checkUserClick();
public: public:
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL); DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
~DeckMenuItem(); ~DeckMenuItem();
virtual void Relocate(float x, float y); virtual void Relocate(float x, float y);
@@ -44,39 +44,39 @@ public:
virtual bool ButtonPressed(); virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
virtual bool getTopLeft(float& top, float& left) virtual bool getTopLeft(float& top, float& left)
{ {
top = mY + mYOffset; top = mY + mYOffset;
left = mX; left = mX;
return true; return true;
} }
// Accessors // Accessors
string getImageFilename() const { return mImageFilename; }; string getImageFilename() const { return mImageFilename; };
float getY() const { return mY; }; float getY() const { return mY; };
float getX() const { return mX; }; float getX() const { return mX; };
string getDescription() const { return mDescription; }; string getDescription() const { return mDescription; };
string getText() const { return mText; }; string getText() const { return mText; };
bool hasFocus() const { return mHasFocus; }; bool hasFocus() const { return mHasFocus; };
bool hasMetaData() const { return mMetaData == NULL ? false : true;}; bool hasMetaData() const { return mMetaData == NULL ? false : true;};
float getWidth() const; float getWidth() const;
string getDeckName() const; string getDeckName() const;
string getDeckStatsSummary() const string getDeckStatsSummary() const
{ {
if (mMetaData) if (mMetaData)
return mMetaData->getStatsSummary(); return mMetaData->getStatsSummary();
return ""; return "";
} }
DeckMetaData *getMetaData() const DeckMetaData *getMetaData() const
{ {
return mMetaData; return mMetaData;
} }
// Setters // Setters
void setDescription( const string& description ) { mDescription = description; } void setDescription( const string& description ) { mDescription = description; }
}; };
+6 -6
View File
@@ -29,7 +29,7 @@ protected:
GuiAvatars * avatars; GuiAvatars * avatars;
GameObserver* observer; GameObserver* observer;
MTGGamePhase* phaseHandler; MTGGamePhase* phaseHandler;
int mPlayerViewIndex; int mPlayerViewIndex;
CardSelectorBase* mCardSelector; CardSelectorBase* mCardSelector;
public: public:
@@ -48,11 +48,11 @@ public:
void Remove(); void Remove();
int receiveEvent(WEvent * e); int receiveEvent(WEvent * e);
float RightBoundary(); float RightBoundary();
int getPlayerViewIndex(){ return mPlayerViewIndex; }; int getPlayerViewIndex(){ return mPlayerViewIndex; };
Player* getRenderedPlayer(); Player* getRenderedPlayer();
Player* getRenderedPlayerOpponent(); Player* getRenderedPlayerOpponent();
CardSelectorBase* getCardSelector() { return mCardSelector; }; CardSelectorBase* getCardSelector() { return mCardSelector; };
GameObserver* getObserver(){ return observer; }; GameObserver* getObserver(){ return observer; };
}; };
#include "ActionLayer.h" #include "ActionLayer.h"
+1 -1
View File
@@ -169,7 +169,7 @@ public:
class MillExileCost : public MillCost class MillExileCost : public MillCost
{ {
public: public:
MillExileCost(TargetChooser *_tc = NULL); MillExileCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
}; };
+15 -17
View File
@@ -122,8 +122,6 @@ 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);
@@ -192,23 +190,23 @@ class GameObserver{
class NetworkGameObserver : public GameObserver class NetworkGameObserver : public GameObserver
{ {
protected: protected:
JNetwork* mpNetworkSession; JNetwork* mpNetworkSession;
bool mSynchronized; bool mSynchronized;
bool mForwardAction; bool mForwardAction;
virtual void logAction(const string& s); virtual void logAction(const string& s);
public: public:
// no serverIp means a server is being instantiated, otherwise a client // no serverIp means a server is being instantiated, otherwise a client
NetworkGameObserver(JNetwork* pNetwork, WResourceManager* output = 0, JGE* input = 0); NetworkGameObserver(JNetwork* pNetwork, WResourceManager* output = 0, JGE* input = 0);
virtual ~NetworkGameObserver(); virtual ~NetworkGameObserver();
virtual void loadPlayer(int playerId, Player* player); virtual void loadPlayer(int playerId, Player* player);
virtual void Update(float dt); virtual void Update(float dt);
void synchronize(); void synchronize();
static void loadPlayer(void*pThis, stringstream& in, stringstream& out); static void loadPlayer(void*pThis, stringstream& in, stringstream& out);
static void sendAction(void*pThis, stringstream& in, stringstream& out); static void sendAction(void*pThis, stringstream& in, stringstream& out);
static void synchronize(void*pThis, stringstream& in, stringstream& out); static void synchronize(void*pThis, stringstream& in, stringstream& out);
static void checkSynchro(void*pxThis, stringstream& in, stringstream& out); static void checkSynchro(void*pxThis, stringstream& in, stringstream& out);
static void ignoreResponse(void*, stringstream&, stringstream&){}; static void ignoreResponse(void*, stringstream&, stringstream&){};
static void disconnect(void*pxThis, stringstream& in, stringstream& out); static void disconnect(void*pxThis, stringstream& in, stringstream& out);
}; };
#endif #endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _GAME_STATE_H_ #ifndef _GAME_STATE_H_
#define _GAME_STATE_H_ #define _GAME_STATE_H_
#define FADING_SPEED 350.0f #define FADING_SPEED 350.0f
class JGE; class JGE;
+2 -2
View File
@@ -16,8 +16,8 @@
using std::string; using std::string;
#define SCALE_SELECTED 1.2f #define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f #define SCALE_NORMAL 1.0f
const int kDismissButtonId = 10000; const int kDismissButtonId = 10000;
const int kToggleDeckActionId = 10001; const int kToggleDeckActionId = 10001;
+5 -2
View File
@@ -211,8 +211,11 @@ public:
MORPH_COST = 28, MORPH_COST = 28,
SUSPEND_COST = 29, SUSPEND_COST = 29,
COUNTERS = 30, COUNTERS = 30,
PUT_INTO_PLAY_WITH_KICKER = 31, PUT_INTO_PLAY_WITH_KICKER = 31,
STANDARD_FIZZLER = 32, STANDARD_FIZZLER = 32,
PAYZERO_COST = 33,
OVERLOAD_COST = 34,
BESTOW_COST = 35,
}; };
}; };
+2 -3
View File
@@ -55,7 +55,7 @@ public:
Pos* view; Pos* view;
int X; int X;
int castX; int castX;
int alternateCostPaid[ManaCost::MANA_PAID_WITH_SUSPEND + 1]; int alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW + 1];
int paymenttype; int paymenttype;
int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */ int castMethod; /* Tells if the card reached its current zone by being cast or not (brought into the zone by an effect). non 0 == cast, 0 == not cast */
int frozen; int frozen;
@@ -253,9 +253,8 @@ public:
int cardistargetted; int cardistargetted;
bool isTargetter(); bool isTargetter();
int cardistargetter; int cardistargetter;
int tmodifier;
int tmodifierb;
int myconvertedcost; int myconvertedcost;
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost);
void eventattacked(); void eventattacked();
void eventattackedAlone(); void eventattackedAlone();
+12 -10
View File
@@ -236,7 +236,9 @@ class Constants
OPPGCREATUREEXILER = 118, OPPGCREATUREEXILER = 118,
PAYZERO = 119, PAYZERO = 119,
TRINISPHERE = 120, TRINISPHERE = 120,
NB_BASIC_ABILITIES = 121, CANPLAYFROMEXILE = 121,
LIBRARYEATER = 122,
NB_BASIC_ABILITIES = 123,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
@@ -274,21 +276,21 @@ class Constants
GRADE_UNSUPPORTED = 4, GRADE_UNSUPPORTED = 4,
GRADE_DANGEROUS = 5, GRADE_DANGEROUS = 5,
ASKIP_NONE=0, ASKIP_NONE=0,
ASKIP_SAFE=1, ASKIP_SAFE=1,
ASKIP_FULL=2, ASKIP_FULL=2,
WHO_P=0, WHO_P=0,
WHO_O=1, WHO_O=1,
WHO_R=2, WHO_R=2,
KICKER_ALWAYS=0, KICKER_ALWAYS=0,
KICKER_CHOICE=1, KICKER_CHOICE=1,
}; };
enum enum
{ {
NOT_CAST = 0, NOT_CAST = 0,
CAST_NORMALLY = 1, CAST_NORMALLY = 1,
CAST_WITH_KICKER = 2, CAST_WITH_KICKER = 2,
+42 -24
View File
@@ -76,6 +76,8 @@ public:
MTGPutInPlayRule(GameObserver* observer, int _id); MTGPutInPlayRule(GameObserver* observer, int _id);
const string getMenuText() const string getMenuText()
{ {
if(game && game->gameType() == GAME_TYPE_MOMIR)
return "Play Land";
return "Cast Card Normally"; return "Cast Card Normally";
} }
virtual MTGPutInPlayRule * clone() const; virtual MTGPutInPlayRule * clone() const;
@@ -99,7 +101,7 @@ class MTGAlternativeCostRule: public PermanentAbility
{ {
protected: protected:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana, ManaCost *alternateManaCost); int isReactingToClick(MTGCardInstance * card, ManaCost * mana, ManaCost *alternateManaCost);
int reactToClick(MTGCardInstance * card, ManaCost * alternateManaCost, int paymentType = ManaCost::MANA_PAID); int reactToClick(MTGCardInstance * card, ManaCost * alternateManaCost, int paymentType = ManaCost::MANA_PAID, bool overload = false);
string alternativeName; string alternativeName;
public: public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
@@ -173,21 +175,37 @@ public:
virtual MTGMorphCostRule * clone() const; virtual MTGMorphCostRule * clone() const;
}; };
class MTGPlayFromGraveyardRule: public MTGAlternativeCostRule class MTGPayZeroRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
string CustomName;
virtual ostream& toString(ostream& out) const;
MTGPayZeroRule(GameObserver* observer, int _id);
const string getMenuText()
{
if(CustomName.size())
return CustomName.c_str();
return "Pay Zero To Cast";
}
virtual MTGPayZeroRule * clone() const;
};
class MTGOverloadRule: public MTGAlternativeCostRule
{ {
public: public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGPlayFromGraveyardRule(GameObserver* observer, int _id); MTGOverloadRule(GameObserver* observer, int _id);
const string getMenuText() const string getMenuText()
{ {
return "Cast Card From Graveyard"; return "Overload";
} }
virtual MTGPlayFromGraveyardRule * clone() const; virtual MTGOverloadRule * clone() const;
}; };
class MTGSuspendRule: public MTGAlternativeCostRule class MTGSuspendRule: public MTGAlternativeCostRule
{ {
public: public:
@@ -293,15 +311,15 @@ public:
class MTGDredgeRule: public PermanentAbility, public ReplacementEffect class MTGDredgeRule: public PermanentAbility, public ReplacementEffect
{ {
public: public:
vector<MTGCardInstance*>soulbonders; //vector<MTGCardInstance*>soulbonders;
TargetChooser * tcb; TargetChooser * tcb;
MTGAbility * dredgeAbility; MTGAbility * dredgeAbility;
MTGAbility * targetAbility; MTGAbility * targetAbility;
MTGAbility * targetAbilityAdder; MTGAbility * targetAbilityAdder;
MTGAbility * targetAbility1; MTGAbility * targetAbility1;
MTGAbility * mod; MTGAbility * mod;
MTGAbility * activateDredge; //MTGAbility * activateDredge;
vector<MTGAbility*>pairing; //vector<MTGAbility*>pairing;
MTGDredgeRule(GameObserver* observer, int _id); MTGDredgeRule(GameObserver* observer, int _id);
WEvent * replace(WEvent *e); WEvent * replace(WEvent *e);
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
@@ -418,28 +436,28 @@ private:
vector<int> pool[20]; vector<int> pool[20];
int initialized; int initialized;
public: public:
MTGAllCards * collection; MTGAllCards * collection;
MTGCardInstance * genEquip(int id); MTGCardInstance * genEquip(int id);
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection); MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const string getMenuText() const string getMenuText()
{ {
return "Stone Hewer"; return "Stone Hewer";
} }
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
virtual MTGStoneHewerRule * clone() const; virtual MTGStoneHewerRule * clone() const;
}; };
//Hermit Druid avatar mode //Hermit Druid avatar mode
class MTGHermitRule: public PermanentAbility class MTGHermitRule: public PermanentAbility
{ {
public: public:
MTGHermitRule(GameObserver* observer, int _id); MTGHermitRule(GameObserver* observer, int _id);
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
const string getMenuText() const string getMenuText()
{ {
return "Hermit"; return "Hermit";
} }
virtual MTGHermitRule * clone() const; virtual MTGHermitRule * clone() const;
}; };
// //
/* LifeLink */ /* LifeLink */
+20 -17
View File
@@ -47,33 +47,36 @@ public:
MANA_PAID_WITH_FLASHBACK = 5, MANA_PAID_WITH_FLASHBACK = 5,
MANA_PAID_WITH_RETRACE = 6, MANA_PAID_WITH_RETRACE = 6,
MANA_PAID_WITH_MORPH = 7, MANA_PAID_WITH_MORPH = 7,
MANA_PAID_WITH_SUSPEND = 8 MANA_PAID_WITH_SUSPEND = 8,
MANA_PAID_WITH_OVERLOAD = 9,
MANA_PAID_WITH_BESTOW = 10,
MANA_PAID_WITH_OTHERCOST = 11
}; };
ExtraCosts * extraCosts; ExtraCosts * extraCosts;
ManaCost * getAlternative(){ return alternative; }; ManaCost * getAlternative(){ return alternative; };
void setAlternative(ManaCost * aMana){ SAFE_DELETE(alternative); alternative = aMana;}; void setAlternative(ManaCost * aMana){ SAFE_DELETE(alternative); alternative = aMana;};
ManaCost * getKicker(){ return kicker; }; ManaCost * getKicker(){ return kicker; };
void setKicker(ManaCost * aMana){ SAFE_DELETE(kicker); kicker = aMana;}; void setKicker(ManaCost * aMana){ SAFE_DELETE(kicker); kicker = aMana;};
ManaCost * getBuyback(){ return BuyBack; }; ManaCost * getBuyback(){ return BuyBack; };
void setBuyback(ManaCost * aMana){ SAFE_DELETE(BuyBack); BuyBack = aMana;}; void setBuyback(ManaCost * aMana){ SAFE_DELETE(BuyBack); BuyBack = aMana;};
ManaCost * getFlashback(){ return FlashBack; }; ManaCost * getFlashback(){ return FlashBack; };
void setFlashback(ManaCost * aMana){ SAFE_DELETE(FlashBack); FlashBack = aMana;}; void setFlashback(ManaCost * aMana){ SAFE_DELETE(FlashBack); FlashBack = aMana;};
ManaCost * getRetrace(){ return Retrace; }; ManaCost * getRetrace(){ return Retrace; };
void setRetrace(ManaCost * aMana){ SAFE_DELETE(Retrace); Retrace = aMana;}; void setRetrace(ManaCost * aMana){ SAFE_DELETE(Retrace); Retrace = aMana;};
ManaCost * getMorph(){ return morph; }; ManaCost * getMorph(){ return morph; };
void setMorph(ManaCost * aMana){ SAFE_DELETE(morph); morph = aMana;}; void setMorph(ManaCost * aMana){ SAFE_DELETE(morph); morph = aMana;};
ManaCost * getSuspend(){ return suspend; }; ManaCost * getSuspend(){ return suspend; };
void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;}; void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;};
ManaCost * getManaUsedToCast(){ return manaUsedToCast; }; ManaCost * getManaUsedToCast(){ return manaUsedToCast; };
void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;}; void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;};
string alternativeName; string alternativeName;
bool isMulti; bool isMulti;
+2 -2
View File
@@ -7,8 +7,8 @@
#include <string> #include <string>
using namespace std; using namespace std;
#define SCALE_SELECTED 1.2f #define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f #define SCALE_NORMAL 1.0f
class hgeParticleSystem; class hgeParticleSystem;
+4 -4
View File
@@ -109,11 +109,11 @@ public:
int mFontSize; int mFontSize;
bool mFont; bool mFont;
PIXEL_TYPE mFontColor; PIXEL_TYPE mFontColor;
/*Icons attributes*/ /*Icons attributes*/
int mSizeIcon; int mSizeIcon;
int mIconPosX; int mIconPosX;
int mIconPosY; int mIconPosY;
string mFileName; string mFileName;
ModRulesRenderCardGuiItem(string name, int posX, int posY, string formattedData, string filter, bool font, int fontSize, PIXEL_TYPE fontColor, int SizeIcon,int IconPosX,int IconPosY,string FileName); ModRulesRenderCardGuiItem(string name, int posX, int posY, string formattedData, string filter, bool font, int fontSize, PIXEL_TYPE fontColor, int SizeIcon,int IconPosX,int IconPosY,string FileName);
}; };
+1 -1
View File
@@ -111,7 +111,7 @@ public:
std::string GetCurrentDeckStatsFile(); std::string GetCurrentDeckStatsFile();
virtual bool parseLine(const string& s); virtual bool parseLine(const string& s);
friend ostream& operator<<(ostream&, const Player&); friend ostream& operator<<(ostream&, const Player&);
friend istream& operator>>(istream&, Player&); friend istream& operator>>(istream&, Player&);
bool operator<(Player& aPlayer); bool operator<(Player& aPlayer);
bool isDead(); bool isDead();
}; };
+5 -5
View File
@@ -57,17 +57,17 @@ public:
}; };
string bg; string bg;
string filename; string filename;
GameType gamemode; GameType gamemode;
bool hidden; bool hidden;
string displayName; string displayName;
int unlockOption; int unlockOption;
string mUnlockOptionString; string mUnlockOptionString;
static vector<Rules *> RulesList; static vector<Rules *> RulesList;
Rules(string bg = ""); Rules(string bg = "");
int load(string _filename); int load(string _filename);
static int loadAllRules(); static int loadAllRules();
static void unloadAllRules(); static void unloadAllRules();
static Rules * getRulesByFilename(string _filename); static Rules * getRulesByFilename(string _filename);
void initPlayers(GameObserver *observer); void initPlayers(GameObserver *observer);
+5 -5
View File
@@ -15,11 +15,11 @@
using std::string; using std::string;
#define SCALE_SELECTED 1.2f #define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f #define SCALE_NORMAL 1.0f
#define SCALE_SHRINK 0.75f #define SCALE_SHRINK 0.75f
#define SCALE_SELECTED_LARGE 1.7F #define SCALE_SELECTED_LARGE 1.7f
#define SCALE_LARGE_NORMAL 1.5F #define SCALE_LARGE_NORMAL 1.5f
class SimpleButton: public JGuiObject class SimpleButton: public JGuiObject
{ {
+2 -2
View File
@@ -9,8 +9,8 @@
using std::string; using std::string;
#define SCALE_SELECTED 1.2f #define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f #define SCALE_NORMAL 1.0f
class SimpleMenuItem: public SimpleButton class SimpleMenuItem: public SimpleButton
{ {
+5 -5
View File
@@ -114,7 +114,7 @@ class ThisAttacked:public ThisDescriptor{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisAttacked(int attack); ThisAttacked(int attack);
ThisAttacked * clone() const; ThisAttacked * clone() const;
}; };
@@ -122,7 +122,7 @@ class ThisBlocked:public ThisDescriptor{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisBlocked(int block); ThisBlocked(int block);
ThisBlocked * clone() const; ThisBlocked * clone() const;
}; };
@@ -130,7 +130,7 @@ class ThisNotBlocked:public ThisDescriptor{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisNotBlocked(int unblocked); ThisNotBlocked(int unblocked);
ThisNotBlocked * clone() const; ThisNotBlocked * clone() const;
}; };
@@ -138,7 +138,7 @@ class ThisDamaged:public ThisDescriptor{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisDamaged(int wasDealtDamage); ThisDamaged(int wasDealtDamage);
ThisDamaged * clone() const; ThisDamaged * clone() const;
}; };
@@ -146,7 +146,7 @@ class ThisDualWield:public ThisDescriptor{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisDualWield(int dualWield); ThisDualWield(int dualWield);
ThisDualWield * clone() const; ThisDualWield * clone() const;
}; };
+13 -13
View File
@@ -151,33 +151,33 @@ struct WEventCreatureAttacker : public WEventCardUpdate {
//event when card attacks. //event when card attacks.
struct WEventCardAttacked : public WEventCardUpdate { struct WEventCardAttacked : public WEventCardUpdate {
WEventCardAttacked(MTGCardInstance * card); WEventCardAttacked(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card attacks alone. //event when card attacks alone.
struct WEventCardAttackedAlone : public WEventCardUpdate { struct WEventCardAttackedAlone : public WEventCardUpdate {
WEventCardAttackedAlone(MTGCardInstance * card); WEventCardAttackedAlone(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card attacks but is not blocked. //event when card attacks but is not blocked.
struct WEventCardAttackedNotBlocked : public WEventCardUpdate { struct WEventCardAttackedNotBlocked : public WEventCardUpdate {
WEventCardAttackedNotBlocked(MTGCardInstance * card); WEventCardAttackedNotBlocked(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card attacks but is blocked. //event when card attacks but is blocked.
struct WEventCardAttackedBlocked : public WEventCardUpdate { struct WEventCardAttackedBlocked : public WEventCardUpdate {
WEventCardAttackedBlocked(MTGCardInstance * card,MTGCardInstance * opponent); WEventCardAttackedBlocked(MTGCardInstance * card,MTGCardInstance * opponent);
MTGCardInstance * opponent; MTGCardInstance * opponent;
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card blocked. //event when card blocked.
struct WEventCardBlocked : public WEventCardUpdate { struct WEventCardBlocked : public WEventCardUpdate {
WEventCardBlocked(MTGCardInstance * card,MTGCardInstance * opponent); WEventCardBlocked(MTGCardInstance * card,MTGCardInstance * opponent);
MTGCardInstance * opponent; MTGCardInstance * opponent;
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card is sacrificed. //event when card is sacrificed.
@@ -190,13 +190,13 @@ struct WEventCardSacrifice : public WEventCardUpdate {
//event when card is discarded. //event when card is discarded.
struct WEventCardDiscard : public WEventCardUpdate { struct WEventCardDiscard : public WEventCardUpdate {
WEventCardDiscard(MTGCardInstance * card); WEventCardDiscard(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card is cycled. //event when card is cycled.
struct WEventCardCycle : public WEventCardUpdate { struct WEventCardCycle : public WEventCardUpdate {
WEventCardCycle(MTGCardInstance * card); WEventCardCycle(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//Event when a card's "defenser" status changes //Event when a card's "defenser" status changes
@@ -219,9 +219,9 @@ struct WEventBlockersChosen : public WEvent {
}; };
struct WEventcardDraw : public WEvent { struct WEventcardDraw : public WEvent {
WEventcardDraw(Player * player,int nb_cards); WEventcardDraw(Player * player,int nb_cards);
Player * player; Player * player;
int nb_cards; int nb_cards;
using WEvent::getTarget; using WEvent::getTarget;
virtual Targetable * getTarget(Player * player); virtual Targetable * getTarget(Player * player);
}; };
@@ -276,19 +276,19 @@ struct WEventEmptyManaPool : public WEvent {
//event when card-equipment unattached //event when card-equipment unattached
struct WEventCardUnattached : public WEventCardUpdate { struct WEventCardUnattached : public WEventCardUpdate {
WEventCardUnattached(MTGCardInstance * card); WEventCardUnattached(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card-equipment attached/equipped //event when card-equipment attached/equipped
struct WEventCardEquipped : public WEventCardUpdate { struct WEventCardEquipped : public WEventCardUpdate {
WEventCardEquipped(MTGCardInstance * card); WEventCardEquipped(MTGCardInstance * card);
virtual Targetable * getTarget(int target); 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);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
std::ostream& operator<<(std::ostream&, const WEvent&); std::ostream& operator<<(std::ostream&, const WEvent&);
+1 -1
View File
@@ -173,7 +173,7 @@ protected:
int *mGBCode; int *mGBCode;
int mCurr; int mCurr;
PIXEL_TYPE* mCharBuffer; PIXEL_TYPE* mCharBuffer;
virtual int PreCacheChar(const u8 *ch); virtual int PreCacheChar(const u8 *ch);
}; };
+14 -14
View File
@@ -21,7 +21,7 @@ enum ENUM_WRES_INFO
enum ENUM_RETRIEVE_STYLE enum ENUM_RETRIEVE_STYLE
{ {
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock. RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status. RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status.
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads. RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads. RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads.
@@ -33,7 +33,7 @@ enum ENUM_RETRIEVE_STYLE
enum ENUM_CACHE_SUBTYPE enum ENUM_CACHE_SUBTYPE
{ {
CACHE_NORMAL = (1<<0), //Use default values. Not really a flag. CACHE_NORMAL = (1<<0), //Use default values. Not really a flag.
//CACHE_EXISTING = (1<<1), //Retrieve it only if it already exists //CACHE_EXISTING = (1<<1), //Retrieve it only if it already exists
//Because these bits only modify how a cached resource's Attempt() is called, //Because these bits only modify how a cached resource's Attempt() is called,
@@ -51,8 +51,8 @@ enum ENUM_CACHE_ERROR
CACHE_ERROR_NONE = 0, CACHE_ERROR_NONE = 0,
CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE, CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE,
CACHE_ERROR_404, CACHE_ERROR_404,
CACHE_ERROR_BAD, //Something went wrong with item->attempt() CACHE_ERROR_BAD, //Something went wrong with item->attempt()
CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item
CACHE_ERROR_LOST, CACHE_ERROR_LOST,
CACHE_ERROR_NOT_MANAGED, CACHE_ERROR_NOT_MANAGED,
}; };
@@ -69,16 +69,16 @@ public:
static void Terminate(); static void Terminate();
virtual ~WResourceManager() virtual ~WResourceManager()
{ {
} }
virtual bool IsThreaded() = 0; virtual bool IsThreaded() = 0;
void PlaySample(const string& fileName) { void PlaySample(const string& fileName) {
JSample*sample = RetrieveSample(fileName); JSample*sample = RetrieveSample(fileName);
if(sample) { if(sample) {
JSoundSystem::GetInstance()->PlaySample(sample); JSoundSystem::GetInstance()->PlaySample(sample);
} }
}; };
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0; virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0; virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0; virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
@@ -90,7 +90,7 @@ public:
virtual void Release(JTexture * tex) = 0; virtual void Release(JTexture * tex) = 0;
virtual void Release(JSample * sample) = 0; virtual void Release(JSample * sample) = 0;
//Refreshes all files in cache, for when mode/profile changes. //Refreshes all files in cache, for when mode/profile changes.
virtual void Refresh() = 0; virtual void Refresh() = 0;
//Manual clear of the cache //Manual clear of the cache
@@ -132,8 +132,8 @@ protected:
** Singleton object only accessibly via Instance(), constructor is private ** Singleton object only accessibly via Instance(), constructor is private
*/ */
WResourceManager() WResourceManager()
{ {
} }
static WResourceManager* sInstance; static WResourceManager* sInstance;
}; };
+2 -2
View File
@@ -202,8 +202,8 @@ public:
#endif #endif
private: private:
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards? bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
void FlattenTimes(); //To prevent bad cache timing on int overflow void FlattenTimes(); //To prevent bad cache timing on int overflow
//For cached stuff //For cached stuff
WCache<WCachedTexture,JTexture> textureWCache; WCache<WCachedTexture,JTexture> textureWCache;
+1 -1
View File
@@ -79,7 +79,7 @@ public:
ostream& saveUsedRandValues(ostream& out) const; ostream& saveUsedRandValues(ostream& out) const;
ostream& saveLoadedRandValues(ostream& out); ostream& saveLoadedRandValues(ostream& out);
int random(); int random();
void setSeed(unsigned int seed) { srand(seed); }; void setSeed(unsigned int seed) { srand(seed); };
template<typename Iter> void random_shuffle(Iter first, Iter last) template<typename Iter> void random_shuffle(Iter first, Iter last)
{ {
ptrdiff_t i, n; ptrdiff_t i, n;
+357 -7
View File
@@ -128,7 +128,7 @@ int OrderedAIAction::getEfficiency()
break; break;
} }
case MTGAbility::STANDARD_PREVENT: case MTGAbility::STANDARD_PREVENT:
{ {
efficiency = 0;//starts out low to avoid spamming it when its not needed. efficiency = 0;//starts out low to avoid spamming it when its not needed.
if (!target) if (!target)
@@ -627,6 +627,10 @@ int OrderedAIAction::getEfficiency()
{ {
efficiency += 65; efficiency += 65;
} }
else if (dynamic_cast<MTGAlternativeCostRule *>(a))
{
efficiency += 55;
}
SAFE_DELETE(transAbility); SAFE_DELETE(transAbility);
return efficiency; return efficiency;
} }
@@ -1517,12 +1521,12 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
if (tc->Owner != observer->currentlyActing()) if (tc->Owner != observer->currentlyActing())
{ {
observer->currentActionPlayer = tc->Owner; observer->currentActionPlayer = tc->Owner;
//this is a hack, but if we hit this condition we are locked in a infinate loop //this is a hack, but if we hit this condition we are locked in a infinate loop
//so lets give the tc to its owner //so lets give the tc to its owner
//todo:find the root cause of this. //todo:find the root cause of this.
DebugTrace("AIPLAYER: Error, was asked to chose targets but I don't own the source of the targetController\n"); DebugTrace("AIPLAYER: Error, was asked to chose targets but I don't own the source of the targetController\n");
return 0; return 0;
} }
Player * target = forceTarget; Player * target = forceTarget;
int playerTargetedZone = 1; int playerTargetedZone = 1;
if (!target) if (!target)
@@ -1726,6 +1730,302 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
cd.setType(type); cd.setType(type);
card = NULL; card = NULL;
gotPayments = vector<MTGAbility*>(); gotPayments = vector<MTGAbility*>();
//canplayfromgraveyard
while ((card = cd.nextmatch(game->graveyard, card))&& card->has(Constants::CANPLAYFROMGRAVEYARD))
{
if (!CanHandleCost(card->getManaCost(),card))
continue;
if (card->hasType(Subtypes::TYPE_LAND))
{
if (game->playRestrictions->canPutIntoZone(card, game->inPlay) == PlayRestriction::CANT_PLAY)
continue;
}
else
{
if (game->playRestrictions->canPutIntoZone(card, game->stack) == PlayRestriction::CANT_PLAY)
continue;
}
if (card->hasType(Subtypes::TYPE_LEGENDARY) && game->inPlay->findByName(card->name))
continue;
if (card->hasType(Subtypes::TYPE_PLANESWALKER) && card->types.size() > 0 && game->inPlay->hasTypeSpecificInt(Subtypes::TYPE_PLANESWALKER,card->types[1]))
continue;
if(hints && hints->HintSaysItsForCombo(observer,card))
{
if(hints->canWeCombo(observer,card,this))
{
AbilityFactory af(observer);
int canPlay = af.parseCastRestrictions(card,card->controller(),card->getRestrictions());
if(!canPlay)
continue;
nextCardToPlay = card;
gotPayments.clear();
if((!pMana->canAfford(nextCardToPlay->getManaCost()) || nextCardToPlay->getManaCost()->getKicker()))
gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost());
return activateCombo();
}
else
{
nextCardToPlay = NULL;
continue;
}
}
int currentCost = card->getManaCost()->getConvertedCost();
int hasX = card->getManaCost()->hasX();
gotPayments.clear();
if((!pMana->canAfford(card->getManaCost()) || card->getManaCost()->getKicker()))
gotPayments = canPayMana(card,card->getManaCost());
//for preformence reason we only look for specific mana if the payment couldn't be made with pmana.
if ((currentCost > maxCost || hasX) && (gotPayments.size() || pMana->canAfford(card->getManaCost())))
{
TargetChooserFactory tcf(observer);
TargetChooser * tc = tcf.createTargetChooser(card);
int shouldPlayPercentage = 0;
if (tc)
{
int hasTarget = chooseTarget(tc,NULL,NULL,true);
if(
(tc->maxtargets > hasTarget && tc->maxtargets > 1 && !tc->targetMin && tc->maxtargets != TargetChooser::UNLITMITED_TARGETS) ||//target=<3>creature
(tc->maxtargets == TargetChooser::UNLITMITED_TARGETS && hasTarget < 1)//target=creatures
)
hasTarget = 0;
if (!hasTarget)//single target covered here.
{
SAFE_DELETE(tc);
continue;
}
shouldPlayPercentage = 90;
if(tc->targetMin && hasTarget < tc->maxtargets)
shouldPlayPercentage = 0;
if(tc->maxtargets > 1 && tc->maxtargets != TargetChooser::UNLITMITED_TARGETS && hasTarget <= tc->maxtargets)
{
int maxA = hasTarget-tc->maxtargets;
shouldPlayPercentage += (10*maxA);//reduce the chances of playing multitarget if we are not above max targets.
}
if(tc->maxtargets == TargetChooser::UNLITMITED_TARGETS)
{
shouldPlayPercentage = 40 + (10*hasTarget);
int totalCost = pMana->getConvertedCost()-currentCost;
int totalTargets = hasTarget+hasTarget;
if(hasX && totalCost <= totalTargets)// {x} spell with unlimited targeting tend to divide damage, we want atleast 1 damage per target before casting.
{
shouldPlayPercentage = 0;
}
}
SAFE_DELETE(tc);
}
else
{
int shouldPlay = effectBadOrGood(card);
if (shouldPlay == BAKA_EFFECT_GOOD)
{
shouldPlayPercentage = 90;
}
else if (BAKA_EFFECT_DONTKNOW == shouldPlay)
{
//previously shouldPlayPercentage = 80;, I found this a little to high
//for cards which AI had no idea how to use.
shouldPlayPercentage = 60;
}
else if (card->isLand())
{
shouldPlayPercentage = 90;
}
else
{
// shouldPlay == baka_effect_bad giving it a 1 for odd ball lottery chance.
shouldPlayPercentage = 1;
}
}
//Reduce the chances of playing a spell with X cost if available mana is low
if (hasX)
{
int xDiff = pMana->getConvertedCost() - currentCost;
if (xDiff < 0)
xDiff = 0;
shouldPlayPercentage = shouldPlayPercentage - static_cast<int> ((shouldPlayPercentage * 1.9f) / (1 + xDiff));
}
if(card->getManaCost() && card->getManaCost()->getKicker() && card->getManaCost()->getKicker()->isMulti)
{
shouldPlayPercentage = 10* size_t(gotPayments.size())/int(1+(card->getManaCost()->getConvertedCost()+card->getManaCost()->getKicker()->getConvertedCost()));
if(shouldPlayPercentage <= 10)
shouldPlayPercentage = shouldPlayPercentage/3;
}
DebugTrace("Should I play " << (card ? card->name : "Nothing" ) << "?" << endl
<<"shouldPlayPercentage = "<< shouldPlayPercentage);
if(card->getRestrictions().size())
{
AbilityFactory af(observer);
int canPlay = af.parseCastRestrictions(card,card->controller(),card->getRestrictions());
if(!canPlay)
continue;
}
int randomChance = randomGenerator.random();
int chance = randomChance % 100;
if (chance > shouldPlayPercentage)
continue;
if(shouldPlayPercentage <= 10)
{
DebugTrace("shouldPlayPercentage was less than 10 this was a lottery roll on RNG");
}
nextCardToPlay = card;
maxCost = currentCost;
if (hasX)
maxCost = pMana->getConvertedCost();
}
}
//canplayfromexile
while ((card = cd.nextmatch(game->exile, card))&& card->has(Constants::CANPLAYFROMEXILE))
{
if (!CanHandleCost(card->getManaCost(),card))
continue;
if (card->hasType(Subtypes::TYPE_LAND))
{
if (game->playRestrictions->canPutIntoZone(card, game->inPlay) == PlayRestriction::CANT_PLAY)
continue;
}
else
{
if (game->playRestrictions->canPutIntoZone(card, game->stack) == PlayRestriction::CANT_PLAY)
continue;
}
if (card->hasType(Subtypes::TYPE_LEGENDARY) && game->inPlay->findByName(card->name))
continue;
if (card->hasType(Subtypes::TYPE_PLANESWALKER) && card->types.size() > 0 && game->inPlay->hasTypeSpecificInt(Subtypes::TYPE_PLANESWALKER,card->types[1]))
continue;
if(hints && hints->HintSaysItsForCombo(observer,card))
{
if(hints->canWeCombo(observer,card,this))
{
AbilityFactory af(observer);
int canPlay = af.parseCastRestrictions(card,card->controller(),card->getRestrictions());
if(!canPlay)
continue;
nextCardToPlay = card;
gotPayments.clear();
if((!pMana->canAfford(nextCardToPlay->getManaCost()) || nextCardToPlay->getManaCost()->getKicker()))
gotPayments = canPayMana(nextCardToPlay,nextCardToPlay->getManaCost());
return activateCombo();
}
else
{
nextCardToPlay = NULL;
continue;
}
}
int currentCost = card->getManaCost()->getConvertedCost();
int hasX = card->getManaCost()->hasX();
gotPayments.clear();
if((!pMana->canAfford(card->getManaCost()) || card->getManaCost()->getKicker()))
gotPayments = canPayMana(card,card->getManaCost());
//for preformence reason we only look for specific mana if the payment couldn't be made with pmana.
if ((currentCost > maxCost || hasX) && (gotPayments.size() || pMana->canAfford(card->getManaCost())))
{
TargetChooserFactory tcf(observer);
TargetChooser * tc = tcf.createTargetChooser(card);
int shouldPlayPercentage = 0;
if (tc)
{
int hasTarget = chooseTarget(tc,NULL,NULL,true);
if(
(tc->maxtargets > hasTarget && tc->maxtargets > 1 && !tc->targetMin && tc->maxtargets != TargetChooser::UNLITMITED_TARGETS) ||//target=<3>creature
(tc->maxtargets == TargetChooser::UNLITMITED_TARGETS && hasTarget < 1)//target=creatures
)
hasTarget = 0;
if (!hasTarget)//single target covered here.
{
SAFE_DELETE(tc);
continue;
}
shouldPlayPercentage = 90;
if(tc->targetMin && hasTarget < tc->maxtargets)
shouldPlayPercentage = 0;
if(tc->maxtargets > 1 && tc->maxtargets != TargetChooser::UNLITMITED_TARGETS && hasTarget <= tc->maxtargets)
{
int maxA = hasTarget-tc->maxtargets;
shouldPlayPercentage += (10*maxA);//reduce the chances of playing multitarget if we are not above max targets.
}
if(tc->maxtargets == TargetChooser::UNLITMITED_TARGETS)
{
shouldPlayPercentage = 40 + (10*hasTarget);
int totalCost = pMana->getConvertedCost()-currentCost;
int totalTargets = hasTarget+hasTarget;
if(hasX && totalCost <= totalTargets)// {x} spell with unlimited targeting tend to divide damage, we want atleast 1 damage per target before casting.
{
shouldPlayPercentage = 0;
}
}
SAFE_DELETE(tc);
}
else
{
int shouldPlay = effectBadOrGood(card);
if (shouldPlay == BAKA_EFFECT_GOOD)
{
shouldPlayPercentage = 90;
}
else if (BAKA_EFFECT_DONTKNOW == shouldPlay)
{
//previously shouldPlayPercentage = 80;, I found this a little to high
//for cards which AI had no idea how to use.
shouldPlayPercentage = 60;
}
else if (card->isLand())
{
shouldPlayPercentage = 90;
}
else
{
// shouldPlay == baka_effect_bad giving it a 1 for odd ball lottery chance.
shouldPlayPercentage = 1;
}
}
//Reduce the chances of playing a spell with X cost if available mana is low
if (hasX)
{
int xDiff = pMana->getConvertedCost() - currentCost;
if (xDiff < 0)
xDiff = 0;
shouldPlayPercentage = shouldPlayPercentage - static_cast<int> ((shouldPlayPercentage * 1.9f) / (1 + xDiff));
}
if(card->getManaCost() && card->getManaCost()->getKicker() && card->getManaCost()->getKicker()->isMulti)
{
shouldPlayPercentage = 10* size_t(gotPayments.size())/int(1+(card->getManaCost()->getConvertedCost()+card->getManaCost()->getKicker()->getConvertedCost()));
if(shouldPlayPercentage <= 10)
shouldPlayPercentage = shouldPlayPercentage/3;
}
DebugTrace("Should I play " << (card ? card->name : "Nothing" ) << "?" << endl
<<"shouldPlayPercentage = "<< shouldPlayPercentage);
if(card->getRestrictions().size())
{
AbilityFactory af(observer);
int canPlay = af.parseCastRestrictions(card,card->controller(),card->getRestrictions());
if(!canPlay)
continue;
}
int randomChance = randomGenerator.random();
int chance = randomChance % 100;
if (chance > shouldPlayPercentage)
continue;
if(shouldPlayPercentage <= 10)
{
DebugTrace("shouldPlayPercentage was less than 10 this was a lottery roll on RNG");
}
nextCardToPlay = card;
maxCost = currentCost;
if (hasX)
maxCost = pMana->getConvertedCost();
}
}
while ((card = cd.nextmatch(game->hand, card))) while ((card = cd.nextmatch(game->hand, card)))
{ {
if (!CanHandleCost(card->getManaCost(),card)) if (!CanHandleCost(card->getManaCost(),card))
@@ -2109,6 +2409,56 @@ int AIPlayerBaka::computeActions()
nextCardToPlay = NULL; nextCardToPlay = NULL;
count++; count++;
} }
if(nextCardToPlay == NULL)//check if there is a free card to play, play it....
{//TODO: add potential mana if we can pay if there is a cost increaser in play
CardDescriptor cd;
if (game->hand->hasAbility(Constants::PAYZERO))
{
//Attempt to put free cards into play
cd.init();
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
MTGCardInstance *freecard = cd.match(game->hand);
int canCastCard = game->playRestrictions->canPutIntoZone(freecard, game->inPlay);
if (freecard && (canCastCard == PlayRestriction::CAN_PLAY) && freecard->has(Constants::PAYZERO) && (freecard->getIncreasedManaCost()->getConvertedCost() < 1))
{
MTGAbility * castFreeCard = observer->mLayers->actionLayer()->getAbility(MTGAbility::PAYZERO_COST);
AIAction * aa = NEW AIAction(this, castFreeCard, freecard); //TODO putinplay action
clickstream.push(aa);
break;
}
}
if (game->graveyard->hasAbility(Constants::PAYZERO) && game->graveyard->hasAbility(Constants::CANPLAYFROMGRAVEYARD))
{
//Attempt to put free cards into play
cd.init();
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
MTGCardInstance *freecard = cd.match(game->graveyard);
int canCastCard = game->playRestrictions->canPutIntoZone(freecard, game->inPlay);
if (freecard && (canCastCard == PlayRestriction::CAN_PLAY) && freecard->has(Constants::PAYZERO) && freecard->has(Constants::CANPLAYFROMGRAVEYARD) && (freecard->getIncreasedManaCost()->getConvertedCost() < 1) && (freecard->alias != 1111))
{
MTGAbility * castFreeCard = observer->mLayers->actionLayer()->getAbility(MTGAbility::PAYZERO_COST);
AIAction * aa = NEW AIAction(this, castFreeCard, freecard); //TODO putinplay action
clickstream.push(aa);
break;
}
}
if (game->exile->hasAbility(Constants::PAYZERO) && game->exile->hasAbility(Constants::CANPLAYFROMEXILE))
{
//Attempt to put free cards into play
cd.init();
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
MTGCardInstance *freecard = cd.match(game->exile);
int canCastCard = game->playRestrictions->canPutIntoZone(freecard, game->inPlay);
if (freecard && (canCastCard == PlayRestriction::CAN_PLAY) && freecard->has(Constants::PAYZERO) && freecard->has(Constants::CANPLAYFROMEXILE) && (freecard->getIncreasedManaCost()->getConvertedCost() < 1) && (freecard->alias != 1111))
{
MTGAbility * castFreeCard = observer->mLayers->actionLayer()->getAbility(MTGAbility::PAYZERO_COST);
AIAction * aa = NEW AIAction(this, castFreeCard, freecard); //TODO putinplay action
clickstream.push(aa);
break;
}
}
}//end
} }
SAFE_DELETE(currentMana); SAFE_DELETE(currentMana);
+2 -2
View File
@@ -107,8 +107,8 @@ int AIStats::receiveEvent(WEvent * event)
//the following tells ai if a creature should be blocked or targeted //the following tells ai if a creature should be blocked or targeted
bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue) bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue)
{ {
//return true; //return true;
//uncomment the above return to make Ai always multiblock your creatures. //uncomment the above return to make Ai always multiblock your creatures.
if (stats.size() < max) if (stats.size() < max)
return tooSmallCountsForTrue; return tooSmallCountsForTrue;
unsigned int n = 0; unsigned int n = 0;
+2 -2
View File
@@ -361,8 +361,8 @@ int ActionLayer::reactToClick(MTGCardInstance * card)
} }
#ifdef WIN32 #ifdef WIN32
// if we hit this, then something strange has happened with the click logic - reactToClick() // if we hit this, then something strange has happened with the click logic - reactToClick()
// should never be called if isReactingToClick() previously didn't have an object return true // should never be called if isReactingToClick() previously didn't have an object return true
assert(!mReactions.empty()); assert(!mReactions.empty());
#endif #endif
+18 -12
View File
@@ -98,13 +98,13 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
if (!targetQuad) if (!targetQuad)
{ {
/*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name)
mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);
else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name) else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name)
mFont->DrawString("Opponent plays ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);*/ mFont->DrawString("Opponent plays ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);*/
mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT);
} }
else else
{ {
renderer->FillRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(235,10,10,10)); renderer->FillRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(235,10,10,10));
/*if(source->controller()->isHuman() && source->controller()->opponent()->isAI()) /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI())
renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,0,255,0)); renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,0,255,0));
@@ -301,7 +301,13 @@ bool Spell::FullfilledAlternateCost(const int &costType)
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE); hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE);
break; break;
case ManaCost::MANA_PAID_WITH_SUSPEND: case ManaCost::MANA_PAID_WITH_SUSPEND:
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE); hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_SUSPEND);
break;
case ManaCost::MANA_PAID_WITH_OVERLOAD:
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_OVERLOAD);
break;
case ManaCost::MANA_PAID_WITH_BESTOW:
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_BESTOW);
break; break;
} }
@@ -345,13 +351,13 @@ int Spell::resolve()
if (options[Options::SFXVOLUME].number > 0) if (options[Options::SFXVOLUME].number > 0)
{ {
if(observer->getResourceManager()) if(observer->getResourceManager())
observer->getResourceManager()->PlaySample(source->getSample()); observer->getResourceManager()->PlaySample(source->getSample());
} }
if(this->cost) if(this->cost)
{ {
source->getManaCost()->setManaUsedToCast(NEW ManaCost(this->cost)); source->getManaCost()->setManaUsedToCast(NEW ManaCost(this->cost));
} }
AbilityFactory af(observer); AbilityFactory af(observer);
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), this); af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), this);
return 1; return 1;
@@ -751,7 +757,7 @@ int ActionStack::resolve()
{ {
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (interruptDecision[i] != 2) if (interruptDecision[i] != 2)
interruptDecision[i] = NOT_DECIDED; interruptDecision[i] = NOT_DECIDED;
} }
} }
@@ -815,7 +821,7 @@ int ActionStack::count(int type, int state, int display)
Interruptible * ActionStack::getActionElementFromCard(MTGCardInstance * card) Interruptible * ActionStack::getActionElementFromCard(MTGCardInstance * card)
{ {
if(!card) if(!card)
return 0; return 0;
for (size_t i = 0; i < mObjects.size(); i++) for (size_t i = 0; i < mObjects.size(); i++)
{ {
@@ -999,7 +1005,7 @@ void ActionStack::Update(float dt)
//and set the timer to 4 secs. BUG FIX //http://code.google.com/p/wagic/issues/detail?id=464 //and set the timer to 4 secs. BUG FIX //http://code.google.com/p/wagic/issues/detail?id=464
extraTime = count(0, NOT_RESOLVED, 0); extraTime = count(0, NOT_RESOLVED, 0);
if (extraTime == 0) if (extraTime == 0)
extraTime = 1;//we never want this int to be 0. extraTime = 1;//we never want this int to be 0.
if (timer < 0) if (timer < 0)
timer = static_cast<float>(options[Options::INTERRUPT_SECONDS].number * extraTime); timer = static_cast<float>(options[Options::INTERRUPT_SECONDS].number * extraTime);
+47 -47
View File
@@ -1236,7 +1236,7 @@ int GenericPaidAbility::resolve()
}*/ }*/
} }
if(asAlternate && nomenu && optionalCost->getConvertedCost() < 1) if(asAlternate && nomenu && optionalCost->getConvertedCost() < 1)
{ {
nomenuAbility->resolve(); nomenuAbility->resolve();
} }
else else
@@ -1414,7 +1414,7 @@ AAEPIC * AAEPIC::clone() const
AAFizzler::AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) : AAFizzler::AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost) :
ActivatedAbility(observer, _id, card, _cost, 0) ActivatedAbility(observer, _id, card, _cost, 0)
{ {
aType = MTGAbility::STANDARD_FIZZLER; aType = MTGAbility::STANDARD_FIZZLER;
target = _target; target = _target;
// by default we put the spell to graveyard after fizzling // by default we put the spell to graveyard after fizzling
@@ -4175,12 +4175,12 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou
myCurrentTurn = 1000; myCurrentTurn = 1000;
//this subkeyword adds a color without removing the existing colors. //this subkeyword adds a color without removing the existing colors.
addNewColors = (sabilities.find("newcolors") != string::npos); addNewColors = (sabilities.find("newcolors") != string::npos);
remove = (stypes.find("removealltypes") != string::npos); remove = (stypes.find("removealltypes") != string::npos);
removeCreatureSubtypes = (stypes.find("removecreaturesubtypes") != string::npos); removeCreatureSubtypes = (stypes.find("removecreaturesubtypes") != string::npos);
removeTypes = (stypes.find("removetypes") != string::npos); removeTypes = (stypes.find("removetypes") != string::npos);
if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos) if (stypes.find("allsubtypes") != string::npos || stypes.find("removecreaturesubtypes") != string::npos)
{ {
const vector<string> values = MTGAllCards::getValuesById(); const vector<string> values = MTGAllCards::getValuesById();
for (size_t i = 0; i <values.size(); ++i) for (size_t i = 0; i <values.size(); ++i)
{ {
@@ -4189,7 +4189,7 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou
types.push_back(i); types.push_back(i);
} }
} }
else else
{ {
if(stypes.find("chosentype") != string::npos) if(stypes.find("chosentype") != string::npos)
@@ -4251,17 +4251,17 @@ int ATransformer::addToGame()
for (int i = 0; i < Subtypes::LAST_TYPE; ++ i) for (int i = 0; i < Subtypes::LAST_TYPE; ++ i)
_target->removeType(i,1); _target->removeType(i,1);
} }
else if (remove) else if (remove)
{ {
for (it = oldtypes.begin(); it != oldtypes.end(); it++) for (it = oldtypes.begin(); it != oldtypes.end(); it++)
{ {
_target->removeType(*it); _target->removeType(*it);
} }
} }
else else
{ {
for (it = types.begin(); it != types.end(); it++) for (it = types.begin(); it != types.end(); it++)
{ {
if(removeCreatureSubtypes) if(removeCreatureSubtypes)
{ {
@@ -4280,8 +4280,8 @@ for (it = types.begin(); it != types.end(); it++)
{ {
_target->addType(*it); _target->addType(*it);
} }
} }
} }
for (it = colors.begin(); it != colors.end(); it++) for (it = colors.begin(); it != colors.end(); it++)
{ {
_target->setColor(*it); _target->setColor(*it);
@@ -4361,7 +4361,7 @@ for (it = types.begin(); it != types.end(); it++)
_target->switchPT(true); _target->switchPT(true);
} }
else else
_target->addbaseT(val->getValue()); _target->addbaseT(val->getValue());
delete val; delete val;
} }
@@ -4473,22 +4473,22 @@ int ATransformer::destroy()
newAbilities.erase(_target); newAbilities.erase(_target);
} }
} }
if (remove || removeCreatureSubtypes) if (remove || removeCreatureSubtypes)
{ {
for (it = oldtypes.begin(); it != oldtypes.end(); it++) for (it = oldtypes.begin(); it != oldtypes.end(); it++)
{ {
if(!_target->hasSubtype(*it)) if(!_target->hasSubtype(*it))
_target->addType(*it); _target->addType(*it);
} }
} }
////in the case that we removed or added types to a card, so that it retains its original name when the effect is removed. ////in the case that we removed or added types to a card, so that it retains its original name when the effect is removed.
//if(_target->model->data->name.size())//tokens don't have a model name. //if(_target->model->data->name.size())//tokens don't have a model name.
// _target->setName(_target->model->data->name.c_str()); // _target->setName(_target->model->data->name.c_str());
//edit: this ability shouldn't have to reset the name on a card becuase removing a subtype changes the name of a land. //edit: this ability shouldn't have to reset the name on a card becuase removing a subtype changes the name of a land.
//that should be handled in addType...not here. //that should be handled in addType...not here.
//im sure commenting this out will reintroduce a bug somewhere but it needs to be handled correctly. furthermore, why does adding and removing a type touch the name of a card? //im sure commenting this out will reintroduce a bug somewhere but it needs to be handled correctly. furthermore, why does adding and removing a type touch the name of a card?
} }
return 1; return 1;
} }
@@ -4697,8 +4697,8 @@ int ALoseAbilities::addToGame()
if (al->mObjects[i]) if (al->mObjects[i])
{ {
MTGAbility * currentAction = (MTGAbility *) al->mObjects[i]; MTGAbility * currentAction = (MTGAbility *) al->mObjects[i];
ALord * l = dynamic_cast<ALord*> (currentAction); ALord * l = dynamic_cast<ALord*> (currentAction);
if(l) if(l)
lordsInGame.push_back(l); lordsInGame.push_back(l);
} }
} }
@@ -4708,9 +4708,9 @@ int ALoseAbilities::addToGame()
if (al->mObjects[i]) if (al->mObjects[i])
{ {
MTGAbility * currentAction = (MTGAbility *) al->mObjects[i]; MTGAbility * currentAction = (MTGAbility *) al->mObjects[i];
ALoseAbilities * la = dynamic_cast<ALoseAbilities*> (currentAction); ALoseAbilities * la = dynamic_cast<ALoseAbilities*> (currentAction);
if(la) if(la)
continue; continue;
if (currentAction->source == _target) if (currentAction->source == _target)
{ {
bool canRemove = true; bool canRemove = true;
@@ -4751,20 +4751,20 @@ int ALoseAbilities::destroy()
MTGAbility * a = storedAbilities[i]; MTGAbility * a = storedAbilities[i];
//OneShot abilities are not supposed to stay in the game for long. //OneShot abilities are not supposed to stay in the game for long.
// If we copied one, something wrong probably happened // If we copied one, something wrong probably happened
if (a->oneShot) if (a->oneShot)
{ {
DebugTrace("ALLABILITIES: Ability should not be one shot"); DebugTrace("ALLABILITIES: Ability should not be one shot");
continue; continue;
} }
//Avoid inifinite loop of removing/putting back abilities //Avoid inifinite loop of removing/putting back abilities
if (dynamic_cast<ALoseAbilities*> (a)) if (dynamic_cast<ALoseAbilities*> (a))
{ {
DebugTrace("ALLABILITIES: loseability won't be put in the loseability list"); DebugTrace("ALLABILITIES: loseability won't be put in the loseability list");
continue; continue;
} }
a->addToGame(); a->addToGame();
} }
storedAbilities.clear(); storedAbilities.clear();
return 1; return 1;
@@ -5368,8 +5368,8 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) { void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL; MTGCardInstance * Blinker = NULL;
if(!_target->blinked) if(!_target->blinked)
{ {
this->forceDestroy = 1; this->forceDestroy = 1;
return; return;
} }
@@ -5659,7 +5659,7 @@ int AEquip::unequip()
{ {
MTGAbility * a = currentAbilities[i]; MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a) if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a)
|| dynamic_cast<AANewTarget *> (AbilityFactory::getCoreAbility(a)) || dynamic_cast<AANewTarget *> (AbilityFactory::getCoreAbility(a))
|| (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
{ {
SAFE_DELETE(a); SAFE_DELETE(a);
@@ -6013,7 +6013,7 @@ ATutorialMessage::ATutorialMessage(GameObserver* observer, MTGCardInstance * sou
else else
{ {
mMessage = _(message); //translate directly here, remove this and translate at rendering time if it bites us mMessage = _(message); //translate directly here, remove this and translate at rendering time if it bites us
ReplaceString(mMessage, "\\n", "\n"); ReplaceString(mMessage, "\\n", "\n");
} }
} }
@@ -6143,7 +6143,7 @@ void ATutorialMessage::Render()
if (options[Options::SFXVOLUME].number > 0) if (options[Options::SFXVOLUME].number > 0)
{ {
game->getResourceManager()->PlaySample("tutorial.wav"); game->getResourceManager()->PlaySample("tutorial.wav");
} }
} }
else else
+33 -19
View File
@@ -43,11 +43,11 @@ namespace
} }
CardGui::CardGui(MTGCardInstance* card, float x, float y) CardGui::CardGui(MTGCardInstance* card, float x, float y)
: PlayGuiObject(Height, x, y, 0, false), card(card) : PlayGuiObject(Height, x, y, 0, false), card(card)
{ {
} }
CardGui::CardGui(MTGCardInstance* card, const Pos& ref) CardGui::CardGui(MTGCardInstance* card, const Pos& ref)
: PlayGuiObject(Height, ref, 0, false), card(card) : PlayGuiObject(Height, ref, 0, false), card(card)
{ {
} }
@@ -69,7 +69,7 @@ float CardView::GetCenterY()
CardView::CardView(const SelectorZone owner, MTGCardInstance* card, float x, float y) CardView::CardView(const SelectorZone owner, MTGCardInstance* card, float x, float y)
: CardGui(card, x, y), owner(owner) : CardGui(card, x, y), owner(owner)
{ {
const Pos* ref = card->view; const Pos* ref = card->view;
while (card) while (card)
@@ -81,7 +81,7 @@ CardView::CardView(const SelectorZone owner, MTGCardInstance* card, float x, flo
} }
CardView::CardView(const SelectorZone owner, MTGCardInstance* card, const Pos& ref) CardView::CardView(const SelectorZone owner, MTGCardInstance* card, const Pos& ref)
: CardGui(card, ref), owner(owner) : CardGui(card, ref), owner(owner)
{ {
const Pos* r = card->view; const Pos* r = card->view;
while (card) while (card)
@@ -238,14 +238,14 @@ void CardGui::Render()
{ {
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255)); quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
//fake border... //fake border...
JQuadPtr fakeborder; JQuadPtr fakeborder;
JQuadPtr highlightborder; JQuadPtr highlightborder;
fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white"); fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white"); highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
if(fakeborder) if(fakeborder)
{ {
fakeborder->SetColor(ARGB((int)(actA),15,15,15)); fakeborder->SetColor(ARGB((int)(actA),15,15,15));
renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16); renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16);
} }
//draw border for highlighting //draw border for highlighting
if (game) if (game)
@@ -253,12 +253,12 @@ void CardGui::Render()
if (card && card->isTargetted() && highlightborder) if (card && card->isTargetted() && highlightborder)
{ {
highlightborder->SetColor(ARGB(95,255,0,0)); highlightborder->SetColor(ARGB(95,255,0,0));
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
} }
if (card && card->isTargetter() && highlightborder) if (card && card->isTargetter() && highlightborder)
{ {
highlightborder->SetColor(ARGB(95,0,245,0)); highlightborder->SetColor(ARGB(95,0,245,0));
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
} }
} }
//draw the card image //draw the card image
@@ -307,7 +307,7 @@ void CardGui::Render()
{ {
if (card && card->isTargetted()) if (card && card->isTargetted())
{ {
if(card->isTapped()) if(card->isTapped())
{ {
if(mHasFocus) if(mHasFocus)
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0));
@@ -348,9 +348,9 @@ void CardGui::Render()
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),216,191,216));//thistle powered down mFont->SetColor(ARGB(static_cast<unsigned char>(actA),216,191,216));//thistle powered down
else if(!card->wasDealtDamage && card->pbonus >= 3) else if(!card->wasDealtDamage && card->pbonus >= 3)
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,0));//yellow buff mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,0));//yellow buff
else if(card->hasType("legendary") && card->hasType("eldrazi")) else if(card->hasType("legendary") && card->hasType("eldrazi") && !card->has(Constants::CHANGELING))
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),238,130,238));//violet legendary eldrazi mFont->SetColor(ARGB(static_cast<unsigned char>(actA),238,130,238));//violet legendary eldrazi
else else
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default
mFont->SetScale(actZ); mFont->SetScale(actZ);
mFont->SetScale(actZ); mFont->SetScale(actZ);
@@ -365,13 +365,27 @@ void CardGui::Render()
buff = "CT"; buff = "CT";
if(!card->isToken && card->isACopier) if(!card->isToken && card->isACopier)
buff = "C"; buff = "C";
if(card->has(Constants::PAYZERO))
if(!alternate && buff != "" && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm... buff += "Z";
{ if(card->alias == 1000)
{
if(card->chooseacolor == 1)
buff += "\n-Green";
else if(card->chooseacolor == 2)
buff += "\n-Blue";
else if(card->chooseacolor == 3)
buff += "\n-Red";
else if(card->chooseacolor == 4)
buff += "\n-Black";
else if(card->chooseacolor == 5)
buff += "\n-White";
}
if(!alternate && buff != "" && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm...
{
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
sprintf(buffer, "%s", buff.c_str()); sprintf(buffer, "%s", buff.c_str());
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,182,193));//Light Pink indicator mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,215,0));//Gold indicator
mFont->SetScale(0.8f); mFont->SetScale(0.8f);
mFont->DrawString(buffer, actX - 10 * actZ, actY - (16 * actZ)); mFont->DrawString(buffer, actX - 10 * actZ, actY - (16 * actZ));
mFont->SetScale(1); mFont->SetScale(1);
@@ -1087,7 +1101,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
//white thin line to simulate card edge //white thin line to simulate card edge
renderer->DrawRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(50,240,240,240)); renderer->DrawRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(50,240,240,240));
} }
//render card image //render card image
renderer->RenderQuad(quad.get(), x, pos.actY-2, pos.actT, scale-0.02f, scale-0.02f); renderer->RenderQuad(quad.get(), x, pos.actY-2, pos.actT, scale-0.02f, scale-0.02f);
} }
else else
+1 -1
View File
@@ -69,7 +69,7 @@ bool Unlockable::tryToUnlock(GameObserver * game) {
string id = getValue("id"); string id = getValue("id");
assert(id.size() > 0); assert(id.size() > 0);
GameOptionAward* goa = (GameOptionAward*) &options[id]; GameOptionAward* goa = (GameOptionAward*) &options[id];
goa->giveAward(); goa->giveAward();
return true; return true;
} }
+29 -1
View File
@@ -76,7 +76,7 @@ int Damage::resolve()
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
if ((_target)->protectedAgainst(source)) if ((_target)->protectedAgainst(source))
damage = 0; damage = 0;
//rulings = 10/4/2004 The damage prevention ability works even if it has no counters, as long as some effect keeps its toughness above zero. //rulings = 10/4/2004 The damage prevention ability works even if it has no counters, as long as some effect keeps its toughness above zero.
//these creature are essentially immune to damage. however 0/-1 effects applied through lords or counters can kill them. //these creature are essentially immune to damage. however 0/-1 effects applied through lords or counters can kill them.
if ((_target)->has(Constants::PROTECTIONFROMCOLOREDSPELLS)) if ((_target)->has(Constants::PROTECTIONFROMCOLOREDSPELLS))
{//damage is prevented as long as the damage source is a spell on the stack... {//damage is prevented as long as the damage source is a spell on the stack...
@@ -126,7 +126,35 @@ int Damage::resolve()
} }
_target->doDamageTest = 1; _target->doDamageTest = 1;
} }
if (target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
{
if(source->has(Constants::LIBRARYEATER) && typeOfDamage == 1)
{
for (int j = damage; j > 0; j--)
{
if(((Player*)target)->game->library->nb_cards)
((Player*)target)->game->putInZone(((Player*)target)->game->library->cards[((Player*)target)->game->library->nb_cards - 1], ((Player*)target)->game->library, ((Player*)target)->game->graveyard);
}
damage = 0;
}
if(source->alias == 89092 && typeOfDamage == 1)//Szadek Lord of Secrets
{
for (int j = damage; j > 0; j--)
{
if(((Player*)target)->game->library->nb_cards)
((Player*)target)->game->putInZone(((Player*)target)->game->library->cards[((Player*)target)->game->library->nb_cards - 1], ((Player*)target)->game->library, ((Player*)target)->game->graveyard);
source->counters->addCounter(1, 1);
}
damage = 0;
}
if (!damage)
{
state = RESOLVED_NOK;
delete (e);
return 0;
}
}
int a = damage; int a = damage;
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (source->has(Constants::WITHER) || source->has( if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (source->has(Constants::WITHER) || source->has(
+13 -13
View File
@@ -69,7 +69,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
menuInitialized = false; menuInitialized = false;
float scrollerWidth = 200.0f; float scrollerWidth = 200.0f;
float scrollerHeight = 28.0f; float scrollerHeight = 28.0f;
mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, DeckMenuConst::kVerticalScrollSpeed); mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, DeckMenuConst::kVerticalScrollSpeed);
mAutoTranslate = true; mAutoTranslate = true;
@@ -94,7 +94,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
mSelectionTargetY = selectionY = DeckMenuConst::kVerticalMargin; mSelectionTargetY = selectionY = DeckMenuConst::kVerticalMargin;
if (NULL == stars) if (NULL == stars)
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get())); stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get()));
stars->FireAt(mX, mY); stars->FireAt(mX, mY);
const string detailedInfoString = _("Detailed Info"); const string detailedInfoString = _("Detailed Info");
@@ -248,11 +248,11 @@ void DeckMenu::Render()
if (currentMenuItem->getY() - DeckMenuConst::kLineHeight * startId < mY + height - DeckMenuConst::kLineHeight + 7) if (currentMenuItem->getY() - DeckMenuConst::kLineHeight * startId < mY + height - DeckMenuConst::kLineHeight + 7)
{ {
// only load stats for visible items in the list // only load stats for visible items in the list
DeckMetaData* metaData = currentMenuItem->getMetaData(); DeckMetaData* metaData = currentMenuItem->getMetaData();
if (metaData && !metaData->mStatsLoaded) if (metaData && !metaData->mStatsLoaded)
{ {
metaData->LoadStats(); metaData->LoadStats();
} }
if (currentMenuItem->hasFocus()) if (currentMenuItem->hasFocus())
{ {
@@ -291,7 +291,7 @@ void DeckMenu::Render()
} }
// fill in the description part of the screen // fill in the description part of the screen
string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID ); string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID );
descriptionFont->SetColor(ARGB(255,255,255,255)); descriptionFont->SetColor(ARGB(255,255,255,255));
descriptionFont->DrawString(text.c_str(), descX, descY); descriptionFont->DrawString(text.c_str(), descX, descY);
@@ -314,19 +314,19 @@ void DeckMenu::Render()
} }
} }
if (!title.empty()) if (!title.empty())
{ {
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER); mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
} }
mScroller->Render(); mScroller->Render();
RenderBackground(); RenderBackground();
RenderDeckManaColors(); RenderDeckManaColors();
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
stars->Render(); stars->Render();
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
} }
@@ -403,11 +403,11 @@ void DeckMenu::updateScroller()
for (vector<Task*>::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++) for (vector<Task*>::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++)
{ {
ostringstream taskDescription; ostringstream taskDescription;
taskDescription << "Credits: " << setw(4) << (*it)->getReward() << " / " taskDescription << "Credits: " << setw(4) << (*it)->getReward() << " / "
<< "Days Left: " << (*it)->getExpiration() << endl << "Days Left: " << (*it)->getExpiration() << endl
<< (*it)->getDesc() << endl << endl; << (*it)->getDesc() << endl << endl;
mScroller->Add(taskDescription.str()); mScroller->Add(taskDescription.str());
} }
} }
+35 -35
View File
@@ -16,33 +16,33 @@ float DeckMenuItem::mYOffset = 0;
DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus, bool autoTranslate, DeckMetaData *deckMetaData) DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus, bool autoTranslate, DeckMetaData *deckMetaData)
: JGuiObject(id), parent(_parent), fontId(fontId), mX(x), mY(y) : JGuiObject(id), parent(_parent), fontId(fontId), mX(x), mY(y)
{ {
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId); WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
mMetaData = deckMetaData; mMetaData = deckMetaData;
mText = trim(text); mText = trim(text);
mIsValidSelection = false; mIsValidSelection = false;
if (autoTranslate) if (autoTranslate)
mText = _(mText); mText = _(mText);
mHasFocus = hasFocus; mHasFocus = hasFocus;
float newImageWidth = 0.0f; float newImageWidth = 0.0f;
if (mMetaData && !mMetaData->getGamesPlayed()) if (mMetaData && !mMetaData->getGamesPlayed())
{ {
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png"); JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
if (tex) if (tex)
{ {
JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle around the texture because of bilinear filtering JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle around the texture because of bilinear filtering
newImageWidth = quad->mWidth; newImageWidth = quad->mWidth;
} }
} }
float titleStringWidth = mFont->GetStringWidth( mText.c_str() ); float titleStringWidth = mFont->GetStringWidth( mText.c_str() );
mTitleResetWidth = (titleStringWidth - newImageWidth )/ 2; mTitleResetWidth = (titleStringWidth - newImageWidth )/ 2;
mScrollEnabled = titleStringWidth > ( ITEM_PX_WIDTH - newImageWidth ); mScrollEnabled = titleStringWidth > ( ITEM_PX_WIDTH - newImageWidth );
mScrollerOffset = 0.0f; mScrollerOffset = 0.0f;
if (hasFocus) if (hasFocus)
{ {
mIsValidSelection = true; mIsValidSelection = true;
Entering(); Entering();
@@ -67,7 +67,7 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
break; break;
} }
default: default:
mImageFilename = "noavatar.jpg"; mImageFilename = "noavatar.jpg";
// do nothing. // do nothing.
break; break;
} }
@@ -75,15 +75,15 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
} }
mDisplayInitialized = false; mDisplayInitialized = false;
} }
void DeckMenuItem::Update(float dt) void DeckMenuItem::Update(float dt)
{ {
mScrollerOffset += kHorizontalScrollSpeed * dt; mScrollerOffset += kHorizontalScrollSpeed * dt;
if ( (mScrollerOffset) > mTitleResetWidth ) if ( (mScrollerOffset) > mTitleResetWidth )
mScrollerOffset = -ITEM_PX_WIDTH; mScrollerOffset = -ITEM_PX_WIDTH;
} }
@@ -93,11 +93,11 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId); WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
if (!( mHasFocus && mScrollEnabled )) if (!( mHasFocus && mScrollEnabled ))
mScrollerOffset = 0; mScrollerOffset = 0;
if (!mHasFocus && mScrollEnabled) if (!mHasFocus && mScrollEnabled)
mScrollerOffset = -1 * ( getWidth() - ITEM_PX_WIDTH )/2; mScrollerOffset = -1 * ( getWidth() - ITEM_PX_WIDTH )/2;
float offSet = mScrollerOffset; float offSet = mScrollerOffset;
if (mHasFocus) if (mHasFocus)
mFont->SetScale(SCALE_SELECTED); mFont->SetScale(SCALE_SELECTED);
@@ -105,8 +105,8 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
mFont->SetScale(SCALE_NORMAL); mFont->SetScale(SCALE_NORMAL);
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER, offSet, ITEM_PX_WIDTH); mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER, offSet, ITEM_PX_WIDTH);
mDisplayInitialized = true; mDisplayInitialized = true;
//Render a "new" icon for decks that have never been played yet //Render a "new" icon for decks that have never been played yet
if (mMetaData && !mMetaData->getGamesPlayed()) if (mMetaData && !mMetaData->getGamesPlayed())
{ {
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png"); JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
@@ -128,7 +128,7 @@ void DeckMenuItem::Render()
void DeckMenuItem::checkUserClick() void DeckMenuItem::checkUserClick()
{ {
int x1 = -1, y1 = -1; int x1 = -1, y1 = -1;
if (mEngine->GetLeftClickCoordinates(x1, y1)) if (mEngine->GetLeftClickCoordinates(x1, y1))
{ {
mIsValidSelection = false; mIsValidSelection = false;
@@ -136,8 +136,8 @@ void DeckMenuItem::checkUserClick()
if ( (x1 >= x2) && (x1 <= (x2 + ITEM_PX_WIDTH)) && (y1 >= y2) && (y1 < (y2 + kItemYHeight))) if ( (x1 >= x2) && (x1 <= (x2 + ITEM_PX_WIDTH)) && (y1 >= y2) && (y1 < (y2 + kItemYHeight)))
mIsValidSelection = true; mIsValidSelection = true;
} }
else else
mIsValidSelection = true; mIsValidSelection = true;
} }
@@ -175,14 +175,14 @@ float DeckMenuItem::getWidth() const
string DeckMenuItem::getDeckName() const string DeckMenuItem::getDeckName() const
{ {
if (mMetaData) if (mMetaData)
return mMetaData->getName(); return mMetaData->getName();
std::string s; std::string s;
std::stringstream out; std::stringstream out;
out << mMetaData->getDeckId(); out << mMetaData->getDeckId();
s = out.str(); s = out.str();
return "[deck" + s + "]"; return "[deck" + s + "]";
} }
ostream& DeckMenuItem::toString(ostream& out) const ostream& DeckMenuItem::toString(ostream& out) const
+2 -2
View File
@@ -394,9 +394,9 @@ void StatsWrapper::updateStats(string filename, MTGAllCards *collection)
void StatsWrapper::updateStats(DeckDataWrapper *myDeck) void StatsWrapper::updateStats(DeckDataWrapper *myDeck)
{ {
if (!this->needUpdate || !myDeck) return; if (!this->needUpdate || !myDeck) return;
this->needUpdate = false; this->needUpdate = false;
this->cardCount = myDeck->getCount(WSrcDeck::UNFILTERED_COPIES); this->cardCount = myDeck->getCount(WSrcDeck::UNFILTERED_COPIES);
this->countLands = myDeck->getCount(Constants::MTG_COLOR_LAND); this->countLands = myDeck->getCount(Constants::MTG_COLOR_LAND);
this->totalPrice = myDeck->totalPrice(); this->totalPrice = myDeck->totalPrice();
+5 -5
View File
@@ -89,7 +89,7 @@ DuelLayers::DuelLayers(GameObserver* go, int playerViewIndex) :
nbitems(0), mPlayerViewIndex(playerViewIndex) nbitems(0), mPlayerViewIndex(playerViewIndex)
{ {
observer = go; observer = go;
observer->mLayers = this; observer->mLayers = this;
mCardSelector = NEW CardSelector(go, this); mCardSelector = NEW CardSelector(go, this);
//1 Action Layer //1 Action Layer
action = NEW ActionLayer(go); action = NEW ActionLayer(go);
@@ -98,8 +98,8 @@ DuelLayers::DuelLayers(GameObserver* go, int playerViewIndex) :
//Other display elements //Other display elements
action->Add(NEW HUDDisplay(go, -1)); action->Add(NEW HUDDisplay(go, -1));
Add(NEW GuiMana(20, 20, getRenderedPlayerOpponent())); Add(NEW GuiMana(20, 20, getRenderedPlayerOpponent()));
Add(NEW GuiMana(440, 20, getRenderedPlayer())); Add(NEW GuiMana(440, 20, getRenderedPlayer()));
Add(stack = NEW ActionStack(go)); Add(stack = NEW ActionStack(go));
Add(combat = NEW GuiCombat(go)); Add(combat = NEW GuiCombat(go));
Add(action); Add(action);
@@ -216,10 +216,10 @@ float DuelLayers::RightBoundary()
Player* DuelLayers::getRenderedPlayer() Player* DuelLayers::getRenderedPlayer()
{ {
return observer->players[mPlayerViewIndex]; return observer->players[mPlayerViewIndex];
}; };
Player* DuelLayers::getRenderedPlayerOpponent() Player* DuelLayers::getRenderedPlayerOpponent()
{ {
return observer->players[mPlayerViewIndex]->opponent(); return observer->players[mPlayerViewIndex]->opponent();
}; };
+2 -2
View File
@@ -77,7 +77,7 @@ GameApp::GameApp() :
mCurrentState = NULL; mCurrentState = NULL;
mNextState = NULL; mNextState = NULL;
rules = 0; rules = 0;
music = NULL; music = NULL;
} }
@@ -156,7 +156,7 @@ void GameApp::Create()
//Setup Cache before calling any gfx/sfx functions //Setup Cache before calling any gfx/sfx functions
WResourceManager::Instance()->ResetCacheLimits(); WResourceManager::Instance()->ResetCacheLimits();
LOG("Checking for music files"); LOG("Checking for music files");
+130 -166
View File
@@ -165,18 +165,18 @@ void GameObserver::nextGamePhase()
{ {
Phase * cPhaseOld = phaseRing->getCurrentPhase(); Phase * cPhaseOld = phaseRing->getCurrentPhase();
if (cPhaseOld->id == MTG_PHASE_COMBATDAMAGE) if (cPhaseOld->id == MTG_PHASE_COMBATDAMAGE)
if ((FIRST_STRIKE == combatStep) || (END_FIRST_STRIKE == combatStep) || (DAMAGE == combatStep)) if ((FIRST_STRIKE == combatStep) || (END_FIRST_STRIKE == combatStep) || (DAMAGE == combatStep))
{ {
nextCombatStep(); nextCombatStep();
return; return;
} }
if (cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS) if (cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS)
if (BLOCKERS == combatStep || TRIGGERS == combatStep) if (BLOCKERS == combatStep || TRIGGERS == combatStep)
{ {
nextCombatStep(); nextCombatStep();
return; return;
} }
phaseRing->forward(); phaseRing->forward();
@@ -191,12 +191,12 @@ void GameObserver::nextGamePhase()
mCurrentGamePhase = cPhase->id; mCurrentGamePhase = cPhase->id;
if (MTG_PHASE_COMBATDAMAGE == mCurrentGamePhase) if (MTG_PHASE_COMBATDAMAGE == mCurrentGamePhase)
nextCombatStep(); nextCombatStep();
if (MTG_PHASE_COMBATEND == mCurrentGamePhase) if (MTG_PHASE_COMBATEND == mCurrentGamePhase)
combatStep = BLOCKERS; combatStep = BLOCKERS;
//if (currentPlayer != cPhase->player) //if (currentPlayer != cPhase->player)
// nextPlayer();//depreciated; we call this at EOT step now. unsure what the purpose of this was originally.fix for a bug? // nextPlayer();//depreciated; we call this at EOT step now. unsure what the purpose of this was originally.fix for a bug?
//init begin of turn //init begin of turn
if (mCurrentGamePhase == MTG_PHASE_BEFORE_BEGIN) if (mCurrentGamePhase == MTG_PHASE_BEFORE_BEGIN)
@@ -229,8 +229,8 @@ void GameObserver::nextGamePhase()
handmodified = currentPlayer->handsize+currentPlayer->handmodifier; 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
if(handmodified < 0) if(handmodified < 0)
handmodified = 0; handmodified = 0;
while (currentPlayer->game->hand->nb_cards > handmodified && currentPlayer->nomaxhandsize == false) 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);
@@ -312,16 +312,16 @@ void GameObserver::userRequestNextGamePhase(bool allowInterrupt, bool log)
cardClick(getCurrentTargetChooser()->source, 0, false); cardClick(getCurrentTargetChooser()->source, 0, false);
} }
if (allowInterrupt && mLayers->stackLayer()->getNext(NULL, 0, NOT_RESOLVED)) if (allowInterrupt && mLayers->stackLayer()->getNext(NULL, 0, NOT_RESOLVED))
return; return;
if (getCurrentTargetChooser()) if (getCurrentTargetChooser())
return; return;
//if (mLayers->actionLayer()->isWaitingForAnswer()) //if (mLayers->actionLayer()->isWaitingForAnswer())
// return; // return;
// Wil 12/5/10: additional check, not quite understanding why TargetChooser doesn't seem active at this point. // Wil 12/5/10: additional check, not quite understanding why TargetChooser doesn't seem active at this point.
// If we deem that an extra cost payment needs to be made, don't allow the next game phase to proceed. // If we deem that an extra cost payment needs to be made, don't allow the next game phase to proceed.
// Here's what I find weird - if the extra cost is something like a sacrifice, doesn't that imply a TargetChooser? // Here's what I find weird - if the extra cost is something like a sacrifice, doesn't that imply a TargetChooser?
if (WaitForExtraPayment(NULL)) if (WaitForExtraPayment(NULL))
return; return;
Phase * cPhaseOld = phaseRing->getCurrentPhase(); Phase * cPhaseOld = phaseRing->getCurrentPhase();
if (allowInterrupt && ((cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER) if (allowInterrupt && ((cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER)
@@ -329,7 +329,7 @@ void GameObserver::userRequestNextGamePhase(bool allowInterrupt, bool log)
|| (cPhaseOld->id == MTG_PHASE_COMBATDAMAGE) || (cPhaseOld->id == MTG_PHASE_COMBATDAMAGE)
|| opponent()->isAI() || opponent()->isAI()
|| options[Options::optionInterrupt(mCurrentGamePhase)].number || options[Options::optionInterrupt(mCurrentGamePhase)].number
|| currentPlayer->offerInterruptOnPhase - 1 == mCurrentGamePhase || currentPlayer->offerInterruptOnPhase - 1 == mCurrentGamePhase
)) ))
{ {
mLayers->stackLayer()->AddNextGamePhase(); mLayers->stackLayer()->AddNextGamePhase();
@@ -577,7 +577,7 @@ void GameObserver::Update(float dt)
} }
currentActionPlayer = player; currentActionPlayer = player;
if (isInterrupting) if (isInterrupting)
player = isInterrupting; player = isInterrupting;
if(mLayers) if(mLayers)
{ {
mLayers->Update(dt, player); mLayers->Update(dt, player);
@@ -597,7 +597,7 @@ void GameObserver::gameStateBasedEffects()
{ {
if(getCurrentTargetChooser() && int(getCurrentTargetChooser()->getNbTargets()) == getCurrentTargetChooser()->maxtargets) if(getCurrentTargetChooser() && int(getCurrentTargetChooser()->getNbTargets()) == getCurrentTargetChooser()->maxtargets)
getCurrentTargetChooser()->done = true; getCurrentTargetChooser()->done = true;
///////////////////////////////////// /////////////////////////////////////
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, players[d]->game->exile }; MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile };
@@ -608,8 +608,8 @@ void GameObserver::gameStateBasedEffects()
{ {
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
@@ -885,9 +885,6 @@ void GameObserver::gameStateBasedEffects()
// plus modify costs // // plus modify costs //
///////////////////////////// /////////////////////////////
Affinity(); Affinity();
//trinisphere? buggy...
//ComputeTrinisphere();
//end trinisphere
///////////////////////////////////// /////////////////////////////////////
// Check colored statuses on cards // // Check colored statuses on cards //
///////////////////////////////////// /////////////////////////////////////
@@ -979,10 +976,14 @@ void GameObserver::Affinity()
//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();
ManaCost * alternate = NEW ManaCost(); ManaCost * alternate = NEW ManaCost();
ManaCost * buyback = NEW ManaCost();
ManaCost * flashback = NEW ManaCost();
ManaCost * retrace = NEW ManaCost();
original->copy(card->model->data->getManaCost()); original->copy(card->model->data->getManaCost());
alternate->copy(card->model->data->getManaCost()->getAlternative()); alternate->copy(card->model->data->getManaCost()->getAlternative());
if (card->has(Constants::PAYZERO)) buyback->copy(card->model->data->getManaCost()->getBuyback());
original = ManaCost::parseManaCost("{0}",NULL,card);//can't figure out 2 or more alternative... flashback->copy(card->model->data->getManaCost()->getFlashback());
retrace->copy(card->model->data->getManaCost()->getRetrace());
//have to run alter cost before affinity or the 2 cancel each other out. //have to run alter cost before affinity or the 2 cancel each other out.
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost()) if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
{ {
@@ -995,10 +996,22 @@ void GameObserver::Affinity()
{ {
alternate->add(kc,card->getIncreasedManaCost()->getCost(kc)); alternate->add(kc,card->getIncreasedManaCost()->getCost(kc));
} }
if (card->getManaCost()->getBuyback())
{
buyback->add(kc,card->getIncreasedManaCost()->getCost(kc));
}
if (card->getManaCost()->getFlashback())
{
flashback->add(kc,card->getIncreasedManaCost()->getCost(kc));
}
if (card->getManaCost()->getRetrace())
{
retrace->add(kc,card->getIncreasedManaCost()->getCost(kc));
}
} }
} }
if(card->getReducedManaCost()->getConvertedCost()) if(card->getReducedManaCost()->getConvertedCost())
{ {
original->remove(card->getReducedManaCost()); original->remove(card->getReducedManaCost());
for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++) for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++)
{ {
@@ -1006,12 +1019,30 @@ void GameObserver::Affinity()
{ {
alternate->remove(kc,card->getReducedManaCost()->getCost(kc)); alternate->remove(kc,card->getReducedManaCost()->getCost(kc));
} }
if (card->getManaCost()->getBuyback())
{
buyback->remove(kc,card->getIncreasedManaCost()->getCost(kc));
}
if (card->getManaCost()->getFlashback())
{
flashback->remove(kc,card->getIncreasedManaCost()->getCost(kc));
}
if (card->getManaCost()->getRetrace())
{
retrace->remove(kc,card->getIncreasedManaCost()->getCost(kc));
}
} }
} }
if(card->getManaCost()) if(card->getManaCost())
card->getManaCost()->copy(original); card->getManaCost()->copy(original);
if(card->getManaCost()->getAlternative()) if(card->getManaCost()->getAlternative())
card->getManaCost()->setAlternative(alternate); card->getManaCost()->setAlternative(alternate);
if(card->getManaCost()->getBuyback())
card->getManaCost()->setBuyback(buyback);
if(card->getManaCost()->getFlashback())
card->getManaCost()->setFlashback(flashback);
if(card->getManaCost()->getRetrace())
card->getManaCost()->setRetrace(retrace);
if(card->getManaCost()->extraCosts) if(card->getManaCost()->extraCosts)
{ {
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++) for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
@@ -1068,7 +1099,8 @@ void GameObserver::Affinity()
card->has(Constants::AFFINITYISLAND)|| card->has(Constants::AFFINITYISLAND)||
card->has(Constants::AFFINITYMOUNTAIN)|| card->has(Constants::AFFINITYMOUNTAIN)||
card->has(Constants::AFFINITYPLAINS)|| card->has(Constants::AFFINITYPLAINS)||
card->has(Constants::AFFINITYSWAMP)){ card->has(Constants::AFFINITYSWAMP))
{
if (card->has(Constants::AFFINITYARTIFACTS)) if (card->has(Constants::AFFINITYARTIFACTS))
{ {
type = "artifact"; type = "artifact";
@@ -1123,94 +1155,26 @@ void GameObserver::Affinity()
if(card->getManaCost()->getCost(color) > 0) if(card->getManaCost()->getCost(color) > 0)
card->getManaCost()->remove(color,1); card->getManaCost()->remove(color,1);
} }
}
}
SAFE_DELETE(original); SAFE_DELETE(original);
SAFE_DELETE(alternate);
SAFE_DELETE(buyback);
SAFE_DELETE(flashback);
SAFE_DELETE(retrace);
}//end }//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]);
}
}
}
}
}
}
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)
mLayers->Render(); mLayers->Render();
if (targetChooser || (mLayers && mLayers->actionLayer()->isWaitingForAnswer())) if (targetChooser || (mLayers && mLayers->actionLayer()->isWaitingForAnswer()))
JRenderer::GetInstance()->DrawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(255,255,0,0)); JRenderer::GetInstance()->DrawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(255,255,0,0));
if (mExtraPayment) if (mExtraPayment)
mExtraPayment->Render(); mExtraPayment->Render();
for (size_t i = 0; i < players.size(); ++i) for (size_t i = 0; i < players.size(); ++i)
{ {
@@ -1294,7 +1258,7 @@ void GameObserver::stackObjectClicked(Interruptible * action)
{ {
int reaction = mLayers->actionLayer()->isReactingToTargetClick(action); int reaction = mLayers->actionLayer()->isReactingToTargetClick(action);
if (reaction == -1) if (reaction == -1)
mLayers->actionLayer()->reactToTargetClick(action); mLayers->actionLayer()->reactToTargetClick(action);
} }
} }
@@ -1374,7 +1338,7 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
MTGCardInstance* backup = NULL; MTGCardInstance* backup = NULL;
if (!card) { if (!card) {
clickedPlayer = ((Player *) object); clickedPlayer = ((Player *) object);
} else { } else {
backup = card; backup = card;
zone = card->currentZone; zone = card->currentZone;
@@ -1488,7 +1452,7 @@ int GameObserver::cardClick(MTGCardInstance * card, Targetable * object, bool lo
//Current player's hand //Current player's hand
handmodified = currentPlayer->handsize+currentPlayer->handmodifier; handmodified = currentPlayer->handsize+currentPlayer->handmodifier;
if(handmodified < 0) if(handmodified < 0)
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 > handmodified && currentPlayer->nomaxhandsize == false) && currentPlayer->game->hand->nb_cards > handmodified && currentPlayer->nomaxhandsize == false)
{ {
@@ -1528,9 +1492,9 @@ int GameObserver::untap(MTGCardInstance * card)
return 0; return 0;
} }
if (card->has(Constants::DOESNOTUNTAP)) if (card->has(Constants::DOESNOTUNTAP))
return 0; return 0;
if (card->frozen > 0) if (card->frozen > 0)
return 0; return 0;
card->attemptUntap(); card->attemptUntap();
return 1; return 1;
} }
@@ -1552,7 +1516,7 @@ int GameObserver::isInPlay(MTGCardInstance * card)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (players[i]->game->isInPlay(card)) if (players[i]->game->isInPlay(card))
return 1; return 1;
} }
return 0; return 0;
} }
@@ -1593,10 +1557,10 @@ void GameObserver::untapPhase()
int GameObserver::receiveEvent(WEvent * e) int GameObserver::receiveEvent(WEvent * e)
{ {
if (!e) if (!e)
return 0; return 0;
eventsQueue.push(e); eventsQueue.push(e);
if (eventsQueue.size() > 1) if (eventsQueue.size() > 1)
return -1; //resolving events can generate more events return -1; //resolving events can generate more events
int result = 0; int result = 0;
while (eventsQueue.size()) while (eventsQueue.size())
{ {
@@ -1615,7 +1579,7 @@ int GameObserver::receiveEvent(WEvent * e)
Player * GameObserver::currentlyActing() Player * GameObserver::currentlyActing()
{ {
if (isInterrupting) if (isInterrupting)
return isInterrupting; return isInterrupting;
return currentActionPlayer; return currentActionPlayer;
} }
@@ -1708,7 +1672,7 @@ bool GameObserver::load(const string& ss, bool undo, int controlledPlayerIndex
) )
{ {
bool currentPlayerSet = false; bool currentPlayerSet = false;
int state = -1; int state = -1;
string s; string s;
stringstream stream(ss); stringstream stream(ss);
@@ -1727,7 +1691,7 @@ bool GameObserver::load(const string& ss, bool undo, int controlledPlayerIndex
if (s.find("seed ") == 0) if (s.find("seed ") == 0)
{ {
mSeed = atoi(s.substr(5).c_str()); mSeed = atoi(s.substr(5).c_str());
randomGenerator.setSeed(mSeed); randomGenerator.setSeed(mSeed);
continue; continue;
} }
if (s.find("rvalues:") == 0) if (s.find("rvalues:") == 0)
@@ -1796,7 +1760,7 @@ bool GameObserver::load(const string& ss, bool undo, int controlledPlayerIndex
case 3: case 3:
if (s.compare("[end]") == 0) if (s.compare("[end]") == 0)
{ {
turn = 0; turn = 0;
mLayers = NEW DuelLayers(this, controlledPlayerIndex); mLayers = NEW DuelLayers(this, controlledPlayerIndex);
currentPlayer = players[currentPlayerId]; currentPlayer = players[currentPlayerId];
phaseRing = NEW PhaseRing(this); phaseRing = NEW PhaseRing(this);
@@ -1885,7 +1849,7 @@ bool GameObserver::processAction(const string& s)
DebugTrace("no clue about: " + s); DebugTrace("no clue about: " + s);
} }
return true; return true;
} }
bool GameObserver::processActions(bool undo bool GameObserver::processActions(bool undo
@@ -1926,7 +1890,7 @@ bool GameObserver::processActions(bool undo
for(loadingite = loadingList.begin(); loadingite != loadingList.end(); loadingite++, cmdIndex++) for(loadingite = loadingList.begin(); loadingite != loadingList.end(); loadingite++, cmdIndex++)
{ {
processAction(*loadingite); processAction(*loadingite);
size_t nb = actionsList.size(); size_t nb = actionsList.size();
@@ -2006,7 +1970,7 @@ Player* GameObserver::createPlayer(const string& playerMode
) )
{ {
Player::Mode aMode = (Player::Mode)atoi(playerMode.c_str()); Player::Mode aMode = (Player::Mode)atoi(playerMode.c_str());
Player* pPlayer = 0; Player* pPlayer = 0;
switch(aMode) switch(aMode)
{ {
@@ -2030,12 +1994,12 @@ Player* GameObserver::createPlayer(const string& playerMode
break; break;
} }
if(pPlayer) if(pPlayer)
{ {
players.push_back(pPlayer); players.push_back(pPlayer);
} }
return pPlayer; return pPlayer;
} }
#ifdef TESTSUITE #ifdef TESTSUITE
@@ -2081,7 +2045,7 @@ void GameObserver::loadPlayer(int playerId, PlayerType playerType, int decknb, b
loadPlayer(playerId, NEW HumanPlayer(this, deckFile, deckFileSmall, premadeDeck)); loadPlayer(playerId, NEW HumanPlayer(this, deckFile, deckFileSmall, premadeDeck));
} }
} }
else else
{ //AI Player, chooses deck { //AI Player, chooses deck
AIPlayerFactory playerCreator; AIPlayerFactory playerCreator;
@@ -2117,43 +2081,43 @@ void GameObserver::loadPlayer(int playerId, PlayerType playerType, int decknb, b
#ifdef NETWORK_SUPPORT #ifdef NETWORK_SUPPORT
NetworkGameObserver::NetworkGameObserver(JNetwork* pNetwork, WResourceManager* output, JGE* input) NetworkGameObserver::NetworkGameObserver(JNetwork* pNetwork, WResourceManager* output, JGE* input)
: GameObserver(output, input), mpNetworkSession(pNetwork), mSynchronized(false) : GameObserver(output, input), mpNetworkSession(pNetwork), mSynchronized(false)
{ {
mpNetworkSession->registerCommand("loadPlayer", this, loadPlayer, ignoreResponse); mpNetworkSession->registerCommand("loadPlayer", this, loadPlayer, ignoreResponse);
mpNetworkSession->registerCommand("synchronize", this, synchronize, checkSynchro); mpNetworkSession->registerCommand("synchronize", this, synchronize, checkSynchro);
mpNetworkSession->registerCommand("sendAction", this, sendAction, checkSynchro); mpNetworkSession->registerCommand("sendAction", this, sendAction, checkSynchro);
mpNetworkSession->registerCommand("disconnect", this, disconnect, ignoreResponse); mpNetworkSession->registerCommand("disconnect", this, disconnect, ignoreResponse);
} }
NetworkGameObserver::~NetworkGameObserver() NetworkGameObserver::~NetworkGameObserver()
{ {
mpNetworkSession->sendCommand("disconnect", ""); mpNetworkSession->sendCommand("disconnect", "");
} }
void NetworkGameObserver::disconnect(void*pxThis, stringstream&, stringstream&) void NetworkGameObserver::disconnect(void*pxThis, stringstream&, stringstream&)
{ {
NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis; NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis;
pThis->setLoser(pThis->getView()->getRenderedPlayerOpponent()); pThis->setLoser(pThis->getView()->getRenderedPlayerOpponent());
} }
void NetworkGameObserver::Update(float dt) void NetworkGameObserver::Update(float dt)
{ {
mpNetworkSession->Update(); mpNetworkSession->Update();
::GameObserver::Update(dt); ::GameObserver::Update(dt);
} }
void NetworkGameObserver::loadPlayer(int playerId, Player* player) void NetworkGameObserver::loadPlayer(int playerId, Player* player)
{ {
GameObserver::loadPlayer(playerId, player); GameObserver::loadPlayer(playerId, player);
stringstream out; stringstream out;
out << *player; out << *player;
mpNetworkSession->sendCommand("loadPlayer", out.str()); mpNetworkSession->sendCommand("loadPlayer", out.str());
} }
void NetworkGameObserver::loadPlayer(void*pxThis, stringstream& in, stringstream&) void NetworkGameObserver::loadPlayer(void*pxThis, stringstream& in, stringstream&)
{ {
NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis; NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis;
Player* pPlayer = 0; Player* pPlayer = 0;
string s; string s;
while(std::getline(in, s)) while(std::getline(in, s))
@@ -2176,50 +2140,50 @@ void NetworkGameObserver::loadPlayer(void*pxThis, stringstream& in, stringstream
void NetworkGameObserver::synchronize() void NetworkGameObserver::synchronize()
{ {
if(!mSynchronized && mpNetworkSession->isServer()) if(!mSynchronized && mpNetworkSession->isServer())
{ {
stringstream out; stringstream out;
out << *this; out << *this;
mpNetworkSession->sendCommand("synchronize", out.str()); mpNetworkSession->sendCommand("synchronize", out.str());
mSynchronized = true; mSynchronized = true;
} }
} }
void NetworkGameObserver::synchronize(void*pxThis, stringstream& in, stringstream& out) void NetworkGameObserver::synchronize(void*pxThis, stringstream& in, stringstream& out)
{ {
NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis; NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis;
// now, we need to load the game from player 2's perspective // now, we need to load the game from player 2's perspective
pThis->load(in.str(), false, 1); pThis->load(in.str(), false, 1);
out << *pThis; out << *pThis;
} }
void NetworkGameObserver::checkSynchro(void*pxThis, stringstream& in, stringstream&) void NetworkGameObserver::checkSynchro(void*pxThis, stringstream& in, stringstream&)
{ {
NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis; NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis;
GameObserver aGame; GameObserver aGame;
aGame.mRules = pThis->mRules; aGame.mRules = pThis->mRules;
aGame.load(in.str()); aGame.load(in.str());
assert(aGame == *pThis); assert(aGame == *pThis);
} }
void NetworkGameObserver::sendAction(void*pxThis, stringstream& in, stringstream&) void NetworkGameObserver::sendAction(void*pxThis, stringstream& in, stringstream&)
{ {
NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis; NetworkGameObserver* pThis = (NetworkGameObserver*)pxThis;
pThis->mForwardAction = false; pThis->mForwardAction = false;
pThis->processAction(in.str()); pThis->processAction(in.str());
pThis->mForwardAction = true; pThis->mForwardAction = true;
//out << *pThis; //out << *pThis;
} }
void NetworkGameObserver::logAction(const string& s) void NetworkGameObserver::logAction(const string& s)
{ {
GameObserver::logAction(s); GameObserver::logAction(s);
if(mForwardAction) if(mForwardAction)
mpNetworkSession->sendCommand("sendAction", s); mpNetworkSession->sendCommand("sendAction", s);
} }
#endif #endif
+12 -12
View File
@@ -18,8 +18,8 @@ const string Options::optionNames[] = {
"sfxVolume", "sfxVolume",
"difficulty", "difficulty",
"cheatmode", "cheatmode",
"optimizedhand", "optimizedhand",
"cheatmodedecks", "cheatmodedecks",
"displayOSD", "displayOSD",
"closed_hand", "closed_hand",
"hand_direction", "hand_direction",
@@ -352,11 +352,11 @@ int GameOptions::load()
} }
// (PSY) Make sure that cheatmode is switched off for ineligible profiles: // (PSY) Make sure that cheatmode is switched off for ineligible profiles:
if (options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE) if (options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE)
{ {
(*this)[Options::CHEATMODE].number = 0; (*this)[Options::CHEATMODE].number = 0;
(*this)[Options::OPTIMIZE_HAND].number = 0; (*this)[Options::OPTIMIZE_HAND].number = 0;
(*this)[Options::CHEATMODEAIDECK].number = 0; (*this)[Options::CHEATMODEAIDECK].number = 0;
} }
//Default values. Anywhere else to put those ? //Default values. Anywhere else to put those ?
if (!(*this)[Options::MAX_GRADE].number) if (!(*this)[Options::MAX_GRADE].number)
@@ -371,11 +371,11 @@ int GameOptions::save()
{ {
// (PSY) Make sure that cheatmode is switched off for ineligible profiles: // (PSY) Make sure that cheatmode is switched off for ineligible profiles:
if (options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE) if (options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE)
{ {
(*this)[Options::CHEATMODE].number = 0; (*this)[Options::CHEATMODE].number = 0;
(*this)[Options::OPTIMIZE_HAND].number = 0; (*this)[Options::OPTIMIZE_HAND].number = 0;
(*this)[Options::CHEATMODEAIDECK].number = 0; (*this)[Options::CHEATMODEAIDECK].number = 0;
} }
std::ofstream file; std::ofstream file;
if (JFileSystem::GetInstance()->openForWrite(file, mFilename)) if (JFileSystem::GetInstance()->openForWrite(file, mFilename))
@@ -997,9 +997,9 @@ OptionManaDisplay::OptionManaDisplay()
{ {
mDef.values.push_back(EnumDefinition::assoc(DYNAMIC, "Eye candy")); mDef.values.push_back(EnumDefinition::assoc(DYNAMIC, "Eye candy"));
mDef.values.push_back(EnumDefinition::assoc(STATIC, "Simple")); mDef.values.push_back(EnumDefinition::assoc(STATIC, "Simple"));
mDef.values.push_back(EnumDefinition::assoc(NOSTARSDYNAMIC, "No Glitter")); mDef.values.push_back(EnumDefinition::assoc(NOSTARSDYNAMIC, "No Glitter"));
mDef.values.push_back(EnumDefinition::assoc(BOTH, "Both"));//no luck in getting this to show up as an option. mDef.values.push_back(EnumDefinition::assoc(BOTH, "Both"));//no luck in getting this to show up as an option.
//Both should still work as always however the enum and this dont want to pair up, no "both" in options now. //Both should still work as always however the enum and this dont want to pair up, no "both" in options now.
} }
; ;
OptionVolume OptionVolume::mDef; OptionVolume OptionVolume::mDef;
+2 -2
View File
@@ -70,7 +70,7 @@ vector<DeckMetaData *> GameState::BuildDeckList(const string& path, const string
{ {
std::ostringstream aiStatsDeckName; std::ostringstream aiStatsDeckName;
aiStatsDeckName << smallDeckPrefix << "_deck" << nbDecks; aiStatsDeckName << smallDeckPrefix << "_deck" << nbDecks;
meta->mStatsFilename = aiStatsDeckName.str(); meta->mStatsFilename = aiStatsDeckName.str();
meta->mIsAI = true; meta->mIsAI = true;
if (meta->mPlayerDeck != statsPlayer->GetCurrentDeckStatsFile()) if (meta->mPlayerDeck != statsPlayer->GetCurrentDeckStatsFile())
{ {
@@ -100,7 +100,7 @@ vector<DeckMetaData *> GameState::BuildDeckList(const string& path, const string
meta = NULL; meta = NULL;
} }
std::sort(retList.begin(), retList.end(), sortByName); std::sort(retList.begin(), retList.end(), sortByName);
return retList; return retList;
} }
+1 -1
View File
@@ -1095,7 +1095,7 @@ void GameStateDuel::Render()
char buf[4096]; char buf[4096];
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
int elapsedTime = testSuite->getElapsedTime(); int elapsedTime = testSuite->getElapsedTime();
sprintf(buf, "Time to run the tests: %is", elapsedTime/1000); sprintf(buf, "Time to run the tests: %is", elapsedTime/1000);
mFont->DrawString(buf,0,SCREEN_HEIGHT/2 - 20); mFont->DrawString(buf,0,SCREEN_HEIGHT/2 - 20);
+14 -14
View File
@@ -481,7 +481,7 @@ void GameStateMenu::Update(float dt)
mParent->mpNetwork->connect(mParent->mServerAddress); mParent->mpNetwork->connect(mParent->mServerAddress);
// we let the server choose the game mode // we let the server choose the game mode
mParent->gameType = GAME_TYPE_SLAVE; mParent->gameType = GAME_TYPE_SLAVE;
// just to select one, the HOST is in control here. // just to select one, the HOST is in control here.
mParent->rules = Rules::getRulesByFilename("classic.txt"); mParent->rules = Rules::getRulesByFilename("classic.txt");
hasChosenGameType = true; hasChosenGameType = true;
subMenuController->Close(); subMenuController->Close();
@@ -599,16 +599,16 @@ void GameStateMenu::Update(float dt)
case MENU_STATE_NETWORK_DEFINE: case MENU_STATE_NETWORK_DEFINE:
if(MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR)) if(MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR))
{ {
currentState = MENU_STATE_MAJOR_SUBMENU; currentState = MENU_STATE_MAJOR_SUBMENU;
subMenuController = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), MENU_FIRST_DUEL_SUBMENU, this, Fonts::MENU_FONT, 150, 60); subMenuController = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), MENU_FIRST_DUEL_SUBMENU, this, Fonts::MENU_FONT, 150, 60);
if (subMenuController) if (subMenuController)
{ {
subMenuController->Add(SUBMENUITEM_HOST_GAME, "Host a game"); subMenuController->Add(SUBMENUITEM_HOST_GAME, "Host a game");
subMenuController->Add(SUBMENUITEM_JOIN_GAME, "Join a game"); subMenuController->Add(SUBMENUITEM_JOIN_GAME, "Join a game");
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel"); subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
} }
} }
break; break;
case MENU_STATE_NETWORK_WAIT: case MENU_STATE_NETWORK_WAIT:
if(MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR)) if(MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR))
{ {
@@ -619,9 +619,9 @@ void GameStateMenu::Update(float dt)
} }
else if(!subMenuController) else if(!subMenuController)
{ {
string aString; string aString;
mParent->mpNetwork->getServerIp(aString); mParent->mpNetwork->getServerIp(aString);
aString = "Waiting for connection to " + aString; aString = "Waiting for connection to " + aString;
subMenuController = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), MENU_FIRST_DUEL_SUBMENU, this, Fonts::MENU_FONT, 150, 60, aString.c_str()); subMenuController = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), MENU_FIRST_DUEL_SUBMENU, this, Fonts::MENU_FONT, 150, 60, aString.c_str());
if (subMenuController) if (subMenuController)
@@ -918,7 +918,7 @@ void GameStateMenu::ButtonPressed(int controllerId, int controlId)
subMenuController->Close(); subMenuController->Close();
} }
#ifdef NETWORK_SUPPORT #ifdef NETWORK_SUPPORT
SAFE_DELETE(mParent->mpNetwork); SAFE_DELETE(mParent->mpNetwork);
#endif //NETWORK_SUPPORT #endif //NETWORK_SUPPORT
currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_SUBMENU_CLOSING; currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_SUBMENU_CLOSING;
break; break;
+2 -2
View File
@@ -81,8 +81,8 @@ void GameStateOptions::Start()
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, GameStateOptionsConst::kNewProfileID, this)); optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, GameStateOptionsConst::kNewProfileID, this));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode"))); optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode")));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand"))); optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODEAIDECK, "Unlock All Ai Decks"))); optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODEAIDECK, "Unlock All Ai Decks")));
optionsTabs->Add(optionsList); optionsTabs->Add(optionsList);
+3 -3
View File
@@ -627,12 +627,12 @@ void GameStateShop::Update(float dt)
else if (btn == JGE_BTN_CANCEL) else if (btn == JGE_BTN_CANCEL)
options[Options::DISABLECARDS].number = !options[Options::DISABLECARDS].number; options[Options::DISABLECARDS].number = !options[Options::DISABLECARDS].number;
else if (btn == JGE_BTN_SEC) else if (btn == JGE_BTN_SEC)
{ {
bListCards = !bListCards; bListCards = !bListCards;
disablePurchase = false; disablePurchase = false;
clearInput = true; clearInput = true;
return; return;
} }
else if (shopMenu) else if (shopMenu)
{ {
#if defined (IOS) || defined (ANDROID) #if defined (IOS) || defined (ANDROID)
@@ -770,7 +770,7 @@ void GameStateShop::Render()
#ifndef TOUCH_ENABLED #ifndef TOUCH_ENABLED
float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str()); float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - 0.5 - 10, SCREEN_HEIGHT - 8, 0, kPspIconScaleFactor, kPspIconScaleFactor); r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - 0.5 - 10, SCREEN_HEIGHT - 8, 0, kPspIconScaleFactor, kPspIconScaleFactor);
mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14); mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
#else #else
enableButtons(); enableButtons();
+2 -2
View File
@@ -10,11 +10,11 @@
GuiAvatars::GuiAvatars(DuelLayers* duelLayers) : GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
GuiLayer(duelLayers), active(NULL) GuiLayer(duelLayers), active(NULL)
{ {
Add(self = NEW GuiAvatar(SCREEN_WIDTH, SCREEN_HEIGHT, false, mpDuelLayers->getRenderedPlayer(), GuiAvatar::BOTTOM_RIGHT, this)); Add(self = NEW GuiAvatar(SCREEN_WIDTH, SCREEN_HEIGHT, false, mpDuelLayers->getRenderedPlayer(), GuiAvatar::BOTTOM_RIGHT, this));
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 //myexile
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 30, false, mpDuelLayers->getRenderedPlayer(), this)); 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));
+1 -1
View File
@@ -330,4 +330,4 @@ int GuiHandOpponent::receiveEventMinus(WEvent* e)
// I wanna write it like that. GCC doesn't want me to without -O. // I wanna write it like that. GCC doesn't want me to without -O.
// I'm submitting a bug report. // I'm submitting a bug report.
// it->x = (it->x + (flip ? RightRowX : LeftRowX)) / 2; // it->x = (it->x + (flip ? RightRowX : LeftRowX)) / 2;
+8 -8
View File
@@ -106,14 +106,14 @@ ManaIcon::ManaIcon(int color, float x, float y, float destx, float desty) :
// if we want to throttle the amount of particles for mana, // if we want to throttle the amount of particles for mana,
// here's where to do it - this is hardcoded to something like 114 in the psi file // here's where to do it - this is hardcoded to something like 114 in the psi file
if(OptionManaDisplay::NOSTARSDYNAMIC == options[Options::MANADISPLAY].number) if(OptionManaDisplay::NOSTARSDYNAMIC == options[Options::MANADISPLAY].number)
{ {
particleSys->info.nEmission = 0; particleSys->info.nEmission = 0;
} }
else else
{ {
particleSys->info.nEmission = 60; particleSys->info.nEmission = 60;
} }
icon = manaIcons[color]; icon = manaIcons[color];
particleSys->FireAt(x, y); particleSys->FireAt(x, y);
@@ -193,7 +193,7 @@ void ManaIcon::Update(float dt, float shift)
if (particleSys && (fabs(destx - x) < 5) && (fabs(desty + shift - y) < 5)) if (particleSys && (fabs(destx - x) < 5) && (fabs(desty + shift - y) < 5))
{ {
if (OptionManaDisplay::STATIC == options[Options::MANADISPLAY].number) if (OptionManaDisplay::STATIC == options[Options::MANADISPLAY].number)
{ {
SAFE_DELETE(particleSys); //Static Mana Only: avoid expensive particle processing SAFE_DELETE(particleSys); //Static Mana Only: avoid expensive particle processing
} }
@@ -305,7 +305,7 @@ void GuiMana::Render()
for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it) for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it)
(*it)->Render(); (*it)->Render();
if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number ) if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number )
RenderStatic(); RenderStatic();
} }
+3 -3
View File
@@ -124,7 +124,7 @@ void GuiPlay::BattleField::reset(float x, float y)
void GuiPlay::BattleField::EnstackAttacker(CardView* card) void GuiPlay::BattleField::EnstackAttacker(CardView* card)
{ {
card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1)); card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1));
card->y = baseY + (card->card->getObserver()->getView()->getRenderedPlayer() == card->card->controller() ? 20 + y : -20 - y); card->y = baseY + (card->card->getObserver()->getView()->getRenderedPlayer() == card->card->controller() ? 20 + y : -20 - y);
++currentAttacker; ++currentAttacker;
// JRenderer::GetInstance()->RenderQuad(WResourceManager::Instance()->GetQuad("BattleIcon"), card->actX, card->actY, 0, 0.5 + 0.1 * sinf(JGE::GetInstance()->GetTime()), 0.5 + 0.1 * sinf(JGE::GetInstance()->GetTime())); // JRenderer::GetInstance()->RenderQuad(WResourceManager::Instance()->GetQuad("BattleIcon"), card->actX, card->actY, 0, 0.5 + 0.1 * sinf(JGE::GetInstance()->GetTime()), 0.5 + 0.1 * sinf(JGE::GetInstance()->GetTime()));
} }
@@ -197,7 +197,7 @@ void GuiPlay::Replace()
{ {
if((!(*it)->card->hasSubtype(Subtypes::TYPE_AURA)|| ((*it)->card->hasSubtype(Subtypes::TYPE_AURA) && (*it)->card->playerTarget)) && !(*it)->card->hasType(Subtypes::TYPE_PLANESWALKER)) if((!(*it)->card->hasSubtype(Subtypes::TYPE_AURA)|| ((*it)->card->hasSubtype(Subtypes::TYPE_AURA) && (*it)->card->playerTarget)) && !(*it)->card->hasType(Subtypes::TYPE_PLANESWALKER))
{ {
if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller()) if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller())
++selfSpellsN; ++selfSpellsN;
else else
++opponentSpellsN; ++opponentSpellsN;
@@ -398,7 +398,7 @@ int GuiPlay::receiveEventPlus(WEvent * e)
} }
else else
{ {
// this should never happen, if you have a consistent repro case, ping Wil please // this should never happen, if you have a consistent repro case, ping Wil please
assert(false); assert(false);
} }
return 1; return 1;
+2 -2
View File
@@ -4,8 +4,8 @@
#include "WResourceManager.h" #include "WResourceManager.h"
#include "WFont.h" #include "WFont.h"
#define SCALE_SELECTED 1.2f #define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f #define SCALE_NORMAL 1.0f
IconButtonsController::IconButtonsController(JGE* jge, float x, float y): JGuiController(jge, 0, NULL), mX(x), mY(y) IconButtonsController::IconButtonsController(JGE* jge, float x, float y): JGuiController(jge, 0, NULL), mX(x), mY(y)
{ {
+1 -1
View File
@@ -80,7 +80,7 @@ void InteractiveButton::Render()
mYOffset += 2; mYOffset += 2;
#endif #endif
float buttonXOffset = getX() - mXOffset; float buttonXOffset = getX() - mXOffset;
float buttonYOffset = getY() + mYOffset; float buttonYOffset = getY() + mYOffset;
if (buttonImage != NULL) if (buttonImage != NULL)
{ {
+63 -52
View File
@@ -39,7 +39,9 @@ const string kAlternateCostKeywords[] =
"flashback", "flashback",
"retrace", "retrace",
"facedown", "facedown",
"suspended" "suspended",
"overload",
"bestow"
}; };
const int kAlternateCostIds[] = const int kAlternateCostIds[] =
{ {
@@ -51,7 +53,9 @@ const int kAlternateCostIds[] =
ManaCost::MANA_PAID_WITH_FLASHBACK, ManaCost::MANA_PAID_WITH_FLASHBACK,
ManaCost::MANA_PAID_WITH_RETRACE, ManaCost::MANA_PAID_WITH_RETRACE,
ManaCost::MANA_PAID_WITH_MORPH, ManaCost::MANA_PAID_WITH_MORPH,
ManaCost::MANA_PAID_WITH_SUSPEND ManaCost::MANA_PAID_WITH_SUSPEND,
ManaCost::MANA_PAID_WITH_OVERLOAD,
ManaCost::MANA_PAID_WITH_BESTOW
}; };
//Used for "dynamic ability" parsing //Used for "dynamic ability" parsing
@@ -726,8 +730,8 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
bool limitOnceATurn = (s.find("turnlimited") != string::npos); bool limitOnceATurn = (s.find("turnlimited") != string::npos);
bool isSuspended = (s.find("suspended") != string::npos); bool isSuspended = (s.find("suspended") != string::npos);
bool opponentPoisoned = (s.find("opponentpoisoned") != string::npos); bool opponentPoisoned = (s.find("opponentpoisoned") != string::npos);
bool lifelost = (s.find("foelost(") != string::npos); bool lifelost = (s.find("foelost(") != string::npos);
int lifeamount = lifelost ? atoi(s.substr(s.find("foelost(") + 8,')').c_str()) : 0; int lifeamount = lifelost ? atoi(s.substr(s.find("foelost(") + 8,')').c_str()) : 0;
bool neverRemove = (s.find("dontremove") != string::npos); bool neverRemove = (s.find("dontremove") != string::npos);
//Card Changed Zone //Card Changed Zone
@@ -1059,12 +1063,12 @@ MTGAbility * AbilityFactory::getCoreAbility(MTGAbility * a)
if (MultiAbility * abi = dynamic_cast<MultiAbility*>(a)) if (MultiAbility * abi = dynamic_cast<MultiAbility*>(a))
return getCoreAbility(abi->abilities[0]); return getCoreAbility(abi->abilities[0]);
if (NestedAbility * na = dynamic_cast<NestedAbility*> (a)) if (NestedAbility * na = dynamic_cast<NestedAbility*> (a))
{ {
if(na->ability) if(na->ability)
//only atempt to return a nestedability if it contains a valid ability. example where this causes a bug otherwise. AEquip is considered nested, but contains no ability. //only atempt to return a nestedability if it contains a valid ability. example where this causes a bug otherwise. AEquip is considered nested, but contains no ability.
return getCoreAbility(na->ability); return getCoreAbility(na->ability);
} }
if (MenuAbility * ma = dynamic_cast<MenuAbility*>(a)) if (MenuAbility * ma = dynamic_cast<MenuAbility*>(a))
return getCoreAbility(ma->abilities[0]); return getCoreAbility(ma->abilities[0]);
@@ -1089,8 +1093,8 @@ 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? //pay and castcard?
if(s.find("castcard(restricted") != string::npos && (s.find("pay(") != string::npos || s.find("pay[[") != string::npos)) if(s.find("castcard(restricted") != string::npos && (s.find("pay(") != string::npos || s.find("pay[[") != string::npos))
asAlternate = true; asAlternate = true;
//MTG Specific rules //MTG Specific rules
//adds the bonus credit system //adds the bonus credit system
@@ -1156,10 +1160,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
observer->addObserver(NEW MTGMorphCostRule(observer, -1)); observer->addObserver(NEW MTGMorphCostRule(observer, -1));
return NULL; return NULL;
} }
found = s.find("playfromgraveyardrule"); found = s.find("payzerorule");
if(found != string::npos) if(found != string::npos)
{ {
observer->addObserver(NEW MTGPlayFromGraveyardRule(observer, -1)); observer->addObserver(NEW MTGPayZeroRule(observer, -1));
return NULL;
}
found = s.find("overloadrule");
if(found != string::npos)
{
observer->addObserver(NEW MTGOverloadRule(observer, -1));
return NULL; return NULL;
} }
//this rule handles attacking ability during attacker phase //this rule handles attacking ability during attacker phase
@@ -1816,7 +1826,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
found = string::npos; found = string::npos;
i = -1; i = -1;
for (size_t j = 0; j < kLordKeywordsCount; ++j) for (size_t j = 0; j < kLordKeywordsCount; ++j)
{ {
size_t found2 = s.find(kLordKeywords[j]); size_t found2 = s.find(kLordKeywords[j]);
if (found2 != string::npos && ((found == string::npos) || found2 < found)) if (found2 != string::npos && ((found == string::npos) || found2 < found))
@@ -2592,16 +2602,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a; 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())
{ {
int hand = atoi(splitSetHand[1].c_str()); int hand = atoi(splitSetHand[1].c_str());
Damageable * t = spell ? spell->getNextDamageableTarget() : NULL; Damageable * t = spell ? spell->getNextDamageableTarget() : NULL;
MTGAbility * a = NEW AASetHand(observer, id, card, t, hand, NULL, who); MTGAbility * a = NEW AASetHand(observer, id, card, t, hand, NULL, who);
a->oneShot = 1; a->oneShot = 1;
return a; return a;
} }
//set life total //set life total
vector<string> splitLifeset = parseBetween(s, "lifeset:", " ", false); vector<string> splitLifeset = parseBetween(s, "lifeset:", " ", false);
@@ -2713,7 +2723,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
} }
//Cast/Play Restrictions //Cast/Play Restrictions
for (size_t i = 0; i < kMaxCastKeywordsCount; ++i) for (size_t i = 0; i < kMaxCastKeywordsCount; ++i)
{ {
vector<string> splitCast = parseBetween(s, kMaxCastKeywords[i], ")"); vector<string> splitCast = parseBetween(s, kMaxCastKeywords[i], ")");
if (splitCast.size()) if (splitCast.size())
@@ -2929,9 +2939,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{ {
vector<string> becomesParameters = split(splitBecomes[1], ','); vector<string> becomesParameters = split(splitBecomes[1], ',');
string stypes = becomesParameters[0]; string stypes = becomesParameters[0];
string newPower = ""; string newPower = "";
string newToughness = ""; string newToughness = "";
bool ptFound = false; bool ptFound = false;
if(becomesParameters.size() >1) if(becomesParameters.size() >1)
{ {
vector<string> pt = split(becomesParameters[1], '/'); vector<string> pt = split(becomesParameters[1], '/');
@@ -2942,17 +2952,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
ptFound = true; ptFound = true;
} }
} }
string sabilities = ""; string sabilities = "";
unsigned int becomesSize = ptFound?2:1; unsigned int becomesSize = ptFound?2:1;
if(becomesParameters.size() > becomesSize) if(becomesParameters.size() > becomesSize)
{ {
for(unsigned int i = becomesSize;i < becomesParameters.size();i++) for(unsigned int i = becomesSize;i < becomesParameters.size();i++)
{ {
sabilities.append(becomesParameters[i].c_str()); sabilities.append(becomesParameters[i].c_str());
if(i+1 < becomesParameters.size()) if(i+1 < becomesParameters.size())
sabilities.append(","); sabilities.append(",");
} }
} }
if (oneShot || forceUEOT || forceForever) if (oneShot || forceUEOT || forceForever)
return NEW ATransformerInstant(observer, id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceForever,untilYourNextTurn); return NEW ATransformerInstant(observer, id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceForever,untilYourNextTurn);
@@ -3034,14 +3044,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
newtoughnessfound = true; newtoughnessfound = true;
newtoughness = splitToughness[1]; newtoughness = splitToughness[1];
} }
if(abilities[j].find("newability[") != string::npos) if(abilities[j].find("newability[") != string::npos)
{ {
size_t NewSkill = abilities[j].find("newability["); size_t NewSkill = abilities[j].find("newability[");
size_t NewSkillEnd = abilities[j].find_last_of("]"); size_t NewSkillEnd = abilities[j].find_last_of("]");
string newAbilities = abilities[j].substr(NewSkill + 11,NewSkillEnd - NewSkill - 11); string newAbilities = abilities[j].substr(NewSkill + 11,NewSkillEnd - NewSkill - 11);
newAbilitiesList.push_back(newAbilities); newAbilitiesList.push_back(newAbilities);
newAbilityFound = true; newAbilityFound = true;
} }
} }
if (oneShot || forceUEOT || forceForever) if (oneShot || forceUEOT || forceForever)
@@ -3078,11 +3088,15 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{ {
return NEW PTInstant(observer, id, card, target, wppt,s,nonstatic); return NEW PTInstant(observer, id, card, target, wppt,s,nonstatic);
} }
else if(s.find("cdaactive") != string::npos) else if(s.find("cdaactive") != string::npos)
{ {
return NEW APowerToughnessModifier(observer, id, card, target, wppt,s,true); MTGAbility * a = NEW APowerToughnessModifier(observer, id, card, target, wppt,s,true);
a->forcedAlive = 1;
//a->forceDestroy = -1;
return a;
//return NEW APowerToughnessModifier(observer, id, card, target, wppt,s,true);
} }
else else
return NEW APowerToughnessModifier(observer, id, card, target, wppt,s,nonstatic); return NEW APowerToughnessModifier(observer, id, card, target, wppt,s,nonstatic);
} }
return NEW PTInstant(observer, id, card, target, wppt,s,nonstatic); return NEW PTInstant(observer, id, card, target, wppt,s,nonstatic);
@@ -3689,9 +3703,6 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ
badAbilities[(int)Constants::WEAK] = true; badAbilities[(int)Constants::WEAK] = true;
badAbilities[(int)Constants::NOLIFEGAIN] = true; badAbilities[(int)Constants::NOLIFEGAIN] = true;
badAbilities[(int)Constants::NOLIFEGAINOPPONENT] = true; badAbilities[(int)Constants::NOLIFEGAINOPPONENT] = true;
badAbilities[(int)Constants::CANTLOSE] = false;
badAbilities[(int)Constants::CANTLIFELOSE] = false;
badAbilities[(int)Constants::CANTMILLLOSE] = false;
if (AInstantBasicAbilityModifierUntilEOT * abi = dynamic_cast<AInstantBasicAbilityModifierUntilEOT *>(a)) if (AInstantBasicAbilityModifierUntilEOT * abi = dynamic_cast<AInstantBasicAbilityModifierUntilEOT *>(a))
{ {
@@ -3754,7 +3765,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
if (dest == zones->exile) if (dest == zones->exile)
{ {
magicText = card->magicTexts["exile"]; magicText = card->magicTexts["exile"];
card->exileEffects = true; card->exileEffects = true;
break; break;
} }
if (dest == zones->library) if (dest == zones->library)
+23 -6
View File
@@ -65,8 +65,6 @@ 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(); myconvertedcost = getManaCost()->getConvertedCost();
} }
@@ -575,7 +573,7 @@ MTGCardInstance * MTGCardInstance::changeController(Player * newController,bool
} }
Player * originalOwner = controller(); Player * originalOwner = controller();
MTGCardInstance * copy = originalOwner->game->putInZone(this, this->currentZone, newController->game->inPlay); MTGCardInstance * copy = originalOwner->game->putInZone(this, this->currentZone, newController->game->inPlay);
copy->summoningSickness = 1; //copy->summoningSickness = 1;
return copy; return copy;
} }
@@ -755,7 +753,7 @@ bool MTGCardInstance::StackIsEmptyandSorcerySpeed()
controller() == getObserver()->currentPlayer && controller() == getObserver()->currentPlayer &&
!getObserver()->isInterrupting) !getObserver()->isInterrupting)
{ {
return true; return true;
} }
return false; return false;
} }
@@ -782,7 +780,7 @@ bool MTGCardInstance::isTargetted()
} }
if(cardistargetted) if(cardistargetted)
return true; return true;
return false; return false;
} }
//check targetter? //check targetter?
@@ -807,7 +805,7 @@ bool MTGCardInstance::isTargetter()
} }
if(cardistargetter) if(cardistargetter)
return true; return true;
return false; return false;
} }
int MTGCardInstance::canBlock() int MTGCardInstance::canBlock()
@@ -920,6 +918,25 @@ JQuadPtr MTGCardInstance::getIcon()
return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB); return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB);
} }
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * oldCost)
{
if(card->isLand())
return oldCost;
if(!card)
return oldCost;
//use forcedalive//
//pay zero costs//
//kicker???...//
//morph cost todo//
//trinisphere must be here below//
if(card->has(Constants::TRINISPHERE))
for(int jj = oldCost->getConvertedCost(); jj < 3; jj++)
oldCost->add(Constants::MTG_COLOR_ARTIFACT, 1);
return oldCost;
}
MTGCardInstance * MTGCardInstance::getNextPartner() MTGCardInstance * MTGCardInstance::getNextPartner()
{ {
MTGInPlay * inplay = controller()->game->inPlay; MTGInPlay * inplay = controller()->game->inPlay;
+11 -1
View File
@@ -93,6 +93,16 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
} }
} }
} }
if (key == "anyzone")
{
if (!primitive) primitive = NEW CardPrimitive();
primitive->addMagicText(val,"hand");
primitive->addMagicText(val,"library");
primitive->addMagicText(val,"graveyard");
primitive->addMagicText(val,"stack");
primitive->addMagicText(val,"exile");
primitive->addMagicText(val);
}
break; break;
case 'b': //buyback case 'b': //buyback
@@ -271,7 +281,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
{ {
string value = val; string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower); std::transform(value.begin(), value.end(), value.begin(), ::tolower);
cost->setSuspend(ManaCost::parseManaCost(value)); cost->setSuspend(ManaCost::parseManaCost(value));
primitive->suspendedTime = suspendTime; primitive->suspendedTime = suspendTime;
} }
+35 -33
View File
@@ -14,9 +14,9 @@ const string Constants::kManaRed = "red";
const string Constants::kManaBlack = "black"; const string Constants::kManaBlack = "black";
const string Constants::kManaWhite = "white"; const string Constants::kManaWhite = "white";
int Constants::_r[7] = {75, 20, 20, 200,50,255,128}; int Constants::_r[7] = {75,20,20,200,50,255,128};
int Constants::_g[7] = {30, 140, 30, 15, 50,255,128}; int Constants::_g[7] = {30,140,30,15,50,255,128};
int Constants::_b[7] = {20, 0, 140,15, 50,255,128}; int Constants::_b[7] = {20,0,140,15,50,255,128};
const string Constants::kAlternativeKeyword = "alternative"; const string Constants::kAlternativeKeyword = "alternative";
@@ -148,8 +148,10 @@ const char* Constants::MTGBasicAbilities[] = {
"protectionfromcoloredspells", "protectionfromcoloredspells",
"mygcreatureexiler", "mygcreatureexiler",
"oppgcreatureexiler", "oppgcreatureexiler",
"payzero", "zerocast",
"trinisphere" "trinisphere",
"canplayfromexile",
"libraryeater"
}; };
map<string,int> Constants::MTGBasicAbilitiesMap; map<string,int> Constants::MTGBasicAbilitiesMap;
@@ -182,36 +184,36 @@ int Constants::GetColorStringIndex(string mtgColor)
const string Constants::MTGPhaseNames[] = const string Constants::MTGPhaseNames[] =
{ {
"---", "---",
"Untap", "Untap",
"Upkeep", "Upkeep",
"Draw", "Draw",
"Main phase 1", "Main phase 1",
"Combat begins", "Combat begins",
"Attackers", "Attackers",
"Blockers", "Blockers",
"Combat damage", "Combat damage",
"Combat ends", "Combat ends",
"Main phase 2", "Main phase 2",
"End", "End",
"Cleanup", "Cleanup",
"---" "---"
}; };
const char* Constants::MTGPhaseCodeNames[] = const char* Constants::MTGPhaseCodeNames[] =
{ {
"beginofturn", "beginofturn",
"untap", "untap",
"upkeep", "upkeep",
"draw", "draw",
"firstmain", "firstmain",
"combatbegins", "combatbegins",
"attackers", "attackers",
"blockers", "blockers",
"combatdamage", "combatdamage",
"combatends", "combatends",
"secondmain", "secondmain",
"end", "end",
"cleanup", "cleanup",
"beforenextturn" "beforenextturn"
}; };
+9 -9
View File
@@ -323,12 +323,12 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
int doCopy = 1; int doCopy = 1;
bool shufflelibrary = card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH]; bool shufflelibrary = card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH];
bool inplaytoinplay = false; bool inplaytoinplay = false;
bool ripToken = false; bool ripToken = false;
if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace")) if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace"))
ripToken = true; ripToken = true;
//Madness or Put in Play... //Madness or Put in Play...
for(int i = 0; i < 2; ++i) for(int i = 0; i < 2; ++i)
{ {
if (card->discarded && (to == g->players[i]->game->graveyard) && (from == g->players[i]->game->hand)) if (card->discarded && (to == g->players[i]->game->graveyard) && (from == g->players[i]->game->hand))
{ {
if(card->basicAbilities[(int)Constants::MADNESS]) if(card->basicAbilities[(int)Constants::MADNESS])
@@ -337,7 +337,7 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
} }
//Darksteel Colossus, Legacy Weapon ... top priority since we replace destination directly automatically... //Darksteel Colossus, Legacy Weapon ... top priority since we replace destination directly automatically...
for(int i = 0; i < 2; ++i) for(int i = 0; i < 2; ++i)
{ {
if ((to == g->players[i]->game->graveyard) && ( if ((to == g->players[i]->game->graveyard) && (
card->basicAbilities[(int)Constants::LIBRARYDEATH]|| card->basicAbilities[(int)Constants::LIBRARYDEATH]||
card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH])) card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH]))
@@ -347,13 +347,13 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
} }
//Leyline of the Void, Yawgmoth's Agenda... effect... //Leyline of the Void, Yawgmoth's Agenda... effect...
for(int i = 0; i < 2; ++i) for(int i = 0; i < 2; ++i)
{ {
if ((to == g->players[i]->game->graveyard) && ( if ((to == g->players[i]->game->graveyard) && (
(g->players[i]->game->battlefield->hasAbility(Constants::MYGCREATUREEXILER) && card->isCreature()) || (g->players[i]->game->battlefield->hasAbility(Constants::MYGCREATUREEXILER) && card->isCreature()) ||
(g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGCREATUREEXILER) && card->isCreature())|| (g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGCREATUREEXILER) && card->isCreature())||
g->players[i]->game->battlefield->hasAbility(Constants::MYGRAVEEXILER) || g->players[i]->game->battlefield->hasAbility(Constants::MYGRAVEEXILER) ||
g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER))) g->players[i]->opponent()->game->battlefield->hasAbility(Constants::OPPGRAVEEXILER)))
{ {
if ((card->isToken && ripToken)) if ((card->isToken && ripToken))
to = g->players[i]->game->exile; to = g->players[i]->game->exile;
if (!card->isToken) if (!card->isToken)
@@ -379,7 +379,7 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
{//set discarded for madness... {//set discarded for madness...
if(from == g->players[0]->game->hand || from == g->players[1]->game->hand) if(from == g->players[0]->game->hand || from == g->players[1]->game->hand)
copy->discarded = true; copy->discarded = true;
else//turn off discarded if its previous zone is not in hand... else//turn off discarded if its previous zone is not in hand...
copy->discarded = false; copy->discarded = false;
} }
if (options[Options::SFXVOLUME].number > 0) if (options[Options::SFXVOLUME].number > 0)
@@ -546,7 +546,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
copy->kicked = card->kicked; copy->kicked = card->kicked;
copy->storedCard = card->storedCard; copy->storedCard = card->storedCard;
copy->storedSourceCard = card->storedSourceCard; copy->storedSourceCard = card->storedSourceCard;
for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++) for (int i = 0; i < ManaCost::MANA_PAID_WITH_OVERLOAD +1; i++)
copy->alternateCostPaid[i] = card->alternateCostPaid[i]; copy->alternateCostPaid[i] = card->alternateCostPaid[i];
//stupid bug with tokens... //stupid bug with tokens...
@@ -742,7 +742,7 @@ bool MTGGameZone::hasColor(int value)
{ {
for (int i = 0; i < (nb_cards); i++) for (int i = 0; i < (nb_cards); i++)
{ {
if (cards[i]->getManaCost()->hasColor(value) && cards[i]->getManaCost()->getConvertedCost() > 0) if (cards[i]->getManaCost()->hasColor(value) && cards[i]->getManaCost()->getConvertedCost() > 0)
{ {
return true; return true;
} }
+1 -1
View File
@@ -28,7 +28,7 @@ int MTGPackEntryRandom::addCard(WSrcCards *pool, MTGDeck *to)
} }
int MTGPackEntrySpecific::addCard(WSrcCards *, MTGDeck *to) int MTGPackEntrySpecific::addCard(WSrcCards *, MTGDeck *to)
{ {
if (!card) if (!card)
return copies; return copies;
for (int i = 0; i < copies; i++) for (int i = 0; i < copies; i++)
to->add(card); to->add(card);
+192 -92
View File
@@ -58,8 +58,8 @@ int MTGEventBonus::receiveEvent(WEvent * event)
//bonus for chain chain casting without tapping for mana or being interupted; //bonus for chain chain casting without tapping for mana or being interupted;
//note gaining mana from other sources is still possible. //note gaining mana from other sources is still possible.
//only spells going to the stack are counted. //only spells going to the stack are counted.
if(game->turn <2)//this shouldnt trigger on first turn, chances are they are cheating. if(game->turn <2)//this shouldnt trigger on first turn, chances are they are cheating.
return 0; return 0;
if (dynamic_cast<WEventCardTappedForMana*>(event)) if (dynamic_cast<WEventCardTappedForMana*>(event))
{ {
@@ -284,8 +284,10 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{ {
int cardsinhand = game->players[0]->game->hand->nb_cards; int cardsinhand = game->players[0]->game->hand->nb_cards;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
if (!player->game->hand->hasCard(card)) if (!player->game->hand->hasCard(card) && !player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card))
return 0; return 0;
if ((player->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (player->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
return 0;
if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[(int)Constants::LEYLINE]) if ((game->turn < 1) && (cardsinhand != 0) && (card->basicAbilities[(int)Constants::LEYLINE])
&& game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN && game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
&& game->players[0]->game->graveyard->nb_cards == 0 && game->players[0]->game->graveyard->nb_cards == 0
@@ -295,7 +297,7 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if (card->basicAbilities[(int)Constants::LEYLINE]) if (card->basicAbilities[(int)Constants::LEYLINE])
{ {
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->temp); MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->temp);
Spell * spell = NEW Spell(game, copy); Spell * spell = NEW Spell(game, copy);
spell->resolve(); spell->resolve();
delete spell; delete spell;
@@ -412,7 +414,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
delete previousManaPool; delete previousManaPool;
if (card->isLand()) if (card->isLand())
{ {
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->temp); MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->temp);
Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, payResult); Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, payResult);
spell->resolve(); spell->resolve();
delete spellCost; delete spellCost;
@@ -421,7 +423,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
else else
{ {
Spell * spell = NULL; Spell * spell = NULL;
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack); MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->stack);
if (game->targetChooser) if (game->targetChooser)
{ {
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, payResult, 0); spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, payResult, 0);
@@ -475,17 +477,23 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if(OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number) if(OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number)
return 0; return 0;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
if(!player->game->hand->hasCard(card)) if (!player->game->hand->hasCard(card) && !player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card))
return 0; return 0;
if ((player->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (player->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
return 0;
ManaCost * kicker = card->getManaCost()->getKicker(); ManaCost * kicker = card->getManaCost()->getKicker();
if(!kicker) if(!kicker)
{ {
SAFE_DELETE(kicker); SAFE_DELETE(kicker);
return 0; return 0;
} }
ManaCost * playerMana = player->getManaPool(); ManaCost * playerMana = player->getManaPool();
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost()); ManaCost * withKickerCost= NEW ManaCost(card->model->data->getManaCost());
withKickerCost->add(withKickerCost->getKicker()); if(card->getIncreasedManaCost()->getConvertedCost())
withKickerCost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
withKickerCost->remove(card->getReducedManaCost());
withKickerCost->add(card->model->data->getManaCost()->getKicker());
if(!playerMana->canAfford(withKickerCost)) if(!playerMana->canAfford(withKickerCost))
{ {
delete withKickerCost; delete withKickerCost;
@@ -503,12 +511,16 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
return 0; return 0;
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());//using pointers here alters the real cost of the card. ManaCost * withKickerCost= NEW ManaCost(card->model->data->getManaCost());//using pointers here alters the real cost of the card.
if (card->getManaCost()->getKicker()->isMulti) if(card->getIncreasedManaCost()->getConvertedCost())
withKickerCost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
withKickerCost->remove(card->getReducedManaCost());
if (card->model->data->getManaCost()->getKicker()->isMulti)
{ {
while(player->getManaPool()->canAfford(withKickerCost)) while(player->getManaPool()->canAfford(withKickerCost))
{ {
withKickerCost->add(withKickerCost->getKicker()); withKickerCost->add(card->model->data->getManaCost()->getKicker());
card->kicked += 1; card->kicked += 1;
} }
card->kicked -= 1; card->kicked -= 1;
@@ -518,7 +530,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
} }
else else
{ {
withKickerCost->add(withKickerCost->getKicker()); withKickerCost->add(card->model->data->getManaCost()->getKicker());
card->paymenttype = MTGAbility::PUT_INTO_PLAY_WITH_KICKER; card->paymenttype = MTGAbility::PUT_INTO_PLAY_WITH_KICKER;
} }
if (withKickerCost->isExtraPaymentSet()) if (withKickerCost->isExtraPaymentSet())
@@ -545,7 +557,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
delete previousManaPool; delete previousManaPool;
if (card->isLand()) if (card->isLand())
{ {
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->temp); MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->temp);
Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, ManaCost::MANA_PAID_WITH_KICKER); Spell * spell = NEW Spell(game, 0,copy,NULL,NULL, ManaCost::MANA_PAID_WITH_KICKER);
spell->resolve(); spell->resolve();
delete spellCost; delete spellCost;
@@ -554,7 +566,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
else else
{ {
Spell * spell = NULL; Spell * spell = NULL;
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack); MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->stack);
if (game->targetChooser) if (game->targetChooser)
{ {
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, ManaCost::MANA_PAID_WITH_KICKER, 0); spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, ManaCost::MANA_PAID_WITH_KICKER, 0);
@@ -615,9 +627,13 @@ PermanentAbility(observer, _id)
int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{ {
ManaCost * alternateCost = card->getManaCost()->getAlternative(); if (card->alias == 11000)
if (!game->currentlyActing()->game->hand->hasCard(card)) return 0;//overload has its own rule
return 0; ManaCost * alternateCost = card->getManaCost()->getAlternative();
if (!game->currentlyActing()->game->hand->hasCard(card) && !game->currentlyActing()->game->graveyard->hasCard(card) && !game->currentlyActing()->game->exile->hasCard(card))
return 0;
if ((game->currentlyActing()->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (game->currentlyActing()->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
return 0;
return isReactingToClick( card, mana, alternateCost ); return isReactingToClick( card, mana, alternateCost );
} }
@@ -630,7 +646,12 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
if(!allowedToAltCast(card,player)) if(!allowedToAltCast(card,player))
return 0; return 0;
if(card->model->data->getManaCost()->getAlternative() && card->model->data->getManaCost()->getAlternative()->alternativeName.size())
if(card->has(Constants::CANPLAYFROMGRAVEYARD))
alternativeName = "Alternate Cast From Graveyard";
else if(card->has(Constants::CANPLAYFROMEXILE))
alternativeName = "Alternate Cast From Exile";
else if(card->model->data->getManaCost()->getAlternative() && card->model->data->getManaCost()->getAlternative()->alternativeName.size())
alternativeName = card->model->data->getManaCost()->getAlternative()->alternativeName; alternativeName = card->model->data->getManaCost()->getAlternative()->alternativeName;
if (card->isLand()) if (card->isLand())
@@ -665,27 +686,32 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card) int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card)
{ {
if ( !isReactingToClick(card)) if ( !isReactingToClick(card))
return 0; return 0;
ManaCost *alternateCost = card->getManaCost()->getAlternative(); ManaCost *alternateCost = card->getManaCost()->getAlternative();
card->paymenttype = MTGAbility::ALTERNATIVE_COST; card->paymenttype = MTGAbility::ALTERNATIVE_COST;
return reactToClick(card, alternateCost, ManaCost::MANA_PAID_WITH_ALTERNATIVE); return reactToClick(card, alternateCost, ManaCost::MANA_PAID_WITH_ALTERNATIVE);
} }
int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType){ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alternateCost, int alternateCostType, bool overload){
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaPool * playerMana = player->getManaPool(); ManaPool * playerMana = player->getManaPool();
//this handles extra cost payments at the moment a card is played. //this handles extra cost payments at the moment a card is played.
if(overload)
card->spellTargetType = "";
else if(card->model->data->spellTargetType.size())
card->spellTargetType = card->model->data->spellTargetType;
assert(alternateCost); assert(alternateCost);
if (alternateCost->isExtraPaymentSet() ) if (alternateCost->isExtraPaymentSet() )
{ {
if (!game->targetListIsSet(card)) if (!game->targetListIsSet(card))
return 0; return 0;
} }
else else
{ {
alternateCost->setExtraCostsAction(this, card); alternateCost->setExtraCostsAction(this, card);
@@ -763,8 +789,10 @@ MTGAlternativeCostRule(observer, _id)
int MTGBuyBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) int MTGBuyBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{ {
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
if (!player->game->hand->hasCard(card)) if (!player->game->hand->hasCard(card) && !player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card))
return 0; return 0;
if ((player->game->graveyard->hasCard(card) && !card->has(Constants::CANPLAYFROMGRAVEYARD)) || (player->game->exile->hasCard(card) && !card->has(Constants::CANPLAYFROMEXILE)))
return 0;
if(!allowedToCast(card,player)) if(!allowedToCast(card,player))
return 0; return 0;
return MTGAlternativeCostRule::isReactingToClick( card, mana, card->getManaCost()->getBuyback() ); return MTGAlternativeCostRule::isReactingToClick( card, mana, card->getManaCost()->getBuyback() );
@@ -1129,46 +1157,118 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) : MTGPayZeroRule::MTGPayZeroRule(GameObserver* observer, int _id) :
MTGAlternativeCostRule(observer, _id) MTGAlternativeCostRule(observer, _id)
{ {
aType = MTGAbility::PUT_INTO_PLAY; aType = MTGAbility::PAYZERO_COST;
} }
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{ {
Player * player = game->currentlyActing(); if(!card->has(Constants::PAYZERO))
ManaCost * cost = card->getManaCost();
if (!player->game->graveyard->hasCard(card))
return 0; return 0;
if (!card->has(Constants::CANPLAYFROMGRAVEYARD)) Player * player = game->currentlyActing();
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
if(card->isLand())
return 0;
if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card))
return 0;
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card))||(!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
return 0;
if(card->has(Constants::CANPLAYFROMGRAVEYARD))
CustomName = "Zero Cast From Graveyard";
else if(card->has(Constants::CANPLAYFROMEXILE))
CustomName = "Zero Cast From Exile";
else
CustomName = "Zero Cast From Anywhere";
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
}
int MTGPayZeroRule::reactToClick(MTGCardInstance * card)
{
if (!isReactingToClick(card))
return 0;
ManaCost * cost = NEW ManaCost(ManaCost::parseManaCost("{0}",NULL,NULL));
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
card->paymenttype = MTGAbility::PAYZERO_COST;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);
}
ostream& MTGPayZeroRule::toString(ostream& out) const
{
out << "MTGPayZeroRule ::: (";
return MTGAbility::toString(out) << ")";
}
MTGPayZeroRule * MTGPayZeroRule::clone() const
{
return NEW MTGPayZeroRule(*this);
}
MTGOverloadRule::MTGOverloadRule(GameObserver* observer, int _id) :
MTGAlternativeCostRule(observer, _id)
{
aType = MTGAbility::OVERLOAD_COST;
}
int MTGOverloadRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
if (card->alias != 11000)
return 0;
Player * player = game->currentlyActing();
ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative());
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
if (card->isLand())
return 0;
if (!player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card))
return 0;
if ((!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card))||(!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
return 0; return 0;
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost); return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
} }
int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card) int MTGOverloadRule::reactToClick(MTGCardInstance * card)
{ {
if (!isReactingToClick(card)) if (!isReactingToClick(card))
return 0; return 0;
ManaCost * cost = card->getManaCost(); ManaCost * cost = NEW ManaCost(card->model->data->getManaCost()->getAlternative());
if(card->getIncreasedManaCost()->getConvertedCost())
cost->add(card->getIncreasedManaCost());
if(card->getReducedManaCost()->getConvertedCost())
cost->remove(card->getReducedManaCost());
card->paymenttype = MTGAbility::PUT_INTO_PLAY; card->paymenttype = MTGAbility::OVERLOAD_COST;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID); return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID_WITH_OVERLOAD, true);
} }
ostream& MTGPlayFromGraveyardRule::toString(ostream& out) const ostream& MTGOverloadRule::toString(ostream& out) const
{ {
out << "MTGPlayFromGraveyardRule ::: ("; out << "MTGOverloadRule ::: (";
return MTGAbility::toString(out) << ")"; return MTGAbility::toString(out) << ")";
} }
MTGPlayFromGraveyardRule * MTGPlayFromGraveyardRule::clone() const MTGOverloadRule * MTGOverloadRule::clone() const
{ {
return NEW MTGPlayFromGraveyardRule(*this); return NEW MTGOverloadRule(*this);
} }
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1718,7 +1818,7 @@ int MTGMomirRule::reactToClick(MTGCardInstance * card_to_discard, int cardId)
ManaCost * cost = player->getManaPool(); ManaCost * cost = player->getManaPool();
player->getManaPool()->pay(cost); player->getManaPool()->pay(cost);
MTGCardInstance * card = genCreature(cardId); MTGCardInstance * card = genCreature(cardId);
player->game->putInZone(card_to_discard, player->game->hand, player->game->graveyard); player->game->putInZone(card_to_discard, card_to_discard->currentZone, player->game->graveyard);
player->game->stack->addCard(card); player->game->stack->addCard(card);
Spell * spell = NEW Spell(game, card); Spell * spell = NEW Spell(game, card);
@@ -1812,7 +1912,7 @@ MTGStoneHewerRule::MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCard
for (size_t i = 0; i < collection->ids.size(); i++) for (size_t i = 0; i < collection->ids.size(); i++)
{ {
MTGCard * card = collection->collection[collection->ids[i]]; MTGCard * card = collection->collection[collection->ids[i]];
if (card->data->hasSubtype("equipment") && (card->getRarity() != Constants::RARITY_T) && //remove tokens if (card->data->hasSubtype("equipment") && (card->getRarity() != Constants::RARITY_T) && //remove tokens
card->setId != MTGSets::INTERNAL_SET //remove cards that are defined in primitives. Those are workarounds (usually tokens) and should only be used internally card->setId != MTGSets::INTERNAL_SET //remove cards that are defined in primitives. Those are workarounds (usually tokens) and should only be used internally
) )
{ {
@@ -1828,32 +1928,32 @@ MTGStoneHewerRule::MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCard
int MTGStoneHewerRule::receiveEvent(WEvent * event) int MTGStoneHewerRule::receiveEvent(WEvent * event)
{ {
WEventZoneChange * e = (WEventZoneChange *) event; WEventZoneChange * e = (WEventZoneChange *) event;
if (e->to == game->currentlyActing()->game->inPlay && e->card->isCreature()) if (e->to == game->currentlyActing()->game->inPlay && e->card->isCreature())
{ {
int eId = genRandomEquipId(e->card->getManaCost()->getConvertedCost()); int eId = genRandomEquipId(e->card->getManaCost()->getConvertedCost());
MTGCardInstance * card = genEquip(eId); MTGCardInstance * card = genEquip(eId);
if(card) if(card)
{ {
game->currentlyActing()->game->temp->addCard(card); game->currentlyActing()->game->temp->addCard(card);
Spell * spell = NEW Spell(game, card); Spell * spell = NEW Spell(game, card);
spell->resolve(); spell->resolve();
spell->source->isToken = 1; spell->source->isToken = 1;
for (size_t i = 1; i < game->mLayers->actionLayer()->mObjects.size(); i++) for (size_t i = 1; i < game->mLayers->actionLayer()->mObjects.size(); i++)
{ {
MTGAbility * a = ((MTGAbility *) game->mLayers->actionLayer()->mObjects[i]); MTGAbility * a = ((MTGAbility *) game->mLayers->actionLayer()->mObjects[i]);
AEquip * eq = dynamic_cast<AEquip*> (a); AEquip * eq = dynamic_cast<AEquip*> (a);
if (eq && eq->source == spell->source) if (eq && eq->source == spell->source)
{ {
((AEquip*)a)->unequip(); ((AEquip*)a)->unequip();
((AEquip*)a)->equip(e->card); ((AEquip*)a)->equip(e->card);
} }
} }
SAFE_DELETE(spell); SAFE_DELETE(spell);
} }
return 1; return 1;
} }
return 0; return 0;
} }
MTGCardInstance * MTGStoneHewerRule::genEquip(int id) MTGCardInstance * MTGStoneHewerRule::genEquip(int id)
@@ -1867,8 +1967,8 @@ MTGCardInstance * MTGStoneHewerRule::genEquip(int id)
int MTGStoneHewerRule::genRandomEquipId(int convertedCost) int MTGStoneHewerRule::genRandomEquipId(int convertedCost)
{ {
if (convertedCost >= 20) if (convertedCost >= 20)
convertedCost = 19; convertedCost = 19;
int total_cards = 0; int total_cards = 0;
int i = (game->getRandomGenerator()->random() % int(convertedCost+1));//+1 becuase we want to generate a random "<=" the coverted. int i = (game->getRandomGenerator()->random() % int(convertedCost+1));//+1 becuase we want to generate a random "<=" the coverted.
while (!total_cards && i >= 0) while (!total_cards && i >= 0)
@@ -1904,29 +2004,29 @@ PermanentAbility(observer, _id)
int MTGHermitRule::receiveEvent(WEvent * event) int MTGHermitRule::receiveEvent(WEvent * event)
{ {
WEventPhaseChange * e = dynamic_cast<WEventPhaseChange*>(event); WEventPhaseChange * e = dynamic_cast<WEventPhaseChange*>(event);
if (e && e->from->id == MTG_PHASE_UNTAP) if (e && e->from->id == MTG_PHASE_UNTAP)
{ {
MTGCardInstance * lcard = NULL; MTGCardInstance * lcard = NULL;
vector<MTGCardInstance*>lands = vector<MTGCardInstance*>(); vector<MTGCardInstance*>lands = vector<MTGCardInstance*>();
for(int i = 0; i < game->currentPlayer->game->library->nb_cards-1; i++) for(int i = 0; i < game->currentPlayer->game->library->nb_cards-1; i++)
{ {
MTGCardInstance * temp = game->currentPlayer->game->library->cards[i]; MTGCardInstance * temp = game->currentPlayer->game->library->cards[i];
if(temp && temp->isLand()) if(temp && temp->isLand())
lands.push_back(temp); lands.push_back(temp);
} }
if(lands.size()) if(lands.size())
lcard = lands[game->getRandomGenerator()->random() % lands.size()]; lcard = lands[game->getRandomGenerator()->random() % lands.size()];
if(lcard) if(lcard)
{ {
MTGCardInstance * copy = game->currentPlayer->game->putInZone(lcard,game->currentPlayer->game->library, game->currentPlayer->game->temp); MTGCardInstance * copy = game->currentPlayer->game->putInZone(lcard,game->currentPlayer->game->library, game->currentPlayer->game->temp);
Spell * spell = NEW Spell(game, copy); Spell * spell = NEW Spell(game, copy);
spell->resolve(); spell->resolve();
delete spell; delete spell;
} }
return 1; return 1;
} }
return 0; return 0;
} }
MTGHermitRule * MTGHermitRule::clone() const MTGHermitRule * MTGHermitRule::clone() const
+3 -3
View File
@@ -94,7 +94,7 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
} }
//switch on the first letter. If two costs share their first letter, add an "if" within the switch //switch on the first letter. If two costs share their first letter, add an "if" within the switch
std::transform(value.begin(), value.end(), value.begin(), ::tolower); std::transform(value.begin(), value.end(), value.begin(), ::tolower);
switch (value[0]) switch (value[0])
{ {
case 'x': case 'x':
@@ -695,7 +695,7 @@ ManaCostHybrid * ManaCost::getHybridCost(unsigned int i)
ExtraCost * ManaCost::getExtraCost(unsigned int i) ExtraCost * ManaCost::getExtraCost(unsigned int i)
{ {
if(extraCosts && extraCosts->costs.size()) if(extraCosts && extraCosts->costs.size())
{ {
if (extraCosts->costs.size() <= i) if (extraCosts->costs.size() <= i)
return NULL; return NULL;
return extraCosts->costs[i]; return extraCosts->costs[i];
@@ -1055,7 +1055,7 @@ ostream& operator<<(ostream& out, ManaCost m)
void ManaPool::Empty() void ManaPool::Empty()
{ {
SAFE_DELETE(extraCosts); SAFE_DELETE(extraCosts);
SAFE_DELETE(kicker); SAFE_DELETE(kicker);
SAFE_DELETE(alternative); SAFE_DELETE(alternative);
SAFE_DELETE(BuyBack); SAFE_DELETE(BuyBack);
+30 -30
View File
@@ -301,12 +301,12 @@ ModRulesRenderCardGuiItem::ModRulesRenderCardGuiItem(string name, int posX, int
mFormattedData = formattedData; mFormattedData = formattedData;
mFilter = filter; mFilter = filter;
mFontSize = fontSize; mFontSize = fontSize;
mFont = font; mFont = font;
mFontColor = fontColor; mFontColor = fontColor;
mSizeIcon = SizeIcon; mSizeIcon = SizeIcon;
mIconPosX = IconPosX; mIconPosX = IconPosX;
mIconPosY = IconPosY; mIconPosY = IconPosY;
mFileName = FileName; mFileName = FileName;
} }
@@ -318,12 +318,12 @@ void ModRulesCardGui::parse(TiXmlElement* element)
string _FormattedText; string _FormattedText;
string _Filter; string _Filter;
int _FontSize; int _FontSize;
bool _Font; bool _Font;
PIXEL_TYPE _FontColor; PIXEL_TYPE _FontColor;
int _SizeIcon; int _SizeIcon;
int _IconPosX; int _IconPosX;
int _IconPosY; int _IconPosY;
string _FileName; string _FileName;
@@ -353,12 +353,12 @@ void ModRulesCardGui::parse(TiXmlElement* element)
_FormattedText = ""; _FormattedText = "";
_Filter = ""; _Filter = "";
_FontSize = 0; _FontSize = 0;
_Font = false; _Font = false;
_FontColor = 0; _FontColor = 0;
_SizeIcon = 0; _SizeIcon = 0;
_IconPosX = 0; _IconPosX = 0;
_IconPosY = 0 ; _IconPosY = 0 ;
_FileName = ""; _FileName = "";
TiXmlElement* ItemElement = node->ToElement(); TiXmlElement* ItemElement = node->ToElement();
@@ -379,11 +379,11 @@ void ModRulesCardGui::parse(TiXmlElement* element)
} }
ChildNode = ItemElement->FirstChild("font"); ChildNode = ItemElement->FirstChild("font");
if (ChildNode) { if (ChildNode) {
_Font = true; _Font = true;
_FontSize = atoi(ChildNode->ToElement()->Attribute("size")); _FontSize = atoi(ChildNode->ToElement()->Attribute("size"));
vector<string> argb = split( ChildNode->ToElement()->Attribute("color"), ','); vector<string> argb = split( ChildNode->ToElement()->Attribute("color"), ',');
_FontColor = ARGB( _FontColor = ARGB(
atoi(argb[0].c_str()), atoi(argb[0].c_str()),
atoi(argb[1].c_str()), atoi(argb[1].c_str()),
atoi(argb[2].c_str()), atoi(argb[2].c_str()),
@@ -392,7 +392,7 @@ void ModRulesCardGui::parse(TiXmlElement* element)
} }
ChildNode = ItemElement->FirstChild("iconposition"); ChildNode = ItemElement->FirstChild("iconposition");
if (ChildNode) { if (ChildNode) {
_IconPosX = atoi(ChildNode->ToElement()->Attribute("x")); _IconPosX = atoi(ChildNode->ToElement()->Attribute("x"));
_IconPosY = atoi(ChildNode->ToElement()->Attribute("y")); _IconPosY = atoi(ChildNode->ToElement()->Attribute("y"));
} }
@@ -423,12 +423,12 @@ void ModRulesCardGui::parse(TiXmlElement* element)
_FormattedText = ""; _FormattedText = "";
_Filter = ""; _Filter = "";
_FontSize = 0; _FontSize = 0;
_Font = false; _Font = false;
_FontColor = 0; _FontColor = 0;
_SizeIcon = 0; _SizeIcon = 0;
_IconPosX = 0; _IconPosX = 0;
_IconPosY = 0 ; _IconPosY = 0 ;
_FileName = ""; _FileName = "";
TiXmlElement* ItemElement = node->ToElement(); TiXmlElement* ItemElement = node->ToElement();
@@ -449,11 +449,11 @@ void ModRulesCardGui::parse(TiXmlElement* element)
} }
ChildNode = ItemElement->FirstChild("font"); ChildNode = ItemElement->FirstChild("font");
if (ChildNode) { if (ChildNode) {
_Font = true; _Font = true;
_FontSize = atoi(ChildNode->ToElement()->Attribute("size")); _FontSize = atoi(ChildNode->ToElement()->Attribute("size"));
vector<string> argb = split( ChildNode->ToElement()->Attribute("color"), ','); vector<string> argb = split( ChildNode->ToElement()->Attribute("color"), ',');
_FontColor = ARGB( _FontColor = ARGB(
atoi(argb[0].c_str()), atoi(argb[0].c_str()),
atoi(argb[1].c_str()), atoi(argb[1].c_str()),
atoi(argb[2].c_str()), atoi(argb[2].c_str()),
@@ -462,7 +462,7 @@ void ModRulesCardGui::parse(TiXmlElement* element)
} }
ChildNode = ItemElement->FirstChild("iconposition"); ChildNode = ItemElement->FirstChild("iconposition");
if (ChildNode) { if (ChildNode) {
_IconPosX = atoi(ChildNode->ToElement()->Attribute("x")); _IconPosX = atoi(ChildNode->ToElement()->Attribute("x"));
_IconPosY = atoi(ChildNode->ToElement()->Attribute("y")); _IconPosY = atoi(ChildNode->ToElement()->Attribute("y"));
} }
+8 -8
View File
@@ -266,7 +266,7 @@ bool Player::DeadLifeState(bool check)
if (cantlosers < 1) if (cantlosers < 1)
{ {
if(!check) if(!check)
{ {
ActionStack * stack = getObserver()->mLayers->stackLayer(); ActionStack * stack = getObserver()->mLayers->stackLayer();
for (int i = stack->mObjects.size() - 1; i >= 0; i--) for (int i = stack->mObjects.size() - 1; i >= 0; i--)
{ {
@@ -320,7 +320,7 @@ bool Player::parseLine(const string& s)
} }
else if (areaS.compare("mode") == 0) else if (areaS.compare("mode") == 0)
{ {
this->playMode = (Player::Mode)atoi(s.substr(limiter + 1).c_str()); this->playMode = (Player::Mode)atoi(s.substr(limiter + 1).c_str());
return true; return true;
} }
else if (areaS.compare("avatar") == 0) else if (areaS.compare("avatar") == 0)
@@ -406,12 +406,12 @@ ostream& operator<<(ostream& out, const Player& p)
{ {
out << "mode=" << p.playMode << endl; out << "mode=" << p.playMode << endl;
out << *(Damageable*)&p; out << *(Damageable*)&p;
if(p.manaPool) if(p.manaPool)
{ {
string manapoolstring = p.manaPool->toString(); string manapoolstring = p.manaPool->toString();
if(manapoolstring != "") if(manapoolstring != "")
out << "manapool=" << manapoolstring << endl; out << "manapool=" << manapoolstring << endl;
} }
if(p.mAvatarName != "") if(p.mAvatarName != "")
out << "avatar=" << p.mAvatarName << endl; out << "avatar=" << p.mAvatarName << endl;
if(p.phaseRing != "") if(p.phaseRing != "")
+10 -10
View File
@@ -18,9 +18,9 @@ vector<Rules *> Rules::RulesList = vector<Rules *>();
//Sorting by displayName //Sorting by displayName
struct RulesMenuCmp{ struct RulesMenuCmp{
bool operator()(const Rules * a,const Rules * b) const{ bool operator()(const Rules * a,const Rules * b) const{
return a->displayName < b->displayName; return a->displayName < b->displayName;
} }
} RulesMenuCmp_; } RulesMenuCmp_;
Rules * Rules::getRulesByFilename(string _filename) Rules * Rules::getRulesByFilename(string _filename)
@@ -391,12 +391,12 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
if(OptionWhosFirst::WHO_O == options[Options::FIRSTPLAYER].number) if(OptionWhosFirst::WHO_O == options[Options::FIRSTPLAYER].number)
initState.player = 1; initState.player = 1;
} }
if(!currentPlayerSet) if(!currentPlayerSet)
{ {
g->currentPlayerId = initState.player; g->currentPlayerId = initState.player;
} }
g->currentPlayer = g->players[g->currentPlayerId]; g->currentPlayer = g->players[g->currentPlayerId];
g->currentActionPlayer = g->currentPlayer; g->currentActionPlayer = g->currentPlayer;
g->phaseRing->goToPhase(0, g->currentPlayer, false); g->phaseRing->goToPhase(0, g->currentPlayer, false);
g->phaseRing->goToPhase(initState.phase, g->currentPlayer); g->phaseRing->goToPhase(initState.phase, g->currentPlayer);
g->setCurrentGamePhase(initState.phase); g->setCurrentGamePhase(initState.phase);
@@ -623,7 +623,7 @@ GameType Rules::strToGameMode(string s)
if (s.compare("random1") == 0) return GAME_TYPE_RANDOM1; if (s.compare("random1") == 0) return GAME_TYPE_RANDOM1;
if (s.compare("random2") == 0) return GAME_TYPE_RANDOM2; if (s.compare("random2") == 0) return GAME_TYPE_RANDOM2;
if (s.compare("story") == 0) return GAME_TYPE_STORY; if (s.compare("story") == 0) return GAME_TYPE_STORY;
if (s.compare("stonehewer") == 0) return GAME_TYPE_STONEHEWER; if (s.compare("stonehewer") == 0) return GAME_TYPE_STONEHEWER;
if (s.compare("hermit") == 0) return GAME_TYPE_HERMIT; if (s.compare("hermit") == 0) return GAME_TYPE_HERMIT;
return GAME_TYPE_CLASSIC; return GAME_TYPE_CLASSIC;
} }
+1 -1
View File
@@ -42,7 +42,7 @@ JGuiObject(id), mX(x), mY(y), parent(_parent), mFontId(fontId)
mXOffset = mX; mXOffset = mX;
if (hasFocus) if (hasFocus)
{ {
setIsSelectionValid(true); setIsSelectionValid(true);
Entering(); Entering();
+1 -1
View File
@@ -144,7 +144,7 @@ void SimpleMenu::Render()
float scaleFactor = titleFont->GetScale(); float scaleFactor = titleFont->GetScale();
titleFont->SetScale(SCALE_NORMAL); titleFont->SetScale(SCALE_NORMAL);
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str())))
mWidth = titleFont->GetStringWidth(title.c_str()); mWidth = titleFont->GetStringWidth(title.c_str());
titleFont->SetScale(scaleFactor); titleFont->SetScale(scaleFactor);
mWidth += 2 * SimpleMenuConst::kHorizontalMargin; mWidth += 2 * SimpleMenuConst::kHorizontalMargin;
+44 -44
View File
@@ -19,7 +19,7 @@ SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const
{ {
mX = 19; mX = 19;
mY = 66; mY = 66;
mWidth = 180.0f; mWidth = 180.0f;
mTitle = _title; mTitle = _title;
mMaxLines = 12; mMaxLines = 12;
@@ -41,11 +41,11 @@ void SimplePopup::Render()
const float textHeight = mTextFont->GetHeight() * mMaxLines; const float textHeight = mTextFont->GetHeight() * mMaxLines;
r->FillRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 0, 0, 0 ) ); r->FillRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 0, 0, 0 ) );
// currently causes a crash on the PSP when drawing the corners. // currently causes a crash on the PSP when drawing the corners.
// TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP // TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP
#if 0 #if 0
r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) ); r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) );
drawBoundingBox( mX-3, mY, mWidth + 3, textHeight ); drawBoundingBox( mX-3, mY, mWidth + 3, textHeight );
#endif #endif
mTextFont->DrawString(detailedInformation.c_str(), mX + 9 , mY + 10); mTextFont->DrawString(detailedInformation.c_str(), mX + 9 , mY + 10);
@@ -58,22 +58,22 @@ void SimplePopup::drawBoundingBox( float x, float y, float width, float height )
//draw the corners //draw the corners
string topCornerImageName = "top_corner.png"; string topCornerImageName = "top_corner.png";
string bottomCornerImageName = "bottom_corner.png"; string bottomCornerImageName = "bottom_corner.png";
string verticalBarImageName = "vert_bar.png"; string verticalBarImageName = "vert_bar.png";
string horizontalBarImageName = "top_bar.png"; string horizontalBarImageName = "top_bar.png";
const float boxWidth = ( width + 15 ) / 3.0f; const float boxWidth = ( width + 15 ) / 3.0f;
const float boxHeight = ( height + 15 ) / 3.0f; const float boxHeight = ( height + 15 ) / 3.0f;
drawHorzPole( horizontalBarImageName, false, false, x, y, boxWidth ); drawHorzPole( horizontalBarImageName, false, false, x, y, boxWidth );
drawHorzPole( horizontalBarImageName, false, true, x, y + height, boxWidth ); drawHorzPole( horizontalBarImageName, false, true, x, y + height, boxWidth );
drawVertPole( verticalBarImageName, false, false, x, y, boxHeight ); drawVertPole( verticalBarImageName, false, false, x, y, boxHeight );
drawVertPole( verticalBarImageName, true, false, x + width, y, boxHeight ); drawVertPole( verticalBarImageName, true, false, x + width, y, boxHeight );
drawCorner( topCornerImageName, false, false, x, y ); drawCorner( topCornerImageName, false, false, x, y );
drawCorner( topCornerImageName, true, false, x + width, y ); drawCorner( topCornerImageName, true, false, x + width, y );
drawCorner( bottomCornerImageName, false, false, x, y + height ); drawCorner( bottomCornerImageName, false, false, x, y + height );
drawCorner( bottomCornerImageName, true, false, x + width, y + height ); drawCorner( bottomCornerImageName, true, false, x + width, y + height );
} }
void SimplePopup::Update(DeckMetaData* selectedDeck) void SimplePopup::Update(DeckMetaData* selectedDeck)
@@ -130,52 +130,52 @@ void SimplePopup::Update(float)
// drawing routines // drawing routines
void SimplePopup::drawCorner(string imageName, bool flipX, bool flipY, float x, float y) void SimplePopup::drawCorner(string imageName, bool flipX, bool flipY, float x, float y)
{ {
LOG(" Drawing a Corner! "); LOG(" Drawing a Corner! ");
JRenderer* r = JRenderer::GetInstance(); JRenderer* r = JRenderer::GetInstance();
JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551); JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
horizontalBarImage->SetHFlip(flipX); horizontalBarImage->SetHFlip(flipX);
horizontalBarImage->SetVFlip(flipY); horizontalBarImage->SetVFlip(flipY);
r->RenderQuad(horizontalBarImage.get(), x, y); r->RenderQuad(horizontalBarImage.get(), x, y);
LOG(" Done Drawing a Corner! "); LOG(" Done Drawing a Corner! ");
} }
void SimplePopup::drawHorzPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float width = SCREEN_WIDTH_F) void SimplePopup::drawHorzPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float width = SCREEN_WIDTH_F)
{ {
LOG(" Drawing a horizontal border! "); LOG(" Drawing a horizontal border! ");
JRenderer* r = JRenderer::GetInstance(); JRenderer* r = JRenderer::GetInstance();
JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551); JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
if ( horizontalBarImage != NULL ) if ( horizontalBarImage != NULL )
{ {
horizontalBarImage->SetHFlip(flipX); horizontalBarImage->SetHFlip(flipX);
horizontalBarImage->SetVFlip(flipY); horizontalBarImage->SetVFlip(flipY);
r->RenderQuad(horizontalBarImage.get(), x, y, 0, width); r->RenderQuad(horizontalBarImage.get(), x, y, 0, width);
} }
else else
{ {
LOG ( "ERROR: Error trying to render horizontal edge! "); LOG ( "ERROR: Error trying to render horizontal edge! ");
} }
LOG(" Done Drawing a horizontal border! "); LOG(" Done Drawing a horizontal border! ");
} }
void SimplePopup::drawVertPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float height = SCREEN_HEIGHT_F) void SimplePopup::drawVertPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float height = SCREEN_HEIGHT_F)
{ {
LOG(" Drawing a Vertical border! "); LOG(" Drawing a Vertical border! ");
JRenderer* r = JRenderer::GetInstance(); JRenderer* r = JRenderer::GetInstance();
JQuadPtr verticalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551); JQuadPtr verticalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
if ( verticalBarImage != NULL ) if ( verticalBarImage != NULL )
{ {
verticalBarImage->SetHFlip(flipX); verticalBarImage->SetHFlip(flipX);
verticalBarImage->SetVFlip(flipY); verticalBarImage->SetVFlip(flipY);
r->RenderQuad(verticalBarImage.get(), x, y, 0, 1.0f, height); r->RenderQuad(verticalBarImage.get(), x, y, 0, 1.0f, height);
} }
else else
{ {
LOG ( "ERROR: Error trying to render vertical edge! "); LOG ( "ERROR: Error trying to render vertical edge! ");
} }
LOG(" DONE Drawing a horizontal border! "); LOG(" DONE Drawing a horizontal border! ");
} }
+3 -3
View File
@@ -1094,13 +1094,13 @@ bool TypeTargetChooser::canTarget(Targetable * target,bool withoutProtections)
return true; return true;
} }
if(card->getLCName().size()) if(card->getLCName().size())
{ {
if (MTGAllCards::findType(card->getLCName()) == types[i]) if (MTGAllCards::findType(card->getLCName()) == types[i])
return true; return true;
if (MTGAllCards::findType(card->getName()) == types[i]) if (MTGAllCards::findType(card->getName()) == types[i])
return true; return true;
} }
} }
return false; return false;
} }
+2 -2
View File
@@ -351,7 +351,7 @@ void TestSuiteGame::assertGame()
int error = 0; int error = 0;
bool wasAI = false; bool wasAI = false;
if (observer->getCurrentGamePhase() != endState.phase) if (observer->getCurrentGamePhase() != endState.phase)
{ {
sprintf(result, "<span class=\"error\">==phase problem. Expected [ %s ](%i), got [ %s ](%i)==</span><br />", sprintf(result, "<span class=\"error\">==phase problem. Expected [ %s ](%i), got [ %s ](%i)==</span><br />",
Constants::MTGPhaseNames[endState.phase].c_str(),endState.phase, Constants::MTGPhaseNames[endState.phase].c_str(),endState.phase,
@@ -581,7 +581,7 @@ int TestSuite::loadNext()
#elif defined(IOS) #elif defined(IOS)
thread_count = 6; thread_count = 6;
#else #else
thread_count = 4; thread_count = 4;
#endif #endif
for(size_t i = 0; i < (thread_count-1); i++) for(size_t i = 0; i < (thread_count-1); i++)
mWorkerThread.push_back(new boost::thread(ThreadProc, this)); mWorkerThread.push_back(new boost::thread(ThreadProc, this));
+24 -24
View File
@@ -32,7 +32,7 @@ void TextScroller::setRandom(int mode)
void TextScroller::Add(string text) void TextScroller::Add(string text)
{ {
if (!strings.size()) if (!strings.size())
mText = text; mText = text;
strings.push_back(text); strings.push_back(text);
} }
@@ -67,21 +67,21 @@ void TextScroller::Update(float dt)
void TextScroller::Render() void TextScroller::Render()
{ {
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId); WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth); mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth);
} }
ostream& TextScroller::toString(ostream& out) const ostream& TextScroller::toString(ostream& out) const
{ {
return out << "TextScroller ::: mText : " << mText return out << "TextScroller ::: mText : " << mText
<< " ; tempText : " << tempText << " ; tempText : " << tempText
<< " ; mWidth : " << mWidth << " ; mWidth : " << mWidth
<< " ; mSpeed : " << mScrollSpeed << " ; mSpeed : " << mScrollSpeed
<< " ; mX,mY : " << mX << "," << mY << " ; mX,mY : " << mX << "," << mY
<< " ; start : " << start << " ; start : " << start
<< " ; timer : " << timer << " ; timer : " << timer
<< " ; strings : ?" << " ; strings : ?"
<< " ; currentId : " << currentId << " ; currentId : " << currentId
<< " ; mRandom : " << mRandom; << " ; mRandom : " << mRandom;
} }
@@ -93,28 +93,28 @@ ostream& TextScroller::toString(ostream& out) const
VerticalTextScroller::VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed, size_t numItemsShown) : VerticalTextScroller::VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed, size_t numItemsShown) :
TextScroller( fontId, x, y, width, scrollSpeed) TextScroller( fontId, x, y, width, scrollSpeed)
{ {
mHeight = height; mHeight = height;
mNbItemsShown = numItemsShown; mNbItemsShown = numItemsShown;
mMarginX = 0; mMarginX = 0;
timer=0; timer=0;
WFont *mFont = WResourceManager::Instance()->GetWFont(fontId); WFont *mFont = WResourceManager::Instance()->GetWFont(fontId);
mOriginalY = mY; mOriginalY = mY;
mMarginY = mY - mFont->GetHeight(); mMarginY = mY - mFont->GetHeight();
Add("\n"); // initialize the scroller with a blank line Add("\n"); // initialize the scroller with a blank line
} }
void VerticalTextScroller::Add( string text ) void VerticalTextScroller::Add( string text )
{ {
strings.push_back( text ); strings.push_back( text );
string wrappedText = wordWrap(text, mWidth, fontId); string wrappedText = wordWrap(text, mWidth, fontId);
mText.append(wrappedText); mText.append(wrappedText);
} }
/* /*
Updates happen everytime the top line disappears from view. Updates happen everytime the top line disappears from view.
The top line is then moved to the end of the file and the scrolling resumes where it left off The top line is then moved to the end of the file and the scrolling resumes where it left off
*/ */
void VerticalTextScroller::Update(float dt) void VerticalTextScroller::Update(float dt)
@@ -145,5 +145,5 @@ void VerticalTextScroller::Update(float dt)
void VerticalTextScroller::Render() void VerticalTextScroller::Render()
{ {
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId); WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
mFont->DrawString(mText.c_str(), mX, mY); mFont->DrawString(mText.c_str(), mX, mY);
} }
+12 -12
View File
@@ -82,7 +82,7 @@ WCachedTexture::WCachedTexture()
WCachedTexture::~WCachedTexture() WCachedTexture::~WCachedTexture()
{ {
if (texture) if (texture)
SAFE_DELETE(texture); SAFE_DELETE(texture);
} }
JTexture * WCachedTexture::Actual() JTexture * WCachedTexture::Actual()
@@ -113,27 +113,27 @@ JQuadPtr WCachedTexture::GetQuad(float offX, float offY, float width, float heig
resource = kPlaceholderID; resource = kPlaceholderID;
} }
std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resource); std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resource);
if (iter != mTrackedQuads.end()) if (iter != mTrackedQuads.end())
return iter->second; return iter->second;
JQuadPtr quad(NEW JQuad(texture, offX, offY, width, height)); JQuadPtr quad(NEW JQuad(texture, offX, offY, width, height));
//Update JQ's values to what we called this with. //Update JQ's values to what we called this with.
quad->SetTextureRect(offX, offY, width, height); quad->SetTextureRect(offX, offY, width, height);
mTrackedQuads.insert(std::pair<string, JQuadPtr>(resource, quad)); mTrackedQuads.insert(std::pair<string, JQuadPtr>(resource, quad));
return quad; return quad;
} }
JQuadPtr WCachedTexture::GetQuad(const string& resname) JQuadPtr WCachedTexture::GetQuad(const string& resname)
{ {
JQuadPtr result; JQuadPtr result;
std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resname); std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resname);
if (iter != mTrackedQuads.end()) if (iter != mTrackedQuads.end())
result = iter->second; result = iter->second;
return result; return result;
} }
JQuadPtr WCachedTexture::GetCard(float offX, float offY, float width, float height, const string& resname) JQuadPtr WCachedTexture::GetCard(float offX, float offY, float width, float height, const string& resname)
@@ -192,7 +192,7 @@ bool WCachedTexture::Attempt(const string& filename, int submode, int & error)
string realname = filename; string realname = filename;
//Form correct filename. //Form correct filename.
if (submode & TEXTURE_SUB_CARD) if (submode & TEXTURE_SUB_CARD)
{ {
if (submode & TEXTURE_SUB_THUMB) if (submode & TEXTURE_SUB_THUMB)
{ {
+3 -3
View File
@@ -56,13 +56,13 @@ WSrcCards::WSrcCards(float delay)
JQuadPtr WSrcCards::getImage(int offset) JQuadPtr WSrcCards::getImage(int offset)
{ {
if (!WResourceManager::Instance()->IsThreaded()) if (!WResourceManager::Instance()->IsThreaded())
{ {
if (mDelay && mLastInput < mDelay) if (mDelay && mLastInput < mDelay)
{ {
return WResourceManager::Instance()->RetrieveCard(getCard(offset), RETRIEVE_EXISTING); return WResourceManager::Instance()->RetrieveCard(getCard(offset), RETRIEVE_EXISTING);
} }
} }
return WResourceManager::Instance()->RetrieveCard(getCard(offset)); return WResourceManager::Instance()->RetrieveCard(getCard(offset));
} }
+2 -2
View File
@@ -359,7 +359,7 @@ int WFBFont::PreCacheChar(const u8 *ch)
#else #else
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
y = (int)mSprites[index]->mY; y = (int)mSprites[index]->mY;
mTexture->UpdateBits(x, y, mFontSize, mFontSize, mCharBuffer); mTexture->UpdateBits(x, y, mFontSize, mFontSize, mCharBuffer);
#endif #endif
return index; return index;
} }
@@ -758,7 +758,7 @@ int WGBKFont::PreCacheChar(const u8 *ch)
#else #else
x = (int)mSprites[index]->mX; x = (int)mSprites[index]->mX;
y = (int)mSprites[index]->mY; y = (int)mSprites[index]->mY;
mTexture->UpdateBits(x, y, mFontSize, mFontSize, mCharBuffer); mTexture->UpdateBits(x, y, mFontSize, mFontSize, mCharBuffer);
#endif #endif
return index; return index;
} }
+9 -9
View File
@@ -37,18 +37,18 @@ WResourceManager* WResourceManager::sInstance = NULL;
WResourceManager* WResourceManager::Instance() WResourceManager* WResourceManager::Instance()
{ {
if (sInstance == NULL) if (sInstance == NULL)
{ {
sInstance = NEW ResourceManagerImpl; sInstance = NEW ResourceManagerImpl;
} }
return sInstance; return sInstance;
} }
void WResourceManager::Terminate() void WResourceManager::Terminate()
{ {
if (sInstance) if (sInstance)
SAFE_DELETE(sInstance); SAFE_DELETE(sInstance);
} }
@@ -1040,12 +1040,12 @@ cacheItem* WCache<cacheItem, cacheActual>::AttemptNew(const string& filename, in
SAFE_DELETE(item); SAFE_DELETE(item);
return NULL; return NULL;
} }
else else
{ {
DebugTrace("AttemptNew failed to load (not a 404 error). Deleting cache item " << ToHex(item)); DebugTrace("AttemptNew failed to load (not a 404 error). Deleting cache item " << ToHex(item));
SAFE_DELETE(item); SAFE_DELETE(item);
mError = CACHE_ERROR_BAD; mError = CACHE_ERROR_BAD;
return NULL; return NULL;
} }
} }