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
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/Scripts/pip.exe install pyjavaproperties"
- "C:/Python27/Scripts/pip.exe install github3.py"
@@ -13,6 +13,8 @@ auto=flashbackrule
auto=retracerule
auto=suspendrule
auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule
auto=blockrule
auto=combattriggerrule
+2
View File
@@ -12,6 +12,8 @@ auto=flashbackrule
auto=retracerule
auto=suspendrule
auto=morphrule
auto=payzerorule
auto=overloadrule
auto=attackrule
auto=blockrule
auto=combattriggerrule
+2 -1
View File
@@ -16,7 +16,8 @@ auto=flashbackrule
auto=retracerule
auto=suspendrule
auto=morphrule
auto=playfromgraveyardrule
auto=payzerorule
auto=overloadrule
auto=attackrule
auto=blockrule
auto=combattriggerrule
@@ -69,6 +69,16 @@ mana={B}
type=Sorcery
[/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
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.
@@ -89,6 +99,16 @@ mana={1}{B}{G}
type=Instant
[/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
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)
@@ -99,6 +119,16 @@ mana={4}{B}{B}
type=Instant
[/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
target=creature
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.)
[/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
target=creature
auto=2/0
File diff suppressed because it is too large Load Diff
@@ -224,12 +224,6 @@ mana={1}{U}
type=Instant
[/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
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}
@@ -1223,6 +1217,7 @@ text=Blazing Salvo deals 3 damage to target creature unless that creature's cont
mana={R}
type=Instant
[/card]
#blazing torch is source of damage but the equipped creature has the activated ability... weird
[card]
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}
@@ -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.
[/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
mana={2}{G}
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.
[/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
mana={1}{R}
type=Summon — Egg
@@ -3000,12 +2983,6 @@ mana={U}{U}
type=Enchantment
[/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
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}
@@ -3305,12 +3282,6 @@ mana={2}{G}{G}
type=Enchantment
[/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
text=When Cyclopean Giant is put into a graveyard from the battlefield, target land becomes a Swamp. Exile Cyclopean Giant.
mana={2}{B}{B}
@@ -3954,6 +3925,7 @@ subtype=Djinn
power=3
toughness=5
[/card]
#needs alias borderline
[card]
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.
@@ -4075,12 +4047,6 @@ mana={3}{B} // {2}{G}
type=Sorcery // Sorcery
[/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
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}
@@ -4282,12 +4248,6 @@ power=1
toughness=1
[/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
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}
@@ -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.
[/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
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}
@@ -4768,11 +4722,6 @@ power=1
toughness=2
[/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
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}
@@ -4991,12 +4940,6 @@ type=Enchantment
subtype=Aura
[/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
text=Put a +1/+1 counter on target creature you control. Another target creature blocks it this turn if able.
mana={3}{G}
@@ -6866,15 +6809,6 @@ power=1
toughness=1
[/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
text=As an additional cost to cast Hatred, pay X life. -- Target creature gets +X/+0 until end of turn.
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}
type=Sorcery
[/card]
#needs alias borderline
[card]
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.
@@ -9863,6 +9798,7 @@ text=Each opponent reveals cards from the top of his or her library until he or
mana={X}{U}{B}
type=Sorcery
[/card]
#needs alias
[card]
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.)
@@ -10097,18 +10033,6 @@ mana={1}{U}{U}
type=Sorcery
[/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
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}
@@ -11075,6 +10999,7 @@ text=Look at the top three cards of your library, then put them back in any orde
mana={1}{U}
type=Sorcery
[/card]
#needs alias
[card]
name=Omen Machine
mana={6}
@@ -12498,6 +12423,7 @@ text=Pyrotechnics deals 4 damage divided as you choose among any number of targe
mana={4}{R}
type=Sorcery
[/card]
#anyzone is basic for now and used for cdaactive
[card]
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.
@@ -12615,15 +12541,6 @@ mana={1}{U}
type=Sorcery
[/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
mana=
type=Legendary Land
@@ -12812,6 +12729,7 @@ mana={2}{U}
type=Enchantment
subtype=Aura
[/card]
#needs suspend ability not suspend activated ability
[card]
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.)
@@ -12923,11 +12841,6 @@ mana={4}
type=Artifact
[/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
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}
@@ -13490,6 +13403,7 @@ subtype=Elemental
power=3
toughness=2
[/card]
#seems possible
[card]
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.
@@ -13939,6 +13853,7 @@ subtype=Giant Warrior
power=4
toughness=5
[/card]
#modded ingest
[card]
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.
@@ -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}
type=Sorcery
[/card]
#moverandom?
[card]
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.
@@ -14480,6 +14396,7 @@ mana={3}{U}
type=Instant
subtype=Arcane
[/card]
#phaseactionmulti?
[card]
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.
@@ -14944,6 +14861,7 @@ type=Enchantment
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.)
[/card]
#manaflashback rule
[card]
name=Snapcaster Mage
abilities=flash
@@ -15565,6 +15483,7 @@ subtype=Monger
power=3
toughness=3
[/card]
#needs alias
[card]
name=Squandered Resources
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
[/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
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}
@@ -16209,27 +16122,12 @@ power=2
toughness=2
[/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
mana={2}{G}{G}
type=Sorcery
text=Put a 1/1 colorless Expansion-Symbol creature token into play for each different expansion symbol among permanents you control.
[/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
text={X}, {T}: Tap X target noncreature artifacts. -- {X}, {T}: Untap X target noncreature artifacts.
mana={2}{U}
@@ -16410,12 +16308,6 @@ mana={U}
type=Enchantment
[/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
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}
@@ -16490,15 +16382,6 @@ type=Planeswalker
subtype=Tezzeret
[/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
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}
@@ -17284,17 +17167,6 @@ mana={2}{U}
type=Sorcery
[/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
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}
@@ -17456,12 +17328,6 @@ power=3
toughness=3
[/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
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}
+110
View File
@@ -668,6 +668,116 @@ private:
{
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})
{
intValue = 0;
-2
View File
@@ -122,8 +122,6 @@ class GameObserver{
void gameStateBasedEffects();
void enchantmentStatus();
void Affinity();
void ComputeTrinisphere();
void RemoveTrinisphere(MTGCardInstance * card);
void addObserver(MTGAbility * observer);
bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules);
+3
View File
@@ -213,6 +213,9 @@ public:
COUNTERS = 30,
PUT_INTO_PLAY_WITH_KICKER = 31,
STANDARD_FIZZLER = 32,
PAYZERO_COST = 33,
OVERLOAD_COST = 34,
BESTOW_COST = 35,
};
};
+2 -3
View File
@@ -55,7 +55,7 @@ public:
Pos* view;
int X;
int castX;
int alternateCostPaid[ManaCost::MANA_PAID_WITH_SUSPEND + 1];
int alternateCostPaid[ManaCost::MANA_PAID_WITH_BESTOW + 1];
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 frozen;
@@ -253,9 +253,8 @@ public:
int cardistargetted;
bool isTargetter();
int cardistargetter;
int tmodifier;
int tmodifierb;
int myconvertedcost;
ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost);
void eventattacked();
void eventattackedAlone();
+3 -1
View File
@@ -236,7 +236,9 @@ class Constants
OPPGCREATUREEXILER = 118,
PAYZERO = 119,
TRINISPHERE = 120,
NB_BASIC_ABILITIES = 121,
CANPLAYFROMEXILE = 121,
LIBRARYEATER = 122,
NB_BASIC_ABILITIES = 123,
RARITY_S = 'S', //Special Rarity
+27 -9
View File
@@ -76,6 +76,8 @@ public:
MTGPutInPlayRule(GameObserver* observer, int _id);
const string getMenuText()
{
if(game && game->gameType() == GAME_TYPE_MOMIR)
return "Play Land";
return "Cast Card Normally";
}
virtual MTGPutInPlayRule * clone() const;
@@ -99,7 +101,7 @@ class MTGAlternativeCostRule: public PermanentAbility
{
protected:
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;
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
@@ -173,21 +175,37 @@ public:
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:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGPlayFromGraveyardRule(GameObserver* observer, int _id);
MTGOverloadRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "Cast Card From Graveyard";
return "Overload";
}
virtual MTGPlayFromGraveyardRule * clone() const;
virtual MTGOverloadRule * clone() const;
};
class MTGSuspendRule: public MTGAlternativeCostRule
{
public:
@@ -293,15 +311,15 @@ public:
class MTGDredgeRule: public PermanentAbility, public ReplacementEffect
{
public:
vector<MTGCardInstance*>soulbonders;
//vector<MTGCardInstance*>soulbonders;
TargetChooser * tcb;
MTGAbility * dredgeAbility;
MTGAbility * targetAbility;
MTGAbility * targetAbilityAdder;
MTGAbility * targetAbility1;
MTGAbility * mod;
MTGAbility * activateDredge;
vector<MTGAbility*>pairing;
//MTGAbility * activateDredge;
//vector<MTGAbility*>pairing;
MTGDredgeRule(GameObserver* observer, int _id);
WEvent * replace(WEvent *e);
virtual ostream& toString(ostream& out) const;
+4 -1
View File
@@ -47,7 +47,10 @@ public:
MANA_PAID_WITH_FLASHBACK = 5,
MANA_PAID_WITH_RETRACE = 6,
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;
+2 -2
View File
@@ -18,8 +18,8 @@ using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SHRINK 0.75f
#define SCALE_SELECTED_LARGE 1.7F
#define SCALE_LARGE_NORMAL 1.5F
#define SCALE_SELECTED_LARGE 1.7f
#define SCALE_LARGE_NORMAL 1.5f
class SimpleButton: public JGuiObject
{
+350
View File
@@ -627,6 +627,10 @@ int OrderedAIAction::getEfficiency()
{
efficiency += 65;
}
else if (dynamic_cast<MTGAlternativeCostRule *>(a))
{
efficiency += 55;
}
SAFE_DELETE(transAbility);
return efficiency;
}
@@ -1726,6 +1730,302 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
cd.setType(type);
card = NULL;
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)))
{
if (!CanHandleCost(card->getManaCost(),card))
@@ -2109,6 +2409,56 @@ int AIPlayerBaka::computeActions()
nextCardToPlay = NULL;
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);
+7 -1
View File
@@ -301,7 +301,13 @@ bool Spell::FullfilledAlternateCost(const int &costType)
hasFullfilledAlternateCost = (payResult == ManaCost::MANA_PAID_WITH_RETRACE);
break;
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;
}
+17 -3
View File
@@ -348,7 +348,7 @@ void CardGui::Render()
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),216,191,216));//thistle powered down
else if(!card->wasDealtDamage && card->pbonus >= 3)
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
else
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default
@@ -365,13 +365,27 @@ void CardGui::Render()
buff = "CT";
if(!card->isToken && card->isACopier)
buff = "C";
if(card->has(Constants::PAYZERO))
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);
char buffer[200];
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->DrawString(buffer, actX - 10 * actZ, actY - (16 * actZ));
mFont->SetScale(1);
+28
View File
@@ -126,7 +126,35 @@ int Damage::resolve()
}
_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;
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE && (source->has(Constants::WITHER) || source->has(
+43 -79
View File
@@ -885,9 +885,6 @@ void GameObserver::gameStateBasedEffects()
// plus modify costs //
/////////////////////////////
Affinity();
//trinisphere? buggy...
//ComputeTrinisphere();
//end trinisphere
/////////////////////////////////////
// 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.
ManaCost * original = NEW ManaCost();
ManaCost * alternate = NEW ManaCost();
ManaCost * buyback = NEW ManaCost();
ManaCost * flashback = NEW ManaCost();
ManaCost * retrace = NEW ManaCost();
original->copy(card->model->data->getManaCost());
alternate->copy(card->model->data->getManaCost()->getAlternative());
if (card->has(Constants::PAYZERO))
original = ManaCost::parseManaCost("{0}",NULL,card);//can't figure out 2 or more alternative...
buyback->copy(card->model->data->getManaCost()->getBuyback());
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.
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
{
@@ -995,6 +996,18 @@ void GameObserver::Affinity()
{
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())
@@ -1006,12 +1019,30 @@ void GameObserver::Affinity()
{
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())
card->getManaCost()->copy(original);
if(card->getManaCost()->getAlternative())
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)
{
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::AFFINITYMOUNTAIN)||
card->has(Constants::AFFINITYPLAINS)||
card->has(Constants::AFFINITYSWAMP)){
card->has(Constants::AFFINITYSWAMP))
{
if (card->has(Constants::AFFINITYARTIFACTS))
{
type = "artifact";
@@ -1123,86 +1155,18 @@ void GameObserver::Affinity()
if(card->getManaCost()->getCost(color) > 0)
card->getManaCost()->remove(color,1);
}
}
SAFE_DELETE(original);
SAFE_DELETE(alternate);
SAFE_DELETE(buyback);
SAFE_DELETE(flashback);
SAFE_DELETE(retrace);
}//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()
{
if(mLayers)
+19 -8
View File
@@ -39,7 +39,9 @@ const string kAlternateCostKeywords[] =
"flashback",
"retrace",
"facedown",
"suspended"
"suspended",
"overload",
"bestow"
};
const int kAlternateCostIds[] =
{
@@ -51,7 +53,9 @@ const int kAlternateCostIds[] =
ManaCost::MANA_PAID_WITH_FLASHBACK,
ManaCost::MANA_PAID_WITH_RETRACE,
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
@@ -1156,10 +1160,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
observer->addObserver(NEW MTGMorphCostRule(observer, -1));
return NULL;
}
found = s.find("playfromgraveyardrule");
found = s.find("payzerorule");
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;
}
//this rule handles attacking ability during attacker phase
@@ -3080,7 +3090,11 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
}
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
return NEW APowerToughnessModifier(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::NOLIFEGAIN] = 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))
{
+20 -3
View File
@@ -65,8 +65,6 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
LKItoughness = toughness;
cardistargetted = 0;
cardistargetter = 0;
tmodifier = 0;
tmodifierb = 0;
myconvertedcost = getManaCost()->getConvertedCost();
}
@@ -575,7 +573,7 @@ MTGCardInstance * MTGCardInstance::changeController(Player * newController,bool
}
Player * originalOwner = controller();
MTGCardInstance * copy = originalOwner->game->putInZone(this, this->currentZone, newController->game->inPlay);
copy->summoningSickness = 1;
//copy->summoningSickness = 1;
return copy;
}
@@ -920,6 +918,25 @@ JQuadPtr MTGCardInstance::getIcon()
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()
{
MTGInPlay * inplay = controller()->game->inPlay;
+10
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;
case 'b': //buyback
+4 -2
View File
@@ -148,8 +148,10 @@ const char* Constants::MTGBasicAbilities[] = {
"protectionfromcoloredspells",
"mygcreatureexiler",
"oppgcreatureexiler",
"payzero",
"trinisphere"
"zerocast",
"trinisphere",
"canplayfromexile",
"libraryeater"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
+1 -1
View File
@@ -546,7 +546,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
copy->kicked = card->kicked;
copy->storedCard = card->storedCard;
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];
//stupid bug with tokens...
+134 -34
View File
@@ -284,7 +284,9 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
{
int cardsinhand = game->players[0]->game->hand->nb_cards;
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;
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])
&& game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN
@@ -295,7 +297,7 @@ int MTGPutInPlayRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
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->resolve();
delete spell;
@@ -412,7 +414,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
delete previousManaPool;
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->resolve();
delete spellCost;
@@ -421,7 +423,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
else
{
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)
{
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, payResult, 0);
@@ -475,7 +477,9 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
if(OptionKicker::KICKER_ALWAYS == options[Options::KICKERPAYMENT].number)
return 0;
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;
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();
if(!kicker)
@@ -484,8 +488,12 @@ int MTGKickerRule::isReactingToClick(MTGCardInstance * card, ManaCost *)
return 0;
}
ManaCost * playerMana = player->getManaPool();
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());
withKickerCost->add(withKickerCost->getKicker());
ManaCost * withKickerCost= NEW ManaCost(card->model->data->getManaCost());
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))
{
delete withKickerCost;
@@ -503,12 +511,16 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
return 0;
Player * player = game->currentlyActing();
ManaCost * withKickerCost= NEW ManaCost(card->getManaCost());//using pointers here alters the real cost of the card.
if (card->getManaCost()->getKicker()->isMulti)
ManaCost * withKickerCost= NEW ManaCost(card->model->data->getManaCost());//using pointers here alters the real cost of the card.
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))
{
withKickerCost->add(withKickerCost->getKicker());
withKickerCost->add(card->model->data->getManaCost()->getKicker());
card->kicked += 1;
}
card->kicked -= 1;
@@ -518,7 +530,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
}
else
{
withKickerCost->add(withKickerCost->getKicker());
withKickerCost->add(card->model->data->getManaCost()->getKicker());
card->paymenttype = MTGAbility::PUT_INTO_PLAY_WITH_KICKER;
}
if (withKickerCost->isExtraPaymentSet())
@@ -545,7 +557,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
delete previousManaPool;
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->resolve();
delete spellCost;
@@ -554,7 +566,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
else
{
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)
{
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, ManaCost::MANA_PAID_WITH_KICKER, 0);
@@ -615,8 +627,12 @@ PermanentAbility(observer, _id)
int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
if (card->alias == 11000)
return 0;//overload has its own rule
ManaCost * alternateCost = card->getManaCost()->getAlternative();
if (!game->currentlyActing()->game->hand->hasCard(card))
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 );
}
@@ -630,7 +646,12 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost *
if(!allowedToAltCast(card,player))
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;
if (card->isLand())
@@ -674,12 +695,17 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card)
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();
ManaPool * playerMana = player->getManaPool();
//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);
if (alternateCost->isExtraPaymentSet() )
{
@@ -763,7 +789,9 @@ MTGAlternativeCostRule(observer, _id)
int MTGBuyBackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
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;
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))
return 0;
@@ -1129,46 +1157,118 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
MTGPayZeroRule::MTGPayZeroRule(GameObserver* observer, int _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();
ManaCost * cost = card->getManaCost();
if (!player->game->graveyard->hasCard(card))
if(!card->has(Constants::PAYZERO))
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 MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
}
int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card)
int MTGOverloadRule::reactToClick(MTGCardInstance * card)
{
if (!isReactingToClick(card))
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) << ")";
}
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();
player->getManaPool()->pay(cost);
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);
Spell * spell = NEW Spell(game, card);